Add uip_clear_buf() macro and replace all instances of uip_len = 0; with it
This commit is contained in:
parent
cb09689846
commit
1784338b2e
|
@ -293,7 +293,7 @@ PROCESS_THREAD(slip_process, ev, data)
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
SLIP_STATISTICS(slip_ip_drop++);
|
SLIP_STATISTICS(slip_ip_drop++);
|
||||||
}
|
}
|
||||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||||
|
|
|
@ -529,10 +529,7 @@ void
|
||||||
tcpip_input(void)
|
tcpip_input(void)
|
||||||
{
|
{
|
||||||
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
|
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
#if NETSTACK_CONF_WITH_IPV6
|
|
||||||
uip_ext_len = 0;
|
|
||||||
#endif /*NETSTACK_CONF_WITH_IPV6*/
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if NETSTACK_CONF_WITH_IPV6
|
#if NETSTACK_CONF_WITH_IPV6
|
||||||
|
@ -548,13 +545,13 @@ tcpip_ipv6_output(void)
|
||||||
|
|
||||||
if(uip_len > UIP_LINK_MTU) {
|
if(uip_len > UIP_LINK_MTU) {
|
||||||
UIP_LOG("tcpip_ipv6_output: Packet to big");
|
UIP_LOG("tcpip_ipv6_output: Packet to big");
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
|
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
|
||||||
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
|
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,7 +588,7 @@ tcpip_ipv6_output(void)
|
||||||
#else
|
#else
|
||||||
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
|
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
|
||||||
#endif /* !UIP_FALLBACK_INTERFACE */
|
#endif /* !UIP_FALLBACK_INTERFACE */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,7 +640,7 @@ tcpip_ipv6_output(void)
|
||||||
|
|
||||||
#if UIP_CONF_IPV6_RPL
|
#if UIP_CONF_IPV6_RPL
|
||||||
if(rpl_update_header_final(nexthop)) {
|
if(rpl_update_header_final(nexthop)) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* UIP_CONF_IPV6_RPL */
|
#endif /* UIP_CONF_IPV6_RPL */
|
||||||
|
@ -651,7 +648,7 @@ tcpip_ipv6_output(void)
|
||||||
if(nbr == NULL) {
|
if(nbr == NULL) {
|
||||||
#if UIP_ND6_SEND_NA
|
#if UIP_ND6_SEND_NA
|
||||||
if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) {
|
if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||||
|
@ -689,7 +686,7 @@ tcpip_ipv6_output(void)
|
||||||
uip_packetqueue_set_buflen(&nbr->packethandle, uip_len);
|
uip_packetqueue_set_buflen(&nbr->packethandle, uip_len);
|
||||||
}
|
}
|
||||||
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Send in parallel if we are running NUD (nbc state is either STALE,
|
/* Send in parallel if we are running NUD (nbc state is either STALE,
|
||||||
|
@ -719,15 +716,14 @@ tcpip_ipv6_output(void)
|
||||||
}
|
}
|
||||||
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
|
||||||
|
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Multicast IP destination address. */
|
/* Multicast IP destination address. */
|
||||||
tcpip_output(NULL);
|
tcpip_output(NULL);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_ext_len = 0;
|
|
||||||
}
|
}
|
||||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -1326,6 +1326,22 @@ extern uint8_t uip_ext_len;
|
||||||
extern uint16_t uip_urglen, uip_surglen;
|
extern uint16_t uip_urglen, uip_surglen;
|
||||||
#endif /* UIP_URGDATA > 0 */
|
#endif /* UIP_URGDATA > 0 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear uIP buffer
|
||||||
|
*
|
||||||
|
* This function clears the uIP buffer by reseting the uip_len and
|
||||||
|
* uip_ext_len pointers.
|
||||||
|
*/
|
||||||
|
#if NETSTACK_CONF_WITH_IPV6
|
||||||
|
#define uip_clear_buf() { \
|
||||||
|
uip_len = 0; \
|
||||||
|
uip_ext_len = 0; \
|
||||||
|
}
|
||||||
|
#else /*NETSTACK_CONF_WITH_IPV6*/
|
||||||
|
#define uip_clear_buf() { \
|
||||||
|
uip_len = 0; \
|
||||||
|
}
|
||||||
|
#endif /*NETSTACK_CONF_WITH_IPV6*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a uIP TCP connection.
|
* Representation of a uIP TCP connection.
|
||||||
|
|
|
@ -59,7 +59,7 @@ input_callback(void)
|
||||||
/*PRINTF("SIN: %u\n", uip_len);*/
|
/*PRINTF("SIN: %u\n", uip_len);*/
|
||||||
if(uip_buf[0] == '!') {
|
if(uip_buf[0] == '!') {
|
||||||
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
#if 0
|
#if 0
|
||||||
if(uip_buf[1] == 'P') {
|
if(uip_buf[1] == 'P') {
|
||||||
uip_ipaddr_t prefix;
|
uip_ipaddr_t prefix;
|
||||||
|
@ -87,7 +87,7 @@ input_callback(void)
|
||||||
slip_send();
|
slip_send();
|
||||||
|
|
||||||
}
|
}
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Save the last sender received over SLIP to avoid bouncing the
|
/* Save the last sender received over SLIP to avoid bouncing the
|
||||||
|
@ -101,7 +101,7 @@ input_callback(void)
|
||||||
uip_len = len;
|
uip_len = len;
|
||||||
/* PRINTF("send len %d\n", len); */
|
/* PRINTF("send len %d\n", len); */
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ time_exceeded(void)
|
||||||
/* We don't send out ICMP errors for ICMP messages (unless they are pings). */
|
/* We don't send out ICMP errors for ICMP messages (unless they are pings). */
|
||||||
if(ICMPBUF->proto == UIP_PROTO_ICMP &&
|
if(ICMPBUF->proto == UIP_PROTO_ICMP &&
|
||||||
ICMPBUF->type != ICMP_ECHO) {
|
ICMPBUF->type != ICMP_ECHO) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Copy fields from packet header into payload of this ICMP packet. */
|
/* Copy fields from packet header into payload of this ICMP packet. */
|
||||||
|
|
|
@ -709,7 +709,7 @@ uip_process(uint8_t flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the length variables. */
|
/* Reset the length variables. */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_slen = 0;
|
uip_slen = 0;
|
||||||
|
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
|
@ -1589,7 +1589,7 @@ uip_process(uint8_t flag)
|
||||||
uip_add_rcv_nxt(1);
|
uip_add_rcv_nxt(1);
|
||||||
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
|
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
|
||||||
uip_connr->len = 0;
|
uip_connr->len = 0;
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_slen = 0;
|
uip_slen = 0;
|
||||||
UIP_APPCALL();
|
UIP_APPCALL();
|
||||||
goto appsend;
|
goto appsend;
|
||||||
|
@ -1934,7 +1934,7 @@ uip_process(uint8_t flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_flags = 0;
|
uip_flags = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,10 +284,10 @@ uip_arp_arpin(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(uip_len < sizeof(struct arp_hdr)) {
|
if(uip_len < sizeof(struct arp_hdr)) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
|
|
||||||
switch(BUF->opcode) {
|
switch(BUF->opcode) {
|
||||||
case UIP_HTONS(ARP_REQUEST):
|
case UIP_HTONS(ARP_REQUEST):
|
||||||
|
|
|
@ -1380,8 +1380,7 @@ out()
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
uip_slen = 0;
|
uip_slen = 0;
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_ext_len = 0;
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static uint8_t
|
static uint8_t
|
||||||
|
|
|
@ -81,7 +81,7 @@ mcast_fwd(void *p)
|
||||||
uip_len = mcast_len;
|
uip_len = mcast_len;
|
||||||
UIP_IP_BUF->ttl--;
|
UIP_IP_BUF->ttl--;
|
||||||
tcpip_output(NULL);
|
tcpip_output(NULL);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static uint8_t
|
static uint8_t
|
||||||
|
|
|
@ -210,12 +210,12 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
|
||||||
/* check if originating packet is not an ICMP error*/
|
/* check if originating packet is not an ICMP error*/
|
||||||
if (uip_ext_len) {
|
if (uip_ext_len) {
|
||||||
if(UIP_EXT_BUF->next == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
|
if(UIP_EXT_BUF->next == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
|
if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
|
||||||
/* the source should not be unspecified nor multicast, the check for
|
/* the source should not be unspecified nor multicast, the check for
|
||||||
multicast is done in uip_process */
|
multicast is done in uip_process */
|
||||||
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)){
|
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)){
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
|
||||||
if(type == ICMP6_PARAM_PROB && code == ICMP6_PARAMPROB_OPTION){
|
if(type == ICMP6_PARAM_PROB && code == ICMP6_PARAMPROB_OPTION){
|
||||||
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr);
|
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr);
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -385,7 +385,7 @@ echo_reply_input(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -321,7 +321,7 @@ create_na:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* UIP_ND6_SEND_NA */
|
#endif /* UIP_ND6_SEND_NA */
|
||||||
|
@ -360,7 +360,7 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
|
||||||
}
|
}
|
||||||
if (uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
|
if (uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
|
||||||
PRINTF("Dropping NS due to no suitable source address\n");
|
PRINTF("Dropping NS due to no suitable source address\n");
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UIP_IP_BUF->len[1] =
|
UIP_IP_BUF->len[1] =
|
||||||
|
@ -557,7 +557,7 @@ na_input(void)
|
||||||
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
|
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* UIP_ND6_SEND_NA */
|
#endif /* UIP_ND6_SEND_NA */
|
||||||
|
@ -646,7 +646,7 @@ rs_input(void)
|
||||||
uip_ds6_send_ra_sollicited();
|
uip_ds6_send_ra_sollicited();
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,7 +1029,7 @@ ra_input(void)
|
||||||
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
|
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
|
||||||
|
|
||||||
discard:
|
discard:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* !UIP_CONF_ROUTER */
|
#endif /* !UIP_CONF_ROUTER */
|
||||||
|
|
|
@ -538,8 +538,7 @@ remove_ext_hdr(void)
|
||||||
uip_ext_len, uip_len);
|
uip_ext_len, uip_len);
|
||||||
if(uip_len < UIP_IPH_LEN + uip_ext_len) {
|
if(uip_len < UIP_IPH_LEN + uip_ext_len) {
|
||||||
PRINTF("ERROR: uip_len too short compared to ext len\n");
|
PRINTF("ERROR: uip_len too short compared to ext len\n");
|
||||||
uip_ext_len = 0;
|
uip_clear_buf();
|
||||||
uip_len = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + uip_ext_len,
|
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + uip_ext_len,
|
||||||
|
@ -825,8 +824,7 @@ uip_reass_over(void)
|
||||||
* any RFC, we decided not to include it as it reduces the size of
|
* any RFC, we decided not to include it as it reduces the size of
|
||||||
* the packet.
|
* the packet.
|
||||||
*/
|
*/
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_ext_len = 0;
|
|
||||||
memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src
|
memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src
|
||||||
and dest address*/
|
and dest address*/
|
||||||
uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_REASSEMBLY, 0);
|
uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_REASSEMBLY, 0);
|
||||||
|
@ -971,7 +969,7 @@ uip_process(uint8_t flag)
|
||||||
} else if(flag == UIP_TIMER) {
|
} else if(flag == UIP_TIMER) {
|
||||||
/* Reset the length variables. */
|
/* Reset the length variables. */
|
||||||
#if UIP_TCP
|
#if UIP_TCP
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_slen = 0;
|
uip_slen = 0;
|
||||||
|
|
||||||
/* Increase the initial sequence number. */
|
/* Increase the initial sequence number. */
|
||||||
|
@ -1456,7 +1454,7 @@ uip_process(uint8_t flag)
|
||||||
UIP_STAT(++uip_stat.icmp.drop);
|
UIP_STAT(++uip_stat.icmp.drop);
|
||||||
UIP_STAT(++uip_stat.icmp.typeerr);
|
UIP_STAT(++uip_stat.icmp.typeerr);
|
||||||
UIP_LOG("icmp6: unknown ICMPv6 message.");
|
UIP_LOG("icmp6: unknown ICMPv6 message.");
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
|
@ -1978,7 +1976,7 @@ uip_process(uint8_t flag)
|
||||||
uip_add_rcv_nxt(1);
|
uip_add_rcv_nxt(1);
|
||||||
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
|
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
|
||||||
uip_connr->len = 0;
|
uip_connr->len = 0;
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_slen = 0;
|
uip_slen = 0;
|
||||||
UIP_APPCALL();
|
UIP_APPCALL();
|
||||||
goto appsend;
|
goto appsend;
|
||||||
|
@ -2310,8 +2308,7 @@ uip_process(uint8_t flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
uip_ext_len = 0;
|
|
||||||
uip_ext_bitmap = 0;
|
uip_ext_bitmap = 0;
|
||||||
uip_flags = 0;
|
uip_flags = 0;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -175,7 +175,7 @@ dis_input(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -418,7 +418,7 @@ dio_input(void)
|
||||||
|
|
||||||
rpl_process_dio(&from, &dio);
|
rpl_process_dio(&from, &dio);
|
||||||
|
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -801,7 +801,7 @@ fwd_dao:
|
||||||
dao_ack_output(instance, &dao_sender_addr, sequence);
|
dao_ack_output(instance, &dao_sender_addr, sequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -931,7 +931,7 @@ dao_ack_input(void)
|
||||||
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -83,7 +83,7 @@ pollhandler(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ pollhandler(void)
|
||||||
}
|
}
|
||||||
#endif /* !NETSTACK_CONF_WITH_IPV6 */
|
#endif /* !NETSTACK_CONF_WITH_IPV6 */
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,7 +146,7 @@ pollhandler(void)
|
||||||
#endif /* !NETSTACK_CONF_WITH_IPV6 */
|
#endif /* !NETSTACK_CONF_WITH_IPV6 */
|
||||||
} else {
|
} else {
|
||||||
bail:
|
bail:
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,7 +90,7 @@ request_prefix(void) CC_NON_BANKED
|
||||||
uip_buf[1] = 'P';
|
uip_buf[1] = 'P';
|
||||||
uip_len = 2;
|
uip_len = 2;
|
||||||
slip_send();
|
slip_send();
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Set our prefix when we receive one over SLIP */
|
/* Set our prefix when we receive one over SLIP */
|
||||||
|
|
|
@ -59,7 +59,7 @@ slip_input_callback(void)
|
||||||
PRINTF("SIN: %u\n", uip_len);
|
PRINTF("SIN: %u\n", uip_len);
|
||||||
if((char)uip_buf[0] == '!') {
|
if((char)uip_buf[0] == '!') {
|
||||||
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
if((char)uip_buf[1] == 'P') {
|
if((char)uip_buf[1] == 'P') {
|
||||||
uip_ipaddr_t prefix;
|
uip_ipaddr_t prefix;
|
||||||
/* Here we set a prefix !!! */
|
/* Here we set a prefix !!! */
|
||||||
|
|
|
@ -311,7 +311,7 @@ request_prefix(void)
|
||||||
uip_buf[1] = 'P';
|
uip_buf[1] = 'P';
|
||||||
uip_len = 2;
|
uip_len = 2;
|
||||||
slip_send();
|
slip_send();
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -59,7 +59,7 @@ slip_input_callback(void)
|
||||||
// PRINTF("SIN: %u\n", uip_len);
|
// PRINTF("SIN: %u\n", uip_len);
|
||||||
if(uip_buf[0] == '!') {
|
if(uip_buf[0] == '!') {
|
||||||
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
if(uip_buf[1] == 'P') {
|
if(uip_buf[1] == 'P') {
|
||||||
uip_ipaddr_t prefix;
|
uip_ipaddr_t prefix;
|
||||||
/* Here we set a prefix !!! */
|
/* Here we set a prefix !!! */
|
||||||
|
@ -85,7 +85,7 @@ slip_input_callback(void)
|
||||||
slip_send();
|
slip_send();
|
||||||
|
|
||||||
}
|
}
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/* Save the last sender received over SLIP to avoid bouncing the
|
/* Save the last sender received over SLIP to avoid bouncing the
|
||||||
packet back if no route is found */
|
packet back if no route is found */
|
||||||
|
|
|
@ -162,7 +162,7 @@ slip_input_callback(void)
|
||||||
{
|
{
|
||||||
PRINTF("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]);
|
PRINTF("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]);
|
||||||
cmd_input(uip_buf, uip_len);
|
cmd_input(uip_buf, uip_len);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -90,7 +90,7 @@ request_prefix(void) CC_NON_BANKED
|
||||||
uip_buf[1] = 'P';
|
uip_buf[1] = 'P';
|
||||||
uip_len = 2;
|
uip_len = 2;
|
||||||
slip_send();
|
slip_send();
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Set our prefix when we receive one over SLIP */
|
/* Set our prefix when we receive one over SLIP */
|
||||||
|
|
|
@ -60,7 +60,7 @@ slip_input_callback(void)
|
||||||
PRINTF("SIN: %u\n", uip_len);
|
PRINTF("SIN: %u\n", uip_len);
|
||||||
if((char)uip_buf[0] == '!') {
|
if((char)uip_buf[0] == '!') {
|
||||||
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
if((char)uip_buf[1] == 'P') {
|
if((char)uip_buf[1] == 'P') {
|
||||||
uip_ipaddr_t prefix;
|
uip_ipaddr_t prefix;
|
||||||
/* Here we set a prefix !!! */
|
/* Here we set a prefix !!! */
|
||||||
|
|
|
@ -342,7 +342,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
|
|
||||||
/* In sniffer or sneezr mode we don't ever send anything */
|
/* In sniffer or sneezr mode we don't ever send anything */
|
||||||
if ((usbstick_mode.sendToRf == 0) || (usbstick_mode.sneeze != 0)) {
|
if ((usbstick_mode.sendToRf == 0) || (usbstick_mode.sneeze != 0)) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.txbad++;
|
usb_eth_stat.txbad++;
|
||||||
#endif
|
#endif
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.txbad++;
|
usb_eth_stat.txbad++;
|
||||||
#endif
|
#endif
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
#if UIP_CONF_SIMPLE_JACKDAW_ADDR_TRANS
|
#if UIP_CONF_SIMPLE_JACKDAW_ADDR_TRANS
|
||||||
else {
|
else {
|
||||||
//Not addressed to us
|
//Not addressed to us
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -422,7 +422,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.txbad++;
|
usb_eth_stat.txbad++;
|
||||||
#endif
|
#endif
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRINTF(" translated OK\n\r");
|
PRINTF(" translated OK\n\r");
|
||||||
|
@ -463,7 +463,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.txok++;
|
usb_eth_stat.txok++;
|
||||||
#endif
|
#endif
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ void mac_LowpanToEthernet(void)
|
||||||
#if !RF230BB
|
#if !RF230BB
|
||||||
usb_eth_stat.rxok++;
|
usb_eth_stat.rxok++;
|
||||||
#endif
|
#endif
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d6711e24ceeb1de09421166a3dc1b97378648af5
|
Subproject commit 1223bfe03cdb31c439f1a51593808cdabc1939d2
|
|
@ -294,7 +294,7 @@ PROCESS_THREAD(slip_process, ev, data)
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
SLIP_STATISTICS(slip_ip_drop++);
|
SLIP_STATISTICS(slip_ip_drop++);
|
||||||
}
|
}
|
||||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||||
|
|
|
@ -238,13 +238,13 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
|
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
|
||||||
PRINTF("eth2low: Packet is not IPv6, dropping\n");
|
PRINTF("eth2low: Packet is not IPv6, dropping\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In sniffer mode we don't ever send anything
|
// In sniffer mode we don't ever send anything
|
||||||
if (usbstick_mode.sendToRf == 0) {
|
if (usbstick_mode.sendToRf == 0) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
/* IPv6 does not use broadcast addresses, hence this should not happen */
|
/* IPv6 does not use broadcast addresses, hence this should not happen */
|
||||||
PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n");
|
PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("eth2low: Addressed packet received... ");
|
PRINTF("eth2low: Addressed packet received... ");
|
||||||
|
@ -271,7 +271,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
if (mac_createSicslowpanLongAddr( &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), &destAddr) == 0) {
|
if (mac_createSicslowpanLongAddr( &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), &destAddr) == 0) {
|
||||||
PRINTF(" translation failed\n");
|
PRINTF(" translation failed\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRINTF(" translated OK\n");
|
PRINTF(" translated OK\n");
|
||||||
|
@ -295,7 +295,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ void mac_LowpanToEthernet(void)
|
||||||
|
|
||||||
/* rndis_send(uip_buf, uip_len, 1); */
|
/* rndis_send(uip_buf, uip_len, 1); */
|
||||||
/* rndis_stat.rxok++; */
|
/* rndis_stat.rxok++; */
|
||||||
/* uip_len = 0; */
|
/* uip_clear_buf(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,7 +95,7 @@ tcpip_input(void)
|
||||||
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
||||||
slip_write(uip_buf, uip_len);
|
slip_write(uip_buf, uip_len);
|
||||||
leds_toggle(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@ PROCESS_THREAD(slip_process, ev, data)
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
SLIP_STATISTICS(slip_ip_drop++);
|
SLIP_STATISTICS(slip_ip_drop++);
|
||||||
}
|
}
|
||||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||||
|
|
|
@ -267,13 +267,13 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
|
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
|
||||||
PRINTF("eth2low: Packet is not IPv6, dropping\n");
|
PRINTF("eth2low: Packet is not IPv6, dropping\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In sniffer mode we don't ever send anything
|
// In sniffer mode we don't ever send anything
|
||||||
if (usbstick_mode.sendToRf == 0) {
|
if (usbstick_mode.sendToRf == 0) {
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
/* IPv6 does not use broadcast addresses, hence this should not happen */
|
/* IPv6 does not use broadcast addresses, hence this should not happen */
|
||||||
PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n");
|
PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("eth2low: Addressed packet received... ");
|
PRINTF("eth2low: Addressed packet received... ");
|
||||||
|
@ -300,7 +300,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
if (mac_createSicslowpanLongAddr( &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), &destAddr) == 0) {
|
if (mac_createSicslowpanLongAddr( &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), &destAddr) == 0) {
|
||||||
PRINTF(" translation failed\n");
|
PRINTF(" translation failed\n");
|
||||||
/* rndis_stat.txbad++; */
|
/* rndis_stat.txbad++; */
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRINTF(" translated OK\n");
|
PRINTF(" translated OK\n");
|
||||||
|
@ -322,7 +322,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
|
||||||
/* rndis_stat.txok++; */
|
/* rndis_stat.txok++; */
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ void mac_LowpanToEthernet(void)
|
||||||
|
|
||||||
/* rndis_send(uip_buf, uip_len, 1); */
|
/* rndis_send(uip_buf, uip_len, 1); */
|
||||||
/* rndis_stat.rxok++; */
|
/* rndis_stat.rxok++; */
|
||||||
/* uip_len = 0; */
|
/* uip_clear_buf(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,7 +98,7 @@ tcpip_input(void)
|
||||||
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
||||||
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
||||||
slip_write(uip_buf, uip_len);
|
slip_write(uip_buf, uip_len);
|
||||||
uip_len = 0;
|
uip_clear_buf();
|
||||||
leds_off(LEDS_RED);
|
leds_off(LEDS_RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue