diff options
author | ru <ru@FreeBSD.org> | 2005-11-03 07:46:04 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-11-03 07:46:04 +0000 |
commit | 5a3b8c2f8a3b077111cbcc7caef63e617f04c913 (patch) | |
tree | 67040bcad00035e82a77d0c8089c6d0dee8f80af /sys/netgraph/ng_ether.c | |
parent | 7b692a9f88856b47041ab527eb8f5d377245661b (diff) | |
download | FreeBSD-src-5a3b8c2f8a3b077111cbcc7caef63e617f04c913.zip FreeBSD-src-5a3b8c2f8a3b077111cbcc7caef63e617f04c913.tar.gz |
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.
Diffstat (limited to 'sys/netgraph/ng_ether.c')
-rw-r--r-- | sys/netgraph/ng_ether.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 8937fc8..2b70230 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -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 */ |