From 007a2701bbd7556ba9ca6294a80dcc5336da086e Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 20 Dec 2017 12:32:52 +0100 Subject: [PATCH] ike: Don't handle roam events if no IKE config is available IKE_SAs newly created via HA_IKE_ADD message don't have any IKE or peer config assigned yet (this happens later with an HA_IKE_UPDATE message). And because the state is initially set to IKE_CONNECTING the roam() method does not immediately return, as it later would for passive HA SAs. This might cause the check for explicitly configured local addresses to crash the daemon with a segmentation fault. Fixes #2500. --- src/libcharon/sa/ike_sa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c index 823cf2579..4123cc49d 100644 --- a/src/libcharon/sa/ike_sa.c +++ b/src/libcharon/sa/ike_sa.c @@ -2561,6 +2561,12 @@ METHOD(ike_sa_t, roam, status_t, break; } + if (!this->ike_cfg) + { /* this is the case for new HA SAs not yet in state IKE_PASSIVE and + * without config assigned */ + return SUCCESS; + } + /* ignore roam events if MOBIKE is not supported/enabled and the local * address is statically configured */ if (this->version == IKEV2 && !supports_extension(this, EXT_MOBIKE) &&