Replaces a lookup to find the link-layer address by accessing the if_sadl
authormpi <mpi@openbsd.org>
Thu, 16 Jan 2014 10:26:21 +0000 (10:26 +0000)
committermpi <mpi@openbsd.org>
Thu, 16 Jan 2014 10:26:21 +0000 (10:26 +0000)
member directly.

ok mikeb@

sys/net/if_ethersubr.c

index 2fefd20..9e4f274 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_ethersubr.c,v 1.159 2013/11/18 20:22:23 deraadt Exp $      */
+/*     $OpenBSD: if_ethersubr.c,v 1.160 2014/01/16 10:26:21 mpi Exp $  */
 /*     $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $        */
 
 /*
@@ -491,21 +491,12 @@ ether_input(struct ifnet *ifp0, struct ether_header *eh, struct mbuf *m)
                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;