]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
include: Update XFRM header for SA direction attribute
authorTobias Brunner <tobias@strongswan.org>
Tue, 30 Apr 2024 09:09:41 +0000 (11:09 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 7 Aug 2024 12:41:28 +0000 (14:41 +0200)
src/include/linux/xfrm.h

index 80630dfd4a59ac7f282901d7cb2a496a2a801d12..0c2191bf9f42117ccd0352217834c1271369da8c 100644 (file)
@@ -30,7 +30,7 @@ struct xfrm_sec_ctx {
        __u8    ctx_alg;
        __u16   ctx_len;
        __u32   ctx_sid;
-       char    ctx_str[0];
+       char    ctx_str[];
 };
 
 /* Security Context Domains of Interpretation */
@@ -93,27 +93,27 @@ struct xfrm_replay_state_esn {
        __u32           oseq_hi;
        __u32           seq_hi;
        __u32           replay_window;
-       __u32           bmp[0];
+       __u32           bmp[];
 };
 
 struct xfrm_algo {
        char            alg_name[64];
        unsigned int    alg_key_len;    /* in bits */
-       char            alg_key[0];
+       char            alg_key[];
 };
 
 struct xfrm_algo_auth {
        char            alg_name[64];
        unsigned int    alg_key_len;    /* in bits */
        unsigned int    alg_trunc_len;  /* in bits */
-       char            alg_key[0];
+       char            alg_key[];
 };
 
 struct xfrm_algo_aead {
        char            alg_name[64];
        unsigned int    alg_key_len;    /* in bits */
        unsigned int    alg_icv_len;    /* in bits */
-       char            alg_key[0];
+       char            alg_key[];
 };
 
 struct xfrm_stats {
@@ -137,6 +137,11 @@ enum {
        XFRM_POLICY_MAX = 3
 };
 
+enum xfrm_sa_dir {
+       XFRM_SA_DIR_IN  = 1,
+       XFRM_SA_DIR_OUT = 2
+};
+
 enum {
        XFRM_SHARE_ANY,         /* No limitations */
        XFRM_SHARE_SESSION,     /* For this session only */
@@ -212,6 +217,11 @@ enum {
 
        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
 };
 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -288,7 +298,7 @@ enum xfrm_attr_type_t {
        XFRMA_ETIMER_THRESH,
        XFRMA_SRCADDR,          /* xfrm_address_t */
        XFRMA_COADDR,           /* xfrm_address_t */
-       XFRMA_LASTUSED,         /* __u64  */
+       XFRMA_LASTUSED,         /* __u64 */
        XFRMA_POLICY_TYPE,      /* struct xfrm_userpolicy_type */
        XFRMA_MIGRATE,
        XFRMA_ALG_AEAD,         /* struct xfrm_algo_aead */
@@ -301,10 +311,12 @@ enum xfrm_attr_type_t {
        XFRMA_PROTO,            /* __u8 */
        XFRMA_ADDRESS_FILTER,   /* struct xfrm_address_filter */
        XFRMA_PAD,
-       XFRMA_OFFLOAD_DEV,      /* struct xfrm_state_offload */
+       XFRMA_OFFLOAD_DEV,      /* struct xfrm_user_offload */
        XFRMA_SET_MARK,         /* __u32 */
        XFRMA_SET_MARK_MASK,    /* __u32 */
        XFRMA_IF_ID,            /* __u32 */
+       XFRMA_MTIMER_THRESH,    /* __u32 in seconds for input SA */
+       XFRMA_SA_DIR,           /* __u8 */
        __XFRMA_MAX
 
 #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_OSEQ_MAY_WRAP    2
 
 struct xfrm_usersa_id {
        xfrm_address_t                  daddr;
@@ -501,10 +514,30 @@ struct xfrm_user_offload {
        int                             ifindex;
        __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_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
 
+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__
 /* backwards compatibility for userspace */
 #define XFRMGRP_ACQUIRE                1