ike: Simplify error handling if name resolution failed

This avoids a second name resolution attempt just to determine if %any
etc. was configured.

Fixes #440.
This commit is contained in:
Tobias Brunner
2014-01-23 10:04:19 +01:00
parent be8af56e7a
commit 53d2164c5d
+3 -16
View File
@@ -1170,26 +1170,13 @@ METHOD(ike_sa_t, initiate, status_t,
#endif /* ME */
)
{
bool is_anyaddr;
host_t *host;
char *addr;
addr = this->ike_cfg->get_other_addr(this->ike_cfg);
host = this->ike_cfg->resolve_other(this->ike_cfg, AF_UNSPEC);
is_anyaddr = host && host->is_anyaddr(host);
DESTROY_IF(host);
if (is_anyaddr || !this->retry_initiate_interval)
if (!this->retry_initiate_interval)
{
if (is_anyaddr)
{
DBG1(DBG_IKE, "unable to initiate to %s", addr);
}
else
{
DBG1(DBG_IKE, "unable to resolve %s, initiate aborted",
addr);
}
DBG1(DBG_IKE, "unable to resolve %s, initiate aborted",
addr);
DESTROY_IF(child_cfg);
charon->bus->alert(charon->bus, ALERT_PEER_ADDR_FAILED);
return DESTROY_ME;