diff options
author | David Ahern <dsahern@gmail.com> | 2018-05-30 15:24:17 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-05-30 17:17:18 -0400 |
commit | bcece5dc40b9e00d0a9a91fc0acc9a825c23362b (patch) | |
tree | cbcc2af28053ff6791db8086ce316de7c7dc971a | |
parent | 71b2c87df3ac37f5f83e166db136b0c1d065a781 (diff) |
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: David Ahern <dsahern@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | net/core/filter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 81bd2e9fe8fc..885fb0e2f264 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -4285,7 +4285,7 @@ BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx, | |||
4285 | flags, true); | 4285 | flags, true); |
4286 | #endif | 4286 | #endif |
4287 | } | 4287 | } |
4288 | return 0; | 4288 | return -EAFNOSUPPORT; |
4289 | } | 4289 | } |
4290 | 4290 | ||
4291 | static const struct bpf_func_proto bpf_xdp_fib_lookup_proto = { | 4291 | 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 | struct bpf_fib_lookup *, params, int, plen, u32, flags) | 4302 | struct bpf_fib_lookup *, params, int, plen, u32, flags) |
4303 | { | 4303 | { |
4304 | struct net *net = dev_net(skb->dev); | 4304 | struct net *net = dev_net(skb->dev); |
4305 | int index = 0; | 4305 | int index = -EAFNOSUPPORT; |
4306 | 4306 | ||
4307 | if (plen < sizeof(*params)) | 4307 | if (plen < sizeof(*params)) |
4308 | return -EINVAL; | 4308 | return -EINVAL; |