naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

Blame SOURCES/0067-uapi-update-bpf-header.patch

8def76
From 415044d7e6f956daec990a7ae358f9f324bd2dcd Mon Sep 17 00:00:00 2001
8def76
From: Andrea Claudi <aclaudi@redhat.com>
8def76
Date: Thu, 13 Jun 2019 14:37:57 +0200
8def76
Subject: [PATCH] uapi: update bpf header
8def76
8def76
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1716361
8def76
Upstream Status: iproute2.git commit 028766aed21a4
8def76
8def76
commit 028766aed21a4d8eb2e60c9ef667f75f9354a104
8def76
Author: Stephen Hemminger <stephen@networkplumber.org>
8def76
Date:   Mon Dec 10 09:22:23 2018 -0800
8def76
8def76
    uapi: update bpf header
8def76
8def76
    Changes from 4.20-rc6
8def76
8def76
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
8def76
---
8def76
 include/uapi/linux/bpf.h | 56 ++++++++++++++++++++++++++--------------
8def76
 1 file changed, 37 insertions(+), 19 deletions(-)
8def76
8def76
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
8def76
index 2bbe33db8aefa..ff651ca661308 100644
8def76
--- a/include/uapi/linux/bpf.h
8def76
+++ b/include/uapi/linux/bpf.h
8def76
@@ -2170,7 +2170,7 @@ union bpf_attr {
8def76
  *	Return
8def76
  *		0 on success, or a negative error in case of failure.
8def76
  *
8def76
- * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
8def76
+ * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
8def76
  *	Description
8def76
  *		Look for TCP socket matching *tuple*, optionally in a child
8def76
  *		network namespace *netns*. The return value must be checked,
8def76
@@ -2187,12 +2187,14 @@ union bpf_attr {
8def76
  *		**sizeof**\ (*tuple*\ **->ipv6**)
8def76
  *			Look for an IPv6 socket.
8def76
  *
8def76
- *		If the *netns* is zero, then the socket lookup table in the
8def76
- *		netns associated with the *ctx* will be used. For the TC hooks,
8def76
- *		this in the netns of the device in the skb. For socket hooks,
8def76
- *		this in the netns of the socket. If *netns* is non-zero, then
8def76
- *		it specifies the ID of the netns relative to the netns
8def76
- *		associated with the *ctx*.
8def76
+ *		If the *netns* is a negative signed 32-bit integer, then the
8def76
+ *		socket lookup table in the netns associated with the *ctx* will
8def76
+ *		will be used. For the TC hooks, this is the netns of the device
8def76
+ *		in the skb. For socket hooks, this is the netns of the socket.
8def76
+ *		If *netns* is any other signed 32-bit value greater than or
8def76
+ *		equal to zero then it specifies the ID of the netns relative to
8def76
+ *		the netns associated with the *ctx*. *netns* values beyond the
8def76
+ *		range of 32-bit integers are reserved for future use.
8def76
  *
8def76
  *		All values for *flags* are reserved for future usage, and must
8def76
  *		be left at zero.
8def76
@@ -2201,8 +2203,10 @@ union bpf_attr {
8def76
  *		**CONFIG_NET** configuration option.
8def76
  *	Return
8def76
  *		Pointer to *struct bpf_sock*, or NULL in case of failure.
8def76
+ *		For sockets with reuseport option, the *struct bpf_sock*
8def76
+ *		result is from reuse->socks[] using the hash of the tuple.
8def76
  *
8def76
- * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
8def76
+ * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
8def76
  *	Description
8def76
  *		Look for UDP socket matching *tuple*, optionally in a child
8def76
  *		network namespace *netns*. The return value must be checked,
8def76
@@ -2219,12 +2223,14 @@ union bpf_attr {
8def76
  *		**sizeof**\ (*tuple*\ **->ipv6**)
8def76
  *			Look for an IPv6 socket.
8def76
  *
8def76
- *		If the *netns* is zero, then the socket lookup table in the
8def76
- *		netns associated with the *ctx* will be used. For the TC hooks,
8def76
- *		this in the netns of the device in the skb. For socket hooks,
8def76
- *		this in the netns of the socket. If *netns* is non-zero, then
8def76
- *		it specifies the ID of the netns relative to the netns
8def76
- *		associated with the *ctx*.
8def76
+ *		If the *netns* is a negative signed 32-bit integer, then the
8def76
+ *		socket lookup table in the netns associated with the *ctx* will
8def76
+ *		will be used. For the TC hooks, this is the netns of the device
8def76
+ *		in the skb. For socket hooks, this is the netns of the socket.
8def76
+ *		If *netns* is any other signed 32-bit value greater than or
8def76
+ *		equal to zero then it specifies the ID of the netns relative to
8def76
+ *		the netns associated with the *ctx*. *netns* values beyond the
8def76
+ *		range of 32-bit integers are reserved for future use.
8def76
  *
8def76
  *		All values for *flags* are reserved for future usage, and must
8def76
  *		be left at zero.
8def76
@@ -2233,6 +2239,8 @@ union bpf_attr {
8def76
  *		**CONFIG_NET** configuration option.
8def76
  *	Return
8def76
  *		Pointer to *struct bpf_sock*, or NULL in case of failure.
8def76
+ *		For sockets with reuseport option, the *struct bpf_sock*
8def76
+ *		result is from reuse->socks[] using the hash of the tuple.
8def76
  *
8def76
  * int bpf_sk_release(struct bpf_sock *sk)
8def76
  *	Description
8def76
@@ -2405,6 +2413,9 @@ enum bpf_func_id {
8def76
 /* BPF_FUNC_perf_event_output for sk_buff input context. */
8def76
 #define BPF_F_CTXLEN_MASK		(0xfffffULL << 32)
8def76
 
8def76
+/* Current network namespace */
8def76
+#define BPF_F_CURRENT_NETNS		(-1L)
8def76
+
8def76
 /* Mode for BPF_FUNC_skb_adjust_room helper. */
8def76
 enum bpf_adj_room_mode {
8def76
 	BPF_ADJ_ROOM_NET,
8def76
@@ -2422,6 +2433,12 @@ enum bpf_lwt_encap_mode {
8def76
 	BPF_LWT_ENCAP_SEG6_INLINE
8def76
 };
8def76
 
8def76
+#define __bpf_md_ptr(type, name)	\
8def76
+union {					\
8def76
+	type name;			\
8def76
+	__u64 :64;			\
8def76
+} __attribute__((aligned(8)))
8def76
+
8def76
 /* user accessible mirror of in-kernel sk_buff.
8def76
  * new fields can only be added to the end of this structure
8def76
  */
8def76
@@ -2456,7 +2473,7 @@ struct __sk_buff {
8def76
 	/* ... here. */
8def76
 
8def76
 	__u32 data_meta;
8def76
-	struct bpf_flow_keys *flow_keys;
8def76
+	__bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
8def76
 };
8def76
 
8def76
 struct bpf_tunnel_key {
8def76
@@ -2572,8 +2589,8 @@ enum sk_action {
8def76
  * be added to the end of this structure
8def76
  */
8def76
 struct sk_msg_md {
8def76
-	void *data;
8def76
-	void *data_end;
8def76
+	__bpf_md_ptr(void *, data);
8def76
+	__bpf_md_ptr(void *, data_end);
8def76
 
8def76
 	__u32 family;
8def76
 	__u32 remote_ip4;	/* Stored in network byte order */
8def76
@@ -2589,8 +2606,9 @@ struct sk_reuseport_md {
8def76
 	 * Start of directly accessible data. It begins from
8def76
 	 * the tcp/udp header.
8def76
 	 */
8def76
-	void *data;
8def76
-	void *data_end;		/* End of directly accessible data */
8def76
+	__bpf_md_ptr(void *, data);
8def76
+	/* End of directly accessible data */
8def76
+	__bpf_md_ptr(void *, data_end);
8def76
 	/*
8def76
 	 * Total length of packet (starting from the tcp/udp header).
8def76
 	 * Note that the directly accessible bytes (data_end - data)
8def76
-- 
8def76
2.20.1
8def76