From 5a3b8c2f8a3b077111cbcc7caef63e617f04c913 Mon Sep 17 00:00:00 2001 From: ru Date: Thu, 3 Nov 2005 07:46:04 +0000 Subject: 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. --- sys/netgraph/ng_ether.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sys') 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 */ -- cgit v1.1