File 0798-erts-inet-driver-Remove-REUSEADDR-windows-ifdef-ing.patch of Package erlang

From 2a6ac6f3f027fcab6d607599e82714e930d9fde2 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Tue, 16 Nov 2021 18:32:14 +0100
Subject: [PATCH] [erts|inet-driver] Remove REUSEADDR windows ifdef'ing

The REUSEADDR option was disabled for Windows. The reason for
this is that this option *had* issues on Windows, specifically
Windows XP, which we no longer support.
Therefor, we now treat this option the same way on windows as
we do on all other platforms.

OTP-17447
---
 erts/emulator/drivers/common/inet_drv.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 00421d0c73..ed098abdbb 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -6638,15 +6638,16 @@ static int inet_set_opts(inet_descriptor* desc, char* ptr, int len)
 	    desc->delimiter = (char)ival;
 	    continue;
 
-	case INET_OPT_REUSEADDR: 
-#ifdef __WIN32__
-	    continue;  /* Bjorn says */
-#else
-	    type = SO_REUSEADDR;
+            /* The behaviour changed in Windows Server 2003.
+             * Now it works as the combo of `SO_REUSEADDR` and 
+             * `SO_REUSEPORT` does on *BSD.
+             * This option was "dangerous" only in Windows XP,
+             * which we don't support anymore!
+             */
+	case INET_OPT_REUSEADDR: type = SO_REUSEADDR;
 	    DEBUGF(("inet_set_opts(%p): s=%d, SO_REUSEADDR=%d\r\n",
 		    desc->port, desc->s,ival));
 	    break;
-#endif
 	case INET_OPT_KEEPALIVE: type = SO_KEEPALIVE;
 	    DEBUGF(("inet_set_opts(%p): s=%d, SO_KEEPALIVE=%d\r\n",
 		    desc->port, desc->s, ival));
-- 
2.31.1

openSUSE Build Service is sponsored by