ike-cfg: remove the to be obsoleted allow any parameter in get_my/other_addr

This commit is contained in:
Martin Willi
2013-09-04 10:38:37 +02:00
parent 62282ec0ed
commit beffdc6ab8
7 changed files with 18 additions and 33 deletions
+8 -11
View File
@@ -135,7 +135,6 @@ METHOD(backend_manager_t, get_ike_cfg, ike_cfg_t*,
{ {
ike_cfg_t *current, *found = NULL; ike_cfg_t *current, *found = NULL;
char *my_addr, *other_addr; char *my_addr, *other_addr;
bool my_allow_any, other_allow_any;
enumerator_t *enumerator; enumerator_t *enumerator;
ike_cfg_match_t match, best = MATCH_ANY; ike_cfg_match_t match, best = MATCH_ANY;
ike_data_t *data; ike_data_t *data;
@@ -159,11 +158,10 @@ METHOD(backend_manager_t, get_ike_cfg, ike_cfg_t*,
match, me, other, ike_version_names, version); match, me, other, ike_version_names, version);
if (match) if (match)
{ {
my_addr = current->get_my_addr(current, &my_allow_any); my_addr = current->get_my_addr(current);
other_addr = current->get_other_addr(current, &other_allow_any); other_addr = current->get_other_addr(current);
DBG2(DBG_CFG, " candidate: %s%s...%s%s, prio %d", DBG2(DBG_CFG, " candidate: %s...%s, prio %d",
my_allow_any ? "%":"", my_addr, my_addr, other_addr, match);
other_allow_any ? "%":"", other_addr, match);
if (match > best) if (match > best)
{ {
DESTROY_IF(found); DESTROY_IF(found);
@@ -177,11 +175,10 @@ METHOD(backend_manager_t, get_ike_cfg, ike_cfg_t*,
this->lock->unlock(this->lock); this->lock->unlock(this->lock);
if (found) if (found)
{ {
my_addr = found->get_my_addr(found, &my_allow_any); my_addr = found->get_my_addr(found);
other_addr = found->get_other_addr(found, &other_allow_any); other_addr = found->get_other_addr(found);
DBG2(DBG_CFG, "found matching ike config: %s%s...%s%s with prio %d", DBG2(DBG_CFG, "found matching ike config: %s...%s with prio %d",
my_allow_any ? "%":"", my_addr, my_addr, other_addr, best);
other_allow_any ? "%":"", other_addr, best);
} }
return found; return found;
} }
+2 -10
View File
@@ -186,22 +186,14 @@ METHOD(ike_cfg_t, match_other, u_int,
} }
METHOD(ike_cfg_t, get_my_addr, char*, METHOD(ike_cfg_t, get_my_addr, char*,
private_ike_cfg_t *this, bool *allow_any) private_ike_cfg_t *this)
{ {
if (allow_any)
{
*allow_any = this->my_allow_any;
}
return this->me; return this->me;
} }
METHOD(ike_cfg_t, get_other_addr, char*, METHOD(ike_cfg_t, get_other_addr, char*,
private_ike_cfg_t *this, bool *allow_any) private_ike_cfg_t *this)
{ {
if (allow_any)
{
*allow_any = this->other_allow_any;
}
return this->other; return this->other;
} }
+2 -4
View File
@@ -112,18 +112,16 @@ struct ike_cfg_t {
/** /**
* Get own address. * Get own address.
* *
* @param allow_any allow any address to match
* @return string of address/DNS name * @return string of address/DNS name
*/ */
char* (*get_my_addr) (ike_cfg_t *this, bool *allow_any); char* (*get_my_addr) (ike_cfg_t *this);
/** /**
* Get peer's address. * Get peer's address.
* *
* @param allow_any allow any address to match
* @return string of address/DNS name * @return string of address/DNS name
*/ */
char* (*get_other_addr) (ike_cfg_t *this, bool *allow_any); char* (*get_other_addr) (ike_cfg_t *this);
/** /**
* Get the port to use as our source port. * Get the port to use as our source port.
+2 -2
View File
@@ -309,9 +309,9 @@ static void request_query_config(xmlTextReaderPtr reader, xmlTextWriterPtr write
ike_cfg = peer_cfg->get_ike_cfg(peer_cfg); ike_cfg = peer_cfg->get_ike_cfg(peer_cfg);
xmlTextWriterStartElement(writer, "ikeconfig"); xmlTextWriterStartElement(writer, "ikeconfig");
xmlTextWriterWriteElement(writer, "local", xmlTextWriterWriteElement(writer, "local",
ike_cfg->get_my_addr(ike_cfg, NULL)); ike_cfg->get_my_addr(ike_cfg));
xmlTextWriterWriteElement(writer, "remote", xmlTextWriterWriteElement(writer, "remote",
ike_cfg->get_other_addr(ike_cfg, NULL)); ike_cfg->get_other_addr(ike_cfg));
xmlTextWriterEndElement(writer); xmlTextWriterEndElement(writer);
/* </ikeconfig> */ /* </ikeconfig> */
+1 -1
View File
@@ -824,7 +824,7 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
} }
else else
{ {
if (strchr(ike_cfg->get_my_addr(ike_cfg, NULL), ':')) if (strchr(ike_cfg->get_my_addr(ike_cfg), ':'))
{ {
vip = host_create_any(AF_INET6); vip = host_create_any(AF_INET6);
} }
+2 -4
View File
@@ -555,10 +555,8 @@ METHOD(stroke_list_t, status, void,
ike_version = peer_cfg->get_ike_version(peer_cfg); ike_version = peer_cfg->get_ike_version(peer_cfg);
my_addr = ike_cfg->get_my_addr(ike_cfg, &my_allow_any); my_addr = ike_cfg->get_my_addr(ike_cfg, &my_allow_any);
other_addr = ike_cfg->get_other_addr(ike_cfg, &other_allow_any); other_addr = ike_cfg->get_other_addr(ike_cfg, &other_allow_any);
fprintf(out, "%12s: %s%s...%s%s %N", peer_cfg->get_name(peer_cfg), fprintf(out, "%12s: %s...%s %N", peer_cfg->get_name(peer_cfg),
my_allow_any ? "%":"", my_addr, my_addr, other_addr, ike_version_names, ike_version);
other_allow_any ? "%":"", other_addr,
ike_version_names, ike_version);
if (ike_version == IKEV1 && peer_cfg->use_aggressive(peer_cfg)) if (ike_version == IKEV1 && peer_cfg->use_aggressive(peer_cfg))
{ {
+1 -1
View File
@@ -1166,7 +1166,7 @@ METHOD(ike_sa_t, initiate, status_t,
host_t *host; host_t *host;
char *addr; char *addr;
addr = this->ike_cfg->get_my_addr(this->ike_cfg, NULL); addr = this->ike_cfg->get_my_addr(this->ike_cfg);
host = this->ike_cfg->resolve_other(this->ike_cfg, AF_UNSPEC); host = this->ike_cfg->resolve_other(this->ike_cfg, AF_UNSPEC);
is_anyaddr = host && host->is_anyaddr(host); is_anyaddr = host && host->is_anyaddr(host);
DESTROY_IF(host); DESTROY_IF(host);