On Mon, Jan 22, 2018 at 11:58:30AM +0100, Martin Pieuchot wrote: > Check if `if_carp' is empty inside carp_ourether() instead of outside. > > ok?
Maybe I am confused by the ! and && but I think this diff changes the logic. Old code: - if_carp is empty - SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) is true - !SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) is false - (!SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) && !carp_ourether(ifl->ifp, eh->ether_dhost)) is false - if block is not executed New Code: - if_carp is empty - SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) is true - carp_ourether() returns 0 - carp_ourether(ifl->ifp, eh->ether_dhost) is false - !carp_ourether(ifl->ifp, eh->ether_dhost) is true - if block is executed Is this modification of behavior intensional? bluhm > Index: net/if_bridge.c > =================================================================== > RCS file: /cvs/src/sys/net/if_bridge.c,v > retrieving revision 1.301 > diff -u -p -r1.301 if_bridge.c > --- net/if_bridge.c 10 Jan 2018 23:50:39 -0000 1.301 > +++ net/if_bridge.c 22 Jan 2018 10:54:48 -0000 > @@ -1108,8 +1108,7 @@ bridge_process(struct ifnet *ifp, struct > ac = (struct arpcom *)ifl->ifp; > if (bcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) == 0 > #if NCARP > 0 > - || (!SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) && > - !carp_ourether(ifl->ifp, eh->ether_dhost)) > + || !carp_ourether(ifl->ifp, eh->ether_dhost) > #endif > ) { > if (srcifl->bif_flags & IFBIF_LEARNING) > @@ -1131,8 +1130,7 @@ bridge_process(struct ifnet *ifp, struct > } > if (bcmp(ac->ac_enaddr, eh->ether_shost, ETHER_ADDR_LEN) == 0 > #if NCARP > 0 > - || (!SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) && > - !carp_ourether(ifl->ifp, eh->ether_shost)) > + || !carp_ourether(ifl->ifp, eh->ether_shost) > #endif > ) { > m_freem(m); > Index: netinet/ip_carp.c > =================================================================== > RCS file: /cvs/src/sys/netinet/ip_carp.c,v > retrieving revision 1.327 > diff -u -p -r1.327 ip_carp.c > --- netinet/ip_carp.c 12 Jan 2018 23:47:24 -0000 1.327 > +++ netinet/ip_carp.c 22 Jan 2018 10:53:35 -0000 > @@ -1339,12 +1339,15 @@ carp_iamatch(struct ifnet *ifp) > int > carp_ourether(struct ifnet *ifp, u_int8_t *ena) > { > - struct srpl *cif; > + struct srpl *cif = &ifp->if_carp; > struct carp_softc *vh; > > KERNEL_ASSERT_LOCKED(); /* touching if_carp + carp_vhosts */ > + > + if (SRPL_EMPTY_LOCKED(cif)) > + return (0); > + > KASSERT(ifp->if_type == IFT_ETHER); > - cif = &ifp->if_carp; > > SRPL_FOREACH_LOCKED(vh, cif, sc_list) { > struct carp_vhost_entry *vhe;