diff options
author | Nicolas Schichan <nschichan@freebox.fr> | 2015-07-21 08:14:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-22 01:19:55 -0400 |
commit | c18fe54b3f8d7daa6a43270f82676d6a563582a4 (patch) | |
tree | 749c52e250fc26bd2533daf555c52ff04bb1554f | |
parent | 6d715e301e950e3314d590bdbabf0c26e4fed94b (diff) |
ARM: net: fix vlan access instructions in ARM JIT.
This makes BPF_ANC | SKF_AD_VLAN_TAG and BPF_ANC | SKF_AD_VLAN_TAG_PRESENT
have the same behaviour as the in kernel VM and makes the test_bpf LD_VLAN_TAG
and LD_VLAN_TAG_PRESENT tests pass.
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/arm/net/bpf_jit_32.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index d9b25242f743..c011e2296cb1 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -889,9 +889,11 @@ b_epilogue: | |||
889 | off = offsetof(struct sk_buff, vlan_tci); | 889 | off = offsetof(struct sk_buff, vlan_tci); |
890 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); | 890 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); |
891 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) | 891 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) |
892 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx); | 892 | OP_IMM3(ARM_AND, r_A, r_A, ~VLAN_TAG_PRESENT, ctx); |
893 | else | 893 | else { |
894 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx); | 894 | OP_IMM3(ARM_LSR, r_A, r_A, 12, ctx); |
895 | OP_IMM3(ARM_AND, r_A, r_A, 0x1, ctx); | ||
896 | } | ||
895 | break; | 897 | break; |
896 | case BPF_ANC | SKF_AD_QUEUE: | 898 | case BPF_ANC | SKF_AD_QUEUE: |
897 | ctx->seen |= SEEN_SKB; | 899 | ctx->seen |= SEEN_SKB; |