From da1604af2d286365b544bc97b9d0374c75cf57af Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 17 Mar 2009 19:00:37 +0800 Subject: [PATCH] ether_input: Add M_ETHER_VLANCHECKED - In ether_input_handler(), if ether_vlancheck() has not been called (M_ETHER_VLANCHECKED) call it there; this could happen with upcoming RSS changes. - Clear ethernet protocol mbuf flags before entering upper layer. --- sys/net/ethernet.h | 5 ++++- sys/net/if_ethersubr.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index d7b75a048a..643c8cfb09 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -356,7 +356,10 @@ extern const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN]; #ifdef _KERNEL -#define M_ETHER_BRIDGED M_PROTO1 +#define M_ETHER_BRIDGED M_PROTO1 +#define M_ETHER_VLANCHECKED M_PROTO2 + +#define M_ETHER_FLAGS (M_ETHER_BRIDGED | M_ETHER_VLANCHECKED) struct ifnet; struct mbuf; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 4f3cb3b385..06bb96a54a 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1170,6 +1170,7 @@ post_stats: return; } + m->m_flags &= ~M_ETHER_FLAGS; m_adj(m, sizeof(struct ether_header)); redispatch = 0; @@ -1447,6 +1448,7 @@ ether_vlancheck(struct mbuf **m0) } KKASSERT(ether_type != ETHERTYPE_VLAN); + m->m_flags |= M_ETHER_VLANCHECKED; *m0 = m; return TRUE; failed: @@ -1478,6 +1480,13 @@ ether_input_handler(struct netmsg *nmsg) ifp->if_imcasts++; } + if ((m->m_flags & M_ETHER_VLANCHECKED) == 0) { + if (!ether_vlancheck(&m)) { + KKASSERT(m == NULL); + return; + } + } + ether_input_oncpu(ifp, m); } -- 2.11.4.GIT