summaryrefslogtreecommitdiff
path: root/bpf_parser.y
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-03-19 16:36:10 +0100
committerDaniel Borkmann <dborkman@redhat.com>2013-03-19 16:36:10 +0100
commitceae98914962e4375a98db2622b65ecf44b0232a (patch)
tree1560778e9ea194247c1cec6d827dde882a860b58 /bpf_parser.y
parente4c98bb91e35dba56a077e8e5b9c70556fdd4e24 (diff)
bpfc: filter: add poff ancillary operation
In preparation for [1], add the #poff operation, so that users can dynamically truncate packets on the payload start offset. This is useful for several reasons: privacy, speed, ... Example for bpfc: ld #poff ret a [1] http://thread.gmane.org/gmane.linux.network/262512 Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'bpf_parser.y')
-rw-r--r--bpf_parser.y11
1 files changed, 10 insertions, 1 deletions
diff --git a/bpf_parser.y b/bpf_parser.y
index 7f6bcc8..459ea99 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -132,7 +132,7 @@ static int find_intr_offset_or_panic(char *label_to_search)
%token OP_LDXI
%token K_PKT_LEN K_PROTO K_TYPE K_NLATTR K_NLATTR_NEST K_MARK K_QUEUE K_HATYPE
-%token K_RXHASH K_CPU K_IFIDX K_VLANT K_VLANP
+%token K_RXHASH K_CPU K_IFIDX K_VLANT K_VLANP K_POFF
%token ':' ',' '[' ']' '(' ')' 'x' 'a' '+' 'M' '*' '&' '#'
@@ -235,6 +235,9 @@ ldb
| OP_LDB K_VLANP {
set_curr_instr(BPF_LD | BPF_B | BPF_ABS, 0, 0,
SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT); }
+ | OP_LDB K_POFF {
+ set_curr_instr(BPF_LD | BPF_B | BPF_ABS, 0, 0,
+ SKF_AD_OFF + SKF_AD_PAY_OFFSET); }
;
ldh
@@ -278,6 +281,9 @@ ldh
| OP_LDH K_VLANP {
set_curr_instr(BPF_LD | BPF_H | BPF_ABS, 0, 0,
SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT); }
+ | OP_LDH K_POFF {
+ set_curr_instr(BPF_LD | BPF_H | BPF_ABS, 0, 0,
+ SKF_AD_OFF + SKF_AD_PAY_OFFSET); }
;
ldi
@@ -326,6 +332,9 @@ ld
| OP_LD K_VLANP {
set_curr_instr(BPF_LD | BPF_W | BPF_ABS, 0, 0,
SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT); }
+ | OP_LD K_POFF {
+ set_curr_instr(BPF_LD | BPF_W | BPF_ABS, 0, 0,
+ SKF_AD_OFF + SKF_AD_PAY_OFFSET); }
| OP_LD 'M' '[' number ']' {
set_curr_instr(BPF_LD | BPF_MEM, 0, 0, $4); }
| OP_LD '[' 'x' '+' number ']' {