From a7115cced29bf47f9e7fee6d9e194dbcae21fc6f Mon Sep 17 00:00:00 2001 From: Derek Schrock Date: Sun, 25 Feb 2024 17:53:44 -0500 Subject: [PATCH] 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 5afbca4954cf585805c80e72620183914a8719f6) --- common/os_calls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/os_calls.c b/common/os_calls.c index b8f6b633..357df6da 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -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);