Don't invoke updown hook when flushing SAs for IKEv1, tasks will do it
authorMartin Willi <martin@revosec.ch>
Mon, 16 Jan 2012 14:57:46 +0000 (15:57 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:36 +0000 (17:31 +0100)
src/libcharon/sa/ike_sa_manager.c

index 2b4418f..79a52c9 100644 (file)
@@ -1695,16 +1695,18 @@ METHOD(ike_sa_manager_t, flush, void,
        while (enumerator->enumerate(enumerator, &entry, &segment))
        {
                charon->bus->set_sa(charon->bus, entry->ike_sa);
-               /* as the delete never gets processed, fire down events */
-               switch (entry->ike_sa->get_state(entry->ike_sa))
-               {
-                       case IKE_ESTABLISHED:
-                       case IKE_REKEYING:
-                       case IKE_DELETING:
-                               charon->bus->ike_updown(charon->bus, entry->ike_sa, FALSE);
-                               break;
-                       default:
-                               break;
+               if (entry->ike_sa->get_version(entry->ike_sa) == IKEV2)
+               {       /* as the delete never gets processed, fire down events */
+                       switch (entry->ike_sa->get_state(entry->ike_sa))
+                       {
+                               case IKE_ESTABLISHED:
+                               case IKE_REKEYING:
+                               case IKE_DELETING:
+                                       charon->bus->ike_updown(charon->bus, entry->ike_sa, FALSE);
+                                       break;
+                               default:
+                                       break;
+                       }
                }
                entry->ike_sa->delete(entry->ike_sa);
        }