Slightly refactored port floating.

In case of MOBIKE, only float to port 4500 if the other peer actually supports MOBIKE.
This commit is contained in:
Tobias Brunner
2010-08-30 13:42:58 +02:00
parent be63a48c36
commit 277f02ce9e
5 changed files with 39 additions and 35 deletions
+15
View File
@@ -810,6 +810,20 @@ METHOD(ike_sa_t, get_pending_updates, u_int32_t,
return this->pending_updates;
}
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) == IKEV2_UDP_PORT)
{
this->my_host->set_port(this->my_host, IKEV2_NATT_PORT);
}
if (this->other_host->get_port(this->other_host) == IKEV2_UDP_PORT)
{
this->other_host->set_port(this->other_host, IKEV2_NATT_PORT);
}
}
METHOD(ike_sa_t, update_hosts, void,
private_ike_sa_t *this, host_t *me, host_t *other)
{
@@ -2023,6 +2037,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
.get_other_host = _get_other_host,
.set_other_host = _set_other_host,
.set_message_id = _set_message_id,
.float_ports = _float_ports,
.update_hosts = _update_hosts,
.get_my_id = _get_my_id,
.set_my_id = _set_my_id,