git: ccff2078af42 - main - carp: fix source MAC

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 28 Mar 2023 01:18:34 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ccff2078af42dc066e1c38d25fcb83d960c3c22b

commit ccff2078af42dc066e1c38d25fcb83d960c3c22b
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-03-27 22:01:37 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-03-27 23:18:18 +0000

    carp: fix source MAC
    
    When we're not in unicast mode we need to change the source MAC address.
    The check for this was wrong, because IN_MULTICAST() assumes host
    endianness and the address in sc_carpaddr is in network endianness.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netinet/ip_carp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index deb2f3f347d9..2e1c8e084b4b 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1588,7 +1588,7 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa)
 
 	switch (sa->sa_family) {
 	case AF_INET:
-		if (! IN_MULTICAST(sc->sc_carpaddr.s_addr))
+		if (! IN_MULTICAST(ntohl(sc->sc_carpaddr.s_addr)))
 			return (0);
 		break;
 	case AF_INET6: