this passes the destination ethernet address from the network packet as a uint64_t from ether_input into carp_input, so it can use it to see if a carp interface should take the packet.
it's been working on amd64 and sparc64. anyone else want to try? Index: netinet/ip_carp.c =================================================================== RCS file: /cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.352 diff -u -p -r1.352 ip_carp.c --- netinet/ip_carp.c 8 Feb 2021 12:30:10 -0000 1.352 +++ netinet/ip_carp.c 5 Mar 2021 04:42:27 -0000 @@ -260,7 +260,7 @@ void carp_update_lsmask(struct carp_soft int carp_new_vhost(struct carp_softc *, int, int); void carp_destroy_vhosts(struct carp_softc *); void carp_del_all_timeouts(struct carp_softc *); -int carp_vhe_match(struct carp_softc *, uint8_t *); +int carp_vhe_match(struct carp_softc *, uint64_t); struct if_clone carp_cloner = IF_CLONE_INITIALIZER("carp", carp_clone_create, carp_clone_destroy); @@ -1345,6 +1345,7 @@ carp_ourether(struct ifnet *ifp, uint8_t struct carp_softc *sc; struct srp_ref sr; int match = 0; + uint64_t dst = ether_addr_to_e64((struct ether_addr *)ena); KASSERT(ifp->if_type == IFT_ETHER); @@ -1352,7 +1353,7 @@ carp_ourether(struct ifnet *ifp, uint8_t if ((sc->sc_if.if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) continue; - if (carp_vhe_match(sc, ena)) { + if (carp_vhe_match(sc, dst)) { match = 1; break; } @@ -1363,29 +1364,27 @@ carp_ourether(struct ifnet *ifp, uint8_t } int -carp_vhe_match(struct carp_softc *sc, uint8_t *ena) +carp_vhe_match(struct carp_softc *sc, uint64_t dst) { struct carp_vhost_entry *vhe; struct srp_ref sr; - int match = 0; + int active = 0; vhe = SRPL_FIRST(&sr, &sc->carp_vhosts); - match = (vhe->state == MASTER || sc->sc_balancing >= CARP_BAL_IP) && - !memcmp(ena, sc->sc_ac.ac_enaddr, ETHER_ADDR_LEN); + active = (vhe->state == MASTER || sc->sc_balancing >= CARP_BAL_IP); SRPL_LEAVE(&sr); - return (match); + return (active && (dst == + ether_addr_to_e64((struct ether_addr *)sc->sc_ac.ac_enaddr))); } struct mbuf * -carp_input(struct ifnet *ifp0, struct mbuf *m) +carp_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst) { - struct ether_header *eh; struct srpl *cif; struct carp_softc *sc; struct srp_ref sr; - eh = mtod(m, struct ether_header *); cif = &ifp0->if_carp; SRPL_FOREACH(sc, &sr, cif, sc_list) { @@ -1393,7 +1392,7 @@ carp_input(struct ifnet *ifp0, struct mb (IFF_UP|IFF_RUNNING)) continue; - if (carp_vhe_match(sc, eh->ether_dhost)) { + if (carp_vhe_match(sc, dst)) { /* * These packets look like layer 2 multicast but they * are unicast at layer 3. With help of the tag the @@ -1417,7 +1416,7 @@ carp_input(struct ifnet *ifp0, struct mb if (sc == NULL) { SRPL_LEAVE(&sr); - if (!ETHER_IS_MULTICAST(eh->ether_dhost)) + if (!ETH64_IS_MULTICAST(dst)) return (m); /* Index: netinet/ip_carp.h =================================================================== RCS file: /cvs/src/sys/netinet/ip_carp.h,v retrieving revision 1.50 diff -u -p -r1.50 ip_carp.h --- netinet/ip_carp.h 24 Jul 2020 18:17:15 -0000 1.50 +++ netinet/ip_carp.h 5 Mar 2021 04:42:27 -0000 @@ -209,7 +209,7 @@ carp_strict_addr_chk(struct ifnet *ifp_a ifp_a->if_carpdevidx == ifp_b->if_carpdevidx)); } -struct mbuf *carp_input(struct ifnet *, struct mbuf *); +struct mbuf *carp_input(struct ifnet *, struct mbuf *, uint64_t); int carp_proto_input(struct mbuf **, int *, int, int); void carp_carpdev_state(void *); Index: net/if_ethersubr.c =================================================================== RCS file: /cvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.272 diff -u -p -r1.272 if_ethersubr.c --- net/if_ethersubr.c 5 Mar 2021 03:51:41 -0000 1.272 +++ net/if_ethersubr.c 5 Mar 2021 04:42:27 -0000 @@ -460,7 +460,7 @@ ether_input(struct ifnet *ifp, struct mb */ if (ifp->if_type != IFT_CARP && !SRPL_EMPTY_LOCKED(&ifp->if_carp)) { - m = carp_input(ifp, m); + m = carp_input(ifp, m, dst); if (m == NULL) return;