uip6: fix bug that caused the payload of ICMPv6 messages not to match that of the original packet

This commit is contained in:
Simon Duquennoy 2016-03-10 11:41:06 +01:00
parent 06e984a02e
commit 3fa25eac8c

View file

@ -1482,8 +1482,6 @@ uip_process(uint8_t flag)
work. If the application sets uip_slen, it has a packet to work. If the application sets uip_slen, it has a packet to
send. */ send. */
#if UIP_UDP_CHECKSUMS #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 /* XXX hack: UDP/IPv6 receivers should drop packets with UDP
checksum 0. Here, we explicitly receive UDP packets with checksum checksum 0. Here, we explicitly receive UDP packets with checksum
0. This is to be able to debug code that for one reason or 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()); uip_udpchksum());
goto drop; goto drop;
} }
#else /* UIP_UDP_CHECKSUMS */
uip_len = uip_len - UIP_IPUDPH_LEN;
#endif /* UIP_UDP_CHECKSUMS */ #endif /* UIP_UDP_CHECKSUMS */
/* Make sure that the UDP destination port number is not zero. */ /* 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"); PRINTF("In udp_found\n");
UIP_STAT(++uip_stat.udp.recv); 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_conn = NULL;
uip_flags = UIP_NEWDATA; uip_flags = UIP_NEWDATA;
uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN]; uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];