use of host_create_any() for %any address

This commit is contained in:
Andreas Steffen
2008-11-07 05:15:19 +00:00
parent f11a54bc89
commit e2764b3937
+8 -4
View File
@@ -396,8 +396,7 @@ host_t *host_create_from_string(char *string, u_int16_t port)
if (streq(string, "%any")) if (streq(string, "%any"))
{ {
string = "0.0.0.0"; return host_create_any(AF_INET);
this->address.sa_family = AF_INET;
} }
else if (strchr(string, '.')) else if (strchr(string, '.'))
{ {
@@ -449,8 +448,13 @@ host_t *host_create_from_dns(char *string, int af, u_int16_t port)
char buf[512]; char buf[512];
int err, ret; int err, ret;
if (af == AF_INET6 || strchr(string, ':') || streq(string, "%any")) if (streq(string, "%any"))
{/* gethostbyname does not like IPv6 addresses or wildcards - fallback */ {
return host_create_any(af ? af : AF_INET);
}
else if (strchr(string, ':'))
{
/* gethostbyname does not like IPv6 addresses - fallback */
return host_create_from_string(string, port); return host_create_from_string(string, port);
} }