[vlc-commits] [Git][videolan/vlc][3.0.x] contrib/upnp: disable reuseaddr and fix option

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun May 14 18:17:36 UTC 2023



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
34cd4a61 by Felix Paul Kühne at 2023-05-14T09:44:51+02:00
contrib/upnp: disable reuseaddr and fix option

Use of SO_REUSEADDR leads to a busy loop within libupnp and very high
battery usage. This disables the option and actually fixes its
functionality by patching the library. Patch to be upstreamed.

Manual backport of 74b765d8

- - - - -


2 changed files:

- + contrib/src/upnp/fix-reuseaddr-option.patch
- contrib/src/upnp/rules.mak


Changes:

=====================================
contrib/src/upnp/fix-reuseaddr-option.patch
=====================================
@@ -0,0 +1,51 @@
+diff -ru upnp/upnp/src/ssdp/ssdp_server.c upnp-fixed/upnp/src/ssdp/ssdp_server.c
+--- upnp/upnp/src/ssdp/ssdp_server.c	2022-08-03 16:05:12
++++ upnp-fixed/upnp/src/ssdp/ssdp_server.c	2023-05-11 12:13:42
+@@ -928,6 +928,7 @@
+ 
+ 		return UPNP_E_OUTOF_SOCKET;
+ 	}
++#ifdef UPNP_MINISERVER_REUSEADDR
+ 	onOff = 1;
+ 	ret = setsockopt(*ssdpSock,
+ 		SOL_SOCKET,
+@@ -945,6 +946,7 @@
+ 		ret = UPNP_E_SOCKET_ERROR;
+ 		goto error_handler;
+ 	}
++#endif
+ 	#if (defined(BSD) && !defined(__GNU__)) || defined(__APPLE__)
+ 	onOff = 1;
+ 	ret = setsockopt(*ssdpSock,
+@@ -1133,6 +1135,7 @@
+ 		return UPNP_E_OUTOF_SOCKET;
+ 	}
+ 	onOff = 1;
++#ifdef UPNP_MINISERVER_REUSEADDR
+ 	ret = setsockopt(*ssdpSock,
+ 		SOL_SOCKET,
+ 		SO_REUSEADDR,
+@@ -1149,6 +1152,7 @@
+ 		ret = UPNP_E_SOCKET_ERROR;
+ 		goto error_handler;
+ 	}
++#endif
+ 		#if (defined(BSD) && !defined(__GNU__)) || defined(__APPLE__)
+ 	onOff = 1;
+ 	ret = setsockopt(*ssdpSock,
+@@ -1313,6 +1317,7 @@
+ 		return UPNP_E_OUTOF_SOCKET;
+ 	}
+ 	onOff = 1;
++#ifdef UPNP_MINISERVER_REUSEADDR
+ 	ret = setsockopt(*ssdpSock,
+ 		SOL_SOCKET,
+ 		SO_REUSEADDR,
+@@ -1329,6 +1334,7 @@
+ 		ret = UPNP_E_SOCKET_ERROR;
+ 		goto error_handler;
+ 	}
++#endif
+ 		#if (defined(BSD) && !defined(__GNU__)) || defined(__APPLE__)
+ 	onOff = 1;
+ 	ret = setsockopt(*ssdpSock,


=====================================
contrib/src/upnp/rules.mak
=====================================
@@ -24,8 +24,12 @@ endif
 ifdef HAVE_WINSTORE
 UPNP_CONF += --disable-ipv6 --enable-unspecified_server
 else
+ifdef HAVE_IOS
+UPNP_CONF += --disable-ipv6 --disable-reuseaddr
+else
 UPNP_CONF += --enable-ipv6
 endif
+endif
 ifndef WITH_OPTIMIZATION
 UPNP_CONF += --enable-debug
 endif
@@ -49,6 +53,9 @@ ifdef HAVE_ANDROID
 	$(APPLY) $(SRC)/upnp/revert-ifaddrs.patch
 endif
 	$(APPLY) $(SRC)/upnp/miniserver.patch
+ifdef HAVE_IOS
+	$(APPLY) $(SRC)/upnp/fix-reuseaddr-option.patch
+endif
 	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34cd4a615437c3fbef48458cd9328b9de9cb61d3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34cd4a615437c3fbef48458cd9328b9de9cb61d3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list