| @@ -97,6 +97,7 @@ enum bpf_cmd { · 96 unmodified lines |
| 97 | BPF_RAW_TRACEPOINT_OPEN, | 97 | BPF_RAW_TRACEPOINT_OPEN, |
| 98 | BPF_BTF_LOAD, | 98 | BPF_BTF_LOAD, |
| 99 | BPF_BTF_GET_FD_BY_ID, | 99 | BPF_BTF_GET_FD_BY_ID, |
| | 100 | BPF_TASK_FD_QUERY, |
| 100 | }; | 101 | }; |
| 101 | | 102 | |
| 102 | enum bpf_map_type { | 103 | enum bpf_map_type { |
| @@ -141,6 +142,7 @@ enum bpf_prog_type { · 38 unmodified lines |
| 141 | BPF_PROG_TYPE_SK_MSG, | 142 | BPF_PROG_TYPE_SK_MSG, |
| 142 | BPF_PROG_TYPE_RAW_TRACEPOINT, | 143 | BPF_PROG_TYPE_RAW_TRACEPOINT, |
| 143 | BPF_PROG_TYPE_CGROUP_SOCK_ADDR, | 144 | BPF_PROG_TYPE_CGROUP_SOCK_ADDR, |
| | 145 | BPF_PROG_TYPE_LWT_SEG6LOCAL, |
| 144 | }; | 146 | }; |
| 145 | | 147 | |
| 146 | enum bpf_attach_type { | 148 | enum bpf_attach_type { |
| @@ -284,8 +286,8 @@ union bpf_attr { · 137 unmodified lines |
| 284 | char map_name[BPF_OBJ_NAME_LEN]; | 286 | char map_name[BPF_OBJ_NAME_LEN]; |
| 285 | __u32 map_ifindex; /* ifindex of netdev to create on */ | 287 | __u32 map_ifindex; /* ifindex of netdev to create on */ |
| 286 | __u32 btf_fd; /* fd pointing to a BTF type data */ | 288 | __u32 btf_fd; /* fd pointing to a BTF type data */ |
| 287 | __u32 btf_key_id; /* BTF type_id of the key */ | 289 | __u32 btf_key_type_id; /* BTF type_id of the key */ |
| 288 | __u32 btf_value_id; /* BTF type_id of the value */ | 290 | __u32 btf_value_type_id; /* BTF type_id of the value */ |
| 289 | }; | 291 | }; |
| 290 | | 292 | |
| 291 | struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ | 293 | struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ |
| @@ -379,6 +381,22 @@ union bpf_attr { · 87 unmodified lines |
| 379 | __u32 btf_log_size; | 381 | __u32 btf_log_size; |
| 380 | __u32 btf_log_level; | 382 | __u32 btf_log_level; |
| 381 | }; | 383 | }; |
| | 384 | |
| | 385 | struct { |
| | 386 | __u32 pid; /* input: pid */ |
| | 387 | __u32 fd; /* input: fd */ |
| | 388 | __u32 flags; /* input: flags */ |
| | 389 | __u32 buf_len; /* input/output: buf len */ |
| | 390 | __aligned_u64 buf; /* input/output: |
| | 391 | * tp_name for tracepoint |
| | 392 | * symbol for kprobe |
| | 393 | * filename for uprobe |
| | 394 | */ |
| | 395 | __u32 prog_id; /* output: prod_id */ |
| | 396 | __u32 fd_type; /* output: BPF_FD_TYPE_* */ |
| | 397 | __u64 probe_offset; /* output: probe_offset */ |
| | 398 | __u64 probe_addr; /* output: probe_addr */ |
| | 399 | } task_fd_query; |
| 382 | } __attribute__((aligned(8))); | 400 | } __attribute__((aligned(8))); |
| 383 | | 401 | |
| 384 | /* The description below is an attempt at providing documentation to eBPF | 402 | /* The description below is an attempt at providing documentation to eBPF |
| @@ -1902,6 +1920,90 @@ union bpf_attr { · 1517 unmodified lines |
| 1902 | * egress otherwise). This is the only flag supported for now. | 1920 | * egress otherwise). This is the only flag supported for now. |
| 1903 | * Return | 1921 | * Return |
| 1904 | * **SK_PASS** on success, or **SK_DROP** on error. | 1922 | * **SK_PASS** on success, or **SK_DROP** on error. |
| | 1923 | * |
| | 1924 | * int bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len) |
| | 1925 | * Description |
| | 1926 | * Encapsulate the packet associated to *skb* within a Layer 3 |
| | 1927 | * protocol header. This header is provided in the buffer at |
| | 1928 | * address *hdr*, with *len* its size in bytes. *type* indicates |
| | 1929 | * the protocol of the header and can be one of: |
| | 1930 | * |
| | 1931 | * **BPF_LWT_ENCAP_SEG6** |
| | 1932 | * IPv6 encapsulation with Segment Routing Header |
| | 1933 | * (**struct ipv6_sr_hdr**). *hdr* only contains the SRH, |
| | 1934 | * the IPv6 header is computed by the kernel. |
| | 1935 | * **BPF_LWT_ENCAP_SEG6_INLINE** |
| | 1936 | * Only works if *skb* contains an IPv6 packet. Insert a |
| | 1937 | * Segment Routing Header (**struct ipv6_sr_hdr**) inside |
| | 1938 | * the IPv6 header. |
| | 1939 | * |
| | 1940 | * A call to this helper is susceptible to change the underlaying |
| | 1941 | * packet buffer. Therefore, at load time, all checks on pointers |
| | 1942 | * previously done by the verifier are invalidated and must be |
| | 1943 | * performed again, if the helper is used in combination with |
| | 1944 | * direct packet access. |
| | 1945 | * Return |
| | 1946 | * 0 on success, or a negative error in case of failure. |
| | 1947 | * |
| | 1948 | * int bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len) |
| | 1949 | * Description |
| | 1950 | * Store *len* bytes from address *from* into the packet |
| | 1951 | * associated to *skb*, at *offset*. Only the flags, tag and TLVs |
| | 1952 | * inside the outermost IPv6 Segment Routing Header can be |
| | 1953 | * modified through this helper. |
| | 1954 | * |
| | 1955 | * A call to this helper is susceptible to change the underlaying |
| | 1956 | * packet buffer. Therefore, at load time, all checks on pointers |
| | 1957 | * previously done by the verifier are invalidated and must be |
| | 1958 | * performed again, if the helper is used in combination with |
| | 1959 | * direct packet access. |
| | 1960 | * Return |
| | 1961 | * 0 on success, or a negative error in case of failure. |
| | 1962 | * |
| | 1963 | * int bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta) |
| | 1964 | * Description |
| | 1965 | * Adjust the size allocated to TLVs in the outermost IPv6 |
| | 1966 | * Segment Routing Header contained in the packet associated to |
| | 1967 | * *skb*, at position *offset* by *delta* bytes. Only offsets |
| | 1968 | * after the segments are accepted. *delta* can be as well |
| | 1969 | * positive (growing) as negative (shrinking). |
| | 1970 | * |
| | 1971 | * A call to this helper is susceptible to change the underlaying |
| | 1972 | * packet buffer. Therefore, at load time, all checks on pointers |
| | 1973 | * previously done by the verifier are invalidated and must be |
| | 1974 | * performed again, if the helper is used in combination with |
| | 1975 | * direct packet access. |
| | 1976 | * Return |
| | 1977 | * 0 on success, or a negative error in case of failure. |
| | 1978 | * |
| | 1979 | * int bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len) |
| | 1980 | * Description |
| | 1981 | * Apply an IPv6 Segment Routing action of type *action* to the |
| | 1982 | * packet associated to *skb*. Each action takes a parameter |
| | 1983 | * contained at address *param*, and of length *param_len* bytes. |
| | 1984 | * *action* can be one of: |
| | 1985 | * |
| | 1986 | * **SEG6_LOCAL_ACTION_END_X** |
| | 1987 | * End.X action: Endpoint with Layer-3 cross-connect. |
| | 1988 | * Type of *param*: **struct in6_addr**. |
| | 1989 | * **SEG6_LOCAL_ACTION_END_T** |
| | 1990 | * End.T action: Endpoint with specific IPv6 table lookup. |
| | 1991 | * Type of *param*: **int**. |
| | 1992 | * **SEG6_LOCAL_ACTION_END_B6** |
| | 1993 | * End.B6 action: Endpoint bound to an SRv6 policy. |
| | 1994 | * Type of param: **struct ipv6_sr_hdr**. |
| | 1995 | * **SEG6_LOCAL_ACTION_END_B6_ENCAP** |
| | 1996 | * End.B6.Encap action: Endpoint bound to an SRv6 |
| | 1997 | * encapsulation policy. |
| | 1998 | * Type of param: **struct ipv6_sr_hdr**. |
| | 1999 | * |
| | 2000 | * A call to this helper is susceptible to change the underlaying |
| | 2001 | * packet buffer. Therefore, at load time, all checks on pointers |
| | 2002 | * previously done by the verifier are invalidated and must be |
| | 2003 | * performed again, if the helper is used in combination with |
| | 2004 | * direct packet access. |
| | 2005 | * Return |
| | 2006 | * 0 on success, or a negative error in case of failure. |
| 1905 | */ | 2007 | */ |
| 1906 | #define __BPF_FUNC_MAPPER(FN) \ | 2008 | #define __BPF_FUNC_MAPPER(FN) \ |
| 1907 | FN(unspec), \ | 2009 | FN(unspec), \ |
| @@ -1976,7 +2078,11 @@ union bpf_attr { · 68 unmodified lines |
| 1976 | FN(fib_lookup), \ | 2078 | FN(fib_lookup), \ |
| 1977 | FN(sock_hash_update), \ | 2079 | FN(sock_hash_update), \ |
| 1978 | FN(msg_redirect_hash), \ | 2080 | FN(msg_redirect_hash), \ |
| 1979 | FN(sk_redirect_hash), | 2081 | FN(sk_redirect_hash), \ |
| | 2082 | FN(lwt_push_encap), \ |
| | 2083 | FN(lwt_seg6_store_bytes), \ |
| | 2084 | FN(lwt_seg6_adjust_srh), \ |
| | 2085 | FN(lwt_seg6_action), |
| 1980 | | 2086 | |
| 1981 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 2087 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 1982 | * function eBPF program intends to call | 2088 | * function eBPF program intends to call |
| @@ -2043,6 +2149,12 @@ enum bpf_hdr_start_off { · 60 unmodified lines |
| 2043 | BPF_HDR_START_NET, | 2149 | BPF_HDR_START_NET, |
| 2044 | }; | 2150 | }; |
| 2045 | | 2151 | |
| | 2152 | /* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */ |
| | 2153 | enum bpf_lwt_encap_mode { |
| | 2154 | BPF_LWT_ENCAP_SEG6, |
| | 2155 | BPF_LWT_ENCAP_SEG6_INLINE |
| | 2156 | }; |
| | 2157 | |
| 2046 | /* user accessible mirror of in-kernel sk_buff. | 2158 | /* user accessible mirror of in-kernel sk_buff. |
| 2047 | * new fields can only be added to the end of this structure | 2159 | * new fields can only be added to the end of this structure |
| 2048 | */ | 2160 | */ |
| @@ -2176,6 +2288,14 @@ enum sk_action { · 127 unmodified lines |
| 2176 | struct sk_msg_md { | 2288 | struct sk_msg_md { |
| 2177 | void *data; | 2289 | void *data; |
| 2178 | void *data_end; | 2290 | void *data_end; |
| | 2291 | |
| | 2292 | __u32 family; |
| | 2293 | __u32 remote_ip4; /* Stored in network byte order */ |
| | 2294 | __u32 local_ip4; /* Stored in network byte order */ |
| | 2295 | __u32 remote_ip6[4]; /* Stored in network byte order */ |
| | 2296 | __u32 local_ip6[4]; /* Stored in network byte order */ |
| | 2297 | __u32 remote_port; /* Stored in network byte order */ |
| | 2298 | __u32 local_port; /* stored in host byte order */ |
| 2179 | }; | 2299 | }; |
| 2180 | | 2300 | |
| 2181 | #define BPF_TAG_SIZE 8 | 2301 | #define BPF_TAG_SIZE 8 |
| @@ -2197,6 +2317,10 @@ struct bpf_prog_info { · 15 unmodified lines |
| 2197 | __u32 gpl_compatible:1; | 2317 | __u32 gpl_compatible:1; |
| 2198 | __u64 netns_dev; | 2318 | __u64 netns_dev; |
| 2199 | __u64 netns_ino; | 2319 | __u64 netns_ino; |
| | 2320 | __u32 nr_jited_ksyms; |
| | 2321 | __u32 nr_jited_func_lens; |
| | 2322 | __aligned_u64 jited_ksyms; |
| | 2323 | __aligned_u64 jited_func_lens; |
| 2200 | } __attribute__((aligned(8))); | 2324 | } __attribute__((aligned(8))); |
| 2201 | | 2325 | |
| 2202 | struct bpf_map_info { | 2326 | struct bpf_map_info { |
| @@ -2211,8 +2335,8 @@ struct bpf_map_info { · 8 unmodified lines |
| 2211 | __u64 netns_dev; | 2335 | __u64 netns_dev; |
| 2212 | __u64 netns_ino; | 2336 | __u64 netns_ino; |
| 2213 | __u32 btf_id; | 2337 | __u32 btf_id; |
| 2214 | __u32 btf_key_id; | 2338 | __u32 btf_key_type_id; |
| 2215 | __u32 btf_value_id; | 2339 | __u32 btf_value_type_id; |
| 2216 | } __attribute__((aligned(8))); | 2340 | } __attribute__((aligned(8))); |
| 2217 | | 2341 | |
| 2218 | struct bpf_btf_info { | 2342 | struct bpf_btf_info { |
| @@ -2450,4 +2574,13 @@ struct bpf_fib_lookup { · 231 unmodified lines |
| 2450 | __u8 dmac[6]; /* ETH_ALEN */ | 2574 | __u8 dmac[6]; /* ETH_ALEN */ |
| 2451 | }; | 2575 | }; |
| 2452 | | 2576 | |
| | 2577 | enum bpf_task_fd_type { |
| | 2578 | BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */ |
| | 2579 | BPF_FD_TYPE_TRACEPOINT, /* tp name */ |
| | 2580 | BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */ |
| | 2581 | BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */ |
| | 2582 | BPF_FD_TYPE_UPROBE, /* filename + offset */ |
| | 2583 | BPF_FD_TYPE_URETPROBE, /* filename + offset */ |
| | 2584 | }; |
| | 2585 | |
| 2453 | #endif /* _UAPI__LINUX_BPF_H__ */ | 2586 | #endif /* _UAPI__LINUX_BPF_H__ */ |