ikev1: When a reauth is detected explicitly delete the old IKE_SA

Instead of just implicitly destroying the old SA we properly delete it to
notify the other peer (if the other peer keeps the SA up after the
reauthentication and sends DPDs it might consider us dead even though the
new SA is up, that seems to be the case with racoon).  We delay the DELETE
a bit to give the other peer time to get the new SA fully established.

Since DELETE messages are not retransmitted it is still possible that
the other peer misses that we deleted the SA.
This commit is contained in:
Tobias Brunner
2015-05-21 16:00:39 +02:00
parent b29c5c0f21
commit 4112ebad4a
@@ -21,6 +21,7 @@
#include <daemon.h>
#include <hydra.h>
#include <collections/array.h>
#include <processing/jobs/delete_ike_sa_job.h>
typedef struct private_adopt_children_job_t private_adopt_children_job_t;
@@ -133,10 +134,19 @@ METHOD(job_t, execute, job_requeue_t,
"adopting %d children and %d virtual IPs",
children->get_count(children), vips->get_count(vips));
}
ike_sa->set_state(ike_sa, IKE_DELETING);
charon->bus->ike_updown(charon->bus, ike_sa, FALSE);
charon->ike_sa_manager->checkin_and_destroy(
if (ike_sa->get_state(ike_sa) == IKE_PASSIVE)
{
charon->ike_sa_manager->checkin_and_destroy(
charon->ike_sa_manager, ike_sa);
}
else
{
lib->scheduler->schedule_job(lib->scheduler, (job_t*)
delete_ike_sa_job_create(ike_sa->get_id(ike_sa),
TRUE), 10);
charon->ike_sa_manager->checkin(
charon->ike_sa_manager, ike_sa);
}
}
else
{