summaryrefslogtreecommitdiff
path: root/src/libcharon/config/ike_cfg.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
committerYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
commit05ddd767992d68bb38c7f16ece142e8c2e9ae016 (patch)
tree302c618be306d4ed3c7f9fc58a1f6aaad4dd252f /src/libcharon/config/ike_cfg.c
parent25663e04c3ab01ef8dc9f906608282319cfea2db (diff)
downloadvyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.tar.gz
vyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.zip
New upstream version 5.5.2
Diffstat (limited to 'src/libcharon/config/ike_cfg.c')
-rw-r--r--src/libcharon/config/ike_cfg.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/libcharon/config/ike_cfg.c b/src/libcharon/config/ike_cfg.c
index 7d52ac88f..480dd3720 100644
--- a/src/libcharon/config/ike_cfg.c
+++ b/src/libcharon/config/ike_cfg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2016 Tobias Brunner
+ * Copyright (C) 2012-2017 Tobias Brunner
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
@@ -339,7 +339,7 @@ METHOD(ike_cfg_t, select_proposal, proposal_t*,
}
while (match_enum->enumerate(match_enum, (void**)&match))
{
- selected = proposal->select(proposal, match, private);
+ selected = proposal->select(proposal, match, prefer_self, private);
if (selected)
{
DBG2(DBG_CFG, "received proposals: %#P", proposals);
@@ -559,6 +559,39 @@ int ike_cfg_get_family(ike_cfg_t *cfg, bool local)
/**
* Described in header.
*/
+bool ike_cfg_has_address(ike_cfg_t *cfg, host_t *addr, bool local)
+{
+ private_ike_cfg_t *this = (private_ike_cfg_t*)cfg;
+ enumerator_t *enumerator;
+ host_t *host;
+ char *str;
+ bool found = FALSE;
+
+ if (local)
+ {
+ enumerator = this->my_hosts->create_enumerator(this->my_hosts);
+ }
+ else
+ {
+ enumerator = this->other_hosts->create_enumerator(this->other_hosts);
+ }
+ while (enumerator->enumerate(enumerator, &str))
+ {
+ host = host_create_from_string(str, 0);
+ if (host && addr->ip_equals(addr, host))
+ {
+ found = TRUE;
+ break;
+ }
+ DESTROY_IF(host);
+ }
+ enumerator->destroy(enumerator);
+ return found;
+}
+
+/**
+ * Described in header.
+ */
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
char *me, uint16_t my_port,
char *other, uint16_t other_port,