diff --git a/core/dev/slip.c b/core/dev/slip.c index 6b8a24ceb..451b9ec6c 100644 --- a/core/dev/slip.c +++ b/core/dev/slip.c @@ -293,7 +293,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); #endif } else { - uip_len = 0; + uip_clear_buf(); SLIP_STATISTICS(slip_ip_drop++); } #else /* NETSTACK_CONF_WITH_IPV6 */ diff --git a/core/net/ip/tcpip.c b/core/net/ip/tcpip.c index 1c75d1bc9..0505b3d47 100644 --- a/core/net/ip/tcpip.c +++ b/core/net/ip/tcpip.c @@ -529,10 +529,7 @@ void tcpip_input(void) { process_post_synch(&tcpip_process, PACKET_INPUT, NULL); - uip_len = 0; -#if NETSTACK_CONF_WITH_IPV6 - uip_ext_len = 0; -#endif /*NETSTACK_CONF_WITH_IPV6*/ + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ #if NETSTACK_CONF_WITH_IPV6 @@ -548,13 +545,13 @@ tcpip_ipv6_output(void) if(uip_len > UIP_LINK_MTU) { UIP_LOG("tcpip_ipv6_output: Packet to big"); - uip_len = 0; + uip_clear_buf(); return; } if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){ UIP_LOG("tcpip_ipv6_output: Destination address unspecified"); - uip_len = 0; + uip_clear_buf(); return; } @@ -591,7 +588,7 @@ tcpip_ipv6_output(void) #else PRINTF("tcpip_ipv6_output: Destination off-link but no route\n"); #endif /* !UIP_FALLBACK_INTERFACE */ - uip_len = 0; + uip_clear_buf(); return; } @@ -643,7 +640,7 @@ tcpip_ipv6_output(void) #if UIP_CONF_IPV6_RPL if(rpl_update_header_final(nexthop)) { - uip_len = 0; + uip_clear_buf(); return; } #endif /* UIP_CONF_IPV6_RPL */ @@ -651,7 +648,7 @@ tcpip_ipv6_output(void) if(nbr == NULL) { #if UIP_ND6_SEND_NA if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) { - uip_len = 0; + uip_clear_buf(); return; } else { #if UIP_CONF_IPV6_QUEUE_PKT @@ -689,7 +686,7 @@ tcpip_ipv6_output(void) uip_packetqueue_set_buflen(&nbr->packethandle, uip_len); } #endif /*UIP_CONF_IPV6_QUEUE_PKT*/ - uip_len = 0; + uip_clear_buf(); return; } /* 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*/ - uip_len = 0; + uip_clear_buf(); return; } return; } /* Multicast IP destination address. */ tcpip_output(NULL); - uip_len = 0; - uip_ext_len = 0; + uip_clear_buf(); } #endif /* NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ diff --git a/core/net/ip/uip.h b/core/net/ip/uip.h index cb12f52ab..a85929554 100644 --- a/core/net/ip/uip.h +++ b/core/net/ip/uip.h @@ -1326,6 +1326,22 @@ extern uint8_t uip_ext_len; extern uint16_t uip_urglen, uip_surglen; #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. diff --git a/core/net/ip64/ip64-slip-interface.c b/core/net/ip64/ip64-slip-interface.c index 05fe704c7..8d46d78a8 100644 --- a/core/net/ip64/ip64-slip-interface.c +++ b/core/net/ip64/ip64-slip-interface.c @@ -59,7 +59,7 @@ input_callback(void) /*PRINTF("SIN: %u\n", uip_len);*/ if(uip_buf[0] == '!') { PRINTF("Got configuration message of type %c\n", uip_buf[1]); - uip_len = 0; + uip_clear_buf(); #if 0 if(uip_buf[1] == 'P') { uip_ipaddr_t prefix; @@ -87,7 +87,7 @@ input_callback(void) slip_send(); } - uip_len = 0; + uip_clear_buf(); } else { /* Save the last sender received over SLIP to avoid bouncing the @@ -101,7 +101,7 @@ input_callback(void) uip_len = len; /* PRINTF("send len %d\n", len); */ } else { - uip_len = 0; + uip_clear_buf(); } } } diff --git a/core/net/ipv4/uip-fw.c b/core/net/ipv4/uip-fw.c index c152231c0..530a0b7c0 100644 --- a/core/net/ipv4/uip-fw.c +++ b/core/net/ipv4/uip-fw.c @@ -229,7 +229,7 @@ time_exceeded(void) /* We don't send out ICMP errors for ICMP messages (unless they are pings). */ if(ICMPBUF->proto == UIP_PROTO_ICMP && ICMPBUF->type != ICMP_ECHO) { - uip_len = 0; + uip_clear_buf(); return; } /* Copy fields from packet header into payload of this ICMP packet. */ diff --git a/core/net/ipv4/uip.c b/core/net/ipv4/uip.c index 1c3c24aaf..48366a114 100644 --- a/core/net/ipv4/uip.c +++ b/core/net/ipv4/uip.c @@ -709,7 +709,7 @@ uip_process(uint8_t flag) } /* Reset the length variables. */ - uip_len = 0; + uip_clear_buf(); uip_slen = 0; #if UIP_TCP @@ -1589,7 +1589,7 @@ uip_process(uint8_t flag) uip_add_rcv_nxt(1); uip_flags = UIP_CONNECTED | UIP_NEWDATA; uip_connr->len = 0; - uip_len = 0; + uip_clear_buf(); uip_slen = 0; UIP_APPCALL(); goto appsend; @@ -1934,7 +1934,7 @@ uip_process(uint8_t flag) return; drop: - uip_len = 0; + uip_clear_buf(); uip_flags = 0; return; } diff --git a/core/net/ipv4/uip_arp.c b/core/net/ipv4/uip_arp.c index 5abad8b40..10015295e 100644 --- a/core/net/ipv4/uip_arp.c +++ b/core/net/ipv4/uip_arp.c @@ -284,10 +284,10 @@ uip_arp_arpin(void) { if(uip_len < sizeof(struct arp_hdr)) { - uip_len = 0; + uip_clear_buf(); return; } - uip_len = 0; + uip_clear_buf(); switch(BUF->opcode) { case UIP_HTONS(ARP_REQUEST): diff --git a/core/net/ipv6/multicast/roll-tm.c b/core/net/ipv6/multicast/roll-tm.c index 20a562084..432a4cde0 100644 --- a/core/net/ipv6/multicast/roll-tm.c +++ b/core/net/ipv6/multicast/roll-tm.c @@ -1380,8 +1380,7 @@ out() drop: uip_slen = 0; - uip_len = 0; - uip_ext_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ static uint8_t diff --git a/core/net/ipv6/multicast/smrf.c b/core/net/ipv6/multicast/smrf.c index b1dccbd19..d62547ef6 100644 --- a/core/net/ipv6/multicast/smrf.c +++ b/core/net/ipv6/multicast/smrf.c @@ -81,7 +81,7 @@ mcast_fwd(void *p) uip_len = mcast_len; UIP_IP_BUF->ttl--; tcpip_output(NULL); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ static uint8_t diff --git a/core/net/ipv6/uip-icmp6.c b/core/net/ipv6/uip-icmp6.c index ee8d94c77..a9dc9e352 100644 --- a/core/net/ipv6/uip-icmp6.c +++ b/core/net/ipv6/uip-icmp6.c @@ -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*/ if (uip_ext_len) { if(UIP_EXT_BUF->next == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){ - uip_len = 0; + uip_clear_buf(); return; } } else { if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){ - uip_len = 0; + uip_clear_buf(); 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 multicast is done in uip_process */ if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)){ - uip_len = 0; + uip_clear_buf(); 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){ uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr); } else { - uip_len = 0; + uip_clear_buf(); return; } } else { @@ -385,7 +385,7 @@ echo_reply_input(void) } } - uip_len = 0; + uip_clear_buf(); return; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/ipv6/uip-nd6.c b/core/net/ipv6/uip-nd6.c index 72b1badfa..331e1fae3 100644 --- a/core/net/ipv6/uip-nd6.c +++ b/core/net/ipv6/uip-nd6.c @@ -321,7 +321,7 @@ create_na: return; discard: - uip_len = 0; + uip_clear_buf(); return; } #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)) { PRINTF("Dropping NS due to no suitable source address\n"); - uip_len = 0; + uip_clear_buf(); return; } UIP_IP_BUF->len[1] = @@ -557,7 +557,7 @@ na_input(void) #endif /*UIP_CONF_IPV6_QUEUE_PKT */ discard: - uip_len = 0; + uip_clear_buf(); return; } #endif /* UIP_ND6_SEND_NA */ @@ -646,7 +646,7 @@ rs_input(void) uip_ds6_send_ra_sollicited(); discard: - uip_len = 0; + uip_clear_buf(); return; } @@ -1029,7 +1029,7 @@ ra_input(void) #endif /*UIP_CONF_IPV6_QUEUE_PKT */ discard: - uip_len = 0; + uip_clear_buf(); return; } #endif /* !UIP_CONF_ROUTER */ diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 73abd1115..416edf813 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -538,8 +538,7 @@ remove_ext_hdr(void) uip_ext_len, uip_len); if(uip_len < UIP_IPH_LEN + uip_ext_len) { PRINTF("ERROR: uip_len too short compared to ext len\n"); - uip_ext_len = 0; - uip_len = 0; + uip_clear_buf(); return; } 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 * the packet. */ - uip_len = 0; - uip_ext_len = 0; + uip_clear_buf(); memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src and dest address*/ 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) { /* Reset the length variables. */ #if UIP_TCP - uip_len = 0; + uip_clear_buf(); uip_slen = 0; /* 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.typeerr); UIP_LOG("icmp6: unknown ICMPv6 message."); - uip_len = 0; + uip_clear_buf(); } if(uip_len > 0) { @@ -1978,7 +1976,7 @@ uip_process(uint8_t flag) uip_add_rcv_nxt(1); uip_flags = UIP_CONNECTED | UIP_NEWDATA; uip_connr->len = 0; - uip_len = 0; + uip_clear_buf(); uip_slen = 0; UIP_APPCALL(); goto appsend; @@ -2310,8 +2308,7 @@ uip_process(uint8_t flag) return; drop: - uip_len = 0; - uip_ext_len = 0; + uip_clear_buf(); uip_ext_bitmap = 0; uip_flags = 0; return; diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 66e311d51..880b7986c 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -175,7 +175,7 @@ dis_input(void) } } } - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ void @@ -418,7 +418,7 @@ dio_input(void) rpl_process_dio(&from, &dio); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ void @@ -801,7 +801,7 @@ fwd_dao: dao_ack_output(instance, &dao_sender_addr, sequence); } } - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ void @@ -931,7 +931,7 @@ dao_ack_input(void) PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINTF("\n"); #endif /* DEBUG */ - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ void diff --git a/cpu/native/net/tapdev-drv.c b/cpu/native/net/tapdev-drv.c index 8a7aeed53..d2d4a1ac0 100644 --- a/cpu/native/net/tapdev-drv.c +++ b/cpu/native/net/tapdev-drv.c @@ -83,7 +83,7 @@ pollhandler(void) } #endif } else { - uip_len = 0; + uip_clear_buf(); } } } diff --git a/cpu/native/net/wpcap-drv.c b/cpu/native/net/wpcap-drv.c index 0b3cf926a..7ff8457b6 100644 --- a/cpu/native/net/wpcap-drv.c +++ b/cpu/native/net/wpcap-drv.c @@ -103,7 +103,7 @@ pollhandler(void) } #endif /* !NETSTACK_CONF_WITH_IPV6 */ } else { - uip_len = 0; + uip_clear_buf(); } } #endif @@ -146,7 +146,7 @@ pollhandler(void) #endif /* !NETSTACK_CONF_WITH_IPV6 */ } else { bail: - uip_len = 0; + uip_clear_buf(); } } #endif diff --git a/examples/cc2530dk/border-router/border-router.c b/examples/cc2530dk/border-router/border-router.c index 0df514474..843632b23 100644 --- a/examples/cc2530dk/border-router/border-router.c +++ b/examples/cc2530dk/border-router/border-router.c @@ -90,7 +90,7 @@ request_prefix(void) CC_NON_BANKED uip_buf[1] = 'P'; uip_len = 2; slip_send(); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ /* Set our prefix when we receive one over SLIP */ diff --git a/examples/cc2530dk/border-router/slip-bridge.c b/examples/cc2530dk/border-router/slip-bridge.c index 98aee3bf9..30bd4a429 100644 --- a/examples/cc2530dk/border-router/slip-bridge.c +++ b/examples/cc2530dk/border-router/slip-bridge.c @@ -59,7 +59,7 @@ slip_input_callback(void) PRINTF("SIN: %u\n", uip_len); if((char)uip_buf[0] == '!') { PRINTF("Got configuration message of type %c\n", uip_buf[1]); - uip_len = 0; + uip_clear_buf(); if((char)uip_buf[1] == 'P') { uip_ipaddr_t prefix; /* Here we set a prefix !!! */ diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c index 106107ccb..84943e68f 100644 --- a/examples/ipv6/rpl-border-router/border-router.c +++ b/examples/ipv6/rpl-border-router/border-router.c @@ -311,7 +311,7 @@ request_prefix(void) uip_buf[1] = 'P'; uip_len = 2; slip_send(); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ void diff --git a/examples/ipv6/rpl-border-router/slip-bridge.c b/examples/ipv6/rpl-border-router/slip-bridge.c index 52b4a4060..582f626e7 100644 --- a/examples/ipv6/rpl-border-router/slip-bridge.c +++ b/examples/ipv6/rpl-border-router/slip-bridge.c @@ -59,7 +59,7 @@ slip_input_callback(void) // PRINTF("SIN: %u\n", uip_len); if(uip_buf[0] == '!') { PRINTF("Got configuration message of type %c\n", uip_buf[1]); - uip_len = 0; + uip_clear_buf(); if(uip_buf[1] == 'P') { uip_ipaddr_t prefix; /* Here we set a prefix !!! */ @@ -85,7 +85,7 @@ slip_input_callback(void) slip_send(); } - uip_len = 0; + uip_clear_buf(); } /* Save the last sender received over SLIP to avoid bouncing the packet back if no route is found */ diff --git a/examples/ipv6/slip-radio/slip-radio.c b/examples/ipv6/slip-radio/slip-radio.c index 255cfefb5..b20e559ec 100644 --- a/examples/ipv6/slip-radio/slip-radio.c +++ b/examples/ipv6/slip-radio/slip-radio.c @@ -162,7 +162,7 @@ slip_input_callback(void) { PRINTF("SR-SIN: %u '%c%c'\n", uip_len, uip_buf[0], uip_buf[1]); cmd_input(uip_buf, uip_len); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ static void diff --git a/examples/sensinode/border-router/border-router.c b/examples/sensinode/border-router/border-router.c index 028a2f770..9442c9e03 100644 --- a/examples/sensinode/border-router/border-router.c +++ b/examples/sensinode/border-router/border-router.c @@ -90,7 +90,7 @@ request_prefix(void) CC_NON_BANKED uip_buf[1] = 'P'; uip_len = 2; slip_send(); - uip_len = 0; + uip_clear_buf(); } /*---------------------------------------------------------------------------*/ /* Set our prefix when we receive one over SLIP */ diff --git a/examples/sensinode/border-router/slip-bridge.c b/examples/sensinode/border-router/slip-bridge.c index fc9f95a28..edd048a7d 100644 --- a/examples/sensinode/border-router/slip-bridge.c +++ b/examples/sensinode/border-router/slip-bridge.c @@ -60,7 +60,7 @@ slip_input_callback(void) PRINTF("SIN: %u\n", uip_len); if((char)uip_buf[0] == '!') { PRINTF("Got configuration message of type %c\n", uip_buf[1]); - uip_len = 0; + uip_clear_buf(); if((char)uip_buf[1] == 'P') { uip_ipaddr_t prefix; /* Here we set a prefix !!! */ diff --git a/platform/avr-ravenusb/sicslow_ethernet.c b/platform/avr-ravenusb/sicslow_ethernet.c index 46b9244cc..5f70928ba 100644 --- a/platform/avr-ravenusb/sicslow_ethernet.c +++ b/platform/avr-ravenusb/sicslow_ethernet.c @@ -342,7 +342,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* In sniffer or sneezr mode we don't ever send anything */ if ((usbstick_mode.sendToRf == 0) || (usbstick_mode.sneeze != 0)) { - uip_len = 0; + uip_clear_buf(); return; } @@ -354,7 +354,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #if !RF230BB usb_eth_stat.txbad++; #endif - uip_len = 0; + uip_clear_buf(); return; } @@ -375,7 +375,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #if !RF230BB usb_eth_stat.txbad++; #endif - uip_len = 0; + uip_clear_buf(); return; } else { @@ -409,7 +409,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #if UIP_CONF_SIMPLE_JACKDAW_ADDR_TRANS else { //Not addressed to us - uip_len = 0; + uip_clear_buf(); return; } #else @@ -422,7 +422,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #if !RF230BB usb_eth_stat.txbad++; #endif - uip_len = 0; + uip_clear_buf(); return; } PRINTF(" translated OK\n\r"); @@ -463,7 +463,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) #if !RF230BB usb_eth_stat.txok++; #endif - uip_len = 0; + uip_clear_buf(); } @@ -543,7 +543,7 @@ void mac_LowpanToEthernet(void) #if !RF230BB usb_eth_stat.rxok++; #endif - uip_len = 0; + uip_clear_buf(); } /** diff --git a/tools/cc2538-bsl b/tools/cc2538-bsl index d6711e24c..1223bfe03 160000 --- a/tools/cc2538-bsl +++ b/tools/cc2538-bsl @@ -1 +1 @@ -Subproject commit d6711e24ceeb1de09421166a3dc1b97378648af5 +Subproject commit 1223bfe03cdb31c439f1a51593808cdabc1939d2 diff --git a/tools/sky/uip6-bridge/dev/slip.c b/tools/sky/uip6-bridge/dev/slip.c index 42d6760b1..4cb65cfd5 100644 --- a/tools/sky/uip6-bridge/dev/slip.c +++ b/tools/sky/uip6-bridge/dev/slip.c @@ -294,7 +294,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); } } else { - uip_len = 0; + uip_clear_buf(); SLIP_STATISTICS(slip_ip_drop++); } #else /* NETSTACK_CONF_WITH_IPV6 */ diff --git a/tools/sky/uip6-bridge/sicslow_ethernet.c b/tools/sky/uip6-bridge/sicslow_ethernet.c index a74415020..7de0694c3 100644 --- a/tools/sky/uip6-bridge/sicslow_ethernet.c +++ b/tools/sky/uip6-bridge/sicslow_ethernet.c @@ -238,13 +238,13 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) { PRINTF("eth2low: Packet is not IPv6, dropping\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } // In sniffer mode we don't ever send anything if (usbstick_mode.sendToRf == 0) { - uip_len = 0; + uip_clear_buf(); return; } @@ -263,7 +263,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* IPv6 does not use broadcast addresses, hence this should not happen */ PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } else { 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) { PRINTF(" translation failed\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } 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_stat.rxok++; */ -/* uip_len = 0; */ +/* uip_clear_buf(); */ } /** diff --git a/tools/sky/uip6-bridge/uip6-bridge-tap.c b/tools/sky/uip6-bridge/uip6-bridge-tap.c index f1c5a0256..9aabd752f 100644 --- a/tools/sky/uip6-bridge/uip6-bridge-tap.c +++ b/tools/sky/uip6-bridge/uip6-bridge-tap.c @@ -95,7 +95,7 @@ tcpip_input(void) packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/ slip_write(uip_buf, uip_len); leds_toggle(LEDS_RED); - uip_len = 0; + uip_clear_buf(); } } } diff --git a/tools/stm32w/uip6_bridge/dev/slip.c b/tools/stm32w/uip6_bridge/dev/slip.c index 1380160d1..543896266 100644 --- a/tools/stm32w/uip6_bridge/dev/slip.c +++ b/tools/stm32w/uip6_bridge/dev/slip.c @@ -370,7 +370,7 @@ PROCESS_THREAD(slip_process, ev, data) tcpip_input(); } } else { - uip_len = 0; + uip_clear_buf(); SLIP_STATISTICS(slip_ip_drop++); } #else /* NETSTACK_CONF_WITH_IPV6 */ diff --git a/tools/stm32w/uip6_bridge/sicslow_ethernet.c b/tools/stm32w/uip6_bridge/sicslow_ethernet.c index 440ed9504..24c2b648c 100644 --- a/tools/stm32w/uip6_bridge/sicslow_ethernet.c +++ b/tools/stm32w/uip6_bridge/sicslow_ethernet.c @@ -267,13 +267,13 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) { PRINTF("eth2low: Packet is not IPv6, dropping\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } // In sniffer mode we don't ever send anything if (usbstick_mode.sendToRf == 0) { - uip_len = 0; + uip_clear_buf(); return; } @@ -292,7 +292,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* IPv6 does not use broadcast addresses, hence this should not happen */ PRINTF("eth2low: Ethernet broadcast address received, should not happen?\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } else { 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) { PRINTF(" translation failed\n"); /* rndis_stat.txbad++; */ - uip_len = 0; + uip_clear_buf(); return; } PRINTF(" translated OK\n"); @@ -322,7 +322,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* 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_stat.rxok++; */ -/* uip_len = 0; */ +/* uip_clear_buf(); */ } /** diff --git a/tools/stm32w/uip6_bridge/uip6-bridge-tap.c b/tools/stm32w/uip6_bridge/uip6-bridge-tap.c index 6fea42db2..307d8ea4e 100644 --- a/tools/stm32w/uip6_bridge/uip6-bridge-tap.c +++ b/tools/stm32w/uip6_bridge/uip6-bridge-tap.c @@ -98,7 +98,7 @@ tcpip_input(void) packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME), packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/ slip_write(uip_buf, uip_len); - uip_len = 0; + uip_clear_buf(); leds_off(LEDS_RED); } }