mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Eyal Birger](/assets/img/avatar_default.png)
Allow specifying the xfrm interface if_id and link as part of a route metadata using the lwtunnel infrastructure. This allows for example using a single xfrm interface in collect_md mode as the target of multiple routes each specifying a different if_id. With the appropriate changes to iproute2, considering an xfrm device ipsec1 in collect_md mode one can for example add a route specifying an if_id like so: ip route add <SUBNET> dev ipsec1 encap xfrm if_id 1 In which case traffic routed to the device via this route would use if_id in the xfrm interface policy lookup. Or in the context of vrf, one can also specify the "link" property: ip route add <SUBNET> dev ipsec1 encap xfrm if_id 1 link_dev eth15 Note: LWT_XFRM_LINK uses NLA_U32 similar to IFLA_XFRM_LINK even though internally "link" is signed. This is consistent with other _LINK attributes in other devices as well as in bpf and should not have an effect as device indexes can't be negative. Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Eyal Birger <eyal.birger@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
124 lines
2.3 KiB
C
124 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
#ifndef _UAPI_LWTUNNEL_H_
|
|
#define _UAPI_LWTUNNEL_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
enum lwtunnel_encap_types {
|
|
LWTUNNEL_ENCAP_NONE,
|
|
LWTUNNEL_ENCAP_MPLS,
|
|
LWTUNNEL_ENCAP_IP,
|
|
LWTUNNEL_ENCAP_ILA,
|
|
LWTUNNEL_ENCAP_IP6,
|
|
LWTUNNEL_ENCAP_SEG6,
|
|
LWTUNNEL_ENCAP_BPF,
|
|
LWTUNNEL_ENCAP_SEG6_LOCAL,
|
|
LWTUNNEL_ENCAP_RPL,
|
|
LWTUNNEL_ENCAP_IOAM6,
|
|
LWTUNNEL_ENCAP_XFRM,
|
|
__LWTUNNEL_ENCAP_MAX,
|
|
};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IP_OPT_GENEVE_MAX,
|
|
};
|
|
|
|
#define LWTUNNEL_IP_OPT_GENEVE_MAX (__LWTUNNEL_IP_OPT_GENEVE_MAX - 1)
|
|
|
|
enum {
|
|
LWTUNNEL_IP_OPT_VXLAN_UNSPEC,
|
|
LWTUNNEL_IP_OPT_VXLAN_GBP,
|
|
__LWTUNNEL_IP_OPT_VXLAN_MAX,
|
|
};
|
|
|
|
#define LWTUNNEL_IP_OPT_VXLAN_MAX (__LWTUNNEL_IP_OPT_VXLAN_MAX - 1)
|
|
|
|
enum {
|
|
LWTUNNEL_IP_OPT_ERSPAN_UNSPEC,
|
|
LWTUNNEL_IP_OPT_ERSPAN_VER,
|
|
LWTUNNEL_IP_OPT_ERSPAN_INDEX,
|
|
LWTUNNEL_IP_OPT_ERSPAN_DIR,
|
|
LWTUNNEL_IP_OPT_ERSPAN_HWID,
|
|
__LWTUNNEL_IP_OPT_ERSPAN_MAX,
|
|
};
|
|
|
|
#define LWTUNNEL_IP_OPT_ERSPAN_MAX (__LWTUNNEL_IP_OPT_ERSPAN_MAX - 1)
|
|
|
|
enum {
|
|
LWT_BPF_PROG_UNSPEC,
|
|
LWT_BPF_PROG_FD,
|
|
LWT_BPF_PROG_NAME,
|
|
__LWT_BPF_PROG_MAX,
|
|
};
|
|
|
|
#define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1)
|
|
|
|
enum {
|
|
LWT_BPF_UNSPEC,
|
|
LWT_BPF_IN,
|
|
LWT_BPF_OUT,
|
|
LWT_BPF_XMIT,
|
|
LWT_BPF_XMIT_HEADROOM,
|
|
__LWT_BPF_MAX,
|
|
};
|
|
|
|
#define LWT_BPF_MAX (__LWT_BPF_MAX - 1)
|
|
|
|
#define LWT_BPF_MAX_HEADROOM 256
|
|
|
|
enum {
|
|
LWT_XFRM_UNSPEC,
|
|
LWT_XFRM_IF_ID,
|
|
LWT_XFRM_LINK,
|
|
__LWT_XFRM_MAX,
|
|
};
|
|
|
|
#define LWT_XFRM_MAX (__LWT_XFRM_MAX - 1)
|
|
|
|
#endif /* _UAPI_LWTUNNEL_H_ */
|