diff options
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/bpf.h | 96 |
1 files changed, 95 insertions, 1 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 344d2ddcef49..fdaf6a0bfa5b 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
| @@ -1902,6 +1902,90 @@ union bpf_attr { | |||
| 1902 | * egress otherwise). This is the only flag supported for now. | 1902 | * egress otherwise). This is the only flag supported for now. |
| 1903 | * Return | 1903 | * Return |
| 1904 | * **SK_PASS** on success, or **SK_DROP** on error. | 1904 | * **SK_PASS** on success, or **SK_DROP** on error. |
| 1905 | * | ||
| 1906 | * int bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len) | ||
| 1907 | * Description | ||
| 1908 | * Encapsulate the packet associated to *skb* within a Layer 3 | ||
| 1909 | * protocol header. This header is provided in the buffer at | ||
| 1910 | * address *hdr*, with *len* its size in bytes. *type* indicates | ||
| 1911 | * the protocol of the header and can be one of: | ||
| 1912 | * | ||
| 1913 | * **BPF_LWT_ENCAP_SEG6** | ||
| 1914 | * IPv6 encapsulation with Segment Routing Header | ||
| 1915 | * (**struct ipv6_sr_hdr**). *hdr* only contains the SRH, | ||
| 1916 | * the IPv6 header is computed by the kernel. | ||
| 1917 | * **BPF_LWT_ENCAP_SEG6_INLINE** | ||
| 1918 | * Only works if *skb* contains an IPv6 packet. Insert a | ||
| 1919 | * Segment Routing Header (**struct ipv6_sr_hdr**) inside | ||
| 1920 | * the IPv6 header. | ||
| 1921 | * | ||
| 1922 | * A call to this helper is susceptible to change the underlaying | ||
| 1923 | * packet buffer. Therefore, at load time, all checks on pointers | ||
| 1924 | * previously done by the verifier are invalidated and must be | ||
| 1925 | * performed again, if the helper is used in combination with | ||
| 1926 | * direct packet access. | ||
| 1927 | * Return | ||
| 1928 | * 0 on success, or a negative error in case of failure. | ||
| 1929 | * | ||
| 1930 | * int bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len) | ||
| 1931 | * Description | ||
| 1932 | * Store *len* bytes from address *from* into the packet | ||
| 1933 | * associated to *skb*, at *offset*. Only the flags, tag and TLVs | ||
| 1934 | * inside the outermost IPv6 Segment Routing Header can be | ||
| 1935 | * modified through this helper. | ||
| 1936 | * | ||
| 1937 | * A call to this helper is susceptible to change the underlaying | ||
| 1938 | * packet buffer. Therefore, at load time, all checks on pointers | ||
| 1939 | * previously done by the verifier are invalidated and must be | ||
| 1940 | * performed again, if the helper is used in combination with | ||
| 1941 | * direct packet access. | ||
| 1942 | * Return | ||
| 1943 | * 0 on success, or a negative error in case of failure. | ||
| 1944 | * | ||
| 1945 | * int bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta) | ||
| 1946 | * Description | ||
| 1947 | * Adjust the size allocated to TLVs in the outermost IPv6 | ||
| 1948 | * Segment Routing Header contained in the packet associated to | ||
| 1949 | * *skb*, at position *offset* by *delta* bytes. Only offsets | ||
| 1950 | * after the segments are accepted. *delta* can be as well | ||
| 1951 | * positive (growing) as negative (shrinking). | ||
| 1952 | * | ||
| 1953 | * A call to this helper is susceptible to change the underlaying | ||
| 1954 | * packet buffer. Therefore, at load time, all checks on pointers | ||
| 1955 | * previously done by the verifier are invalidated and must be | ||
| 1956 | * performed again, if the helper is used in combination with | ||
| 1957 | * direct packet access. | ||
| 1958 | * Return | ||
| 1959 | * 0 on success, or a negative error in case of failure. | ||
| 1960 | * | ||
| 1961 | * int bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len) | ||
| 1962 | * Description | ||
| 1963 | * Apply an IPv6 Segment Routing action of type *action* to the | ||
| 1964 | * packet associated to *skb*. Each action takes a parameter | ||
| 1965 | * contained at address *param*, and of length *param_len* bytes. | ||
| 1966 | * *action* can be one of: | ||
| 1967 | * | ||
| 1968 | * **SEG6_LOCAL_ACTION_END_X** | ||
| 1969 | * End.X action: Endpoint with Layer-3 cross-connect. | ||
| 1970 | * Type of *param*: **struct in6_addr**. | ||
| 1971 | * **SEG6_LOCAL_ACTION_END_T** | ||
| 1972 | * End.T action: Endpoint with specific IPv6 table lookup. | ||
| 1973 | * Type of *param*: **int**. | ||
| 1974 | * **SEG6_LOCAL_ACTION_END_B6** | ||
| 1975 | * End.B6 action: Endpoint bound to an SRv6 policy. | ||
| 1976 | * Type of param: **struct ipv6_sr_hdr**. | ||
| 1977 | * **SEG6_LOCAL_ACTION_END_B6_ENCAP** | ||
| 1978 | * End.B6.Encap action: Endpoint bound to an SRv6 | ||
| 1979 | * encapsulation policy. | ||
| 1980 | * Type of param: **struct ipv6_sr_hdr**. | ||
| 1981 | * | ||
| 1982 | * A call to this helper is susceptible to change the underlaying | ||
| 1983 | * packet buffer. Therefore, at load time, all checks on pointers | ||
| 1984 | * previously done by the verifier are invalidated and must be | ||
| 1985 | * performed again, if the helper is used in combination with | ||
| 1986 | * direct packet access. | ||
| 1987 | * Return | ||
| 1988 | * 0 on success, or a negative error in case of failure. | ||
| 1905 | */ | 1989 | */ |
| 1906 | #define __BPF_FUNC_MAPPER(FN) \ | 1990 | #define __BPF_FUNC_MAPPER(FN) \ |
| 1907 | FN(unspec), \ | 1991 | FN(unspec), \ |
| @@ -1976,7 +2060,11 @@ union bpf_attr { | |||
| 1976 | FN(fib_lookup), \ | 2060 | FN(fib_lookup), \ |
| 1977 | FN(sock_hash_update), \ | 2061 | FN(sock_hash_update), \ |
| 1978 | FN(msg_redirect_hash), \ | 2062 | FN(msg_redirect_hash), \ |
| 1979 | FN(sk_redirect_hash), | 2063 | FN(sk_redirect_hash), \ |
| 2064 | FN(lwt_push_encap), \ | ||
| 2065 | FN(lwt_seg6_store_bytes), \ | ||
| 2066 | FN(lwt_seg6_adjust_srh), \ | ||
| 2067 | FN(lwt_seg6_action), | ||
| 1980 | 2068 | ||
| 1981 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 2069 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 1982 | * function eBPF program intends to call | 2070 | * function eBPF program intends to call |
| @@ -2043,6 +2131,12 @@ enum bpf_hdr_start_off { | |||
| 2043 | BPF_HDR_START_NET, | 2131 | BPF_HDR_START_NET, |
| 2044 | }; | 2132 | }; |
| 2045 | 2133 | ||
| 2134 | /* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */ | ||
| 2135 | enum bpf_lwt_encap_mode { | ||
| 2136 | BPF_LWT_ENCAP_SEG6, | ||
| 2137 | BPF_LWT_ENCAP_SEG6_INLINE | ||
| 2138 | }; | ||
| 2139 | |||
| 2046 | /* user accessible mirror of in-kernel sk_buff. | 2140 | /* user accessible mirror of in-kernel sk_buff. |
| 2047 | * new fields can only be added to the end of this structure | 2141 | * new fields can only be added to the end of this structure |
| 2048 | */ | 2142 | */ |
