Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328096
b: refs/heads/master
c: 9e49e88
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Sep 24, 2012
1 parent 8a16a48 commit 8509c05
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 718cffc4ac65f01c6f1efd6baec8b4b5ff0c76b5
refs/heads/master: 9e49e88958feb41ec701fa34b44723dabadbc28c
3 changes: 3 additions & 0 deletions trunk/include/linux/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_MOD 0x90
#define BPF_XOR 0xa0

#define BPF_JA 0x00
#define BPF_JEQ 0x10
Expand Down Expand Up @@ -204,6 +205,8 @@ enum {
BPF_S_ALU_AND_X,
BPF_S_ALU_OR_K,
BPF_S_ALU_OR_X,
BPF_S_ALU_XOR_K,
BPF_S_ALU_XOR_X,
BPF_S_ALU_LSH_K,
BPF_S_ALU_LSH_X,
BPF_S_ALU_RSH_K,
Expand Down
12 changes: 9 additions & 3 deletions trunk/net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ unsigned int sk_run_filter(const struct sk_buff *skb,
case BPF_S_ALU_OR_K:
A |= K;
continue;
case BPF_S_ANC_ALU_XOR_X:
case BPF_S_ALU_XOR_X:
A ^= X;
continue;
case BPF_S_ALU_XOR_K:
A ^= K;
continue;
case BPF_S_ALU_LSH_X:
A <<= X;
continue;
Expand Down Expand Up @@ -334,9 +341,6 @@ unsigned int sk_run_filter(const struct sk_buff *skb,
case BPF_S_ANC_CPU:
A = raw_smp_processor_id();
continue;
case BPF_S_ANC_ALU_XOR_X:
A ^= X;
continue;
case BPF_S_ANC_NLATTR: {
struct nlattr *nla;

Expand Down Expand Up @@ -483,6 +487,8 @@ int sk_chk_filter(struct sock_filter *filter, unsigned int flen)
[BPF_ALU|BPF_AND|BPF_X] = BPF_S_ALU_AND_X,
[BPF_ALU|BPF_OR|BPF_K] = BPF_S_ALU_OR_K,
[BPF_ALU|BPF_OR|BPF_X] = BPF_S_ALU_OR_X,
[BPF_ALU|BPF_XOR|BPF_K] = BPF_S_ALU_XOR_K,
[BPF_ALU|BPF_XOR|BPF_X] = BPF_S_ALU_XOR_X,
[BPF_ALU|BPF_LSH|BPF_K] = BPF_S_ALU_LSH_K,
[BPF_ALU|BPF_LSH|BPF_X] = BPF_S_ALU_LSH_X,
[BPF_ALU|BPF_RSH|BPF_K] = BPF_S_ALU_RSH_K,
Expand Down

0 comments on commit 8509c05

Please sign in to comment.