diff --git a/ChangeLog b/ChangeLog index 7c9f79e5875b7151e0a4dd3d3e0e7d4fd449aa4a..e0af7c0af96cf804d1232410e8c577518ae487d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -447,4 +447,5 @@ * Add support to uIP for application access to ICMP protocol stacks; Add ping request logic. * NSH: Add ping command + * Correct IP checksum calculation in ICMP and UDP message send logic. diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index f05fdc6ce906a9128867114e955b534b682ca89c..06169e4ea0cba3c15053d536a3aaf2c1888d942d 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: September 2, 2008</p> + <p>Last Updated: September 3, 2008</p> </td> </tr> </table> @@ -1074,6 +1074,7 @@ nuttx-0.3.14 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * Add support to uIP for application access to ICMP protocol stacks; Add ping request logic. * NSH: Add ping command + * Correct IP checksum calculation in ICMP and UDP message send logic. pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/net/uip/uip-icmpsend.c b/net/uip/uip-icmpsend.c index c0076b0e8c865ec33b25b06cebc3b3207491b2d5..fc8ac2e8355a8f828cc21466b42a462fa49f7b0a 100644 --- a/net/uip/uip-icmpsend.c +++ b/net/uip/uip-icmpsend.c @@ -92,7 +92,7 @@ void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr) { if (dev->d_sndlen > 0) { - /* The total lenth to send is the size of the application data plus + /* The total length to send is the size of the application data plus * the IP and ICMP headers (and, eventually, the ethernet header) */ @@ -130,19 +130,19 @@ void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr) ++g_ipid; ICMPBUF->ipid[0] = g_ipid >> 8; ICMPBUF->ipid[1] = g_ipid & 0xff; - ICMPBUF->ipoffset[0] = 0; - ICMPBUF->ipoffset[1] = 0; + ICMPBUF->ipoffset[0] = UIP_TCPFLAG_DONTFRAG >> 8; + ICMPBUF->ipoffset[1] = UIP_TCPFLAG_DONTFRAG & 0xff; ICMPBUF->ttl = UIP_TTL; ICMPBUF->proto = UIP_PROTO_ICMP; + uiphdr_ipaddr_copy(ICMPBUF->srcipaddr, &dev->d_ipaddr); + uiphdr_ipaddr_copy(ICMPBUF->destipaddr, destaddr); + /* Calculate IP checksum. */ ICMPBUF->ipchksum = 0; ICMPBUF->ipchksum = ~(uip_ipchksum(dev)); - uiphdr_ipaddr_copy(ICMPBUF->srcipaddr, &dev->d_ipaddr); - uiphdr_ipaddr_copy(ICMPBUF->destipaddr, destaddr); - #endif /* CONFIG_NET_IPv6 */ /* Calculate the ICMP checksum. */ diff --git a/net/uip/uip-udpsend.c b/net/uip/uip-udpsend.c index 563d31a8175b3d01204408c3e5c297b7f60b937b..79ab3685654dc5ff8217afcb3a1ad2adfb03071d 100644 --- a/net/uip/uip-udpsend.c +++ b/net/uip/uip-udpsend.c @@ -134,14 +134,14 @@ void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn) UDPBUF->ttl = conn->ttl; UDPBUF->proto = UIP_PROTO_UDP; + uiphdr_ipaddr_copy(UDPBUF->srcipaddr, &dev->d_ipaddr); + uiphdr_ipaddr_copy(UDPBUF->destipaddr, &conn->ripaddr); + /* Calculate IP checksum. */ UDPBUF->ipchksum = 0; UDPBUF->ipchksum = ~(uip_ipchksum(dev)); - uiphdr_ipaddr_copy(UDPBUF->srcipaddr, &dev->d_ipaddr); - uiphdr_ipaddr_copy(UDPBUF->destipaddr, &conn->ripaddr); - #endif /* CONFIG_NET_IPv6 */ /* Initialize the UDP header */