From: Anton Protopopov Date: Sat, 15 Jun 2019 22:53:48 +0000 (+0000) Subject: bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup X-Git-Tag: android-x86-9.0-r1~1^2~123^2~208 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=59a7ecd9d20b2871c5402e11f813defe3d3151ee;p=android-x86%2Fkernel.git bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup [ Upstream commit 56f0f84e69c7a7f229dfa524b13b0ceb6ce9b09e ] The bpf_ipv6_fib_lookup function should return BPF_FIB_LKUP_RET_FWD_DISABLED when forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the global net->ipv6.devconf_all->forwarding flag. Change it to behave as expected. Fixes: 87f5fc7e48dd ("bpf: Provide helper to do forwarding lookups in kernel FIB table") Signed-off-by: Anton Protopopov Acked-by: Toke Høiland-Jørgensen Reviewed-by: David Ahern Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- diff --git a/net/core/filter.c b/net/core/filter.c index 91b950261975..9daf1a4118b5 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4367,7 +4367,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params, return -ENODEV; idev = __in6_dev_get_safely(dev); - if (unlikely(!idev || !net->ipv6.devconf_all->forwarding)) + if (unlikely(!idev || !idev->cnf.forwarding)) return BPF_FIB_LKUP_RET_FWD_DISABLED; if (flags & BPF_FIB_LOOKUP_OUTPUT) {