]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Enforce encapsulation mode of configuration, in case initiator proposes both
authorMartin Willi <martin@revosec.ch>
Mon, 9 Jan 2012 17:12:17 +0000 (18:12 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:34 +0000 (17:31 +0100)
src/libcharon/sa/ikev1/tasks/quick_mode.c

index fb7e1a0ff898541dc9e359df98f110a867bf91fa..dedeab189126febf4c87e0ec635163e87a16a838 100644 (file)
@@ -765,7 +765,6 @@ METHOD(task_t, process_r, status_t,
 
                        get_lifetimes(this);
                        apply_lifetimes(this, sa_payload);
-                       this->mode = sa_payload->get_encap_mode(sa_payload, &udp);
 
                        if (!this->proposal)
                        {
@@ -799,6 +798,7 @@ METHOD(task_t, process_r, status_t,
 
                        check_for_rekeyed_child(this);
 
+                       udp = this->ike_sa->has_condition(this->ike_sa, COND_NAT_ANY);
                        this->child_sa = child_sa_create(
                                                                        this->ike_sa->get_my_host(this->ike_sa),
                                                                        this->ike_sa->get_other_host(this->ike_sa),
@@ -846,6 +846,7 @@ METHOD(task_t, build_r, status_t,
                        this->proposal->set_spi(this->proposal, this->spi_r);
 
                        udp = this->child_sa->has_encap(this->child_sa);
+                       this->mode = this->config->get_mode(this->config);
                        if (udp && this->mode == MODE_TRANSPORT)
                        {
                                /* TODO-IKEv1: disable NAT-T for TRANSPORT mode by default? */