Remove version argument on peer_cfg constructor, use ike_cfg version instead

This commit is contained in:
Martin Willi 2012-10-16 14:31:02 +02:00
parent 9fc7cc6f9b
commit 1fdd62ffce
14 changed files with 18 additions and 26 deletions

View File

@ -502,7 +502,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
charon->socket->get_port(charon->socket, FALSE), charon->socket->get_port(charon->socket, FALSE),
(char*)address, FALSE, IKEV2_UDP_PORT); (char*)address, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); 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 */ CERT_SEND_IF_ASKED, UNIQUE_REPLACE, 1, /* keyingtries */
36000, 0, /* rekey 10h, reauth none */ 36000, 0, /* rekey 10h, reauth none */
600, 600, /* jitter, over 10min */ 600, 600, /* jitter, over 10min */

View File

@ -251,7 +251,7 @@ static peer_cfg_t *load_peer_config(private_config_t *this,
uintptr_t strength; uintptr_t strength;
ike_cfg = load_ike_config(this, settings, config); 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, UNIQUE_NO, 1, 0, 0, 0, 0, FALSE, FALSE, 0, 0,
FALSE, NULL, NULL); FALSE, NULL, NULL);

View File

@ -474,7 +474,7 @@ static job_requeue_t initiate(private_android_service_t *this)
this->gateway, FALSE, IKEV2_UDP_PORT); this->gateway, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); 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 */ UNIQUE_REPLACE, 0, /* keyingtries */
36000, 0, /* rekey 10h, reauth none */ 36000, 0, /* rekey 10h, reauth none */
600, 600, /* jitter, over 10min */ 600, 600, /* jitter, over 10min */

View File

@ -59,11 +59,6 @@ struct private_peer_cfg_t {
*/ */
char *name; char *name;
/**
* IKE version to use for initiation
*/
ike_version_t ike_version;
/** /**
* IKE config associated to this peer config * IKE config associated to this peer config
*/ */
@ -182,7 +177,7 @@ METHOD(peer_cfg_t, get_name, char*,
METHOD(peer_cfg_t, get_ike_version, ike_version_t, METHOD(peer_cfg_t, get_ike_version, ike_version_t,
private_peer_cfg_t *this) 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*, METHOD(peer_cfg_t, get_ike_cfg, ike_cfg_t*,
@ -578,7 +573,7 @@ METHOD(peer_cfg_t, equals, bool,
e2->destroy(e2); e2->destroy(e2);
return ( return (
this->ike_version == other->ike_version && get_ike_version(this) == get_ike_version(other) &&
this->cert_policy == other->cert_policy && this->cert_policy == other->cert_policy &&
this->unique == other->unique && this->unique == other->unique &&
this->keyingtries == other->keyingtries && this->keyingtries == other->keyingtries &&
@ -633,7 +628,7 @@ METHOD(peer_cfg_t, destroy, void,
/* /*
* Described in header-file * 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, ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
unique_policy_t unique, u_int32_t keyingtries, unique_policy_t unique, u_int32_t keyingtries,
u_int32_t rekey_time, u_int32_t reauth_time, 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 */ #endif /* ME */
}, },
.name = strdup(name), .name = strdup(name),
.ike_version = ike_version,
.ike_cfg = ike_cfg, .ike_cfg = ike_cfg,
.child_cfgs = linked_list_create(), .child_cfgs = linked_list_create(),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT), .mutex = mutex_create(MUTEX_TYPE_DEFAULT),

View File

@ -356,7 +356,6 @@ struct peer_cfg_t {
* (rekeylifetime - random(0, jitter)). * (rekeylifetime - random(0, jitter)).
* *
* @param name name of the peer_cfg * @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 ike_cfg IKE config to use when acting as initiator
* @param cert_policy should we send a certificate payload? * @param cert_policy should we send a certificate payload?
* @param unique uniqueness of an IKE_SA * @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 * @param peer_id ID that identifies our peer at the mediation server
* @return peer_cfg_t object * @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, ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
unique_policy_t unique, u_int32_t keyingtries, unique_policy_t unique, u_int32_t keyingtries,
u_int32_t rekey_time, u_int32_t reauth_time, u_int32_t rekey_time, u_int32_t reauth_time,

View File

@ -269,7 +269,7 @@ static job_requeue_t initiate(private_android_service_t *this)
hostname, FALSE, IKEV2_UDP_PORT); hostname, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); 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 */ UNIQUE_REPLACE, 1, /* keyingtries */
36000, 0, /* rekey 10h, reauth none */ 36000, 0, /* rekey 10h, reauth none */
600, 600, /* jitter, over 10min */ 600, 600, /* jitter, over 10min */

View File

@ -207,7 +207,7 @@ static void setup_tunnel(private_ha_tunnel_t *this,
charon->socket->get_port(charon->socket, FALSE), charon->socket->get_port(charon->socket, FALSE),
remote, FALSE, IKEV2_UDP_PORT); remote, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); 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, UNIQUE_KEEP, 0, 86400, 0, 7200, 3600, FALSE, FALSE, 30,
0, FALSE, NULL, NULL); 0, FALSE, NULL, NULL);

View 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); this->remote, FALSE, IKEV2_UDP_PORT);
} }
ike_cfg->add_proposal(ike_cfg, this->proposal->clone(this->proposal)); 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 */ CERT_SEND_IF_ASKED, UNIQUE_NO, 1, /* keytries */
this->ike_rekey, 0, /* rekey, reauth */ this->ike_rekey, 0, /* rekey, reauth */
0, this->ike_rekey, /* jitter, overtime */ 0, this->ike_rekey, /* jitter, overtime */

