Defined a private status notify to transport arbitrary RADIUS attributes
[strongswan.git] / src / libcharon / encoding / payloads / notify_payload.c
index d1c2ac5..fef2949 100644 (file)
@@ -56,7 +56,9 @@ ENUM_NEXT(notify_type_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUTHENTIC
        "CHILD_SA_NOT_FOUND");
 ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
        "ME_CONNECT_FAILED");
        "CHILD_SA_NOT_FOUND");
 ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
        "ME_CONNECT_FAILED");
-ENUM_NEXT(notify_type_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNECT_FAILED,
+ENUM_NEXT(notify_type_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
+       "MS_NOTIFY_STATUS");
+ENUM_NEXT(notify_type_names, INITIAL_CONTACT, IPSEC_REPLAY_COUNTER_SYNC, MS_NOTIFY_STATUS,
        "INITIAL_CONTACT",
        "SET_WINDOW_SIZE",
        "ADDITIONAL_TS_POSSIBLE",
        "INITIAL_CONTACT",
        "SET_WINDOW_SIZE",
        "ADDITIONAL_TS_POSSIBLE",
@@ -90,18 +92,25 @@ ENUM_NEXT(notify_type_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNEC
        "LINK_ID",
        "USE_WESP_MODE",
        "ROHC_SUPPORTED",
        "LINK_ID",
        "USE_WESP_MODE",
        "ROHC_SUPPORTED",
-       "EAP_ONLY_AUTHENTICATION");
-ENUM_NEXT(notify_type_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
+       "EAP_ONLY_AUTHENTICATION",
+       "CHILDLESS_IKEV2_SUPPORTED",
+       "QUICK_CRASH_DETECTION",
+       "IKEV2_MESSAGE_ID_SYNC_SUPPORTED",
+       "IKEV2_REPLAY_COUNTER_SYNC_SUPPORTED",
+       "IKEV2_MESSAGE_ID_SYNC",
+       "IPSEC_REPLAY_COUNTER_SYNC");
+ENUM_NEXT(notify_type_names, USE_BEET_MODE, USE_BEET_MODE, IPSEC_REPLAY_COUNTER_SYNC,
        "USE_BEET_MODE");
        "USE_BEET_MODE");
-ENUM_NEXT(notify_type_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
+ENUM_NEXT(notify_type_names, ME_MEDIATION, RADIUS_ATTRIBUTE, USE_BEET_MODE,
        "ME_MEDIATION",
        "ME_ENDPOINT",
        "ME_CALLBACK",
        "ME_CONNECTID",
        "ME_CONNECTKEY",
        "ME_CONNECTAUTH",
        "ME_MEDIATION",
        "ME_ENDPOINT",
        "ME_CALLBACK",
        "ME_CONNECTID",
        "ME_CONNECTKEY",
        "ME_CONNECTAUTH",
-       "ME_RESPONSE");
-ENUM_END(notify_type_names, ME_RESPONSE);
+       "ME_RESPONSE",
+       "RADIUS_ATTRIBUTE",);
+ENUM_END(notify_type_names, RADIUS_ATTRIBUTE);
 
 
 ENUM_BEGIN(notify_type_short_names, UNSUPPORTED_CRITICAL_PAYLOAD, UNSUPPORTED_CRITICAL_PAYLOAD,
 
 
 ENUM_BEGIN(notify_type_short_names, UNSUPPORTED_CRITICAL_PAYLOAD, UNSUPPORTED_CRITICAL_PAYLOAD,
@@ -135,11 +144,13 @@ ENUM_NEXT(notify_type_short_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUT
        "NO_CHILD_SA");
 ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
        "ME_CONN_FAIL");
        "NO_CHILD_SA");
 ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
        "ME_CONN_FAIL");
-ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNECT_FAILED,
+ENUM_NEXT(notify_type_short_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
+       "MS_STATUS");
+ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, IPSEC_REPLAY_COUNTER_SYNC, MS_NOTIFY_STATUS,
        "INIT_CONTACT",
        "SET_WINSIZE",
        "ADD_TS_POSS",
        "INIT_CONTACT",
        "SET_WINSIZE",
        "ADD_TS_POSS",
-       "IPCOMP_SUPP",
+       "IPCOMP_SUP",
        "NATD_S_IP",
        "NATD_D_IP",
        "COOKIE",
        "NATD_S_IP",
        "NATD_D_IP",
        "COOKIE",
@@ -169,18 +180,25 @@ ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_
        "LINK_ID",
        "WESP_MODE",
        "ROHC_SUP",
        "LINK_ID",
        "WESP_MODE",
        "ROHC_SUP",
-       "EAP_ONLY");
-ENUM_NEXT(notify_type_short_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
+       "EAP_ONLY",
+       "CHDLESS_SUP",
+       "CRASH_DET",
+       "MSG_ID_SYN_SUP",
+       "RPL_CTR_SYN_SUP",
+       "MSG_ID_SYN",
+       "RPL_CTR_SYN");
+ENUM_NEXT(notify_type_short_names, USE_BEET_MODE, USE_BEET_MODE, IPSEC_REPLAY_COUNTER_SYNC,
        "BEET_MODE");
        "BEET_MODE");
-ENUM_NEXT(notify_type_short_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
+ENUM_NEXT(notify_type_short_names, ME_MEDIATION, RADIUS_ATTRIBUTE, USE_BEET_MODE,
        "ME_MED",
        "ME_EP",
        "ME_CB",
        "ME_CID",
        "ME_CKEY",
        "ME_CAUTH",
        "ME_MED",
        "ME_EP",
        "ME_CB",
        "ME_CID",
        "ME_CKEY",
        "ME_CAUTH",
-       "ME_R");
-ENUM_END(notify_type_short_names, ME_RESPONSE);
+       "ME_R",
+       "RADIUS");
+ENUM_END(notify_type_short_names, RADIUS_ATTRIBUTE);
 
 
 typedef struct private_notify_payload_t private_notify_payload_t;
 
 
 typedef struct private_notify_payload_t private_notify_payload_t;
@@ -206,6 +224,11 @@ struct private_notify_payload_t {
        bool critical;
 
        /**
        bool critical;
 
        /**
+        * reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -248,13 +271,13 @@ encoding_rule_t notify_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_notify_payload_t, critical)                    },
        /* 7 Bit reserved bits, nowhere stored */
        /* the critical bit */
        { FLAG,                         offsetof(private_notify_payload_t, critical)                    },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[0])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[1])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[2])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[3])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[4])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[5])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[6])                 },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_notify_payload_t, payload_length)              },
        /* Protocol ID as 8 bit field*/
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_notify_payload_t, payload_length)              },
        /* Protocol ID as 8 bit field*/