You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/24 15:19:16 UTC
[incubator-nuttx] 01/03: net/icmpv6: Fix icmpv6 checksum calculation in icmpv6_reply
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 233974b32706c7d25ad289bcbb449d407a47837e
Author: Zhe Weng <we...@xiaomi.com>
AuthorDate: Thu Nov 24 16:50:11 2022 +0800
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 <we...@xiaomi.com>
---
net/icmpv6/icmpv6_reply.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/icmpv6/icmpv6_reply.c b/net/icmpv6/icmpv6_reply.c
index c309a8100a..3bd4192d52 100644
--- a/net/icmpv6/icmpv6_reply.c
+++ b/net/icmpv6/icmpv6_reply.c
@@ -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. */
icmpv6->chksum = 0;
- icmpv6->chksum = ~icmpv6_chksum(dev, datalen + sizeof(*icmpv6));
+ icmpv6->chksum = ~icmpv6_chksum(dev, IPv6_HDRLEN);
if (icmpv6->chksum == 0)
{
icmpv6->chksum = 0xffff;