View File

@ -328,7 +328,7 @@ static gboolean initiate_connection(private_maemo_service_t *this,
hostname, FALSE, IKEV2_UDP_PORT); hostname, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); 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, CERT_SEND_IF_ASKED,
UNIQUE_REPLACE, 1, /* keyingtries */ UNIQUE_REPLACE, 1, /* keyingtries */
36000, 0, /* rekey 10h, reauth none */ 36000, 0, /* rekey 10h, reauth none */

View File

@ -124,7 +124,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
address, FALSE, IKEV2_UDP_PORT); address, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
med_cfg = peer_cfg_create( med_cfg = peer_cfg_create(
"mediation", IKEV2, ike_cfg, "mediation", ike_cfg,
CERT_NEVER_SEND, UNIQUE_REPLACE, CERT_NEVER_SEND, UNIQUE_REPLACE,
1, this->rekey*60, 0, /* keytries, rekey, reauth */ 1, this->rekey*60, 0, /* keytries, rekey, reauth */
this->rekey*5, this->rekey*3, /* jitter, overtime */ 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; return NULL;
} }
peer_cfg = peer_cfg_create( 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, CERT_NEVER_SEND, UNIQUE_REPLACE,
1, this->rekey*60, 0, /* keytries, rekey, reauth */ 1, this->rekey*60, 0, /* keytries, rekey, reauth */
this->rekey*5, this->rekey*3, /* jitter, overtime */ this->rekey*5, this->rekey*3, /* jitter, overtime */
@ -236,7 +236,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
return FALSE; return FALSE;
} }
this->current = peer_cfg_create( 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, CERT_NEVER_SEND, UNIQUE_REPLACE,
1, this->rekey*60, 0, /* keytries, rekey, reauth */ 1, this->rekey*60, 0, /* keytries, rekey, reauth */
this->rekey*5, this->rekey*3, /* jitter, overtime */ this->rekey*5, this->rekey*3, /* jitter, overtime */

View File

@ -88,7 +88,7 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
if (e->enumerate(e, &name)) if (e->enumerate(e, &name))
{ {
peer_cfg = peer_cfg_create( 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, CERT_NEVER_SEND, UNIQUE_REPLACE,
1, this->rekey*60, 0, /* keytries, rekey, reauth */ 1, this->rekey*60, 0, /* keytries, rekey, reauth */
this->rekey*5, this->rekey*3, /* jitter, overtime */ this->rekey*5, this->rekey*3, /* jitter, overtime */

View File

@ -371,7 +371,7 @@ static peer_cfg_t *build_peer_cfg(private_sql_config_t *this, enumerator_t *e,
if (ike) if (ike)
{ {
peer_cfg = peer_cfg_create( peer_cfg = peer_cfg_create(
name, IKEV2, ike, cert_policy, uniqueid, name, ike, cert_policy, uniqueid,
keyingtries, rekeytime, reauthtime, jitter, overtime, keyingtries, rekeytime, reauthtime, jitter, overtime,
mobike, FALSE, dpd_delay, 0, mobike, FALSE, dpd_delay, 0,
mediation, mediated_cfg, peer_id); mediation, mediated_cfg, peer_id);

View 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 /* other.sourceip is managed in stroke_attributes. If it is set, we define
* the pool name as the connection name, which the attribute provider * the pool name as the connection name, which the attribute provider
* uses to serve pool addresses. */ * uses to serve pool addresses. */
peer_cfg = peer_cfg_create(msg->add_conn.name, peer_cfg = peer_cfg_create(msg->add_conn.name, ike_cfg,
msg->add_conn.version, ike_cfg,
msg->add_conn.me.sendcert, unique, msg->add_conn.me.sendcert, unique,
msg->add_conn.rekey.tries, rekey, reauth, jitter, over, msg->add_conn.rekey.tries, rekey, reauth, jitter, over,
msg->add_conn.mobike, msg->add_conn.aggressive, msg->add_conn.mobike, msg->add_conn.aggressive,

View File

@ -174,7 +174,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
remote_addr, FALSE, IKEV2_UDP_PORT); remote_addr, FALSE, IKEV2_UDP_PORT);
ike_cfg->add_proposal(ike_cfg, create_proposal(ike_proposal, PROTO_IKE)); ike_cfg->add_proposal(ike_cfg, create_proposal(ike_proposal, PROTO_IKE));
this->peer_cfg = peer_cfg_create( 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 */ 1, create_rekey(ike_rekey), 0, /* keytries, rekey, reauth */
1800, 900, /* jitter, overtime */ 1800, 900, /* jitter, overtime */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, /* mobike, aggressive */