Re: [PATCH 1/3] bpf: Add support for mark with bpf_fib_lookup
From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-06-29 17:50:28
On Tue, Jun 29, 2021 at 10:37:34AM -0700, Rumen Telbizov wrote:
quoted hunk ↗ jump to hunk
Add support for policy routing via marks to the bpf_fib_lookup helper. The bpf_fib_lookup struct is constrained to 64B for performance. Since the smac and dmac entries are used only for output, put them in an anonymous struct and then add a union around a second struct that contains the mark to use in the FIB lookup. Signed-off-by: David Ahern <dsahern@kernel.org> Signed-off-by: Rumen Telbizov <redacted> --- include/uapi/linux/bpf.h | 16 ++++++++++++++-- net/core/filter.c | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-)diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index ec6d85a81744..6c78cc9c3c75 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h@@ -5925,8 +5925,20 @@ struct bpf_fib_lookup { /* output */ __be16 h_vlan_proto; __be16 h_vlan_TCI; - __u8 smac[6]; /* ETH_ALEN */ - __u8 dmac[6]; /* ETH_ALEN */ + + union { + /* input */ + struct { + __u32 mark; /* fwmark for policy routing */ + /* 2 4-byte holes for input */ + };
Tabs seem to be eaten and spit back out with spaces from your email client :(