Commit d65f2fa6 authored by Shmulik Ladkani's avatar Shmulik Ladkani Committed by David S. Miller
Browse files

net/sched: em_meta: Fix 'meta vlan' to correctly recognize zero VID frames

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 05423b24 "vlan: allow null VLAN ID to be used"
(and at time introduced, the 'vlan_tx_tag_get' call in em_meta was not

Fix, testing skb_vlan_tag_present instead of testing skb_vlan_tag_get's

Fixes: 05423b24 ("vlan: allow null VLAN ID to be used")
Fixes: 1a31f204

 ("netsched: Allow meta match on vlan tag on receive")

Signed-off-by: default avatarShmulik Ladkani <>
Cc: Eric Dumazet <>
Cc: Stephen Hemminger <>
Signed-off-by: default avatarDavid S. Miller <>
parent 1bac9381
......@@ -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;
if (skb_vlan_tag_present(skb))
dst->value = skb_vlan_tag_get(skb);
else if (!__vlan_get_tag(skb, &tag))
dst->value = tag;
*err = -1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment