1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-08 00:34:57 +03:00

Fix DNS resolution when no IPv6 address is configured

This commit is contained in:
Yihong Wu
2021-12-03 14:18:43 +08:00
parent 2d1c8765aa
commit 9692a8d961
3 changed files with 63 additions and 11 deletions

View File

@ -9871,6 +9871,36 @@ bool IsIPv6Supported()
#endif // NO_IPV6
}
// Check whether an IPv6 address is configured on any interface
bool HasIPv6Address()
{
LIST *o;
UINT i;
bool ret = false;
o = GetHostIPAddressList();
ret = false;
for (i = 0; i < LIST_NUM(o); i++)
{
IP *p = LIST_DATA(o, i);
if (IsIP6(p))
{
UINT type = GetIPAddrType6(p);
if ((type & IPV6_ADDR_GLOBAL_UNICAST) && ((type & IPV6_ADDR_ZERO) == 0) && ((type & IPV6_ADDR_LOOPBACK) == 0))
{
ret = true;
}
}
}
FreeHostIPAddressList(o);
return ret;
}
// Add the thread to the thread waiting list
void AddWaitThread(THREAD *t)
{