mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 05:14:41 -04:00
bpf: Add BPF_F_ADJ_ROOM_DECAP_* flags for tunnel decapsulation
Add new bpf_skb_adjust_room() decapsulation flags: - BPF_F_ADJ_ROOM_DECAP_L4_GRE - BPF_F_ADJ_ROOM_DECAP_L4_UDP - BPF_F_ADJ_ROOM_DECAP_IPXIP4 - BPF_F_ADJ_ROOM_DECAP_IPXIP6 These flags let BPF programs describe which tunnel layer is being removed, so later changes can update tunnel-related GSO state accordingly during decapsulation. This patch only introduces the UAPI flag definitions and helper documentation. Co-developed-by: Max Tottenham <mtottenh@akamai.com> Co-developed-by: Anna Glasgall <aglasgal@akamai.com> Signed-off-by: Max Tottenham <mtottenh@akamai.com> Signed-off-by: Anna Glasgall <aglasgal@akamai.com> Signed-off-by: Nick Hudson <nhudson@akamai.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://lore.kernel.org/bpf/20260812083115.73100-4-nhudson@akamai.com
This commit is contained in:
committed by
Daniel Borkmann
parent
7b2ea1151e
commit
da199070bc
@@ -3038,8 +3038,34 @@ union bpf_attr {
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L3_IPV4**,
|
||||
* **BPF_F_ADJ_ROOM_DECAP_L3_IPV6**:
|
||||
* Indicate the new IP header version after decapsulating the outer
|
||||
* IP header. Used when the inner and outer IP versions are different.
|
||||
* Indicate the new IP header version after decapsulating the
|
||||
* outer IP header. Used when the inner and outer IP versions
|
||||
* are different. These flags only trigger a protocol change
|
||||
* without clearing any tunnel-specific GSO flags.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L4_GRE**:
|
||||
* Clear GRE tunnel GSO flags (SKB_GSO_GRE and SKB_GSO_GRE_CSUM)
|
||||
* when decapsulating a GRE tunnel.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L4_UDP**:
|
||||
* Clear UDP tunnel GSO flags (SKB_GSO_UDP_TUNNEL and
|
||||
* SKB_GSO_UDP_TUNNEL_CSUM) when decapsulating a UDP tunnel.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_IPXIP4**:
|
||||
* Clear IPIP/SIT tunnel GSO flag (SKB_GSO_IPXIP4) when decapsulating
|
||||
* a tunnel with an outer IPv4 header (IPv4-in-IPv4 or IPv6-in-IPv4).
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_IPXIP6**:
|
||||
* Clear IPv6 encapsulation tunnel GSO flag (SKB_GSO_IPXIP6) when
|
||||
* decapsulating a tunnel with an outer IPv6 header (IPv6-in-IPv6
|
||||
* or IPv4-in-IPv6).
|
||||
*
|
||||
* When using the decapsulation flags above, the skb->encapsulation
|
||||
* flag is automatically cleared if all tunnel-specific GSO flags
|
||||
* (SKB_GSO_UDP_TUNNEL, SKB_GSO_UDP_TUNNEL_CSUM, SKB_GSO_GRE,
|
||||
* SKB_GSO_GRE_CSUM, SKB_GSO_IPXIP4, SKB_GSO_IPXIP6) have been
|
||||
* removed from the packet. This handles cases where all tunnel
|
||||
* layers have been decapsulated.
|
||||
*
|
||||
* A call to this helper is susceptible to change the underlying
|
||||
* packet buffer. Therefore, at load time, all checks on pointers
|
||||
@@ -6293,6 +6319,10 @@ enum bpf_adj_room_flags {
|
||||
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6),
|
||||
BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7),
|
||||
BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8),
|
||||
BPF_F_ADJ_ROOM_DECAP_L4_GRE = (1ULL << 9),
|
||||
BPF_F_ADJ_ROOM_DECAP_L4_UDP = (1ULL << 10),
|
||||
BPF_F_ADJ_ROOM_DECAP_IPXIP4 = (1ULL << 11),
|
||||
BPF_F_ADJ_ROOM_DECAP_IPXIP6 = (1ULL << 12),
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
@@ -3038,8 +3038,34 @@ union bpf_attr {
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L3_IPV4**,
|
||||
* **BPF_F_ADJ_ROOM_DECAP_L3_IPV6**:
|
||||
* Indicate the new IP header version after decapsulating the outer
|
||||
* IP header. Used when the inner and outer IP versions are different.
|
||||
* Indicate the new IP header version after decapsulating the
|
||||
* outer IP header. Used when the inner and outer IP versions
|
||||
* are different. These flags only trigger a protocol change
|
||||
* without clearing any tunnel-specific GSO flags.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L4_GRE**:
|
||||
* Clear GRE tunnel GSO flags (SKB_GSO_GRE and SKB_GSO_GRE_CSUM)
|
||||
* when decapsulating a GRE tunnel.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_L4_UDP**:
|
||||
* Clear UDP tunnel GSO flags (SKB_GSO_UDP_TUNNEL and
|
||||
* SKB_GSO_UDP_TUNNEL_CSUM) when decapsulating a UDP tunnel.
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_IPXIP4**:
|
||||
* Clear IPIP/SIT tunnel GSO flag (SKB_GSO_IPXIP4) when decapsulating
|
||||
* a tunnel with an outer IPv4 header (IPv4-in-IPv4 or IPv6-in-IPv4).
|
||||
*
|
||||
* * **BPF_F_ADJ_ROOM_DECAP_IPXIP6**:
|
||||
* Clear IPv6 encapsulation tunnel GSO flag (SKB_GSO_IPXIP6) when
|
||||
* decapsulating a tunnel with an outer IPv6 header (IPv6-in-IPv6
|
||||
* or IPv4-in-IPv6).
|
||||
*
|
||||
* When using the decapsulation flags above, the skb->encapsulation
|
||||
* flag is automatically cleared if all tunnel-specific GSO flags
|
||||
* (SKB_GSO_UDP_TUNNEL, SKB_GSO_UDP_TUNNEL_CSUM, SKB_GSO_GRE,
|
||||
* SKB_GSO_GRE_CSUM, SKB_GSO_IPXIP4, SKB_GSO_IPXIP6) have been
|
||||
* removed from the packet. This handles cases where all tunnel
|
||||
* layers have been decapsulated.
|
||||
*
|
||||
* A call to this helper is susceptible to change the underlying
|
||||
* packet buffer. Therefore, at load time, all checks on pointers
|
||||
@@ -6293,6 +6319,10 @@ enum bpf_adj_room_flags {
|
||||
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6),
|
||||
BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7),
|
||||
BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8),
|
||||
BPF_F_ADJ_ROOM_DECAP_L4_GRE = (1ULL << 9),
|
||||
BPF_F_ADJ_ROOM_DECAP_L4_UDP = (1ULL << 10),
|
||||
BPF_F_ADJ_ROOM_DECAP_IPXIP4 = (1ULL << 11),
|
||||
BPF_F_ADJ_ROOM_DECAP_IPXIP6 = (1ULL << 12),
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user