diff --git a/programs/pluto/ikev1_quick.c b/programs/pluto/ikev1_quick.c index 81a9178328..81c522c148 100644 --- a/programs/pluto/ikev1_quick.c +++ b/programs/pluto/ikev1_quick.c @@ -1920,6 +1920,11 @@ static struct connection *fc_try(const struct connection *c, const ip_selector *local_client, const ip_selector *remote_client) { + if (selector_is_unset(local_client) || + selector_is_unset(remote_client)) { + return NULL; + } + struct connection *best = NULL; policy_prio_t best_prio = BOTTOM_PRIO; const bool remote_is_host = selector_eq_address(*remote_client, @@ -2103,6 +2108,11 @@ static struct connection *fc_try_oppo(const struct connection *c, const ip_selector *local_client, const ip_selector *remote_client) { + if (selector_is_unset(local_client) || + selector_is_unset(remote_client)) { + return NULL; + } + struct connection *best = NULL; policy_prio_t best_prio = BOTTOM_PRIO; @@ -2224,6 +2234,16 @@ struct connection *find_v1_client_connection(struct connection *const c, str_selectors(local_client, remote_client, &sb)); } + if (selector_is_unset(local_client)) { + dbg("peer's local client is not set"); + return NULL; + } + + if (selector_is_unset(remote_client)) { + dbg("peer's remote client is not set"); + return NULL; + } + /* * Give priority to current connection * but even greater priority to a routed concrete connection.