this copies the "valid interface" check from carp6_proto_input_if
to carp_proto_input_if. the current check looks to see if the current
interface is carp, or if the current interface has any carps attached
to it. the carp6_proto_input_if check just checks if the current
interface is IFT_CARP or not.

right now i think we only really support carp(4) on top of ethernet
interfaces, and the ethernet stack goes to some lengths to make
packets for a carp interface appear to have been received on the
carp interface. either a packet is sent to the carp interfaces mac
address, or it is a multicast packet which gets duplicated for
reception by the carp interface.

i guess a bigger question is do we support carp on non-ethernet
interaces? if so, the check from carp_proto_input_if should be
copied to carp6_proto_input_if. if not, there's a bunch of other
cleanup that could be done.


Index: ip_carp.c
RCS file: /cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.321
diff -u -p -r1.321 ip_carp.c
--- ip_carp.c   9 Jan 2018 15:24:24 -0000       1.321
+++ ip_carp.c   10 Jan 2018 03:57:43 -0000
@@ -454,8 +454,7 @@ carp_proto_input_if(struct ifnet *ifp, s
        ismulti = IN_MULTICAST(ip->ip_dst.s_addr);
        /* check if received on a valid carp interface */
-       if (!(ifp->if_type == IFT_CARP ||
-           (ifp->if_type != IFT_CARP && !ismulti && ifp->if_carp != NULL))) {
+       if (ifp->if_type != IFT_CARP) {
                CARP_LOG(LOG_INFO, sc,
                    ("packet received on non-carp interface: %s",

Reply via email to