Replaced usages of CHARON_*_PORT with calls to get_port().

This commit is contained in:
Tobias Brunner
2012-08-08 15:12:25 +02:00
parent a7babe25ee
commit b223d517c8
14 changed files with 33 additions and 20 deletions
+7 -4
View File
@@ -845,9 +845,11 @@ METHOD(ike_sa_t, float_ports, void,
private_ike_sa_t *this)
{
/* 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)
{
@@ -1054,7 +1056,7 @@ static void resolve_hosts(private_ike_sa_t *this)
if (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
{
@@ -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->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)
{
+2 -1
View File
@@ -116,7 +116,8 @@ METHOD(task_t, process_r, status_t,
notify_type_names, type, redirect);
/* Cisco boxes reject the first message from 4500 */
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->reauth(this->ike_sa);
enumerator->destroy(enumerator);
+6 -2
View File
@@ -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);
}
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);
}