Skip to content

Commit

Permalink
bpf: Change bpf_fib_lookup to return -EAFNOSUPPORT for unsupported ad…
Browse files Browse the repository at this point in the history
…dress 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>
  • Loading branch information
David Ahern authored and Alexei Starovoitov committed May 30, 2018
1 parent 71b2c87 commit bcece5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/filter.c
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit bcece5d

Please sign in to comment.