Refactored the lifetime_cfg_t struct to be simpler and more expressive. Initialization is now static.
This commit is contained in:
@@ -99,8 +99,14 @@ static peer_cfg_t *get_peer_cfg_by_name(private_medcli_config_t *this, char *nam
|
||||
ike_cfg_t *ike_cfg;
|
||||
child_cfg_t *child_cfg;
|
||||
chunk_t me, other;
|
||||
lifetime_cfg_t *lifetime;
|
||||
char *address, *local_net, *remote_net;
|
||||
lifetime_cfg_t lifetime = {
|
||||
.time = {
|
||||
.life = this->rekey * 60 + this->rekey,
|
||||
.rekey = this->rekey,
|
||||
.jitter = this->rekey
|
||||
}
|
||||
};
|
||||
|
||||
/* query mediation server config:
|
||||
* - build ike_cfg/peer_cfg for mediation connection on-the-fly
|
||||
@@ -174,10 +180,7 @@ static peer_cfg_t *get_peer_cfg_by_name(private_medcli_config_t *this, char *nam
|
||||
identification_create_from_encoding(ID_KEY_ID, other));
|
||||
peer_cfg->add_auth_cfg(peer_cfg, auth, FALSE);
|
||||
|
||||
lifetime = lifetime_cfg_create_time(this->rekey * 60 + this->rekey,
|
||||
this->rekey, this->rekey);
|
||||
|
||||
child_cfg = child_cfg_create(name, lifetime, NULL, TRUE,
|
||||
child_cfg = child_cfg_create(name, &lifetime, NULL, TRUE,
|
||||
MODE_TUNNEL, ACTION_NONE, ACTION_NONE, FALSE);
|
||||
child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP));
|
||||
child_cfg->add_traffic_selector(child_cfg, TRUE, ts_from_string(local_net));
|
||||
@@ -220,8 +223,14 @@ static bool peer_enumerator_enumerate(peer_enumerator_t *this, peer_cfg_t **cfg)
|
||||
chunk_t me, other;
|
||||
child_cfg_t *child_cfg;
|
||||
auth_cfg_t *auth;
|
||||
lifetime_cfg_t *lifetime;
|
||||
|
||||
lifetime_cfg_t lifetime = {
|
||||
.time = {
|
||||
.life = this->rekey * 60 + this->rekey,
|
||||
.rekey = this->rekey
|
||||
.jitter = this->rekey
|
||||
}
|
||||
};
|
||||
|
||||
DESTROY_IF(this->current);
|
||||
if (!this->inner->enumerate(this->inner, &name, &me, &other,
|
||||
&local_net, &remote_net))
|
||||
@@ -249,10 +258,7 @@ static bool peer_enumerator_enumerate(peer_enumerator_t *this, peer_cfg_t **cfg)
|
||||
identification_create_from_encoding(ID_KEY_ID, other));
|
||||
this->current->add_auth_cfg(this->current, auth, FALSE);
|
||||
|
||||
lifetime = lifetime_cfg_create_time(this->rekey * 60 + this->rekey,
|
||||
this->rekey, this->rekey);
|
||||
|
||||
child_cfg = child_cfg_create(name, lifetime, NULL, TRUE, MODE_TUNNEL,
|
||||
child_cfg = child_cfg_create(name, &lifetime, NULL, TRUE, MODE_TUNNEL,
|
||||
ACTION_NONE, ACTION_NONE, FALSE);
|
||||
child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP));
|
||||
child_cfg->add_traffic_selector(child_cfg, TRUE, ts_from_string(local_net));
|
||||
|
||||
Reference in New Issue
Block a user