Remove version argument on peer_cfg constructor, use ike_cfg version instead
authorMartin Willi <martin@revosec.ch>
Tue, 16 Oct 2012 12:31:02 +0000 (14:31 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 24 Oct 2012 08:19:33 +0000 (10:19 +0200)
14 files changed:
src/charon-nm/nm/nm_service.c
src/conftest/config.c
src/frontends/android/jni/libandroidbridge/backend/android_service.c
src/libcharon/config/peer_cfg.c
src/libcharon/config/peer_cfg.h
src/libcharon/plugins/android/android_service.c
src/libcharon/plugins/ha/ha_tunnel.c
src/libcharon/plugins/load_tester/load_tester_config.c
src/libcharon/plugins/maemo/maemo_service.c
src/libcharon/plugins/medcli/medcli_config.c
src/libcharon/plugins/medsrv/medsrv_config.c
src/libcharon/plugins/sql/sql_config.c
src/libcharon/plugins/stroke/stroke_config.c
src/libcharon/plugins/uci/uci_config.c

index e908b32..1eeacca 100644 (file)
@@ -502,7 +502,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
                                                         charon->socket->get_port(charon->socket, FALSE),
                                                        (char*)address, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
-       peer_cfg = peer_cfg_create(priv->name, IKEV2, ike_cfg,
+       peer_cfg = peer_cfg_create(priv->name, ike_cfg,
                                        CERT_SEND_IF_ASKED, UNIQUE_REPLACE, 1, /* keyingtries */
                                        36000, 0, /* rekey 10h, reauth none */
                                        600, 600, /* jitter, over 10min */
index 82b05e3..6adb545 100644 (file)
@@ -251,7 +251,7 @@ static peer_cfg_t *load_peer_config(private_config_t *this,
        uintptr_t strength;
 
        ike_cfg = load_ike_config(this, settings, config);
-       peer_cfg = peer_cfg_create(config, IKEV2, ike_cfg, CERT_ALWAYS_SEND,
+       peer_cfg = peer_cfg_create(config, ike_cfg, CERT_ALWAYS_SEND,
                                                           UNIQUE_NO, 1, 0, 0, 0, 0, FALSE, FALSE, 0, 0,
                                                           FALSE, NULL, NULL);
 
index 802d2f6..6c23bf2 100644 (file)
@@ -474,7 +474,7 @@ static job_requeue_t initiate(private_android_service_t *this)
                                                         this->gateway, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
 
-       peer_cfg = peer_cfg_create("android", IKEV2, ike_cfg, CERT_SEND_IF_ASKED,
+       peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
                                                           UNIQUE_REPLACE, 0, /* keyingtries */
                                                           36000, 0, /* rekey 10h, reauth none */
                                                           600, 600, /* jitter, over 10min */
index 04bb343..5b3d869 100644 (file)
@@ -60,11 +60,6 @@ struct private_peer_cfg_t {
        char *name;
 
        /**
-        * IKE version to use for initiation
-        */
-       ike_version_t ike_version;
-
-       /**
         * IKE config associated to this peer config
         */
        ike_cfg_t *ike_cfg;
@@ -182,7 +177,7 @@ METHOD(peer_cfg_t, get_name, char*,
 METHOD(peer_cfg_t, get_ike_version, ike_version_t,
        private_peer_cfg_t *this)
 {
-       return this->ike_version;
+       return this->ike_cfg->get_version(this->ike_cfg);
 }
 
 METHOD(peer_cfg_t, get_ike_cfg, ike_cfg_t*,
@@ -578,7 +573,7 @@ METHOD(peer_cfg_t, equals, bool,
        e2->destroy(e2);
 
        return (
-               this->ike_version == other->ike_version &&
+               get_ike_version(this) == get_ike_version(other) &&
                this->cert_policy == other->cert_policy &&
                this->unique == other->unique &&
                this->keyingtries == other->keyingtries &&
@@ -633,7 +628,7 @@ METHOD(peer_cfg_t, destroy, void,
 /*
  * Described in header-file
  */
-peer_cfg_t *peer_cfg_create(char *name, ike_version_t ike_version,
+peer_cfg_t *peer_cfg_create(char *name,
                                                        ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
                                                        unique_policy_t unique, u_int32_t keyingtries,
                                                        u_int32_t rekey_time, u_int32_t reauth_time,
@@ -689,7 +684,6 @@ peer_cfg_t *peer_cfg_create(char *name, ike_version_t ike_version,
 #endif /* ME */
                },
                .name = strdup(name),
-               .ike_version = ike_version,
                .ike_cfg = ike_cfg,
                .child_cfgs = linked_list_create(),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
index c4dc63f..121f758 100644 (file)
@@ -356,7 +356,6 @@ struct peer_cfg_t {
  * (rekeylifetime - random(0, jitter)).
  *
  * @param name                         name of the peer_cfg
- * @param ike_version          which IKE version we should use for this peer
  * @param ike_cfg                      IKE config to use when acting as initiator
  * @param cert_policy          should we send a certificate payload?
  * @param unique                       uniqueness of an IKE_SA
@@ -374,7 +373,7 @@ struct peer_cfg_t {
  * @param peer_id                      ID that identifies our peer at the mediation server
  * @return                                     peer_cfg_t object
  */
-peer_cfg_t *peer_cfg_create(char *name, ike_version_t ike_version,
+peer_cfg_t *peer_cfg_create(char *name,
                                                        ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
                                                        unique_policy_t unique, u_int32_t keyingtries,
                                                        u_int32_t rekey_time, u_int32_t reauth_time,
index 3c432cf..d398b13 100644 (file)
@@ -269,7 +269,7 @@ static job_requeue_t initiate(private_android_service_t *this)
                                                         hostname, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
 
-       peer_cfg = peer_cfg_create("android", IKEV2, ike_cfg, CERT_SEND_IF_ASKED,
+       peer_cfg = peer_cfg_create("android", ike_cfg, CERT_SEND_IF_ASKED,
                                                           UNIQUE_REPLACE, 1, /* keyingtries */
                                                           36000, 0, /* rekey 10h, reauth none */
                                                           600, 600, /* jitter, over 10min */
index 616b395..05f522e 100644 (file)
@@ -207,7 +207,7 @@ static void setup_tunnel(private_ha_tunnel_t *this,
                                                         charon->socket->get_port(charon->socket, FALSE),
                                                         remote, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
-       peer_cfg = peer_cfg_create("ha", IKEV2, ike_cfg, CERT_NEVER_SEND,
+       peer_cfg = peer_cfg_create("ha", ike_cfg, CERT_NEVER_SEND,
                                                UNIQUE_KEEP, 0, 86400, 0, 7200, 3600, FALSE, FALSE, 30,
                                                0, FALSE, NULL, NULL);
 
index fe7b969..0bfa67e 100644 (file)
@@ -273,7 +273,7 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
                                                                 this->remote, FALSE, IKEV2_UDP_PORT);
        }
        ike_cfg->add_proposal(ike_cfg, this->proposal->clone(this->proposal));
-       peer_cfg = peer_cfg_create("load-test", IKEV2, ike_cfg,
+       peer_cfg = peer_cfg_create("load-test", ike_cfg,
                                                           CERT_SEND_IF_ASKED, UNIQUE_NO, 1, /* keytries */
                                                           this->ike_rekey, 0, /* rekey, reauth */
                                                           0, this->ike_rekey, /* jitter, overtime */
index c7eac29..dca01fb 100644 (file)
@@ -328,7 +328,7 @@ static gboolean initiate_connection(private_maemo_service_t *this,
                                                         hostname, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
 
-       peer_cfg = peer_cfg_create(this->current, IKEV2, ike_cfg,
+       peer_cfg = peer_cfg_create(this->current, ike_cfg,
                                                           CERT_SEND_IF_ASKED,
                                                           UNIQUE_REPLACE, 1, /* keyingtries */
                                                           36000, 0, /* rekey 10h, reauth none */
index 4dde086..440d4dd 100644 (file)
@@ -124,7 +124,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
                                                         address, FALSE, IKEV2_UDP_PORT);
        ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
        med_cfg = peer_cfg_create(
-               "mediation", IKEV2, ike_cfg,
+               "mediation", ike_cfg,
                CERT_NEVER_SEND, UNIQUE_REPLACE,
                1, this->rekey*60, 0,                   /* keytries, rekey, reauth */
                this->rekey*5, this->rekey*3,   /* jitter, overtime */
@@ -161,7 +161,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
                return NULL;
        }
        peer_cfg = peer_cfg_create(
-               name, IKEV2, this->ike->get_ref(this->ike),
+               name, this->ike->get_ref(this->ike),
                CERT_NEVER_SEND, UNIQUE_REPLACE,
                1, this->rekey*60, 0,                   /* keytries, rekey, reauth */
                this->rekey*5, this->rekey*3,   /* jitter, overtime */
@@ -236,7 +236,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
                return FALSE;
        }
        this->current = peer_cfg_create(
-                               name, IKEV2, this->ike->get_ref(this->ike),
+                               name, this->ike->get_ref(this->ike),
                                CERT_NEVER_SEND, UNIQUE_REPLACE,
                                1, this->rekey*60, 0,                   /* keytries, rekey, reauth */
                                this->rekey*5, this->rekey*3,   /* jitter, overtime */
index a3dada6..a2d7489 100644 (file)
@@ -88,7 +88,7 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
                if (e->enumerate(e, &name))
                {
                        peer_cfg = peer_cfg_create(
-                               name, IKEV2, this->ike->get_ref(this->ike),
+                               name, this->ike->get_ref(this->ike),
                                CERT_NEVER_SEND, UNIQUE_REPLACE,
                                1, this->rekey*60, 0,                   /* keytries, rekey, reauth */
                                this->rekey*5, this->rekey*3,   /* jitter, overtime */
index 0054f6c..565c858 100644 (file)
@@ -371,7 +371,7 @@ static peer_cfg_t *build_peer_cfg(private_sql_config_t *this, enumerator_t *e,
                if (ike)
                {
                        peer_cfg = peer_cfg_create(
-                                       name, IKEV2, ike, cert_policy, uniqueid,
+                                       name, ike, cert_policy, uniqueid,
                                        keyingtries, rekeytime, reauthtime, jitter, overtime,
                                        mobike, FALSE, dpd_delay, 0,
                                        mediation, mediated_cfg, peer_id);
index ef7682b..0d3684d 100644 (file)
@@ -708,8 +708,7 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
        /* other.sourceip is managed in stroke_attributes. If it is set, we define
         * the pool name as the connection name, which the attribute provider
         * uses to serve pool addresses. */
-       peer_cfg = peer_cfg_create(msg->add_conn.name,
-               msg->add_conn.version, ike_cfg,
+       peer_cfg = peer_cfg_create(msg->add_conn.name, ike_cfg,
                msg->add_conn.me.sendcert, unique,
                msg->add_conn.rekey.tries, rekey, reauth, jitter, over,
                msg->add_conn.mobike, msg->add_conn.aggressive,
index 4947c62..8288730 100644 (file)
@@ -174,7 +174,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
                                                                 remote_addr, FALSE, IKEV2_UDP_PORT);
                ike_cfg->add_proposal(ike_cfg, create_proposal(ike_proposal, PROTO_IKE));
                this->peer_cfg = peer_cfg_create(
-                                       name, IKEV2, ike_cfg, CERT_SEND_IF_ASKED, UNIQUE_NO,
+                                       name, ike_cfg, CERT_SEND_IF_ASKED, UNIQUE_NO,
                                        1, create_rekey(ike_rekey), 0,  /* keytries, rekey, reauth */
                                        1800, 900,                                              /* jitter, overtime */
                                        TRUE, FALSE,                            /* mobike, aggressive */