aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/netflow
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2006-10-11 15:27:13 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2006-10-11 15:27:13 +0000
commit7801dc7cb32e5df240b1a88b00ef52a2c08887d5 (patch)
tree72c1e3e71d48beaecf1beac750c540f0bc050cf2 /sys/netgraph/netflow
parent68a57ebfad25fd5358d65904b11973a0c47a715d (diff)
downloadsrc-7801dc7cb32e5df240b1a88b00ef52a2c08887d5.tar.gz
src-7801dc7cb32e5df240b1a88b00ef52a2c08887d5.zip
Recognize 802.1q frames in Ethernet input and process them.
PR: kern/101162 Submitted by: CoolDavid (Tseng Guo-Fu) <cooldavid cdpa.nsysu.edu.tw>
Notes
Notes: svn path=/head/; revision=163247
Diffstat (limited to 'sys/netgraph/netflow')
-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 df5caa391dc9..f0cb86792699 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: