peer-cfg: add a pull/push mode option to use with mode config

This commit is contained in:
Martin Willi
2013-09-04 10:33:37 +02:00
parent 0b47bb5377
commit 9aeaa7396e
15 changed files with 43 additions and 20 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
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 */
TRUE, aggressive, /* mobike, aggressive */ TRUE, aggressive, TRUE, /* mobike, aggressive, pull */
30, 0, /* DPD delay, timeout */ 30, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation */ FALSE, NULL, NULL); /* mediation */
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0)); peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
+1 -1
View File
@@ -536,7 +536,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
0, 0, /* DPD delay, timeout */ 0, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation */ FALSE, NULL, NULL); /* mediation */
if (virtual) if (virtual)
+2 -2
View File
@@ -249,8 +249,8 @@ static peer_cfg_t *load_peer_config(private_config_t *this,
ike_cfg = load_ike_config(this, settings, config); ike_cfg = load_ike_config(this, settings, config);
peer_cfg = peer_cfg_create(config, 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, TRUE,
FALSE, NULL, NULL); 0, 0, FALSE, NULL, NULL);
auth = auth_cfg_create(); auth = auth_cfg_create();
auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY); auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
@@ -535,7 +535,7 @@ static job_requeue_t initiate(private_android_service_t *this)
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
0, 0, /* DPD delay, timeout */ 0, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation */ FALSE, NULL, NULL); /* mediation */
peer_cfg->add_virtual_ip(peer_cfg, host_create_any(AF_INET)); peer_cfg->add_virtual_ip(peer_cfg, host_create_any(AF_INET));
+1 -1
View File
@@ -91,7 +91,7 @@ static peer_cfg_t* create_peer_cfg(char *name, char *host)
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
30, 0, /* DPD delay, timeout */ 30, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation */ FALSE, NULL, NULL); /* mediation */
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0)); peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
+16 -2
View File
@@ -99,6 +99,11 @@ struct private_peer_cfg_t {
*/ */
bool aggressive; bool aggressive;
/**
* Use pull or push in mode config?
*/
bool pull_mode;
/** /**
* Time before starting rekeying * Time before starting rekeying
*/ */
@@ -390,6 +395,12 @@ METHOD(peer_cfg_t, use_aggressive, bool,
return this->aggressive; return this->aggressive;
} }
METHOD(peer_cfg_t, use_pull_mode, bool,
private_peer_cfg_t *this)
{
return this->pull_mode;
}
METHOD(peer_cfg_t, get_dpd, u_int32_t, METHOD(peer_cfg_t, get_dpd, u_int32_t,
private_peer_cfg_t *this) private_peer_cfg_t *this)
{ {
@@ -588,6 +599,7 @@ METHOD(peer_cfg_t, equals, bool,
this->over_time == other->over_time && this->over_time == other->over_time &&
this->dpd == other->dpd && this->dpd == other->dpd &&
this->aggressive == other->aggressive && this->aggressive == other->aggressive &&
this->pull_mode == other->pull_mode &&
auth_cfg_equal(this, other) auth_cfg_equal(this, other)
#ifdef ME #ifdef ME
&& this->mediation == other->mediation && && this->mediation == other->mediation &&
@@ -638,8 +650,8 @@ peer_cfg_t *peer_cfg_create(char *name,
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,
u_int32_t jitter_time, u_int32_t over_time, u_int32_t jitter_time, u_int32_t over_time,
bool mobike, bool aggressive, u_int32_t dpd, bool mobike, bool aggressive, bool pull_mode,
u_int32_t dpd_timeout, u_int32_t dpd, u_int32_t dpd_timeout,
bool mediation, peer_cfg_t *mediated_by, bool mediation, peer_cfg_t *mediated_by,
identification_t *peer_id) identification_t *peer_id)
{ {
@@ -671,6 +683,7 @@ peer_cfg_t *peer_cfg_create(char *name,
.get_over_time = _get_over_time, .get_over_time = _get_over_time,
.use_mobike = _use_mobike, .use_mobike = _use_mobike,
.use_aggressive = _use_aggressive, .use_aggressive = _use_aggressive,
.use_pull_mode = _use_pull_mode,
.get_dpd = _get_dpd, .get_dpd = _get_dpd,
.get_dpd_timeout = _get_dpd_timeout, .get_dpd_timeout = _get_dpd_timeout,
.add_virtual_ip = _add_virtual_ip, .add_virtual_ip = _add_virtual_ip,
@@ -701,6 +714,7 @@ peer_cfg_t *peer_cfg_create(char *name,
.over_time = over_time, .over_time = over_time,
.use_mobike = mobike, .use_mobike = mobike,
.aggressive = aggressive, .aggressive = aggressive,
.pull_mode = pull_mode,
.dpd = dpd, .dpd = dpd,
.dpd_timeout = dpd_timeout, .dpd_timeout = dpd_timeout,
.vips = linked_list_create(), .vips = linked_list_create(),
+10 -2
View File
@@ -247,6 +247,13 @@ struct peer_cfg_t {
*/ */
bool (*use_aggressive)(peer_cfg_t *this); bool (*use_aggressive)(peer_cfg_t *this);
/**
* Use pull or push mode for mode config?
*
* @return TRUE to use pull, FALSE to use push mode
*/
bool (*use_pull_mode)(peer_cfg_t *this);
/** /**
* Get the DPD check interval. * Get the DPD check interval.
* *
@@ -366,6 +373,7 @@ struct peer_cfg_t {
* @param over_time maximum overtime before closing a rekeying/reauth SA * @param over_time maximum overtime before closing a rekeying/reauth SA
* @param mobike use MOBIKE (RFC4555) if peer supports it * @param mobike use MOBIKE (RFC4555) if peer supports it
* @param aggressive use/accept aggressive mode with IKEv1 * @param aggressive use/accept aggressive mode with IKEv1
* @param pullmode TRUE to use modeconfig pull, FALSE for push
* @param dpd DPD check interval, 0 to disable * @param dpd DPD check interval, 0 to disable
* @param dpd_timeout DPD timeout interval (IKEv1 only), if 0 default applies * @param dpd_timeout DPD timeout interval (IKEv1 only), if 0 default applies
* @param mediation TRUE if this is a mediation connection * @param mediation TRUE if this is a mediation connection
@@ -378,8 +386,8 @@ peer_cfg_t *peer_cfg_create(char *name,
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,
u_int32_t jitter_time, u_int32_t over_time, u_int32_t jitter_time, u_int32_t over_time,
bool mobike, bool aggressive, u_int32_t dpd, bool mobike, bool aggressive, bool pull_mode,
u_int32_t dpd_timeout, u_int32_t dpd, u_int32_t dpd_timeout,
bool mediation, peer_cfg_t *mediated_by, bool mediation, peer_cfg_t *mediated_by,
identification_t *peer_id); identification_t *peer_id);
+2 -2
View File
@@ -208,8 +208,8 @@ static void setup_tunnel(private_ha_tunnel_t *this,
remote, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO, 0); remote, FALSE, IKEV2_UDP_PORT, FRAGMENTATION_NO, 0);
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", 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,
0, FALSE, NULL, NULL); TRUE, 30, 0, FALSE, NULL, NULL);
auth_cfg = auth_cfg_create(); auth_cfg = auth_cfg_create();
auth_cfg->add(auth_cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PSK); auth_cfg->add(auth_cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PSK);
@@ -561,7 +561,7 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
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 */
FALSE, FALSE, /* mobike, aggressive mode */ FALSE, FALSE, TRUE, /* mobike, aggressive, pull */
this->dpd_delay, /* dpd_delay */ this->dpd_delay, /* dpd_delay */
this->dpd_timeout, /* dpd_timeout */ this->dpd_timeout, /* dpd_timeout */
FALSE, NULL, NULL); FALSE, NULL, NULL);
+1 -1
View File
@@ -334,7 +334,7 @@ static gboolean initiate_connection(private_maemo_service_t *this,
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
0, 0, /* DPD delay, timeout */ 0, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation */ FALSE, NULL, NULL); /* mediation */
peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0)); peer_cfg->add_virtual_ip(peer_cfg, host_create_from_string("0.0.0.0", 0));
+3 -3
View File
@@ -112,7 +112,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
this->dpd, 0, /* DPD delay, timeout */ this->dpd, 0, /* DPD delay, timeout */
TRUE, NULL, NULL); /* mediation, med by, peer id */ TRUE, NULL, NULL); /* mediation, med by, peer id */
e->destroy(e); e->destroy(e);
@@ -149,7 +149,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
this->dpd, 0, /* DPD delay, timeout */ this->dpd, 0, /* DPD delay, timeout */
FALSE, med_cfg, /* mediation, med by */ FALSE, med_cfg, /* mediation, med by */
identification_create_from_encoding(ID_KEY_ID, other)); identification_create_from_encoding(ID_KEY_ID, other));
@@ -224,7 +224,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
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 */
TRUE, FALSE, /* mobike, aggressive */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
this->dpd, 0, /* DPD delay, timeout */ this->dpd, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation, med by, peer id */ FALSE, NULL, NULL); /* mediation, med by, peer id */
+1 -1
View File
@@ -92,7 +92,7 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
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 */
TRUE, FALSE, /* mobike, aggressiv */ TRUE, FALSE, TRUE, /* mobike, aggressive, pull */
this->dpd, 0, /* DPD delay, timeout */ this->dpd, 0, /* DPD delay, timeout */
TRUE, NULL, NULL); /* mediation, med by, peer id */ TRUE, NULL, NULL); /* mediation, med by, peer id */
e->destroy(e); e->destroy(e);
+1 -1
View File
@@ -374,7 +374,7 @@ static peer_cfg_t *build_peer_cfg(private_sql_config_t *this, enumerator_t *e,
peer_cfg = peer_cfg_create( peer_cfg = peer_cfg_create(
name, 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, TRUE, dpd_delay, 0,
mediation, mediated_cfg, peer_id); mediation, mediated_cfg, peer_id);
if (vip) if (vip)
{ {
@@ -731,6 +731,7 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
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,
TRUE,
msg->add_conn.dpd.delay, msg->add_conn.dpd.timeout, msg->add_conn.dpd.delay, msg->add_conn.dpd.timeout,
msg->add_conn.ikeme.mediation, mediated_by, peer_id); msg->add_conn.ikeme.mediation, mediated_by, peer_id);
+1 -1
View File
@@ -162,7 +162,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
name, 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, TRUE, /* mobike, aggressive, pull */
60, 0, /* DPD delay, timeout */ 60, 0, /* DPD delay, timeout */
FALSE, NULL, NULL); /* mediation, med by, peer id */ FALSE, NULL, NULL); /* mediation, med by, peer id */
auth = auth_cfg_create(); auth = auth_cfg_create();