Support multiple address pools configured on a peer_cfg
This commit is contained in:
@@ -275,7 +275,7 @@ static job_requeue_t initiate(private_android_service_t *this)
|
||||
600, 600, /* jitter, over 10min */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
0, 0, /* DPD delay, timeout */
|
||||
NULL, FALSE, NULL, NULL); /* pool, mediation */
|
||||
FALSE, NULL, NULL); /* mediation */
|
||||
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
|
||||
|
||||
auth = auth_cfg_create();
|
||||
|
||||
@@ -413,23 +413,24 @@ static void process_ike_update(private_ha_dispatcher_t *this,
|
||||
}
|
||||
if (received_vip)
|
||||
{
|
||||
enumerator_t *pools, *vips;
|
||||
host_t *vip;
|
||||
char *pool;
|
||||
|
||||
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
|
||||
if (peer_cfg)
|
||||
{
|
||||
pool = peer_cfg->get_pool(peer_cfg);
|
||||
if (pool)
|
||||
pools = peer_cfg->create_pool_enumerator(peer_cfg);
|
||||
while (pools->enumerate(pools, &pool))
|
||||
{
|
||||
enumerator = ike_sa->create_virtual_ip_enumerator(ike_sa,
|
||||
FALSE);
|
||||
while (enumerator->enumerate(enumerator, &vip))
|
||||
vips = ike_sa->create_virtual_ip_enumerator(ike_sa, FALSE);
|
||||
while (vips->enumerate(vips, &vip))
|
||||
{
|
||||
this->attr->reserve(this->attr, pool, vip);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
vips->destroy(vips);
|
||||
}
|
||||
pools->destroy(pools);
|
||||
}
|
||||
}
|
||||
if (ike_sa->get_version(ike_sa) == IKEV1)
|
||||
|
||||
@@ -209,7 +209,7 @@ static void setup_tunnel(private_ha_tunnel_t *this,
|
||||
ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
|
||||
peer_cfg = peer_cfg_create("ha", IKEV2, ike_cfg, CERT_NEVER_SEND,
|
||||
UNIQUE_KEEP, 0, 86400, 0, 7200, 3600, FALSE, FALSE, 30,
|
||||
0, NULL, FALSE, NULL, NULL);
|
||||
0, FALSE, NULL, NULL);
|
||||
|
||||
auth_cfg = auth_cfg_create();
|
||||
auth_cfg->add(auth_cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PSK);
|
||||
|
||||
@@ -268,11 +268,15 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
|
||||
FALSE, FALSE, /* mobike, aggressive mode */
|
||||
this->dpd_delay, /* dpd_delay */
|
||||
this->dpd_timeout, /* dpd_timeout */
|
||||
this->pool, FALSE, NULL, NULL);
|
||||
FALSE, NULL, NULL);
|
||||
if (this->vip)
|
||||
{
|
||||
peer_cfg->add_virtual_ip(peer_cfg, this->vip->clone(this->vip));
|
||||
}
|
||||
if (this->pool)
|
||||
{
|
||||
peer_cfg->add_pool(peer_cfg, this->pool);
|
||||
}
|
||||
if (num)
|
||||
{ /* initiator */
|
||||
generate_auth_cfg(this, this->initiator_auth, peer_cfg, TRUE, num);
|
||||
|
||||
@@ -335,7 +335,7 @@ static gboolean initiate_connection(private_maemo_service_t *this,
|
||||
600, 600, /* jitter, over 10min */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
0, 0, /* DPD delay, timeout */
|
||||
NULL, FALSE, NULL, NULL); /* pool, mediation */
|
||||
FALSE, NULL, NULL); /* mediation */
|
||||
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
|
||||
|
||||
auth = auth_cfg_create();
|
||||
|
||||
@@ -129,7 +129,6 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
|
||||
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
this->dpd, 0, /* DPD delay, timeout */
|
||||
NULL, /* pool */
|
||||
TRUE, NULL, NULL); /* mediation, med by, peer id */
|
||||
e->destroy(e);
|
||||
|
||||
@@ -167,7 +166,6 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
|
||||
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
this->dpd, 0, /* DPD delay, timeout */
|
||||
NULL, /* pool */
|
||||
FALSE, med_cfg, /* mediation, med by */
|
||||
identification_create_from_encoding(ID_KEY_ID, other));
|
||||
|
||||
@@ -243,7 +241,6 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
||||
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
this->dpd, 0, /* DPD delay, timeout */
|
||||
NULL, /* pool */
|
||||
FALSE, NULL, NULL); /* mediation, med by, peer id */
|
||||
|
||||
auth = auth_cfg_create();
|
||||
|
||||
@@ -94,7 +94,6 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
|
||||
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
||||
TRUE, FALSE, /* mobike, aggressiv */
|
||||
this->dpd, 0, /* DPD delay, timeout */
|
||||
NULL, /* pool */
|
||||
TRUE, NULL, NULL); /* mediation, med by, peer id */
|
||||
e->destroy(e);
|
||||
|
||||
|
||||
@@ -371,12 +371,16 @@ static peer_cfg_t *build_peer_cfg(private_sql_config_t *this, enumerator_t *e,
|
||||
peer_cfg = peer_cfg_create(
|
||||
name, IKEV2, ike, cert_policy, uniqueid,
|
||||
keyingtries, rekeytime, reauthtime, jitter, overtime,
|
||||
mobike, FALSE, dpd_delay, 0, pool,
|
||||
mobike, FALSE, dpd_delay, 0,
|
||||
mediation, mediated_cfg, peer_id);
|
||||
if (vip)
|
||||
{
|
||||
peer_cfg->add_virtual_ip(peer_cfg, vip);
|
||||
}
|
||||
if (pool)
|
||||
{
|
||||
peer_cfg->add_pool(peer_cfg, pool);
|
||||
}
|
||||
auth = auth_cfg_create();
|
||||
auth->add(auth, AUTH_RULE_AUTH_CLASS, auth_method);
|
||||
auth->add(auth, AUTH_RULE_IDENTITY, local_id);
|
||||
|
||||
@@ -778,13 +778,19 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
|
||||
msg->add_conn.rekey.tries, rekey, reauth, jitter, over,
|
||||
msg->add_conn.mobike, msg->add_conn.aggressive,
|
||||
msg->add_conn.dpd.delay, msg->add_conn.dpd.timeout,
|
||||
msg->add_conn.other.sourceip_mask ?
|
||||
msg->add_conn.name : msg->add_conn.other.sourceip,
|
||||
msg->add_conn.ikeme.mediation, mediated_by, peer_id);
|
||||
if (vip)
|
||||
{
|
||||
peer_cfg->add_virtual_ip(peer_cfg, vip);
|
||||
}
|
||||
if (msg->add_conn.other.sourceip_mask)
|
||||
{
|
||||
peer_cfg->add_pool(peer_cfg, msg->add_conn.name);
|
||||
}
|
||||
else if (msg->add_conn.other.sourceip)
|
||||
{
|
||||
peer_cfg->add_pool(peer_cfg, msg->add_conn.other.sourceip);
|
||||
}
|
||||
|
||||
/* build leftauth= */
|
||||
auth_cfg = build_auth_cfg(this, msg, TRUE, TRUE);
|
||||
|
||||
@@ -178,7 +178,6 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
||||
1800, 900, /* jitter, overtime */
|
||||
TRUE, FALSE, /* mobike, aggressive */
|
||||
60, 0, /* DPD delay, timeout */
|
||||
NULL, /* pool */
|
||||
FALSE, NULL, NULL); /* mediation, med by, peer id */
|
||||
auth = auth_cfg_create();
|
||||
auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PSK);
|
||||
|
||||
Reference in New Issue
Block a user