[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <602d7aa7bfbb5_ddd220836@john-XPS-13-9370.notmuch>
Date: Wed, 17 Feb 2021 12:20:55 -0800
From: John Fastabend <john.fastabend@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>, bpf@...r.kernel.org
Cc: Jesper Dangaard Brouer <brouer@...hat.com>, netdev@...r.kernel.org,
Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>
Subject: RE: [PATCH bpf-next V1 1/2] bpf: BPF-helper for MTU checking add
length input
Jesper Dangaard Brouer wrote:
> The FIB lookup example[1] show how the IP-header field tot_len
> (iph->tot_len) is used as input to perform the MTU check.
>
> This patch extend the BPF-helper bpf_check_mtu() with the same ability
> to provide the length as user parameter input, via mtu_len parameter.
>
> [1] samples/bpf/xdp_fwd_kern.c
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
> ---
> include/uapi/linux/bpf.h | 17 +++++++++++------
> net/core/filter.c | 12 ++++++++++--
> 2 files changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 4c24daa43bac..9c8aa50dc8a5 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -3850,8 +3850,7 @@ union bpf_attr {
> *
> * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags)
> * Description
> -
> - * Check ctx packet size against exceeding MTU of net device (based
> + * Check packet size against exceeding MTU of net device (based
> * on *ifindex*). This helper will likely be used in combination
> * with helpers that adjust/change the packet size.
> *
> @@ -3868,6 +3867,14 @@ union bpf_attr {
> * against the current net device. This is practical if this isn't
> * used prior to redirect.
> *
> + * On input *mtu_len* must be a valid pointer, else verifier will
> + * reject BPF program. If the value *mtu_len* is initialized to
> + * zero then the ctx packet size is use. When value *mtu_len* is
> + * provided as input this specify the L3 length that the MTU check
> + * is done against. Remeber XDP and TC length operate at L2, but
^^^^^^^
typo, Remember
Acked-by: John Fastabend <john.fastabend@...il.com>
Powered by blists - more mailing lists