nuttx/net/igmp
Jacob Dahl f20cf4aac3 fix(net/igmp): restore General Query handling broken by pointer compare
The group address in the IGMP header is declared as uint16_t grpaddr[2],
so it decays to a pointer.  Comparing it against INADDR_ANY compares the
address of a struct member against 0, which is always false.  The General
Query branch is therefore unreachable and GCC discards it entirely.

Commit 09bb292fa2 ("net/igmp: fix build warning on GCC 12.2.0") replaced
the original

    if (igmp->grpaddr == 0)

with

    if (net_ipv4addr_cmp(igmp->grpaddr, INADDR_ANY) != 0)

but net_ipv4addr_cmp(a, b) expands to (a == b) and INADDR_ANY expands to
((in_addr_t)0), so the emitted comparison is unchanged.  The -Waddress
diagnostic disappeared only because the comparison now originates inside
a macro expanded from a header included via -isystem, and GCC suppresses
warnings from system-header macros.  The defect was hidden, not fixed.

That commit also rewrote the unicast query test from group->grpaddr != 0,
which was well-formed, into the same pointer comparison, making it
unconditionally true.

Convert the header field with net_ip4addr_conv32() once, and compare the
resulting in_addr_t.  The conversion was already being done in the
group-specific branch, so this only hoists it and reuses it.

Impact: a General Query (destination 224.0.0.1, group address 0) is the
periodic query every IGMP querier sends.  It currently falls through to
the group-specific branch, where igmp_grpallocfind() allocates a group
for 0.0.0.0 and schedules a report for it, while joined groups never have
their report timers restarted.  The querier then ages out the membership
and multicast delivery to the device stops.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-07-15 08:46:23 +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 fix(net/igmp): restore General Query handling broken by pointer compare 2026-07-15 08:46:23 +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