Re: [bpf-next v1 8/9] bpf: Provide helper to do lookups in kernel FIB table

2018-05-03 Thread David Ahern
On 5/3/18 6:45 PM, Daniel Borkmann wrote: >> +.ret_type = RET_INTEGER, >> +.arg1_type = ARG_PTR_TO_CTX, >> +.arg2_type = ARG_PTR_TO_MEM, >> +.arg3_type = ARG_CONST_SIZE, >> +.arg4_type = ARG_ANYTHING, >> +}; >> + >> +BPF_CALL_4(bpf_skb_fib_lookup, struc

Re: [bpf-next v1 8/9] bpf: Provide helper to do lookups in kernel FIB table

2018-05-03 Thread Daniel Borkmann
On 05/03/2018 05:53 AM, David Ahern wrote: [...] > + > +BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx, > +struct bpf_fib_lookup *, params, int, plen, u32, flags) > +{ > + if (plen < sizeof(*params)) > + return -EINVAL; > + > + switch (params->family) { > +#if IS_

[bpf-next v1 8/9] bpf: Provide helper to do lookups in kernel FIB table

2018-05-02 Thread David Ahern
Provide a helper for doing a FIB and neighbor lookup in the kernel tables from an XDP program. The helper provides a fastpath for forwarding packets. If the packet is a local delivery or for any reason is not a simple lookup and forward, the packet continues up the stack. If it is to be forwarded,