From ffa20bad6356732e840aaffc6f9ef8fd1e6eb88e Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 3 Aug 2015 19:36:45 +0200 Subject: [PATCH] stroke: Allow %any as local address Actually, resolving addresses in `left` might be overkill as we'll assume left=local anyway (the only difference is the log message). --- src/libcharon/plugins/stroke/stroke_config.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c index afd88cb20..f71719458 100644 --- a/src/libcharon/plugins/stroke/stroke_config.c +++ b/src/libcharon/plugins/stroke/stroke_config.c @@ -186,7 +186,7 @@ static void add_proposals(private_stroke_config_t *this, char *string, /** * Check if any addresses in the given string are local */ -static bool is_local(char *address) +static bool is_local(char *address, bool any_allowed) { enumerator_t *enumerator; host_t *host; @@ -206,6 +206,10 @@ static bool is_local(char *address) { found = TRUE; } + else if (any_allowed && host->is_anyaddr(host)) + { + found = TRUE; + } host->destroy(host); if (found) { @@ -229,7 +233,7 @@ static void swap_ends(stroke_msg_t *msg) return; } - if (is_local(msg->add_conn.other.address)) + if (is_local(msg->add_conn.other.address, FALSE)) { stroke_end_t tmp_end; @@ -238,7 +242,7 @@ static void swap_ends(stroke_msg_t *msg) msg->add_conn.me = msg->add_conn.other; msg->add_conn.other = tmp_end; } - else if (!is_local(msg->add_conn.me.address)) + else if (!is_local(msg->add_conn.me.address, TRUE)) { DBG1(DBG_CFG, "left nor right host is our side, assuming left=local"); }