Pass the CREATE_CHILD_SA initiator flag to the child_keys parameter
authorMartin Willi <martin@revosec.ch>
Mon, 26 Jul 2010 10:05:04 +0000 (12:05 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 26 Jul 2010 11:53:53 +0000 (13:53 +0200)
src/libcharon/bus/bus.c
src/libcharon/bus/bus.h
src/libcharon/bus/listeners/listener.h
src/libcharon/plugins/ha/ha_child.c
src/libcharon/sa/tasks/child_create.c

index 97d09c4..441009e 100644 (file)
@@ -444,8 +444,8 @@ METHOD(bus_t, ike_keys, void,
 }
 
 METHOD(bus_t, child_keys, void,
-       private_bus_t *this, child_sa_t *child_sa, diffie_hellman_t *dh,
-       chunk_t nonce_i, chunk_t nonce_r)
+       private_bus_t *this, child_sa_t *child_sa, bool initiator,
+       diffie_hellman_t *dh, chunk_t nonce_i, chunk_t nonce_r)
 {
        enumerator_t *enumerator;
        ike_sa_t *ike_sa;
@@ -464,7 +464,7 @@ METHOD(bus_t, child_keys, void,
                }
                entry->calling++;
                keep = entry->listener->child_keys(entry->listener, ike_sa, child_sa,
-                                                                                  dh, nonce_i, nonce_r);
+                                                                                  initiator, dh, nonce_i, nonce_r);
                entry->calling--;
                if (!keep)
                {
index df555d8..6a306af 100644 (file)
@@ -268,12 +268,13 @@ struct bus_t {
         * CHILD_SA keymat hook.
         *
         * @param child_sa      CHILD_SA this keymat is used for
+        * @param initiator     initiator of the CREATE_CHILD_SA exchange
         * @param dh            diffie hellman shared secret
         * @param nonce_i       initiators nonce
         * @param nonce_r       responders nonce
         */
-       void (*child_keys)(bus_t *this, child_sa_t *child_sa, diffie_hellman_t *dh,
-                                          chunk_t nonce_i, chunk_t nonce_r);
+       void (*child_keys)(bus_t *this, child_sa_t *child_sa, bool initiator,
+                                          diffie_hellman_t *dh, chunk_t nonce_i, chunk_t nonce_r);
 
        /**
         * IKE_SA up/down hook.
index 45c61c0..e7873ee 100644 (file)
@@ -110,13 +110,15 @@ struct listener_t {
         *
         * @param ike_sa        IKE_SA the child sa belongs to
         * @param child_sa      CHILD_SA this keymat is used for
+        * @param initiator     initiator of the CREATE_CHILD_SA exchange
         * @param dh            diffie hellman shared secret
         * @param nonce_i       initiators nonce
         * @param nonce_r       responders nonce
         * @return                      TRUE to stay registered, FALSE to unregister
         */
        bool (*child_keys)(listener_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa,
-                                          diffie_hellman_t *dh, chunk_t nonce_i, chunk_t nonce_r);
+                                          bool initiator, diffie_hellman_t *dh,
+                                          chunk_t nonce_i, chunk_t nonce_r);
 
        /**
         * Hook called if an IKE_SA gets up or down.
index 5a437c5..464353e 100644 (file)
@@ -45,7 +45,7 @@ struct private_ha_child_t {
 
 METHOD(listener_t, child_keys, bool,
        private_ha_child_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa,
-       diffie_hellman_t *dh, chunk_t nonce_i, chunk_t nonce_r)
+       bool initiator, diffie_hellman_t *dh, chunk_t nonce_i, chunk_t nonce_r)
 {
        ha_message_t *m;
        chunk_t secret;
index 1113e47..3de27ee 100644 (file)
@@ -489,8 +489,8 @@ static status_t select_and_install(private_child_create_t *this,
                return NOT_FOUND;
        }
 
-       charon->bus->child_keys(charon->bus, this->child_sa, this->dh,
-                                                       nonce_i, nonce_r);
+       charon->bus->child_keys(charon->bus, this->child_sa, this->initiator,
+                                                       this->dh, nonce_i, nonce_r);
 
        /* add to IKE_SA, and remove from task */
        this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);