]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Update kernel headers
authorDavid Ahern <dsahern@gmail.com>
Wed, 17 Apr 2019 21:07:48 +0000 (14:07 -0700)
committerDavid Ahern <dsahern@gmail.com>
Wed, 17 Apr 2019 21:07:48 +0000 (14:07 -0700)
Update kernel headers to commit
    6b0a7f84ea1f ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

Signed-off-by: David Ahern <dsahern@gmail.com>
include/uapi/linux/bpf.h
include/uapi/linux/btf.h
include/uapi/linux/fou.h

index 882a97cc7518d55c1804df73419a96df301a8b46..79f729c669477227566566fe9b99921c08e55aea 100644 (file)
@@ -105,6 +105,7 @@ enum bpf_cmd {
        BPF_BTF_GET_FD_BY_ID,
        BPF_TASK_FD_QUERY,
        BPF_MAP_LOOKUP_AND_DELETE_ELEM,
+       BPF_MAP_FREEZE,
 };
 
 enum bpf_map_type {
@@ -255,8 +256,19 @@ enum bpf_attach_type {
  */
 #define BPF_F_ANY_ALIGNMENT    (1U << 1)
 
-/* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */
+/* When BPF ldimm64's insn[0].src_reg != 0 then this can have
+ * two extensions:
+ *
+ * insn[0].src_reg:  BPF_PSEUDO_MAP_FD   BPF_PSEUDO_MAP_VALUE
+ * insn[0].imm:      map fd              map fd
+ * insn[1].imm:      0                   offset into value
+ * insn[0].off:      0                   0
+ * insn[1].off:      0                   0
+ * ldimm64 rewrite:  address of map      address of map[0]+offset
+ * verifier type:    CONST_PTR_TO_MAP    PTR_TO_MAP_VALUE
+ */
 #define BPF_PSEUDO_MAP_FD      1
+#define BPF_PSEUDO_MAP_VALUE   2
 
 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
  * offset to another bpf function
@@ -283,7 +295,7 @@ enum bpf_attach_type {
 
 #define BPF_OBJ_NAME_LEN 16U
 
-/* Flags for accessing BPF object */
+/* Flags for accessing BPF object from syscall side. */
 #define BPF_F_RDONLY           (1U << 3)
 #define BPF_F_WRONLY           (1U << 4)
 
@@ -293,6 +305,10 @@ enum bpf_attach_type {
 /* Zero-initialize hash function seed. This should only be used for testing. */
 #define BPF_F_ZERO_SEED                (1U << 6)
 
+/* Flags for accessing BPF object from program side. */
+#define BPF_F_RDONLY_PROG      (1U << 7)
+#define BPF_F_WRONLY_PROG      (1U << 8)
+
 /* flags for BPF_PROG_QUERY */
 #define BPF_F_QUERY_EFFECTIVE  (1U << 0)
 
@@ -396,6 +412,13 @@ union bpf_attr {
                __aligned_u64   data_out;
                __u32           repeat;
                __u32           duration;
+               __u32           ctx_size_in;    /* input: len of ctx_in */
+               __u32           ctx_size_out;   /* input/output: len of ctx_out
+                                                *   returns ENOSPC if ctx_out
+                                                *   is too small.
+                                                */
+               __aligned_u64   ctx_in;
+               __aligned_u64   ctx_out;
        } test;
 
        struct { /* anonymous struct used by BPF_*_GET_*_ID */
@@ -1478,13 +1501,31 @@ union bpf_attr {
  *             Grow or shrink the room for data in the packet associated to
  *             *skb* by *len_diff*, and according to the selected *mode*.
  *
- *             There is a single supported mode at this time:
+ *             There are two supported modes at this time:
+ *
+ *             * **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer
+ *               (room space is added or removed below the layer 2 header).
  *
  *             * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer
  *               (room space is added or removed below the layer 3 header).
  *
- *             All values for *flags* are reserved for future usage, and must
- *             be left at zero.
+ *             The following flags are supported at this time:
+ *
+ *             * **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size.
+ *               Adjusting mss in this way is not allowed for datagrams.
+ *
+ *             * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 **:
+ *             * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 **:
+ *               Any new space is reserved to hold a tunnel header.
+ *               Configure skb offsets and other fields accordingly.
+ *
+ *             * **BPF_F_ADJ_ROOM_ENCAP_L4_GRE **:
+ *             * **BPF_F_ADJ_ROOM_ENCAP_L4_UDP **:
+ *               Use with ENCAP_L3 flags to further specify the tunnel type.
+ *
+ *             * **BPF_F_ADJ_ROOM_ENCAP_L2(len) **:
+ *               Use with ENCAP_L3/L4 flags to further specify the tunnel
+ *               type; **len** is the length of the inner MAC header.
  *
  *             A call to this helper is susceptible to change the underlaying
  *             packet buffer. Therefore, at load time, all checks on pointers
@@ -2431,6 +2472,38 @@ union bpf_attr {
  *     Return
  *             A **struct bpf_sock** pointer on success, or **NULL** in
  *             case of failure.
+ *
+ * struct bpf_sock *bpf_skc_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
+ *     Description
+ *             Look for TCP socket matching *tuple*, optionally in a child
+ *             network namespace *netns*. The return value must be checked,
+ *             and if non-**NULL**, released via **bpf_sk_release**\ ().
+ *
+ *             This function is identical to bpf_sk_lookup_tcp, except that it
+ *             also returns timewait or request sockets. Use bpf_sk_fullsock
+ *             or bpf_tcp_socket to access the full structure.
+ *
+ *             This helper is available only if the kernel was compiled with
+ *             **CONFIG_NET** configuration option.
+ *     Return
+ *             Pointer to **struct bpf_sock**, or **NULL** in case of failure.
+ *             For sockets with reuseport option, the **struct bpf_sock**
+ *             result is from **reuse->socks**\ [] using the hash of the tuple.
+ *
+ * int bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
+ *     Description
+ *             Check whether iph and th contain a valid SYN cookie ACK for
+ *             the listening socket in sk.
+ *
+ *             iph points to the start of the IPv4 or IPv6 header, while
+ *             iph_len contains sizeof(struct iphdr) or sizeof(struct ip6hdr).
+ *
+ *             th points to the start of the TCP header, while th_len contains
+ *             sizeof(struct tcphdr).
+ *
+ *     Return
+ *             0 if iph and th are a valid SYN cookie ACK, or a negative error
+ *             otherwise.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2531,7 +2604,9 @@ union bpf_attr {
        FN(sk_fullsock),                \
        FN(tcp_sock),                   \
        FN(skb_ecn_set_ce),             \
-       FN(get_listener_sock),
+       FN(get_listener_sock),          \
+       FN(skc_lookup_tcp),             \
+       FN(tcp_check_syncookie),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -2590,9 +2665,24 @@ enum bpf_func_id {
 /* Current network namespace */
 #define BPF_F_CURRENT_NETNS            (-1L)
 
+/* BPF_FUNC_skb_adjust_room flags. */
+#define BPF_F_ADJ_ROOM_FIXED_GSO       (1ULL << 0)
+
+#define        BPF_ADJ_ROOM_ENCAP_L2_MASK      0xff
+#define        BPF_ADJ_ROOM_ENCAP_L2_SHIFT     56
+
+#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4   (1ULL << 1)
+#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6   (1ULL << 2)
+#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE    (1ULL << 3)
+#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP    (1ULL << 4)
+#define        BPF_F_ADJ_ROOM_ENCAP_L2(len)    (((__u64)len & \
+                                         BPF_ADJ_ROOM_ENCAP_L2_MASK) \
+                                        << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
+
 /* Mode for BPF_FUNC_skb_adjust_room helper. */
 enum bpf_adj_room_mode {
        BPF_ADJ_ROOM_NET,
+       BPF_ADJ_ROOM_MAC,
 };
 
 /* Mode for BPF_FUNC_skb_load_bytes_relative helper. */
index cb4cf8cc7c84f01ad5afc915acdb60ad0dd21005..73eba2e5f0f2f70fb20672fdc7ee7d49751df967 100644 (file)
@@ -39,11 +39,11 @@ struct btf_type {
         *             struct, union and fwd
         */
        __u32 info;
-       /* "size" is used by INT, ENUM, STRUCT and UNION.
+       /* "size" is used by INT, ENUM, STRUCT, UNION and DATASEC.
         * "size" tells the size of the type it is describing.
         *
         * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
-        * FUNC and FUNC_PROTO.
+        * FUNC, FUNC_PROTO and VAR.
         * "type" is a type_id referring to another type.
         */
        union {
@@ -70,8 +70,10 @@ struct btf_type {
 #define BTF_KIND_RESTRICT      11      /* Restrict     */
 #define BTF_KIND_FUNC          12      /* Function     */
 #define BTF_KIND_FUNC_PROTO    13      /* Function Proto       */
-#define BTF_KIND_MAX           13
-#define NR_BTF_KINDS           14
+#define BTF_KIND_VAR           14      /* Variable     */
+#define BTF_KIND_DATASEC       15      /* Section      */
+#define BTF_KIND_MAX           BTF_KIND_DATASEC
+#define NR_BTF_KINDS           (BTF_KIND_MAX + 1)
 
 /* For some specific BTF_KIND, "struct btf_type" is immediately
  * followed by extra data.
@@ -138,4 +140,26 @@ struct btf_param {
        __u32   type;
 };
 
+enum {
+       BTF_VAR_STATIC = 0,
+       BTF_VAR_GLOBAL_ALLOCATED,
+};
+
+/* BTF_KIND_VAR is followed by a single "struct btf_var" to describe
+ * additional information related to the variable such as its linkage.
+ */
+struct btf_var {
+       __u32   linkage;
+};
+
+/* BTF_KIND_DATASEC is followed by multiple "struct btf_var_secinfo"
+ * to describe all BTF_KIND_VAR types it contains along with it's
+ * in-section offset as well as size.
+ */
+struct btf_var_secinfo {
+       __u32   type;
+       __u32   offset;
+       __u32   size;
+};
+
 #endif /* __LINUX_BTF_H__ */
index bf022c63d5ff6ffcfeb5781626e69b0e4ffa2338..9f915118feb1113b96e41998c2c78d64fe8a01da 100644 (file)
@@ -16,6 +16,12 @@ enum {
        FOU_ATTR_IPPROTO,                       /* u8 */
        FOU_ATTR_TYPE,                          /* u8 */
        FOU_ATTR_REMCSUM_NOPARTIAL,             /* flag */
+       FOU_ATTR_LOCAL_V4,                      /* u32 */
+       FOU_ATTR_LOCAL_V6,                      /* in6_addr */
+       FOU_ATTR_PEER_V4,                       /* u32 */
+       FOU_ATTR_PEER_V6,                       /* in6_addr */
+       FOU_ATTR_PEER_PORT,                     /* u16 */
+       FOU_ATTR_IFINDEX,                       /* s32 */
 
        __FOU_ATTR_MAX,
 };