Skip to content

Commit d65f2fa

Browse files
sladkanidavem330
authored andcommitted
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 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: 05423b2 ("vlan: allow null VLAN ID to be used") Fixes: 1a31f20 ("netsched: Allow meta match on vlan tag on receive") Signed-off-by: Shmulik Ladkani <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1bac938 commit d65f2fa

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/sched/em_meta.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ META_COLLECTOR(int_vlan_tag)
176176
{
177177
unsigned short tag;
178178

179-
tag = skb_vlan_tag_get(skb);
180-
if (!tag && __vlan_get_tag(skb, &tag))
181-
*err = -1;
182-
else
179+
if (skb_vlan_tag_present(skb))
180+
dst->value = skb_vlan_tag_get(skb);
181+
else if (!__vlan_get_tag(skb, &tag))
183182
dst->value = tag;
183+
else
184+
*err = -1;
184185
}
185186

186187

0 commit comments

Comments
 (0)