Replaced usages of CHARON_*_PORT with calls to get_port().
This commit is contained in:
parent
a7babe25ee
commit
b223d517c8
|
@ -497,7 +497,8 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
|
||||||
/**
|
/**
|
||||||
* Set up configurations
|
* Set up configurations
|
||||||
*/
|
*/
|
||||||
ike_cfg = ike_cfg_create(TRUE, encap, "0.0.0.0", FALSE, CHARON_UDP_PORT,
|
ike_cfg = ike_cfg_create(TRUE, encap, "0.0.0.0", 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, IKEV2, ike_cfg,
|
||||||
|
|
|
@ -264,7 +264,8 @@ static job_requeue_t initiate(private_android_service_t *this)
|
||||||
this->creds->set_username_password(this->creds, user, password);
|
this->creds->set_username_password(this->creds, user, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
ike_cfg = ike_cfg_create(TRUE, FALSE, "0.0.0.0", FALSE, CHARON_UDP_PORT,
|
ike_cfg = ike_cfg_create(TRUE, FALSE, "0.0.0.0", FALSE,
|
||||||
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
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));
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,8 @@ static void setup_tunnel(private_ha_tunnel_t *this,
|
||||||
lib->credmgr->add_set(lib->credmgr, &this->creds.public);
|
lib->credmgr->add_set(lib->credmgr, &this->creds.public);
|
||||||
|
|
||||||
/* create config and backend */
|
/* create config and backend */
|
||||||
ike_cfg = ike_cfg_create(FALSE, FALSE, local, FALSE, CHARON_UDP_PORT,
|
ike_cfg = ike_cfg_create(FALSE, FALSE, local, 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", IKEV2, ike_cfg, CERT_NEVER_SEND,
|
||||||
|
|
|
@ -257,7 +257,7 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
||||||
this->local, FALSE, CHARON_UDP_PORT,
|
this->local, FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
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));
|
||||||
|
|
|
@ -323,7 +323,8 @@ static gboolean initiate_connection(private_maemo_service_t *this,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ike_cfg = ike_cfg_create(TRUE, FALSE, "0.0.0.0", FALSE, CHARON_UDP_PORT,
|
ike_cfg = ike_cfg_create(TRUE, FALSE, "0.0.0.0", FALSE,
|
||||||
|
charon->socket->get_port(charon->socket, FALSE),
|
||||||
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));
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
||||||
"0.0.0.0", FALSE, CHARON_UDP_PORT,
|
"0.0.0.0", FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
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(
|
||||||
|
@ -396,7 +396,7 @@ medcli_config_t *medcli_config_create(database_t *db)
|
||||||
.rekey = lib->settings->get_time(lib->settings, "medcli.rekey", 1200),
|
.rekey = lib->settings->get_time(lib->settings, "medcli.rekey", 1200),
|
||||||
.dpd = lib->settings->get_time(lib->settings, "medcli.dpd", 300),
|
.dpd = lib->settings->get_time(lib->settings, "medcli.dpd", 300),
|
||||||
.ike = ike_cfg_create(FALSE, FALSE,
|
.ike = ike_cfg_create(FALSE, FALSE,
|
||||||
"0.0.0.0", FALSE, CHARON_UDP_PORT,
|
"0.0.0.0", FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
"0.0.0.0", FALSE, IKEV2_UDP_PORT),
|
"0.0.0.0", FALSE, IKEV2_UDP_PORT),
|
||||||
);
|
);
|
||||||
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
||||||
|
|
|
@ -141,7 +141,7 @@ medsrv_config_t *medsrv_config_create(database_t *db)
|
||||||
.rekey = lib->settings->get_time(lib->settings, "medsrv.rekey", 1200),
|
.rekey = lib->settings->get_time(lib->settings, "medsrv.rekey", 1200),
|
||||||
.dpd = lib->settings->get_time(lib->settings, "medsrv.dpd", 300),
|
.dpd = lib->settings->get_time(lib->settings, "medsrv.dpd", 300),
|
||||||
.ike = ike_cfg_create(FALSE, FALSE,
|
.ike = ike_cfg_create(FALSE, FALSE,
|
||||||
"0.0.0.0", FALSE, CHARON_UDP_PORT,
|
"0.0.0.0", FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
"0.0.0.0", FALSE, IKEV2_UDP_PORT),
|
"0.0.0.0", FALSE, IKEV2_UDP_PORT),
|
||||||
);
|
);
|
||||||
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
||||||
|
|
|
@ -259,7 +259,7 @@ static ike_cfg_t *build_ike_cfg(private_sql_config_t *this, enumerator_t *e,
|
||||||
ike_cfg_t *ike_cfg;
|
ike_cfg_t *ike_cfg;
|
||||||
|
|
||||||
ike_cfg = ike_cfg_create(certreq, force_encap,
|
ike_cfg = ike_cfg_create(certreq, force_encap,
|
||||||
local, FALSE, CHARON_UDP_PORT,
|
local, FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote, FALSE, IKEV2_UDP_PORT);
|
remote, FALSE, IKEV2_UDP_PORT);
|
||||||
add_ike_proposals(this, ike_cfg, id);
|
add_ike_proposals(this, ike_cfg, id);
|
||||||
return ike_cfg;
|
return ike_cfg;
|
||||||
|
|
|
@ -226,7 +226,8 @@ static ike_cfg_t *build_ike_cfg(private_stroke_config_t *this, stroke_msg_t *msg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ikeport = msg->add_conn.me.ikeport;
|
ikeport = msg->add_conn.me.ikeport;
|
||||||
ikeport = (ikeport == IKEV2_UDP_PORT) ? CHARON_UDP_PORT : ikeport;
|
ikeport = (ikeport == IKEV2_UDP_PORT) ?
|
||||||
|
charon->socket->get_port(charon->socket, FALSE) : ikeport;
|
||||||
ike_cfg = ike_cfg_create(msg->add_conn.other.sendcert != CERT_NEVER_SEND,
|
ike_cfg = ike_cfg_create(msg->add_conn.other.sendcert != CERT_NEVER_SEND,
|
||||||
msg->add_conn.force_encap,
|
msg->add_conn.force_encap,
|
||||||
msg->add_conn.me.address,
|
msg->add_conn.me.address,
|
||||||
|
|
|
@ -169,7 +169,7 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
||||||
{
|
{
|
||||||
DESTROY_IF(this->peer_cfg);
|
DESTROY_IF(this->peer_cfg);
|
||||||
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
ike_cfg = ike_cfg_create(FALSE, FALSE,
|
||||||
local_addr, FALSE, CHARON_UDP_PORT,
|
local_addr, FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
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(
|
||||||
|
@ -267,7 +267,7 @@ METHOD(enumerator_t, ike_enumerator_enumerate, bool,
|
||||||
{
|
{
|
||||||
DESTROY_IF(this->ike_cfg);
|
DESTROY_IF(this->ike_cfg);
|
||||||
this->ike_cfg = ike_cfg_create(FALSE, FALSE,
|
this->ike_cfg = ike_cfg_create(FALSE, FALSE,
|
||||||
local_addr, FALSE, CHARON_UDP_PORT,
|
local_addr, FALSE, charon->socket->get_port(charon->socket, FALSE),
|
||||||
remote_addr, FALSE, IKEV2_UDP_PORT);
|
remote_addr, FALSE, IKEV2_UDP_PORT);
|
||||||
this->ike_cfg->add_proposal(this->ike_cfg,
|
this->ike_cfg->add_proposal(this->ike_cfg,
|
||||||
create_proposal(ike_proposal, PROTO_IKE));
|
create_proposal(ike_proposal, PROTO_IKE));
|
||||||
|
|
|
@ -97,7 +97,7 @@ METHOD(job_t, execute, job_requeue_t,
|
||||||
ike_sa->set_kmaddress(ike_sa, this->local, this->remote);
|
ike_sa->set_kmaddress(ike_sa, this->local, this->remote);
|
||||||
|
|
||||||
host = this->local->clone(this->local);
|
host = this->local->clone(this->local);
|
||||||
host->set_port(host, CHARON_UDP_PORT);
|
host->set_port(host, charon->socket->get_port(charon->socket, FALSE));
|
||||||
ike_sa->set_my_host(ike_sa, host);
|
ike_sa->set_my_host(ike_sa, host);
|
||||||
|
|
||||||
host = this->remote->clone(this->remote);
|
host = this->remote->clone(this->remote);
|
||||||
|
|
|
@ -845,9 +845,11 @@ METHOD(ike_sa_t, float_ports, void,
|
||||||
private_ike_sa_t *this)
|
private_ike_sa_t *this)
|
||||||
{
|
{
|
||||||
/* do not switch if we have a custom port from MOBIKE/NAT */
|
/* do not switch if we have a custom port from MOBIKE/NAT */
|
||||||
if (this->my_host->get_port(this->my_host) == CHARON_UDP_PORT)
|
if (this->my_host->get_port(this->my_host) ==
|
||||||
|
charon->socket->get_port(charon->socket, FALSE))
|
||||||
{
|
{
|
||||||
this->my_host->set_port(this->my_host, CHARON_NATT_PORT);
|
this->my_host->set_port(this->my_host,
|
||||||
|
charon->socket->get_port(charon->socket, TRUE));
|
||||||
}
|
}
|
||||||
if (this->other_host->get_port(this->other_host) == IKEV2_UDP_PORT)
|
if (this->other_host->get_port(this->other_host) == IKEV2_UDP_PORT)
|
||||||
{
|
{
|
||||||
|
@ -1054,7 +1056,7 @@ static void resolve_hosts(private_ike_sa_t *this)
|
||||||
if (this->local_host)
|
if (this->local_host)
|
||||||
{
|
{
|
||||||
host = this->local_host->clone(this->local_host);
|
host = this->local_host->clone(this->local_host);
|
||||||
host->set_port(host, CHARON_UDP_PORT);
|
host->set_port(host, charon->socket->get_port(charon->socket, FALSE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2239,7 +2241,8 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id, bool initiator,
|
||||||
}
|
}
|
||||||
|
|
||||||
this->task_manager = task_manager_create(&this->public);
|
this->task_manager = task_manager_create(&this->public);
|
||||||
this->my_host->set_port(this->my_host, CHARON_UDP_PORT);
|
this->my_host->set_port(this->my_host,
|
||||||
|
charon->socket->get_port(charon->socket, FALSE));
|
||||||
|
|
||||||
if (!this->task_manager || !this->keymat)
|
if (!this->task_manager || !this->keymat)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,8 @@ METHOD(task_t, process_r, status_t,
|
||||||
notify_type_names, type, redirect);
|
notify_type_names, type, redirect);
|
||||||
/* Cisco boxes reject the first message from 4500 */
|
/* Cisco boxes reject the first message from 4500 */
|
||||||
me = this->ike_sa->get_my_host(this->ike_sa);
|
me = this->ike_sa->get_my_host(this->ike_sa);
|
||||||
me->set_port(me, CHARON_UDP_PORT);
|
me->set_port(me, charon->socket->get_port(
|
||||||
|
charon->socket, FALSE));
|
||||||
this->ike_sa->set_other_host(this->ike_sa, redirect);
|
this->ike_sa->set_other_host(this->ike_sa, redirect);
|
||||||
this->ike_sa->reauth(this->ike_sa);
|
this->ike_sa->reauth(this->ike_sa);
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
|
@ -277,9 +277,13 @@ static void apply_port(host_t *host, host_t *old, u_int16_t port, bool local)
|
||||||
{
|
{
|
||||||
port = old->get_port(old);
|
port = old->get_port(old);
|
||||||
}
|
}
|
||||||
else if (port == (local ? CHARON_UDP_PORT : IKEV2_UDP_PORT))
|
else if (local && port == charon->socket->get_port(charon->socket, FALSE))
|
||||||
{
|
{
|
||||||
port = (local ? CHARON_NATT_PORT : IKEV2_NATT_PORT);
|
port = charon->socket->get_port(charon->socket, TRUE);
|
||||||
|
}
|
||||||
|
else if (!local && port == IKEV2_UDP_PORT)
|
||||||
|
{
|
||||||
|
port = IKEV2_NATT_PORT;
|
||||||
}
|
}
|
||||||
host->set_port(host, port);
|
host->set_port(host, port);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue