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().

(cherry picked from commit 5afbca4954)
This commit is contained in:
Derek Schrock 2024-02-25 17:53:44 -05:00 committed by Koichiro Iwao
parent 83f9d4ec17
commit a7115cced2

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);