summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-09-03 22:43:05 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-09-03 22:44:59 +0200
commit34b8b715fa98a78b00d06c1eafab56984025ed2e (patch)
treefafe03f2d39f27abe683279436e9199db67f0a0c
parentd41c80f7eb1eeb08b074d77e8826086f71a7a246 (diff)
bpf: ldi,ldxi: allow for '#' prefix in numbers
For consistency, allow for '#' prefix in numbers, which we currently do not do. So keep old mode as compatibility to not break current programs, and add new one with '#' prefix. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--bpf_parser.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/bpf_parser.y b/bpf_parser.y
index a101057..48a6e4c 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -288,7 +288,9 @@ ldh
;
ldi
- : OP_LDI number {
+ : OP_LDI '#' number {
+ set_curr_instr(BPF_LD | BPF_IMM, 0, 0, $3); }
+ | OP_LDI number {
set_curr_instr(BPF_LD | BPF_IMM, 0, 0, $2); }
;
@@ -345,7 +347,9 @@ ld
;
ldxi
- : OP_LDXI number {
+ : OP_LDXI '#' number {
+ set_curr_instr(BPF_LDX | BPF_IMM, 0, 0, $3); }
+ | OP_LDXI number {
set_curr_instr(BPF_LDX | BPF_IMM, 0, 0, $2); }
;