From 3fa25eac8c8aa787dba4dc92433cfef2eddef856 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 10 Mar 2016 11:41:06 +0100 Subject: [PATCH] uip6: fix bug that caused the payload of ICMPv6 messages not to match that of the original packet --- core/net/ipv6/uip6.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 057d6173a..7e9ab0016 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -1482,8 +1482,6 @@ uip_process(uint8_t flag) work. If the application sets uip_slen, it has a packet to send. */ #if UIP_UDP_CHECKSUMS - uip_len = uip_len - UIP_IPUDPH_LEN; - uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN]; /* XXX hack: UDP/IPv6 receivers should drop packets with UDP checksum 0. Here, we explicitly receive UDP packets with checksum 0. This is to be able to debug code that for one reason or @@ -1496,8 +1494,6 @@ uip_process(uint8_t flag) uip_udpchksum()); goto drop; } -#else /* UIP_UDP_CHECKSUMS */ - uip_len = uip_len - UIP_IPUDPH_LEN; #endif /* UIP_UDP_CHECKSUMS */ /* Make sure that the UDP destination port number is not zero. */ @@ -1536,6 +1532,8 @@ uip_process(uint8_t flag) PRINTF("In udp_found\n"); UIP_STAT(++uip_stat.udp.recv); + uip_len = uip_len - UIP_IPUDPH_LEN; + uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN]; uip_conn = NULL; uip_flags = UIP_NEWDATA; uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];