fixed NAT detection with mobike

This commit is contained in:
Martin Willi
2007-09-12 07:14:05 +00:00
parent 39cc6d1ad7
commit 12fa4387c6
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -422,6 +422,7 @@ static status_t process_i(private_ike_mobike_t *this, message_t *message)
/* start the update with the same task */ /* start the update with the same task */
this->check = FALSE; this->check = FALSE;
this->address = FALSE; this->address = FALSE;
this->natd = ike_natd_create(this->ike_sa, this->initiator);
this->ike_sa->set_pending_updates(this->ike_sa, 1); this->ike_sa->set_pending_updates(this->ike_sa, 1);
return NEED_MORE; return NEED_MORE;
} }
@@ -438,7 +439,6 @@ static void roam(private_ike_mobike_t *this, bool address)
{ {
this->check = TRUE; this->check = TRUE;
this->address = address; this->address = address;
this->natd = ike_natd_create(this->ike_sa, this->initiator);
this->ike_sa->set_pending_updates(this->ike_sa, this->ike_sa->set_pending_updates(this->ike_sa,
this->ike_sa->get_pending_updates(this->ike_sa) + 1); this->ike_sa->get_pending_updates(this->ike_sa) + 1);
} }
+6 -6
View File
@@ -147,8 +147,8 @@ static void process_payloads(private_ike_natd_t *this, message_t *message)
/* Precompute NAT-D hashes for incoming NAT notify comparison */ /* Precompute NAT-D hashes for incoming NAT notify comparison */
ike_sa_id = message->get_ike_sa_id(message); ike_sa_id = message->get_ike_sa_id(message);
me = this->ike_sa->get_my_host(this->ike_sa); me = message->get_destination(message);
other = this->ike_sa->get_other_host(this->ike_sa); other = message->get_source(message);
dst_hash = generate_natd_hash(this, ike_sa_id, me); dst_hash = generate_natd_hash(this, ike_sa_id, me);
src_hash = generate_natd_hash(this, ike_sa_id, other); src_hash = generate_natd_hash(this, ike_sa_id, other);
@@ -252,7 +252,7 @@ static status_t build_i(private_ike_natd_t *this, message_t *message)
host_t *host; host_t *host;
/* destination is always set */ /* destination is always set */
host = this->ike_sa->get_other_host(this->ike_sa); host = message->get_destination(message);
notify = build_natd_payload(this, NAT_DETECTION_DESTINATION_IP, host); notify = build_natd_payload(this, NAT_DETECTION_DESTINATION_IP, host);
message->add_payload(message, (payload_t*)notify); message->add_payload(message, (payload_t*)notify);
@@ -261,7 +261,7 @@ static status_t build_i(private_ike_natd_t *this, message_t *message)
* 2. We do a routing lookup in the kernel interface * 2. We do a routing lookup in the kernel interface
* 3. Include all possbile addresses * 3. Include all possbile addresses
*/ */
host = this->ike_sa->get_my_host(this->ike_sa); host = message->get_source(message);
if (!host->is_anyaddr(host)) if (!host->is_anyaddr(host))
{ /* 1. */ { /* 1. */
notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, host); notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, host);
@@ -312,11 +312,11 @@ static status_t build_r(private_ike_natd_t *this, message_t *message)
if (this->src_seen && this->dst_seen) if (this->src_seen && this->dst_seen)
{ {
/* initiator seems to support NAT detection, add response */ /* initiator seems to support NAT detection, add response */
me = this->ike_sa->get_my_host(this->ike_sa); me = message->get_source(message);
notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, me); notify = build_natd_payload(this, NAT_DETECTION_SOURCE_IP, me);
message->add_payload(message, (payload_t*)notify); message->add_payload(message, (payload_t*)notify);
other = this->ike_sa->get_other_host(this->ike_sa); other = message->get_destination(message);
notify = build_natd_payload(this, NAT_DETECTION_DESTINATION_IP, other); notify = build_natd_payload(this, NAT_DETECTION_DESTINATION_IP, other);
message->add_payload(message, (payload_t*)notify); message->add_payload(message, (payload_t*)notify);
} }