summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2002-05-09 20:19:00 +0000
committerarchie <archie@FreeBSD.org>2002-05-09 20:19:00 +0000
commitbce224fa8ede78e6675256e043a7458fdbe5df5d (patch)
tree67fb835e914162da08567b14e5c137a3c7a5da93 /sys/netgraph
parent98051db4df2d731c020b9560e9937beb0e4656b1 (diff)
downloadFreeBSD-src-bce224fa8ede78e6675256e043a7458fdbe5df5d.zip
FreeBSD-src-bce224fa8ede78e6675256e043a7458fdbe5df5d.tar.gz
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
Diffstat (limited to 'sys/netgraph')
-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 0050bdd..dfb84e7 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);
}
/*
OpenPOWER on IntegriCloud