mirror of
https://github.com/apache/nuttx.git
synced 2026-09-29 14:29:27 +08:00
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>