aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2014-06-23 05:38:53 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-06-26 05:48:21 -0400
commit91a41d7f972b1d78b4bcbb61ada4a33c9d7ba8a3 (patch)
tree4754b9ac95168ec1b2bea02c15ee04345eaf67ee /arch/mips
parent6e86c59d4d0d04e7ebefd05b8af245c968892f81 (diff)
MIPS: bpf: Fix return values for VLAN_TAG_PRESENT case
If VLAN_TAG_PRESENT is not zero, then return 1 as expected by classic BPF. Otherwise return 0. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Cc: David S. Miller <davem@davemloft.net> Cc: Daniel Borkmann <dborkman@redhat.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: netdev@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/7128/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/net/bpf_jit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index a4d1b76e7373..d852bb6d3fe3 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -1316,10 +1316,13 @@ jmp_cmp:
1316 vlan_tci) != 2); 1316 vlan_tci) != 2);
1317 off = offsetof(struct sk_buff, vlan_tci); 1317 off = offsetof(struct sk_buff, vlan_tci);
1318 emit_half_load(r_s0, r_skb, off, ctx); 1318 emit_half_load(r_s0, r_skb, off, ctx);
1319 if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) 1319 if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
1320 emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx); 1320 emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
1321 else 1321 } else {
1322 emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx); 1322 emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
1323 /* return 1 if present */
1324 emit_sltu(r_A, r_zero, r_A, ctx);
1325 }
1323 break; 1326 break;
1324 case BPF_ANC | SKF_AD_PKTTYPE: 1327 case BPF_ANC | SKF_AD_PKTTYPE:
1325 ctx->flags |= SEEN_SKB; 1328 ctx->flags |= SEEN_SKB;