bpf: allow BPF programs access 'protocol' and 'vlan_tci' fields
as a follow on to patch 70006af955
("bpf: allow eBPF access skb fields")
this patch allows 'protocol' and 'vlan_tci' fields to be accessible
from extended BPF programs.
The usage of 'protocol', 'vlan_present' and 'vlan_tci' fields is the same as
corresponding SKF_AD_PROTOCOL, SKF_AD_VLAN_TAG_PRESENT and SKF_AD_VLAN_TAG
accesses in classic BPF.
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9cf7867c24
commit
c249739579
@@ -658,6 +658,15 @@ static struct bpf_test tests[] = {
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
|
||||
offsetof(struct __sk_buff, queue_mapping)),
|
||||
BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 0),
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
|
||||
offsetof(struct __sk_buff, protocol)),
|
||||
BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 0),
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
|
||||
offsetof(struct __sk_buff, vlan_present)),
|
||||
BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 0),
|
||||
BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
|
||||
offsetof(struct __sk_buff, vlan_tci)),
|
||||
BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = ACCEPT,
|
||||
|
Reference in New Issue
Block a user