diff --git a/include/nuttx/net/icmp.h b/include/nuttx/net/icmp.h index eeb52a308b1..9665753590f 100644 --- a/include/nuttx/net/icmp.h +++ b/include/nuttx/net/icmp.h @@ -141,7 +141,7 @@ struct icmp_hdr_s uint16_t seqno; /* " " "" " " " " " " " " */ }; - uint32_t data; + uint16_t data[2]; }; }; diff --git a/include/nuttx/net/icmpv6.h b/include/nuttx/net/icmpv6.h index 457619d223b..e47566aef68 100644 --- a/include/nuttx/net/icmpv6.h +++ b/include/nuttx/net/icmpv6.h @@ -157,7 +157,7 @@ struct icmpv6_hdr_s * message type indicated by the Type and Code fields. */ - uint32_t data; + uint16_t data[2]; }; /* The ICMPv6 and IPv6 headers */ diff --git a/net/icmp/icmp_reply.c b/net/icmp/icmp_reply.c index c98a5f7993d..77d05c2415b 100644 --- a/net/icmp/icmp_reply.c +++ b/net/icmp/icmp_reply.c @@ -153,7 +153,8 @@ void icmp_reply(FAR struct net_driver_s *dev, int type, int code) icmp->type = type; icmp->icode = code; - icmp->data = 0; + icmp->data[0] = 0; + icmp->data[1] = 0; /* Calculate the ICMP checksum. */ diff --git a/net/icmpv6/icmpv6_reply.c b/net/icmpv6/icmpv6_reply.c index 179c31b52be..72258294cb6 100644 --- a/net/icmpv6/icmpv6_reply.c +++ b/net/icmpv6/icmpv6_reply.c @@ -133,9 +133,10 @@ void icmpv6_reply(FAR struct net_driver_s *dev, int type, int code, int data) /* Initialize the ICMPv6 header */ - icmpv6->type = type; - icmpv6->code = code; - icmpv6->data = htonl(data); + icmpv6->type = type; + icmpv6->code = code; + icmpv6->data[0] = data >> 16; + icmpv6->data[1] = data & 0xffff; /* Calculate the ICMPv6 checksum over the ICMPv6 header and payload. */