[vlc-commits] udp: do not set SO_REUSEPORT on Linux (refs #23201)

Rémi Denis-Courmont git at videolan.org
Mon Feb 10 19:34:36 CET 2020


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Feb  6 19:57:23 2020 +0200| [b51d13730240b3bce266d5cdac05d5c1a5ce8153] | committer: Rémi Denis-Courmont

udp: do not set SO_REUSEPORT on Linux (refs #23201)

VLC set the SO_REUSEPORT socket option on BSD so that multiple UDP
sockets can receive multicast packets on the same port. On Linux,
that behaviour is covered by SO_REUSEADDR.

In "recent" times, Linux added a SO_REUSEPORT option that does
something else - enable load-balancing, which is not the intended
behaviour.

(cherry picked from commit b90d8bb2728d1fcabe1bc1623749864832e33839)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b51d13730240b3bce266d5cdac05d5c1a5ce8153
---

 src/network/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/udp.c b/src/network/udp.c
index b833d712c3..aaee9d88f4 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -92,7 +92,7 @@ extern int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype,
 static int net_SetupDgramSocket (vlc_object_t *p_obj, int fd,
                                  const struct addrinfo *ptr)
 {
-#ifdef SO_REUSEPORT
+#if defined (SO_REUSEPORT) && !defined (__linux__)
     setsockopt (fd, SOL_SOCKET, SO_REUSEPORT, &(int){ 1 }, sizeof (int));
 #endif
 



More information about the vlc-commits mailing list