Merge pull request #350 from AriZuu/udp-stats-fix

Fix UDP statistics.
This commit is contained in:
Adam Dunkels 2013-11-14 23:39:16 -08:00
commit a6227e1e3e
2 changed files with 5 additions and 1 deletions

View file

@ -1136,6 +1136,7 @@ uip_process(uint8_t flag)
} }
} }
UIP_LOG("udp: no matching connection found"); UIP_LOG("udp: no matching connection found");
UIP_STAT(++uip_stat.udp.drop);
#if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6 #if UIP_CONF_ICMP_DEST_UNREACH && !UIP_CONF_IPV6
/* Copy fields from packet header into payload of this ICMP packet. */ /* Copy fields from packet header into payload of this ICMP packet. */
memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8); memcpy(&(ICMPBUF->payload[0]), ICMPBUF, UIP_IPH_LEN + 8);
@ -1169,6 +1170,7 @@ uip_process(uint8_t flag)
#endif /* UIP_CONF_ICMP_DEST_UNREACH */ #endif /* UIP_CONF_ICMP_DEST_UNREACH */
udp_found: udp_found:
UIP_STAT(++uip_stat.udp.recv);
uip_conn = NULL; uip_conn = NULL;
uip_flags = UIP_NEWDATA; uip_flags = UIP_NEWDATA;
uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];
@ -1213,6 +1215,7 @@ uip_process(uint8_t flag)
} }
#endif /* UIP_UDP_CHECKSUMS */ #endif /* UIP_UDP_CHECKSUMS */
UIP_STAT(++uip_stat.udp.sent);
goto ip_send_nolen; goto ip_send_nolen;
#endif /* UIP_UDP */ #endif /* UIP_UDP */

View file

@ -1512,10 +1512,10 @@ uip_process(uint8_t flag)
} }
} }
PRINTF("udp: no matching connection found\n"); PRINTF("udp: no matching connection found\n");
UIP_STAT(++uip_stat.udp.drop);
#if UIP_UDP_SEND_UNREACH_NOPORT #if UIP_UDP_SEND_UNREACH_NOPORT
uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
UIP_STAT(++uip_stat.ip.drop);
goto send; goto send;
#else #else
goto drop; goto drop;
@ -1523,6 +1523,7 @@ uip_process(uint8_t flag)
udp_found: udp_found:
PRINTF("In udp_found\n"); PRINTF("In udp_found\n");
UIP_STAT(++uip_stat.udp.recv);
uip_conn = NULL; uip_conn = NULL;
uip_flags = UIP_NEWDATA; uip_flags = UIP_NEWDATA;