diff options
author | John Fastabend <john.fastabend@gmail.com> | 2017-10-27 09:45:53 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-29 11:18:48 +0900 |
commit | bfa640757e9378c2f26867e723f1287e94f5a7ad (patch) | |
tree | 927d92a4bf5018b3f82f4943fd9ee6a657c3a4e9 /kernel/bpf | |
parent | 8108a77515126f6db4374e8593956e20430307c0 (diff) | |
download | linux-stable-bfa640757e9378c2f26867e723f1287e94f5a7ad.tar.gz linux-stable-bfa640757e9378c2f26867e723f1287e94f5a7ad.tar.bz2 linux-stable-bfa640757e9378c2f26867e723f1287e94f5a7ad.zip |
bpf: rename sk_actions to align with bpf infrastructure
Recent additions to support multiple programs in cgroups impose
a strict requirement, "all yes is yes, any no is no". To enforce
this the infrastructure requires the 'no' return code, SK_DROP in
this case, to be 0.
To apply these rules to SK_SKB program types the sk_actions return
codes need to be adjusted.
This fix adds SK_PASS and makes 'SK_DROP = 0'. Finally, remove
SK_ABORTED to remove any chance that the API may allow aborted
program flows to be passed up the stack. This would be incorrect
behavior and allow programs to break existing policies.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/sockmap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 6778fb773934..66f00a2b27f4 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -122,7 +122,8 @@ static int smap_verdict_func(struct smap_psock *psock, struct sk_buff *skb) preempt_enable(); skb->sk = NULL; - return rc; + return rc == SK_PASS ? + (TCP_SKB_CB(skb)->bpf.map ? SK_REDIRECT : SK_PASS) : SK_DROP; } static void smap_do_verdict(struct smap_psock *psock, struct sk_buff *skb) |