Restore part of the code dropped in rev. 1.25 that makes sure ether_demux()

will receive an mbuf chain with Ethernet header in the data portion of the
first mbuf.
This commit is contained in:
ru 2005-11-03 07:46:04 +00:00
parent 7b692a9f88
commit 5a3b8c2f8a

View File

@ -643,6 +643,15 @@ ng_ether_rcv_upper(node_p node, struct mbuf *m)
const priv_p priv = NG_NODE_PRIVATE(node);
struct ifnet *ifp = priv->ifp;
/* Check length and pull off header */
if (m->m_pkthdr.len < sizeof(struct ether_header)) {
NG_FREE_M(m);
return (EINVAL);
}
if (m->m_len < sizeof(struct ether_header) &&
(m = m_pullup(m, sizeof(struct ether_header))) == NULL)
return (ENOBUFS);
m->m_pkthdr.rcvif = ifp;
/* Pass the packet to the bridge, it may come back to us */