fixing a problem if the mediation server initiates the rekeying
authorTobias Brunner <tobias@strongswan.org>
Thu, 10 Apr 2008 07:24:30 +0000 (07:24 -0000)
committerTobias Brunner <tobias@strongswan.org>
Thu, 10 Apr 2008 07:24:30 +0000 (07:24 -0000)
src/charon/sa/ike_sa.c
src/charon/sa/ike_sa.h
src/charon/sa/tasks/ike_me.c

index cdc5a43..0e947df 100644 (file)
@@ -508,6 +508,15 @@ static void set_ike_cfg(private_ike_sa_t *this, ike_cfg_t *ike_cfg)
        ike_cfg->get_ref(ike_cfg);
        this->ike_cfg = ike_cfg;
 }
+
+/**
+ * Implementation of ike_sa_t.is_ike_initiator
+ */
+static bool is_ike_initiator(private_ike_sa_t *this)
+{
+       return this->ike_initiator;
+}
+
 /**
  * Implementation of ike_sa_t.enable_extension.
  */
@@ -2422,6 +2431,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
        this->public.has_condition = (bool (*)(ike_sa_t*,ike_condition_t)) has_condition;
        this->public.set_pending_updates = (void(*)(ike_sa_t*, u_int32_t updates))set_pending_updates;
        this->public.get_pending_updates = (u_int32_t(*)(ike_sa_t*))get_pending_updates;
+       this->public.is_ike_initiator = (bool (*)(ike_sa_t*))is_ike_initiator;
        this->public.create_additional_address_iterator = (iterator_t*(*)(ike_sa_t*))create_additional_address_iterator;
        this->public.add_additional_address = (void(*)(ike_sa_t*, host_t *host))add_additional_address;
        this->public.retransmit = (status_t (*)(ike_sa_t *, u_int32_t)) retransmit;
index 58e6e01..e290c5b 100644 (file)
@@ -433,6 +433,13 @@ struct ike_sa_t {
         * @param updates               number of pending updates
         */
        void (*set_pending_updates)(ike_sa_t *this, u_int32_t updates);
+       
+       /**
+        * Check if we are the original initiator of this IKE_SA (rekeying does not
+        * change this flag).
+        */
+       bool (*is_ike_initiator)(ike_sa_t *this);
+       
 
 #ifdef ME
        /**
index 4d70a9c..58d99ea 100644 (file)
@@ -793,8 +793,7 @@ ike_me_t *ike_me_create(ike_sa_t *ike_sa, bool initiator)
        this->public.task.migrate = (void(*)(task_t*,ike_sa_t*))migrate;
        this->public.task.destroy = (void(*)(task_t*))destroy;
        
-       ike_sa_id_t *id = ike_sa->get_id(ike_sa);
-       if (id->is_initiator(id))
+       if (ike_sa->is_ike_initiator(ike_sa))
        {
                if (initiator)
                {