Fall back to IPv4 if IPv6 capable but don't have an IPv6 address set

When xrdp is built with IPv6 support it will only fall back to IPv4 if
IPv6 is not supported (EAFNOSUPPORT).  However, if the system is IPv6
capable but doesn't have an IPv6 address set (at least inside a FreeBSD
jail) EPROTONOSUPPORT is returned from socket().
This commit is contained in:
Derek Schrock 2024-02-25 17:53:44 -05:00
parent b79a7690fa
commit 5afbca4954
1 changed files with 1 additions and 0 deletions

View File

@ -378,6 +378,7 @@ g_tcp_socket(void)
{
switch (errno)
{
case EPROTONOSUPPORT: /* if IPv6 is supported, but don't have an IPv6 address */
case EAFNOSUPPORT: /* if IPv6 not supported, retry IPv4 */
LOG(LOG_LEVEL_INFO, "IPv6 not supported, falling back to IPv4");
rv = (int)socket(AF_INET, SOCK_STREAM, 0);