summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-02-06 01:21:04 +0100
committerDavid S. Miller <davem@davemloft.net>2008-02-06 01:21:04 +0100
commit9ec138101f8a79007bc571174976a7814ed616f8 (patch)
tree1839f02b9cee63ebf10707a8d3c5da3f8e4f4213 /net
parent[VLAN]: Constify skb argument to vlan_get_tag() (diff)
downloadlinux-9ec138101f8a79007bc571174976a7814ed616f8.tar.xz
linux-9ec138101f8a79007bc571174976a7814ed616f8.zip
[NET_SCHED]: cls_flow: support classification based on VLAN tag
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/cls_flow.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index eeb223cf14cf..971b867e0484 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -19,6 +19,7 @@
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
+#include <linux/if_vlan.h>
#include <net/pkt_cls.h>
#include <net/ip.h>
@@ -270,6 +271,15 @@ static u32 flow_get_skgid(const struct sk_buff *skb)
return 0;
}
+static u32 flow_get_vlan_tag(const struct sk_buff *skb)
+{
+ u16 uninitialized_var(tag);
+
+ if (vlan_get_tag(skb, &tag) < 0)
+ return 0;
+ return tag & VLAN_VID_MASK;
+}
+
static u32 flow_key_get(const struct sk_buff *skb, int key)
{
switch (key) {
@@ -305,6 +315,8 @@ static u32 flow_key_get(const struct sk_buff *skb, int key)
return flow_get_skuid(skb);
case FLOW_KEY_SKGID:
return flow_get_skgid(skb);
+ case FLOW_KEY_VLAN_TAG:
+ return flow_get_vlan_tag(skb);
default:
WARN_ON(1);
return 0;