summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-02-02 22:00:40 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-02-02 22:00:40 +0000
commit04b3bea92c67829c63a671148d6880d30903ceec (patch)
tree7e888d4761d7c0fc2eb6beee5f603111b5f56a67 /sys/net
parent749ac795884b5cff9f83cbbe61579858ac38b766 (diff)
In ether_input() use goto dropanyway instead of repeating m_freem()
and return. Change sizeof(etherbroadcastaddr) to ETHER_ADDR_LEN for consistency. from Michele Curti
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_ethersubr.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 8f7d8e7cb88..548cf22a305 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.250 2018/01/10 00:14:38 dlg Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.251 2018/02/02 22:00:39 bluhm Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -333,14 +333,12 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
*/
if ((ifp->if_flags & IFF_SIMPLEX) == 0) {
if (memcmp(ac->ac_enaddr, eh->ether_shost,
- ETHER_ADDR_LEN) == 0) {
- m_freem(m);
- return (1);
- }
+ ETHER_ADDR_LEN) == 0)
+ goto dropanyway;
}
if (memcmp(etherbroadcastaddr, eh->ether_dhost,
- sizeof(etherbroadcastaddr)) == 0)
+ ETHER_ADDR_LEN) == 0)
m->m_flags |= M_BCAST;
else
m->m_flags |= M_MCAST;
@@ -351,10 +349,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
* HW vlan tagged packets that were not collected by vlan(4) must
* be dropped now.
*/
- if (m->m_flags & M_VLANTAG) {
- m_freem(m);
- return (1);
- }
+ if (m->m_flags & M_VLANTAG)
+ goto dropanyway;
/*
* If packet is unicast, make sure it is for us. Drop otherwise.
@@ -362,10 +358,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
* where the MAC filter is 'best effort' only.
*/
if ((m->m_flags & (M_BCAST|M_MCAST)) == 0) {
- if (memcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN)) {
- m_freem(m);
- return (1);
- }
+ if (memcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN))
+ goto dropanyway;
}
etype = ntohs(eh->ether_type);