sys/netinet/ip_carp.c - line 1248: if (IN_MULTICAST(sc->sc_carpaddr.s_addr)) m->m_flags |= M_MCAST; Should read: if (IN_MULTICAST(ntohl(sc->sc_carpaddr.s_addr))) m->m_flags |= M_MCAST; At present, any announcement where the peer IP address ends in .244-.239 rather than begins with 244.-239. get sent to an invalid multicast destination MAC address. eg. Frame 17: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) Ethernet II, Src: Microsoft_de:ed:00 (00:15:5d:de:ed:00), Dst: IPv4mcast_28:c9:ef (01:00:5e:28:c9:ef) Internet Protocol Version 4, Src: 192.168.201.238, Dst: 192.168.201.239 Common Address Redundancy Protocol
Nice find. There appear to be two instances of this problem: % git grep -n IN_MULTICAST sys/netinet/ip_carp.c | grep -v ntohl sys/netinet/ip_carp.c:858: multicast = IN_MULTICAST(sc->sc_carpaddr.s_addr); sys/netinet/ip_carp.c:1248: if (IN_MULTICAST(sc->sc_carpaddr.s_addr))
Post fix to https://reviews.freebsd.org/D49053 .
Downstream (OPNsense) report: https://github.com/opnsense/src/issues/239
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=1776633438f24df09cb9815650891bcef0152874 commit 1776633438f24df09cb9815650891bcef0152874 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-02-22 19:26:33 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-02-22 19:26:33 +0000 carp: Fix checking IPv4 multicast address An IPv4 address stored in `struct in_addr` is in network byte order but `IN_MULTICAST` wants host order. PR: 284872 Reported by: Steven Perreau Reported by: Brett Merrick <brett.merrick@itcollective.nz> Reviewed by: Franco Fichtner <franco@opnsense.org>, ae, kp, glebius Tested by: Steven Perreau Fixes: 137818006de5 carp: support unicast MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49053 sys/netinet/ip_carp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=93fbdef51a13b8facac3633f55804a59ca27f635 commit 93fbdef51a13b8facac3633f55804a59ca27f635 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-02-22 19:26:32 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-02-22 19:26:32 +0000 tests: carp: Update test case unicast_v4 to catch PR 284872 In the current test case unicast_v4, host one acts as a router, but it uses if_bridge(4) to verify the reachability to CARP master. Unfortunately, if_bridge(4) brings the two CARP hosts into the same broadcast domain, thus with an unusual (undocumented) setup, one host is in unicast mode but another one in multicast, or two hosts are both in multicast mode, the test case can falsely report success. Fix that by propagating route via routed(8). PR 284872 shows that CARP(4) happens to send packets with multicast destination when the unicast peer address is in the range x.x.x.224 ~ x.x.x.239. Update the peer address in test case to catch that bug. PR: 284872 Reviewed by: kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49076 tests/sys/netinet/carp.sh | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=cad2df3e90d19b083de11f940b20678716811459 commit cad2df3e90d19b083de11f940b20678716811459 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-02-22 19:26:33 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-02-25 04:01:22 +0000 carp: Fix checking IPv4 multicast address An IPv4 address stored in `struct in_addr` is in network byte order but `IN_MULTICAST` wants host order. PR: 284872 Reported by: Steven Perreau Reported by: Brett Merrick <brett.merrick@itcollective.nz> Reviewed by: Franco Fichtner <franco@opnsense.org>, ae, kp, glebius Tested by: Steven Perreau Fixes: 137818006de5 carp: support unicast MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49053 (cherry picked from commit 1776633438f24df09cb9815650891bcef0152874) sys/netinet/ip_carp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d8d8b9c9ca387217bf70b2db1038529d80af280b commit d8d8b9c9ca387217bf70b2db1038529d80af280b Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-02-22 19:26:32 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-02-25 04:01:22 +0000 tests: carp: Update test case unicast_v4 to catch PR 284872 In the current test case unicast_v4, host one acts as a router, but it uses if_bridge(4) to verify the reachability to CARP master. Unfortunately, if_bridge(4) brings the two CARP hosts into the same broadcast domain, thus with an unusual (undocumented) setup, one host is in unicast mode but another one in multicast, or two hosts are both in multicast mode, the test case can falsely report success. Fix that by propagating route via routed(8). PR 284872 shows that CARP(4) happens to send packets with multicast destination when the unicast peer address is in the range x.x.x.224 ~ x.x.x.239. Update the peer address in test case to catch that bug. PR: 284872 Reviewed by: kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49076 (cherry picked from commit 93fbdef51a13b8facac3633f55804a59ca27f635) tests/sys/netinet/carp.sh | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-)
^Triage: assign to committer that resolved.