Use traffic selectors passed to quick mode constructor as initiator
authorMartin Willi <martin@revosec.ch>
Tue, 5 Jun 2012 13:27:34 +0000 (15:27 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 8 Jun 2012 08:22:03 +0000 (10:22 +0200)
src/libcharon/sa/ikev1/tasks/quick_mode.c

index 4eefe6f..663f2c0 100644 (file)
@@ -717,8 +717,14 @@ METHOD(task_t, build_i, status_t,
                                }
                                add_ke(this, message);
                        }
-                       this->tsi = select_ts(this, TRUE, NULL);
-                       this->tsr = select_ts(this, FALSE, NULL);
+                       if (!this->tsi)
+                       {
+                               this->tsi = select_ts(this, TRUE, NULL);
+                       }
+                       if (!this->tsr)
+                       {
+                               this->tsr = select_ts(this, FALSE, NULL);
+                       }
                        tsi = linked_list_create();
                        tsr = linked_list_create();
                        tsi->insert_last(tsi, this->tsi);
@@ -1186,6 +1192,8 @@ quick_mode_t *quick_mode_create(ike_sa_t *ike_sa, child_cfg_t *config,
                .config = config,
                .keymat = (keymat_v1_t*)ike_sa->get_keymat(ike_sa),
                .state = QM_INIT,
+               .tsi = tsi ? tsi->clone(tsi) : NULL,
+               .tsr = tsr ? tsr->clone(tsr) : NULL,
        );
 
        if (config)