From 01f462f0d327bc202b88cce1d5ee3f0e90056be2 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 28 Nov 2018 15:52:27 +0100 Subject: [PATCH] ikev2: Ignore COOKIE notifies we already received This could be due to a delayed response to an IKE_SA_INIT retransmit. Fixes #2837. --- src/libcharon/sa/ikev2/tasks/ike_init.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libcharon/sa/ikev2/tasks/ike_init.c b/src/libcharon/sa/ikev2/tasks/ike_init.c index b5086182b..b570904e2 100644 --- a/src/libcharon/sa/ikev2/tasks/ike_init.c +++ b/src/libcharon/sa/ikev2/tasks/ike_init.c @@ -890,6 +890,20 @@ METHOD(task_t, pre_process_i, status_t, switch (type) { + case COOKIE: + { + chunk_t cookie; + + cookie = notify->get_notification_data(notify); + if (chunk_equals(cookie, this->cookie)) + { + DBG1(DBG_IKE, "ignore response with duplicate COOKIE " + "notify"); + enumerator->destroy(enumerator); + return FAILED; + } + break; + } case REDIRECT: { identification_t *gateway;