net/icmpv6: Fix icmpv6 checksum calculation in icmpv6_reply
The second param of icmpv6_chksum is `iplen`, which indicates `The size of the IPv6 header`. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
6368b29751
commit
233974b327
@ -139,7 +139,7 @@ void icmpv6_reply(FAR struct net_driver_s *dev, int type, int code, int data)
|
|||||||
/* Calculate the ICMPv6 checksum over the ICMPv6 header and payload. */
|
/* Calculate the ICMPv6 checksum over the ICMPv6 header and payload. */
|
||||||
|
|
||||||
icmpv6->chksum = 0;
|
icmpv6->chksum = 0;
|
||||||
icmpv6->chksum = ~icmpv6_chksum(dev, datalen + sizeof(*icmpv6));
|
icmpv6->chksum = ~icmpv6_chksum(dev, IPv6_HDRLEN);
|
||||||
if (icmpv6->chksum == 0)
|
if (icmpv6->chksum == 0)
|
||||||
{
|
{
|
||||||
icmpv6->chksum = 0xffff;
|
icmpv6->chksum = 0xffff;
|
||||||
|
Loading…
Reference in New Issue
Block a user