nuttx/net/igmp
zhekunren f11df565ea net/igmp: fix length check that always dropped valid IGMP packets
igmp_input() verified the packet length with:

  if (dev->d_len < NET_LL_HDRLEN(dev) + (iphdrlen + IGMP_HDRLEN))

but dev->d_len at this point holds the IPv4 total length (IP header plus
payload) without the link-layer header, consistent with the convention
established in ipv4_in()/ipv6_in() (which do `dev->d_len -=
NET_LL_HDRLEN(dev)`) and used by all other transport input handlers
(icmp, tcp, udp), none of which reference NET_LL_HDRLEN.

Adding NET_LL_HDRLEN(dev) to the right-hand side made the check always
true for valid IGMP packets:

  iphdrlen + IGMP_HDRLEN < NET_LL_HDRLEN + iphdrlen + IGMP_HDRLEN
                         (= 0 < NET_LL_HDRLEN)

so every well-formed IGMP message hit the "Length error" path and was
silently dropped, breaking IGMP membership query/report processing.

Drop the extra NET_LL_HDRLEN(dev) so the check matches the other
protocol handlers.

Signed-off-by: zhekunren <zhekunren@qq.com>
2026-08-06 12:49:31 +02: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 length check that always dropped valid IGMP packets 2026-08-06 12:49:31 +02: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