summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2019-04-01 13:57:31 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2019-04-03 16:49:48 +0200
commit822fe61795018265ae14731d4e5399e5bde36864 (patch)
tree46a279c48db0fef4326e864ffc60df9146c99e19 /net
parent2c3af7d901c61c101c02f431cfb520af9ff56ab4 (diff)
downloadlinux-822fe61795018265ae14731d4e5399e5bde36864.tar.bz2
net/flow_dissector: pass flow_keys->n_proto to BPF programs
This is a preparation for the next commit that would prohibit access to the most fields of __sk_buff from the BPF programs. Instead of requiring BPF flow dissector programs to look into skb, pass all input data in the flow_keys. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/flow_dissector.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index bb1a54747d64..9b84250039df 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -707,6 +707,7 @@ bool __skb_flow_bpf_dissect(struct bpf_prog *prog,
/* Pass parameters to the BPF program */
memset(flow_keys, 0, sizeof(*flow_keys));
cb->qdisc_cb.flow_keys = flow_keys;
+ flow_keys->n_proto = skb->protocol;
flow_keys->nhoff = skb_network_offset(skb);
flow_keys->thoff = flow_keys->nhoff;