aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_ether.c
diff options
context:
space:
mode:
authorArchie Cobbs <archie@FreeBSD.org>2002-05-09 20:19:00 +0000
committerArchie Cobbs <archie@FreeBSD.org>2002-05-09 20:19:00 +0000
commita1479aa2fdd87188b1a52a5fd65ed8307c78af66 (patch)
tree67fb835e914162da08567b14e5c137a3c7a5da93 /sys/netgraph/ng_ether.c
parenta922fa645e1dc87955fa8fe6c76513d401bfeb2b (diff)
downloadsrc-a1479aa2fdd87188b1a52a5fd65ed8307c78af66.tar.gz
src-a1479aa2fdd87188b1a52a5fd65ed8307c78af66.zip
Don't send packets out an interface unless it is IFF_UP|IFF_RUNNING.
This fixes panics with certain Ethernet drivers when doing bridging, PPPoE, etc. before the driver has been fully brought up. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=96265
Diffstat (limited to 'sys/netgraph/ng_ether.c')
-rw-r--r--sys/netgraph/ng_ether.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 0050bdd8b960..dfb84e785eca 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -627,6 +627,14 @@ static int
ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta)
{
const priv_p priv = NG_NODE_PRIVATE(node);
+ struct ifnet *const ifp = priv->ifp;
+
+ /* Check whether interface is ready for packets */
+ if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+ NG_FREE_M(m);
+ NG_FREE_META(meta);
+ return (ENETDOWN);
+ }
/* Make sure header is fully pulled up */
if (m->m_pkthdr.len < sizeof(struct ether_header)) {
@@ -642,14 +650,14 @@ ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta)
/* Drop in the MAC address if desired */
if (priv->autoSrcAddr) {
- bcopy((IFP2AC(priv->ifp))->ac_enaddr,
+ bcopy((IFP2AC(ifp))->ac_enaddr,
mtod(m, struct ether_header *)->ether_shost,
ETHER_ADDR_LEN);
}
/* Send it on its way */
NG_FREE_META(meta);
- return ether_output_frame(priv->ifp, m);
+ return ether_output_frame(ifp, m);
}
/*