* [PATCH net-next] net/sched: em_meta: Fix 'meta vlan' to correctly recognize zero VID frames
@ 2016-10-20 21:18 Shmulik Ladkani
2016-10-23 21:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Shmulik Ladkani @ 2016-10-20 21:18 UTC (permalink / raw)
To: David S . Miller
Cc: Jamal Hadi Salim, netdev, Jiri Pirko, Shmulik Ladkani,
Eric Dumazet, Stephen Hemminger
META_COLLECTOR int_vlan_tag() assumes that if the accel tag (vlan_tci)
is zero, then no vlan accel tag is present.
This is incorrect for zero VID vlan accel packets, making the following
match fail:
tc filter add ... basic match 'meta(vlan mask 0xfff eq 0)' ...
Apparently 'int_vlan_tag' was implemented prior VLAN_TAG_PRESENT was
introduced in 05423b2 "vlan: allow null VLAN ID to be used"
(and at time introduced, the 'vlan_tx_tag_get' call in em_meta was not
adapted).
Fix, testing skb_vlan_tag_present instead of testing skb_vlan_tag_get's
value.
Fixes: 05423b2413 ("vlan: allow null VLAN ID to be used")
Fixes: 1a31f2042e ("netsched: Allow meta match on vlan tag on receive")
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
---
net/sched/em_meta.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index a309a07ccb..41c80b6c39 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -176,11 +176,12 @@ META_COLLECTOR(int_vlan_tag)
{
unsigned short tag;
- tag = skb_vlan_tag_get(skb);
- if (!tag && __vlan_get_tag(skb, &tag))
- *err = -1;
- else
+ if (skb_vlan_tag_present(skb))
+ dst->value = skb_vlan_tag_get(skb);
+ else if (!__vlan_get_tag(skb, &tag))
dst->value = tag;
+ else
+ *err = -1;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net/sched: em_meta: Fix 'meta vlan' to correctly recognize zero VID frames
2016-10-20 21:18 [PATCH net-next] net/sched: em_meta: Fix 'meta vlan' to correctly recognize zero VID frames Shmulik Ladkani
@ 2016-10-23 21:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-10-23 21:31 UTC (permalink / raw)
To: shmulik.ladkani; +Cc: jhs, netdev, jiri, eric.dumazet, stephen
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Fri, 21 Oct 2016 00:18:08 +0300
> META_COLLECTOR int_vlan_tag() assumes that if the accel tag (vlan_tci)
> is zero, then no vlan accel tag is present.
>
> This is incorrect for zero VID vlan accel packets, making the following
> match fail:
> tc filter add ... basic match 'meta(vlan mask 0xfff eq 0)' ...
>
> Apparently 'int_vlan_tag' was implemented prior VLAN_TAG_PRESENT was
> introduced in 05423b2 "vlan: allow null VLAN ID to be used"
> (and at time introduced, the 'vlan_tx_tag_get' call in em_meta was not
> adapted).
>
> Fix, testing skb_vlan_tag_present instead of testing skb_vlan_tag_get's
> value.
>
> Fixes: 05423b2413 ("vlan: allow null VLAN ID to be used")
> Fixes: 1a31f2042e ("netsched: Allow meta match on vlan tag on receive")
>
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-23 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 21:18 [PATCH net-next] net/sched: em_meta: Fix 'meta vlan' to correctly recognize zero VID frames Shmulik Ladkani
2016-10-23 21:31 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).