carp interfaces output using ether_output, so it is reasonable to
require that they only get configured on top of ethernet interfaces
rather than just !IFT_CARP.

there's some more simplification that can occur after this is done.

ok?

Index: ip_carp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.324
diff -u -p -r1.324 ip_carp.c
--- ip_carp.c   11 Jan 2018 00:14:15 -0000      1.324
+++ ip_carp.c   11 Jan 2018 00:26:52 -0000
@@ -1001,7 +1001,7 @@ carp_send_ad_all(void)
                return;
        ++carp_send_all_recur;
        TAILQ_FOREACH(ifp0, &ifnet, if_list) {
-               if (ifp0->if_type == IFT_CARP)
+               if (ifp0->if_type != IFT_ETHER)
                        continue;
 
                cif = &ifp0->if_carp;
@@ -1347,7 +1347,7 @@ carp_ourether(struct ifnet *ifp, u_int8_
        struct carp_softc *vh;
 
        KERNEL_ASSERT_LOCKED(); /* touching if_carp + carp_vhosts */
-       KASSERT(ifp->if_type != IFT_CARP);
+       KASSERT(ifp->if_type == IFT_ETHER);
        cif = &ifp->if_carp;
 
        SRPL_FOREACH_LOCKED(vh, cif, sc_list) {
@@ -1694,7 +1694,7 @@ carp_set_ifp(struct carp_softc *sc, stru
        if ((ifp0->if_flags & IFF_MULTICAST) == 0)
                return (EADDRNOTAVAIL);
 
-       if (ifp0->if_type == IFT_CARP)
+       if (ifp0->if_type != IFT_ETHER)
                return (EINVAL);
 
        cif = &ifp0->if_carp;
@@ -2469,7 +2469,7 @@ carp_carpdev_state(void *v)
        struct carp_softc *sc;
        struct ifnet *ifp0 = v;
 
-       if (ifp0->if_type == IFT_CARP)
+       if (ifp0->if_type != IFT_ETHER)
                return;
 
        cif = &ifp0->if_carp;

Reply via email to