diff options
author | Patrick McHardy <kaber@trash.net> | 2008-02-05 19:21:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-05 19:21:04 -0500 |
commit | 9ec138101f8a79007bc571174976a7814ed616f8 (patch) | |
tree | 1839f02b9cee63ebf10707a8d3c5da3f8e4f4213 /net/sched | |
parent | 181499356e5a9f0bcbd69adc3c6df450f6e2586d (diff) |
[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/sched')
-rw-r--r-- | net/sched/cls_flow.c | 12 |
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 @@ | |||
19 | #include <linux/in.h> | 19 | #include <linux/in.h> |
20 | #include <linux/ip.h> | 20 | #include <linux/ip.h> |
21 | #include <linux/ipv6.h> | 21 | #include <linux/ipv6.h> |
22 | #include <linux/if_vlan.h> | ||
22 | 23 | ||
23 | #include <net/pkt_cls.h> | 24 | #include <net/pkt_cls.h> |
24 | #include <net/ip.h> | 25 | #include <net/ip.h> |
@@ -270,6 +271,15 @@ static u32 flow_get_skgid(const struct sk_buff *skb) | |||
270 | return 0; | 271 | return 0; |
271 | } | 272 | } |
272 | 273 | ||
274 | static u32 flow_get_vlan_tag(const struct sk_buff *skb) | ||
275 | { | ||
276 | u16 uninitialized_var(tag); | ||
277 | |||
278 | if (vlan_get_tag(skb, &tag) < 0) | ||
279 | return 0; | ||
280 | return tag & VLAN_VID_MASK; | ||
281 | } | ||
282 | |||
273 | static u32 flow_key_get(const struct sk_buff *skb, int key) | 283 | static u32 flow_key_get(const struct sk_buff *skb, int key) |
274 | { | 284 | { |
275 | switch (key) { | 285 | switch (key) { |
@@ -305,6 +315,8 @@ static u32 flow_key_get(const struct sk_buff *skb, int key) | |||
305 | return flow_get_skuid(skb); | 315 | return flow_get_skuid(skb); |
306 | case FLOW_KEY_SKGID: | 316 | case FLOW_KEY_SKGID: |
307 | return flow_get_skgid(skb); | 317 | return flow_get_skgid(skb); |
318 | case FLOW_KEY_VLAN_TAG: | ||
319 | return flow_get_vlan_tag(skb); | ||
308 | default: | 320 | default: |
309 | WARN_ON(1); | 321 | WARN_ON(1); |
310 | return 0; | 322 | return 0; |