summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2002-02-26 02:19:33 +0000
committerbrooks <brooks@FreeBSD.org>2002-02-26 02:19:33 +0000
commit15d7d34bd9f9f046360391c8a3fa0a68f546dd81 (patch)
tree221b52bd402617ce92a14cadf0084df56951ad8d /sys/net
parentecdaec0ea7a59257dfbdd719d35276bc28ed4a45 (diff)
downloadFreeBSD-src-15d7d34bd9f9f046360391c8a3fa0a68f546dd81.zip
FreeBSD-src-15d7d34bd9f9f046360391c8a3fa0a68f546dd81.tar.gz
When using hardware decoding, reconstruct the wire form of the ethernet
header and push it up any attached bpf devices on the parent interface. This makes hardware vlan decoding more like the normal software path. Tested by: cjtt@employees.org MFC after: 2 weeks
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_vlan.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 8512752..759ae81 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -401,6 +401,26 @@ vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t)
{
struct ifvlan *ifv;
+ /*
+ * Fake up a header and send the packet to the physical interface's
+ * bpf tap if active.
+ */
+ if (m->m_pkthdr.rcvif->if_bpf != NULL) {
+ struct m_hdr mh;
+ struct ether_vlan_header evh;
+
+ bcopy(eh, &evh, 2*ETHER_ADDR_LEN);
+ evh.evl_encap_proto = htons(ETHERTYPE_VLAN);
+ evh.evl_tag = htons(t);
+ evh.evl_proto = eh->ether_type;
+
+ /* This kludge is OK; BPF treats the "mbuf" as read-only */
+ mh.mh_next = m;
+ mh.mh_data = (char *)&evh;
+ mh.mh_len = ETHER_HDR_LEN + EVL_ENCAPLEN;
+ bpf_mtap(m->m_pkthdr.rcvif, (struct mbuf *)&mh);
+ }
+
for (ifv = LIST_FIRST(&ifv_list); ifv != NULL;
ifv = LIST_NEXT(ifv, ifv_list)) {
if (m->m_pkthdr.rcvif == ifv->ifv_p
OpenPOWER on IntegriCloud