Update duplicheck entry during IKE rekeying
authorMartin Willi <martin@revosec.ch>
Mon, 28 Feb 2011 14:49:50 +0000 (14:49 +0000)
committerMartin Willi <martin@revosec.ch>
Mon, 28 Feb 2011 15:37:18 +0000 (15:37 +0000)
src/libcharon/plugins/duplicheck/duplicheck_listener.c

index 1942084..226b2bd 100644 (file)
@@ -91,11 +91,26 @@ static bool equals(identification_t *a, identification_t *b)
 }
 
 METHOD(listener_t, ike_rekey, bool,
-       private_duplicheck_listener_t *this, ike_sa_t *new, ike_sa_t *old)
+       private_duplicheck_listener_t *this, ike_sa_t *old, ike_sa_t *new)
 {
+       identification_t *id;
+       ike_sa_id_t *sa;
+       entry_t *entry;
+
+       sa = new->get_id(new);
+       id = new->get_other_id(new);
+
+       INIT(entry,
+               .id = id->clone(id),
+               .sa = sa->clone(sa),
+       );
        this->mutex->lock(this->mutex);
-       /* TODO update entires */
+       entry = this->active->put(this->active, entry->id, entry);
        this->mutex->unlock(this->mutex);
+       if (entry)
+       {
+               entry_destroy(entry);
+       }
        return TRUE;
 }