summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2006-10-11 15:27:13 +0000
committerglebius <glebius@FreeBSD.org>2006-10-11 15:27:13 +0000
commite2fb442f9b7ee2cbbe98c68395eeb879d9019d61 (patch)
tree72c1e3e71d48beaecf1beac750c540f0bc050cf2 /sys/netgraph
parent7fc0346961dcfe71822111759690b79c8f9610e7 (diff)
downloadFreeBSD-src-e2fb442f9b7ee2cbbe98c68395eeb879d9019d61.zip
FreeBSD-src-e2fb442f9b7ee2cbbe98c68395eeb879d9019d61.tar.gz
Recognize 802.1q frames in Ethernet input and process them.
PR: kern/101162 Submitted by: CoolDavid (Tseng Guo-Fu) <cooldavid cdpa.nsysu.edu.tw>
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/netflow/ng_netflow.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c
index df5caa3..f0cb867 100644
--- a/sys/netgraph/netflow/ng_netflow.c
+++ b/sys/netgraph/netflow/ng_netflow.c
@@ -42,6 +42,7 @@ static const char rcs_id[] =
#include <net/ethernet.h>
#include <net/if_arp.h>
#include <net/if_var.h>
+#include <net/if_vlan_var.h>
#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -514,6 +515,19 @@ ng_netflow_rcvdata (hook_p hook, item_p item)
eh = mtod(m, struct ether_header *);
ip = (struct ip *)(eh + 1);
break;
+ case ETHERTYPE_VLAN:
+ {
+ struct ether_vlan_header *evh;
+
+ M_CHECK(sizeof(struct ether_vlan_header) -
+ sizeof(struct ether_header));
+ evh = mtod(m, struct ether_vlan_header *);
+ if (ntohs(evh->evl_proto) == ETHERTYPE_IP) {
+ M_CHECK(sizeof(struct ip));
+ ip = (struct ip *)(evh + 1);
+ break;
+ }
+ }
default:
goto bypass; /* pass this frame */
}
@@ -551,7 +565,21 @@ ng_netflow_rcvdata (hook_p hook, item_p item)
struct ether_header *eh;
eh = mtod(m, struct ether_header *);
- ip = (struct ip *)(eh + 1);
+ switch (ntohs(eh->ether_type)) {
+ case ETHERTYPE_IP:
+ ip = (struct ip *)(eh + 1);
+ break;
+ case ETHERTYPE_VLAN:
+ {
+ struct ether_vlan_header *evh;
+
+ evh = mtod(m, struct ether_vlan_header *);
+ ip = (struct ip *)(evh + 1);
+ break;
+ }
+ default:
+ panic("ng_netflow entered deadcode");
+ }
break;
}
case DLT_RAW:
OpenPOWER on IntegriCloud