net/icmpv6: Fix datalen
in icmpv6_reply
The `datalen` indicates the whole len of original packet, which will become the payload inside icmpv6 packet. Using `datalen = (ipv4->len[0] << 8) + ipv4->len[1]` in icmp_reply is correct, because it includes IPv4 header, but when coming to IPv6, the `len` does not include the header, so we need to add it back. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
233974b327
commit
a26ea96f3b
@ -99,9 +99,9 @@ void icmpv6_reply(FAR struct net_driver_s *dev, int type, int code, int data)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the data size of the packet. */
|
||||
/* Get the data (whole original packet) size of the packet. */
|
||||
|
||||
datalen = (ipv6->len[0] << 8) + ipv6->len[1];
|
||||
datalen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN;
|
||||
|
||||
/* RFC says return as much as we can without exceeding 1280 bytes. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user