ike-mobike: Always use this task for DPDs even if not behind a NAT
authorTobias Brunner <tobias@strongswan.org>
Tue, 22 May 2018 16:04:00 +0000 (18:04 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 22 Jun 2018 07:20:30 +0000 (09:20 +0200)
This allows switching to probing mode if the client is on a public IP
and this is the active task and connectivity gets restored.  We only add
NAT-D payloads if we are currently behind a NAT (to detect changed NAT
mappings), a MOBIKE update that might follow will add them in case we
move behind a NAT.

src/libcharon/sa/ikev2/task_manager_v2.c
src/libcharon/sa/ikev2/tasks/ike_mobike.c

index fff5672..2facedb 100644 (file)
@@ -1946,8 +1946,7 @@ METHOD(task_manager_t, queue_dpd, void,
 {
        ike_mobike_t *mobike;
 
-       if (this->ike_sa->supports_extension(this->ike_sa, EXT_MOBIKE) &&
-               this->ike_sa->has_condition(this->ike_sa, COND_NAT_HERE))
+       if (this->ike_sa->supports_extension(this->ike_sa, EXT_MOBIKE))
        {
 #ifdef ME
                peer_cfg_t *cfg = this->ike_sa->get_peer_cfg(this->ike_sa);
index fe41a1c..b2ad0a0 100644 (file)
@@ -193,7 +193,7 @@ static void process_payloads(private_ike_mobike_t *this, message_t *message)
                        case NAT_DETECTION_DESTINATION_IP:
                        {
                                /* NAT check in this MOBIKE exchange, create subtask for it */
-                               if (this->natd == NULL)
+                               if (!this->natd)
                                {
                                        this->natd = ike_natd_create(this->ike_sa, this->initiator);
                                }
@@ -648,7 +648,7 @@ METHOD(ike_mobike_t, roam, void,
 METHOD(ike_mobike_t, dpd, void,
           private_ike_mobike_t *this)
 {
-       if (!this->natd)
+       if (!this->natd && this->ike_sa->has_condition(this->ike_sa, COND_NAT_HERE))
        {
                this->natd = ike_natd_create(this->ike_sa, this->initiator);
        }