include: Update XFRM header for SA direction attribute

This commit is contained in:
Tobias Brunner
2024-08-07 14:41:28 +02:00
parent 84bd011752
commit b05628dd2d
+40 -7
View File
@@ -30,7 +30,7 @@ struct xfrm_sec_ctx {
__u8 ctx_alg; __u8 ctx_alg;
__u16 ctx_len; __u16 ctx_len;
__u32 ctx_sid; __u32 ctx_sid;
char ctx_str[0]; char ctx_str[];
}; };
/* Security Context Domains of Interpretation */ /* Security Context Domains of Interpretation */
@@ -93,27 +93,27 @@ struct xfrm_replay_state_esn {
__u32 oseq_hi; __u32 oseq_hi;
__u32 seq_hi; __u32 seq_hi;
__u32 replay_window; __u32 replay_window;
__u32 bmp[0]; __u32 bmp[];
}; };
struct xfrm_algo { struct xfrm_algo {
char alg_name[64]; char alg_name[64];
unsigned int alg_key_len; /* in bits */ unsigned int alg_key_len; /* in bits */
char alg_key[0]; char alg_key[];
}; };
struct xfrm_algo_auth { struct xfrm_algo_auth {
char alg_name[64]; char alg_name[64];
unsigned int alg_key_len; /* in bits */ unsigned int alg_key_len; /* in bits */
unsigned int alg_trunc_len; /* in bits */ unsigned int alg_trunc_len; /* in bits */
char alg_key[0]; char alg_key[];
}; };
struct xfrm_algo_aead { struct xfrm_algo_aead {
char alg_name[64]; char alg_name[64];
unsigned int alg_key_len; /* in bits */ unsigned int alg_key_len; /* in bits */
unsigned int alg_icv_len; /* in bits */ unsigned int alg_icv_len; /* in bits */
char alg_key[0]; char alg_key[];
}; };
struct xfrm_stats { struct xfrm_stats {
@@ -137,6 +137,11 @@ enum {
XFRM_POLICY_MAX = 3 XFRM_POLICY_MAX = 3
}; };
enum xfrm_sa_dir {
XFRM_SA_DIR_IN = 1,
XFRM_SA_DIR_OUT = 2
};
enum { enum {
XFRM_SHARE_ANY, /* No limitations */ XFRM_SHARE_ANY, /* No limitations */
XFRM_SHARE_SESSION, /* For this session only */ XFRM_SHARE_SESSION, /* For this session only */
@@ -212,6 +217,11 @@ enum {
XFRM_MSG_MAPPING, XFRM_MSG_MAPPING,
#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
XFRM_MSG_SETDEFAULT,
#define XFRM_MSG_SETDEFAULT XFRM_MSG_SETDEFAULT
XFRM_MSG_GETDEFAULT,
#define XFRM_MSG_GETDEFAULT XFRM_MSG_GETDEFAULT
__XFRM_MSG_MAX __XFRM_MSG_MAX
}; };
#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -288,7 +298,7 @@ enum xfrm_attr_type_t {
XFRMA_ETIMER_THRESH, XFRMA_ETIMER_THRESH,
XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_SRCADDR, /* xfrm_address_t */
XFRMA_COADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */
XFRMA_LASTUSED, /* __u64 */ XFRMA_LASTUSED, /* __u64 */
XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
XFRMA_MIGRATE, XFRMA_MIGRATE,
XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
@@ -301,10 +311,12 @@ enum xfrm_attr_type_t {
XFRMA_PROTO, /* __u8 */ XFRMA_PROTO, /* __u8 */
XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
XFRMA_PAD, XFRMA_PAD,
XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */ XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */
XFRMA_SET_MARK, /* __u32 */ XFRMA_SET_MARK, /* __u32 */
XFRMA_SET_MARK_MASK, /* __u32 */ XFRMA_SET_MARK_MASK, /* __u32 */
XFRMA_IF_ID, /* __u32 */ XFRMA_IF_ID, /* __u32 */
XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */
XFRMA_SA_DIR, /* __u8 */
__XFRMA_MAX __XFRMA_MAX
#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */
@@ -384,6 +396,7 @@ struct xfrm_usersa_info {
}; };
#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
#define XFRM_SA_XFLAG_OSEQ_MAY_WRAP 2
struct xfrm_usersa_id { struct xfrm_usersa_id {
xfrm_address_t daddr; xfrm_address_t daddr;
@@ -501,10 +514,30 @@ struct xfrm_user_offload {
int ifindex; int ifindex;
__u8 flags; __u8 flags;
}; };
/* This flag was exposed without any kernel code that supports it.
* Unfortunately, strongswan has the code that sets this flag,
* which makes it impossible to reuse this bit.
*
* So leave it here to make sure that it won't be reused by mistake.
*/
#define XFRM_OFFLOAD_IPV6 1 #define XFRM_OFFLOAD_IPV6 1
#define XFRM_OFFLOAD_INBOUND 2 #define XFRM_OFFLOAD_INBOUND 2
/* Two bits above are relevant for state path only, while
* offload is used for both policy and state flows.
*
* In policy offload mode, they are free and can be safely reused.
*/
#define XFRM_OFFLOAD_PACKET 4 #define XFRM_OFFLOAD_PACKET 4
struct xfrm_userpolicy_default {
#define XFRM_USERPOLICY_UNSPEC 0
#define XFRM_USERPOLICY_BLOCK 1
#define XFRM_USERPOLICY_ACCEPT 2
__u8 in;
__u8 fwd;
__u8 out;
};
#ifndef __KERNEL__ #ifndef __KERNEL__
/* backwards compatibility for userspace */ /* backwards compatibility for userspace */
#define XFRMGRP_ACQUIRE 1 #define XFRMGRP_ACQUIRE 1