From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [bpf-next v1 8/9] bpf: Provide helper to do lookups in kernel FIB table Date: Thu, 3 May 2018 18:47:39 -0600 Message-ID: <48fc7c60-c31e-65c6-758f-21fd9f15330c@gmail.com> References: <20180503035319.18290-1-dsahern@gmail.com> <20180503035319.18290-9-dsahern@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, shm@cumulusnetworks.com, roopa@cumulusnetworks.com, brouer@redhat.com, toke@toke.dk, john.fastabend@gmail.com To: Daniel Borkmann , netdev@vger.kernel.org, borkmann@iogearbox.net, ast@kernel.org Return-path: Received: from mail-pf0-f173.google.com ([209.85.192.173]:43080 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbeEDArr (ORCPT ); Thu, 3 May 2018 20:47:47 -0400 Received: by mail-pf0-f173.google.com with SMTP id j20so1758449pff.10 for ; Thu, 03 May 2018 17:47:47 -0700 (PDT) In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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, struct sk_buff *, skb, >> + struct bpf_fib_lookup *, params, int, plen, u32, flags) >> +{ >> + if (plen < sizeof(*params)) >> + return -EINVAL; >> + >> + switch (params->family) { >> +#if IS_ENABLED(CONFIG_INET) >> + case AF_INET: >> + return bpf_ipv4_fib_lookup(dev_net(skb->dev), params, flags); >> +#endif >> +#if IS_ENABLED(CONFIG_IPV6) >> + case AF_INET6: >> + return bpf_ipv6_fib_lookup(dev_net(skb->dev), params, flags); >> +#endif >> + } >> + return -ENOTSUPP; >> +} >> + >> +static const struct bpf_func_proto bpf_skb_fib_lookup_proto = { >> + .func = bpf_skb_fib_lookup, >> + .gpl_only = true, >> + .pkt_access = true, > > ... this should both not be marked as pkt_access = true. What this means is that > arg2, which is the struct bpf_fib_lookup, could come from the raw packet buffer. leftover from the first version which did pass in the packet. Will remove.