From: mpi Date: Thu, 16 Jan 2014 10:26:21 +0000 (+0000) Subject: Replaces a lookup to find the link-layer address by accessing the if_sadl X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7931c50048e6365c6e1ad7c5858394cbee911818;p=openbsd Replaces a lookup to find the link-layer address by accessing the if_sadl member directly. ok mikeb@ --- diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 2fefd205ef9..9e4f274fb16 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -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;