nuttx/net/igmp
zhekunren 8a0f354ac6 net/igmp: fix checksum validation that always dropped valid IGMP packets
igmp_input() validated the IGMP checksum with:

  if (net_chksum((FAR uint16_t *)igmp, IGMP_HDRLEN) != 0)

but net_chksum() returns the raw one's complement sum of the 16-bit
words (it does NOT take the one's complement of that sum). For a valid
IGMP packet whose checksum field holds ~S (as written by igmp_send()),
the sum of all 16-bit words is S + ~S = 0xffff, never 0.

So the existing check `!= 0` was always true for any well-formed IGMP
message, sending every valid packet down the "Checksum error" path to
be silently dropped and breaking IGMP membership query/report processing.

Compare against 0xffff instead, matching the convention used by the
other transport input handlers:

  - ipv4_input.c: (ipv4_chksum(IPv4BUF) != 0xffff)
  - tcp_input.c:  (tcp_chksum(dev) != 0xffff)

This is also consistent with the sender side in igmp_send.c, which
stores `igmp->chksum = ~igmp_chksum(...)`.

Signed-off-by: zhekunren <zhekunren@qq.com>
Assisted-by: GLM-5.2 <noreply@z.ai>
2026-08-07 16:36:42 +08:00
..
CMakeLists.txt net: migrate to SPDX identifier 2024-09-12 01:08:11 +08:00
igmp.h net: migrate to SPDX identifier 2024-09-12 01:08:11 +08:00
igmp_group.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_initialize.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_input.c net/igmp: fix checksum validation that always dropped valid IGMP packets 2026-08-07 16:36:42 +08:00
igmp_join.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_leave.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_mcastmac.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_msg.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_poll.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_send.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp_timer.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
Kconfig modify for offload checksum and add macro with tcp/icmp/icmpv6/igmp checksum 2024-08-24 20:41:40 +08:00
Make.defs net: migrate to SPDX identifier 2024-09-12 01:08:11 +08:00