summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-06-13 23:24:22 +0000
committerMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-06-13 23:24:22 +0000
commit2579cb3d1d3c8e93b54546c8463052d4ec2ab4a2 (patch)
treee1df07ac2401970f89644165c43f4bb6e89530a1 /sys/net
parent54fdeed5f8455bda70e51f6e187612b2c230fc99 (diff)
Move the responsibility to free received packets on trunked interfaces
from ether_input() into trunk_input() where it can be handled in a smarter way. OK claudio@ and reyk@ on an earlier version.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_ethersubr.c10
-rw-r--r--sys/net/if_trunk.c14
2 files changed, 13 insertions, 11 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 48af47dd281..6dd11e54023 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.121 2008/05/10 01:52:34 claudio Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.122 2008/06/13 23:24:21 mpf Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -509,12 +509,12 @@ ether_input(ifp0, eh, m)
#if NTRUNK > 0
/* Handle input from a trunk port */
while (ifp->if_type == IFT_IEEE8023ADLAG) {
- if (++i > TRUNK_MAX_STACKING ||
- trunk_input(ifp, eh, m) != 0) {
- if (m)
- m_freem(m);
+ if (++i > TRUNK_MAX_STACKING) {
+ m_freem(m);
return;
}
+ if (trunk_input(ifp, eh, m) != 0)
+ return;
/* Has been set to the trunk interface */
ifp = m->m_pkthdr.rcvif;
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 5fdc323a48a..e5b41f47051 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.43 2008/06/08 17:25:46 brad Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.44 2008/06/13 23:24:21 mpf Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1062,13 +1062,15 @@ trunk_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
error = ENOENT;
goto bad;
}
- if (tr->tr_proto == TRUNK_PROTO_NONE)
- goto bad;
trifp = &tr->tr_ac.ac_if;
+ if (tr->tr_proto == TRUNK_PROTO_NONE) {
+ error = ENOENT;
+ goto bad;
+ }
error = (*tr->tr_input)(tr, tp, eh, m);
if (error != 0)
- goto bad;
+ return (error);
#if NBPFILTER > 0
if (trifp->if_bpf)
@@ -1077,12 +1079,12 @@ trunk_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
#endif
trifp->if_ipackets++;
-
return (0);
bad:
if (error > 0 && trifp != NULL)
trifp->if_ierrors++;
+ m_freem(m);
return (error);
}
@@ -1318,7 +1320,7 @@ trunk_fail_input(struct trunk_softc *tr, struct trunk_port *tp,
return (0);
}
}
-
+ m_freem(m);
return (-1);
}