From c44f116251ececdee68097a5245bbb4c2bdbb168 Mon Sep 17 00:00:00 2001 From: Seongsik Kim Date: Mon, 28 Sep 2020 17:45:43 +0900 Subject: [PATCH] [APR-5544]libcharon: Check if the interface is available after terminate IKE SA [Jira] NEUS7920-26406 [Problem] Even though there is no interface, a message is sent to the server after IKE SA terminate. [Cause] Send without checking if the interface is available. [Solution] Check if the interface is available. Change-Id: I5b4b9b7ae64bed4ce7f3bb091df40ad05da82ad4 Signed-off-by: Seongsik Kim --- src/libcharon/control/controller.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libcharon/control/controller.c b/src/libcharon/control/controller.c index 0c86275..7a14658 100755 --- a/src/libcharon/control/controller.c +++ b/src/libcharon/control/controller.c @@ -569,6 +569,27 @@ METHOD(job_t, terminate_ike_execute, job_requeue_t, listener->ike_sa = ike_sa; listener->lock->unlock(listener->lock); +#ifdef VOWIFI_CFG + char *iface; + if (charon->kernel->get_interface(charon->kernel, ike_sa->get_my_host(ike_sa), &iface)) + { + DBG1(DBG_KNL, "HOST_IP %H is on interface %s", ike_sa->get_my_host(ike_sa), iface); + } + else + { + DBG1(DBG_KNL, "%H is not present on any interface. Deleting IKE_SA %s[%d] without sending message to server.", + ike_sa->get_my_host(ike_sa), ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa)); + + if (ike_sa->get_state(ike_sa) == IKE_ESTABLISHED) + { + ike_sa->set_state(ike_sa, IKE_DELETING); + } + + charon->bus->ike_updown(charon->bus, ike_sa, FALSE); + charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager,ike_sa); + return JOB_REQUEUE_NONE; + } +#endif if (ike_sa->delete(ike_sa, listener->options.force) != DESTROY_ME) { /* delete queued */ listener->status = FAILED; -- 2.20.1