Why do we do a lookup on all the addresses of the systems to know if the destination address given to ether_output() is on the carp interface?
If this address is on any of our interfaces we should not even end up here. Since both arp_rtrequest() and nd6_rtrequest() change the ifp of the route entries for our addresses to loopback, if `dst' is one of our addresses it won't be passed to ether_output() but looutput(). ok? Index: net/if_ethersubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.162 diff -u -p -r1.162 if_ethersubr.c --- net/if_ethersubr.c 17 Feb 2014 14:48:48 -0000 1.162 +++ net/if_ethersubr.c 24 Mar 2014 15:35:53 -0000 @@ -226,27 +226,16 @@ ether_output(struct ifnet *ifp0, struct senderr(EBUSY); #endif + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) + senderr(ENETDOWN); + #if NCARP > 0 if (ifp->if_type == IFT_CARP) { - struct ifaddr *ifa; - - /* loop back if this is going to the carp interface */ - if (dst != NULL && LINK_STATE_IS_UP(ifp0->if_link_state) && - (ifa = ifa_ifwithaddr(dst, ifp->if_rdomain)) != NULL && - ifa->ifa_ifp == ifp0) - return (looutput(ifp0, m, dst, rt0)); - ifp = ifp->if_carpdev; ac = (struct arpcom *)ifp; - - if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) != - (IFF_UP|IFF_RUNNING)) - senderr(ENETDOWN); } #endif /* NCARP > 0 */ - if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) - senderr(ENETDOWN); if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = rtalloc1(dst, RT_REPORT,