Diff below replaces a lookup to find the link-layer address by accessing
the if_sadl member directly. ok?

Index: net/if_ethersubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.159
diff -u -p -r1.159 if_ethersubr.c
--- net/if_ethersubr.c  18 Nov 2013 20:22:23 -0000      1.159
+++ net/if_ethersubr.c  14 Jan 2014 09:52:49 -0000
@@ -491,21 +491,12 @@ ether_input(struct ifnet *ifp0, struct e
                return;
        }
        if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
+               /*
+                * If this is not a simplex interface, drop the packet
+                * if it came from us.
+                */
                if ((ifp->if_flags & IFF_SIMPLEX) == 0) {
-                       struct ifaddr *ifa;
-                       struct sockaddr_dl *sdl = NULL;
-
-                       TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
-                               if ((sdl =
-                                   (struct sockaddr_dl *)ifa->ifa_addr) &&
-                                   sdl->sdl_family == AF_LINK)
-                                       break;
-                       }
-                       /*
-                        * If this is not a simplex interface, drop the packet
-                        * if it came from us.
-                        */
-                       if (sdl && bcmp(LLADDR(sdl), eh->ether_shost,
+                       if (memcmp(LLADDR(ifp->if_sadl), eh->ether_shost,
                            ETHER_ADDR_LEN) == 0) {
                                m_freem(m);
                                return;

Reply via email to