aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/filter.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-05-30 12:24:17 -0700
committerAlexei Starovoitov <ast@kernel.org>2018-05-30 14:17:18 -0700
commitbcece5dc40b9e00d0a9a91fc0acc9a825c23362b (patch)
treecbcc2af28053ff6791db8086ce316de7c7dc971a /net/core/filter.c
parentbpf: devmap: remove redundant assignment of dev = dev (diff)
downloadlinux-dev-bcece5dc40b9e00d0a9a91fc0acc9a825c23362b.tar.xz
linux-dev-bcece5dc40b9e00d0a9a91fc0acc9a825c23362b.zip
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>
Diffstat (limited to 'net/core/filter.c')
-rw-r--r--net/core/filter.c4
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,
flags, true);
#endif
}
- return 0;
+ return -EAFNOSUPPORT;
}
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,
struct bpf_fib_lookup *, params, int, plen, u32, flags)
{
struct net *net = dev_net(skb->dev);
- int index = 0;
+ int index = -EAFNOSUPPORT;
if (plen < sizeof(*params))
return -EINVAL;