ha: Add DH group to IKE_ADD message
[strongswan.git] / src / libcharon / plugins / ha / ha_message.c
index 16e214b..b40219c 100644 (file)
@@ -46,7 +46,7 @@ struct private_ha_message_t {
        chunk_t buf;
 };
 
-ENUM(ha_message_type_names, HA_IKE_ADD, HA_RESYNC,
+ENUM(ha_message_type_names, HA_IKE_ADD, HA_IKE_IV,
        "IKE_ADD",
        "IKE_UPDATE",
        "IKE_MID_INITIATOR",
@@ -58,6 +58,7 @@ ENUM(ha_message_type_names, HA_IKE_ADD, HA_RESYNC,
        "SEGMENT_TAKE",
        "STATUS",
        "RESYNC",
+       "IKE_IV",
 );
 
 typedef struct ike_sa_id_encoding_t ike_sa_id_encoding_t;
@@ -66,6 +67,7 @@ typedef struct ike_sa_id_encoding_t ike_sa_id_encoding_t;
  * Encoding if an ike_sa_id_t
  */
 struct ike_sa_id_encoding_t {
+       u_int8_t ike_version;
        u_int64_t initiator_spi;
        u_int64_t responder_spi;
        u_int8_t initiator;
@@ -156,6 +158,7 @@ METHOD(ha_message_t, add_attribute, void,
                        enc = (ike_sa_id_encoding_t*)(this->buf.ptr + this->buf.len);
                        this->buf.len += sizeof(ike_sa_id_encoding_t);
                        enc->initiator = id->is_initiator(id);
+                       enc->ike_version = id->get_ike_version(id);
                        enc->initiator_spi = id->get_initiator_spi(id);
                        enc->responder_spi = id->get_responder_spi(id);
                        break;
@@ -163,6 +166,7 @@ METHOD(ha_message_t, add_attribute, void,
                /* identification_t* */
                case HA_LOCAL_ID:
                case HA_REMOTE_ID:
+               case HA_REMOTE_EAP_ID:
                {
                        identification_encoding_t *enc;
                        identification_t *id;
@@ -183,7 +187,7 @@ METHOD(ha_message_t, add_attribute, void,
                case HA_REMOTE_ADDR:
                case HA_LOCAL_VIP:
                case HA_REMOTE_VIP:
-               case HA_ADDITIONAL_ADDR:
+               case HA_PEER_ADDR:
                {
                        host_encoding_t *enc;
                        host_t *host;
@@ -212,6 +216,7 @@ METHOD(ha_message_t, add_attribute, void,
                        break;
                }
                /* u_int8_t */
+               case HA_IKE_VERSION:
                case HA_INITIATOR:
                case HA_IPSEC_MODE:
                case HA_IPCOMP:
@@ -225,6 +230,7 @@ METHOD(ha_message_t, add_attribute, void,
                        break;
                }
                /* u_int16_t */
+               case HA_ALG_DH:
                case HA_ALG_PRF:
                case HA_ALG_OLD_PRF:
                case HA_ALG_ENCR:
@@ -233,6 +239,7 @@ METHOD(ha_message_t, add_attribute, void,
                case HA_INBOUND_CPI:
                case HA_OUTBOUND_CPI:
                case HA_SEGMENT:
+               case HA_ESN:
                {
                        u_int16_t val;
 
@@ -261,6 +268,10 @@ METHOD(ha_message_t, add_attribute, void,
                case HA_NONCE_I:
                case HA_NONCE_R:
                case HA_SECRET:
+               case HA_LOCAL_DH:
+               case HA_REMOTE_DH:
+               case HA_PSK:
+               case HA_IV:
                case HA_OLD_SKD:
                {
                        chunk_t chunk;
@@ -349,8 +360,9 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                                return FALSE;
                        }
                        enc = (ike_sa_id_encoding_t*)(this->buf.ptr);
-                       value->ike_sa_id = ike_sa_id_create(enc->initiator_spi,
-                                                                                       enc->responder_spi, enc->initiator);
+                       value->ike_sa_id = ike_sa_id_create(enc->ike_version,
+                                                                               enc->initiator_spi, enc->responder_spi,
+                                                                               enc->initiator);
                        *attr_out = attr;
                        this->cleanup = (void*)value->ike_sa_id->destroy;
                        this->cleanup_data = value->ike_sa_id;
@@ -360,6 +372,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                /* identification_t* */
                case HA_LOCAL_ID:
                case HA_REMOTE_ID:
+               case HA_REMOTE_EAP_ID:
                {
                        identification_encoding_t *enc;
 
@@ -383,7 +396,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                case HA_REMOTE_ADDR:
                case HA_LOCAL_VIP:
                case HA_REMOTE_VIP:
-               case HA_ADDITIONAL_ADDR:
+               case HA_PEER_ADDR:
                {
                        host_encoding_t *enc;
 
@@ -423,6 +436,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                        return TRUE;
                }
                /* u_int8_t */
+               case HA_IKE_VERSION:
                case HA_INITIATOR:
                case HA_IPSEC_MODE:
                case HA_IPCOMP:
@@ -437,6 +451,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                        return TRUE;
                }
                /** u_int16_t */
+               case HA_ALG_DH:
                case HA_ALG_PRF:
                case HA_ALG_OLD_PRF:
                case HA_ALG_ENCR:
@@ -445,6 +460,7 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                case HA_INBOUND_CPI:
                case HA_OUTBOUND_CPI:
                case HA_SEGMENT:
+               case HA_ESN:
                {
                        if (this->buf.len < sizeof(u_int16_t))
                        {
@@ -475,6 +491,10 @@ METHOD(enumerator_t, attribute_enumerate, bool,
                case HA_NONCE_I:
                case HA_NONCE_R:
                case HA_SECRET:
+               case HA_LOCAL_DH:
+               case HA_REMOTE_DH:
+               case HA_PSK:
+               case HA_IV:
                case HA_OLD_SKD:
                {
                        size_t len;