Added support for Phase1 IV synchronization to HA plugin

This commit is contained in:
Martin Willi
2012-03-20 17:31:37 +01:00
parent 47b8f6ef4b
commit c8531b7e69
5 changed files with 134 additions and 32 deletions
+17
View File
@@ -88,6 +88,8 @@ typedef struct {
ha_message_t *midi;
/* last responder mid */
ha_message_t *midr;
/* last IV update */
ha_message_t *iv;
} entry_t;
/**
@@ -114,6 +116,7 @@ static void entry_destroy(entry_t *entry)
entry->add->destroy(entry->add);
DESTROY_IF(entry->midi);
DESTROY_IF(entry->midr);
DESTROY_IF(entry->iv);
free(entry);
}
@@ -164,6 +167,16 @@ METHOD(ha_cache_t, cache, void,
}
message->destroy(message);
break;
case HA_IKE_IV:
entry = this->cache->get(this->cache, ike_sa);
if (entry)
{
DESTROY_IF(entry->iv);
entry->iv = message;
break;
}
message->destroy(message);
break;
case HA_IKE_DELETE:
entry = this->cache->remove(this->cache, ike_sa);
if (entry)
@@ -309,6 +322,10 @@ METHOD(ha_cache_t, resync, void,
{
this->socket->push(this->socket, entry->midr);
}
if (entry->iv)
{
this->socket->push(this->socket, entry->iv);
}
}
}
enumerator->destroy(enumerator);