Commit bcece5dc authored by David Ahern's avatar David Ahern Committed by Alexei Starovoitov

bpf: Change bpf_fib_lookup to return -EAFNOSUPPORT for unsupported address families

Update bpf_fib_lookup to return -EAFNOSUPPORT for unsupported address
families. Allows userspace to probe for support as more are added
(e.g., AF_MPLS).
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 71b2c87d
...@@ -4285,7 +4285,7 @@ BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx, ...@@ -4285,7 +4285,7 @@ BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx,
flags, true); flags, true);
#endif #endif
} }
return 0; return -EAFNOSUPPORT;
} }
static const struct bpf_func_proto bpf_xdp_fib_lookup_proto = { static const struct bpf_func_proto bpf_xdp_fib_lookup_proto = {
...@@ -4302,7 +4302,7 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb, ...@@ -4302,7 +4302,7 @@ BPF_CALL_4(bpf_skb_fib_lookup, struct sk_buff *, skb,
struct bpf_fib_lookup *, params, int, plen, u32, flags) struct bpf_fib_lookup *, params, int, plen, u32, flags)
{ {
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
int index = 0; int index = -EAFNOSUPPORT;
if (plen < sizeof(*params)) if (plen < sizeof(*params))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment