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
This commit is contained in:
parent
a922fa645e
commit
a1479aa2fd
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user