Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[sfrench/cifs-2.6.git] / tools / include / uapi / linux / bpf.h
index ef78e0e1a75492002824871291648b8e0db8b776..3dd13fe738b9b441f6c4a039a351d7b2fa7c8e83 100644 (file)
@@ -998,6 +998,7 @@ enum bpf_attach_type {
        BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
        BPF_PERF_EVENT,
        BPF_TRACE_KPROBE_MULTI,
+       BPF_LSM_CGROUP,
        __MAX_BPF_ATTACH_TYPE
 };
 
@@ -1431,6 +1432,7 @@ union bpf_attr {
                __u32           attach_flags;
                __aligned_u64   prog_ids;
                __u32           prog_cnt;
+               __aligned_u64   prog_attach_flags; /* output: per-program attach_flags */
        } query;
 
        struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
@@ -3597,10 +3599,11 @@ union bpf_attr {
  *
  *             *iph* points to the start of the IPv4 or IPv6 header, while
  *             *iph_len* contains **sizeof**\ (**struct iphdr**) or
- *             **sizeof**\ (**struct ip6hdr**).
+ *             **sizeof**\ (**struct ipv6hdr**).
  *
  *             *th* points to the start of the TCP header, while *th_len*
- *             contains **sizeof**\ (**struct tcphdr**).
+ *             contains the length of the TCP header (at least
+ *             **sizeof**\ (**struct tcphdr**)).
  *     Return
  *             0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
  *             error otherwise.
@@ -3783,10 +3786,11 @@ union bpf_attr {
  *
  *             *iph* points to the start of the IPv4 or IPv6 header, while
  *             *iph_len* contains **sizeof**\ (**struct iphdr**) or
- *             **sizeof**\ (**struct ip6hdr**).
+ *             **sizeof**\ (**struct ipv6hdr**).
  *
  *             *th* points to the start of the TCP header, while *th_len*
- *             contains the length of the TCP header.
+ *             contains the length of the TCP header with options (at least
+ *             **sizeof**\ (**struct tcphdr**)).
  *     Return
  *             On success, lower 32 bits hold the generated SYN cookie in
  *             followed by 16 bits which hold the MSS value for that cookie,
@@ -5252,6 +5256,80 @@ union bpf_attr {
  *             Pointer to the underlying dynptr data, NULL if the dynptr is
  *             read-only, if the dynptr is invalid, or if the offset and length
  *             is out of bounds.
+ *
+ * s64 bpf_tcp_raw_gen_syncookie_ipv4(struct iphdr *iph, struct tcphdr *th, u32 th_len)
+ *     Description
+ *             Try to issue a SYN cookie for the packet with corresponding
+ *             IPv4/TCP headers, *iph* and *th*, without depending on a
+ *             listening socket.
+ *
+ *             *iph* points to the IPv4 header.
+ *
+ *             *th* points to the start of the TCP header, while *th_len*
+ *             contains the length of the TCP header (at least
+ *             **sizeof**\ (**struct tcphdr**)).
+ *     Return
+ *             On success, lower 32 bits hold the generated SYN cookie in
+ *             followed by 16 bits which hold the MSS value for that cookie,
+ *             and the top 16 bits are unused.
+ *
+ *             On failure, the returned value is one of the following:
+ *
+ *             **-EINVAL** if *th_len* is invalid.
+ *
+ * s64 bpf_tcp_raw_gen_syncookie_ipv6(struct ipv6hdr *iph, struct tcphdr *th, u32 th_len)
+ *     Description
+ *             Try to issue a SYN cookie for the packet with corresponding
+ *             IPv6/TCP headers, *iph* and *th*, without depending on a
+ *             listening socket.
+ *
+ *             *iph* points to the IPv6 header.
+ *
+ *             *th* points to the start of the TCP header, while *th_len*
+ *             contains the length of the TCP header (at least
+ *             **sizeof**\ (**struct tcphdr**)).
+ *     Return
+ *             On success, lower 32 bits hold the generated SYN cookie in
+ *             followed by 16 bits which hold the MSS value for that cookie,
+ *             and the top 16 bits are unused.
+ *
+ *             On failure, the returned value is one of the following:
+ *
+ *             **-EINVAL** if *th_len* is invalid.
+ *
+ *             **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
+ *
+ * long bpf_tcp_raw_check_syncookie_ipv4(struct iphdr *iph, struct tcphdr *th)
+ *     Description
+ *             Check whether *iph* and *th* contain a valid SYN cookie ACK
+ *             without depending on a listening socket.
+ *
+ *             *iph* points to the IPv4 header.
+ *
+ *             *th* points to the TCP header.
+ *     Return
+ *             0 if *iph* and *th* are a valid SYN cookie ACK.
+ *
+ *             On failure, the returned value is one of the following:
+ *
+ *             **-EACCES** if the SYN cookie is not valid.
+ *
+ * long bpf_tcp_raw_check_syncookie_ipv6(struct ipv6hdr *iph, struct tcphdr *th)
+ *     Description
+ *             Check whether *iph* and *th* contain a valid SYN cookie ACK
+ *             without depending on a listening socket.
+ *
+ *             *iph* points to the IPv6 header.
+ *
+ *             *th* points to the TCP header.
+ *     Return
+ *             0 if *iph* and *th* are a valid SYN cookie ACK.
+ *
+ *             On failure, the returned value is one of the following:
+ *
+ *             **-EACCES** if the SYN cookie is not valid.
+ *
+ *             **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -5458,6 +5536,10 @@ union bpf_attr {
        FN(dynptr_read),                \
        FN(dynptr_write),               \
        FN(dynptr_data),                \
+       FN(tcp_raw_gen_syncookie_ipv4), \
+       FN(tcp_raw_gen_syncookie_ipv6), \
+       FN(tcp_raw_check_syncookie_ipv4),       \
+       FN(tcp_raw_check_syncookie_ipv6),       \
        /* */
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5998,6 +6080,8 @@ struct bpf_prog_info {
        __u64 run_cnt;
        __u64 recursion_misses;
        __u32 verified_insns;
+       __u32 attach_btf_obj_id;
+       __u32 attach_btf_id;
 } __attribute__((aligned(8)));
 
 struct bpf_map_info {
@@ -6705,6 +6789,7 @@ enum bpf_core_relo_kind {
        BPF_CORE_TYPE_SIZE = 9,              /* type size in bytes */
        BPF_CORE_ENUMVAL_EXISTS = 10,        /* enum value existence in target kernel */
        BPF_CORE_ENUMVAL_VALUE = 11,         /* enum value integer value */
+       BPF_CORE_TYPE_MATCHES = 12,          /* type match in target kernel */
 };
 
 /*