bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup
Subsystems (4)
PATCH 1/1 bpf: fix the check that forwarding is enabled in bpf_ipv6_fib_lookup
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.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -4737,7 +4737,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 ) {
Signature · 1 line
2.19.1
Quoted 6 lines · Anton Protopopov
The
bpf_ipv6_fib_lookupfunction should returnBPF_FIB_LKUP_RET_FWD_DISABLEDwhen forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the globalnet->ipv6.devconf_all->forwardingflag. Change it to behave as expected.Signed-off-by Anton Protopopov <[email protected]>
Thanks!
David Ahern
Reviewed-byQuoted 7 lines · Toke Høiland-Jørgensen
Quoted 5 lines · Anton Protopopov
The
bpf_ipv6_fib_lookupfunction should returnBPF_FIB_LKUP_RET_FWD_DISABLEDwhen forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the globalnet->ipv6.devconf_all->forwardingflag. Change it to behave as expected.
Quoted 6 lines
Quoted 1 line
Signed-off-by Anton Protopopov <[email protected]>Thanks!
kernel FIB table")
Quoted 6 lines · Anton Protopopov
The
bpf_ipv6_fib_lookupfunction should returnBPF_FIB_LKUP_RET_FWD_DISABLEDwhen forwarding is disabled for the input device. However instead of checking if forwarding is enabled on the input device, it checked the globalnet->ipv6.devconf_all->forwardingflag. Change it to behave as expected.Signed-off-by Anton Protopopov <[email protected]>
Applied, thanks!