aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDenis Kirjanov <kda@linux-powerpc.org>2014-06-25 13:34:56 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-27 19:14:12 -0400
commit3fc60aa097b8eb0f701c5bf755bc8f7d3ffeb0bd (patch)
treecf48802982784b6b60c31aaea3965438bed8bbd8 /arch
parente940f5d6ba6a01f8dbb870854d5205d322452730 (diff)
powerpc: bpf: Use correct mask while accessing the VLAN tag
To get a full tag (and not just a VID) we should access the TCI except the VLAN_TAG_PRESENT field (which means that 802.1q header is present). Also ensure that the VLAN_TAG_PRESENT stay on its place Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdadefd8d0..892167b0a4bc 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -390,10 +390,12 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
390 case BPF_ANC | SKF_AD_VLAN_TAG: 390 case BPF_ANC | SKF_AD_VLAN_TAG:
391 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: 391 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
392 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); 392 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
393 BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
394
393 PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, 395 PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
394 vlan_tci)); 396 vlan_tci));
395 if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) 397 if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
396 PPC_ANDI(r_A, r_A, VLAN_VID_MASK); 398 PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
397 else 399 else
398 PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); 400 PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
399 break; 401 break;