summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-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