Merge pull request #1116 from cetic/pr-uip-clear-buffer
Add uip_clear_buf() macro and replace all instances of uip_len = 0
This commit is contained in:
commit
bfb29d2f11
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1383,8 +1383,7 @@ out()
|
|||
|
||||
drop:
|
||||
uip_slen = 0;
|
||||
uip_len = 0;
|
||||
uip_ext_len = 0;
|
||||
uip_clear_buf();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -83,7 +83,7 @@ pollhandler(void)
|
|||
}
|
||||
#endif
|
||||
} else {
|
||||
uip_len = 0;
|
||||
uip_clear_buf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 !!! */
|
||||
|
|
|
@ -311,7 +311,7 @@ request_prefix(void)
|
|||
uip_buf[1] = 'P';
|
||||
uip_len = 2;
|
||||
slip_send();
|
||||
uip_len = 0;
|
||||
uip_clear_buf();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,6 +13,8 @@ uip_buf_t uip_aligned_buf;
|
|||
|
||||
uint16_t uip_len;
|
||||
|
||||
uint8_t uip_ext_len;
|
||||
|
||||
struct uip_stats uip_stat;
|
||||
|
||||
uip_lladdr_t uip_lladdr;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 !!! */
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d6711e24ceeb1de09421166a3dc1b97378648af5
|
||||
Subproject commit 1223bfe03cdb31c439f1a51593808cdabc1939d2
|
|
@ -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 */
|
||||
|
|
|
@ -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(); */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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(); */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue