summaryrefslogtreecommitdiff
path: root/nuttx/net/uip/uip-icmpsend.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-03 14:57:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-03 14:57:36 +0000
commit32082a46190ea27f7e958fce73167b3a368d7666 (patch)
treebdd8a10255529f954ff577a4017c6a3d1b935566 /nuttx/net/uip/uip-icmpsend.c
parent9f60d09c6faaac732a62a188228a88321aad7368 (diff)
downloadpx4-nuttx-32082a46190ea27f7e958fce73167b3a368d7666.tar.gz
px4-nuttx-32082a46190ea27f7e958fce73167b3a368d7666.tar.bz2
px4-nuttx-32082a46190ea27f7e958fce73167b3a368d7666.zip
Fix ICMP and UDP IP checksums
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@871 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip/uip-icmpsend.c')
-rw-r--r--nuttx/net/uip/uip-icmpsend.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/nuttx/net/uip/uip-icmpsend.c b/nuttx/net/uip/uip-icmpsend.c
index c0076b0e8..fc8ac2e83 100644
--- a/nuttx/net/uip/uip-icmpsend.c
+++ b/nuttx/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. */