host-resolver: don't try to resolve a plain v4 address to an IPv6 address
Suppress 'Address family for hostname not supported' errors if a IPv6 client connects in a mixed IPv4/IPv6 environment.
This commit is contained in:
committed by
Martin Willi
parent
21bade294b
commit
f8298b9f98
@@ -233,10 +233,24 @@ METHOD(host_resolver_t, resolve, host_t*,
|
||||
.family = family,
|
||||
};
|
||||
host_t *result;
|
||||
struct in_addr addr;
|
||||
|
||||
if (family == AF_INET && strchr(name, ':'))
|
||||
{ /* do not try to convert v6 addresses for v4 family */
|
||||
return NULL;
|
||||
switch (family)
|
||||
{
|
||||
case AF_INET:
|
||||
/* do not try to convert v6 addresses for v4 family */
|
||||
if (strchr(name, ':'))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case AF_INET6:
|
||||
/* do not try to convert v4 addresses for v6 family */
|
||||
if (inet_pton(AF_INET, name, &addr) == 1)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->mutex->lock(this->mutex);
|
||||
if (this->disabled)
|
||||
|
||||
Reference in New Issue
Block a user