dragonfly: disable SO_REUSEPORT for UDP socket bindings (#4410)

---------

Signed-off-by: Andy Pan <i@andypan.me>
This commit is contained in:
Andy Pan 2024-05-20 18:36:41 +08:00 committed by GitHub
parent bf61390769
commit 10ccd08471
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -436,10 +436,10 @@ static void uv__udp_sendmsg(uv_udp_t* handle) {
/* On the BSDs, SO_REUSEPORT implies SO_REUSEADDR but with some additional /* On the BSDs, SO_REUSEPORT implies SO_REUSEADDR but with some additional
* refinements for programs that use multicast. * refinements for programs that use multicast.
* *
* Linux as of 3.9 has a SO_REUSEPORT socket option but with semantics that * Linux as of 3.9 and DragonflyBSD 3.6 have the SO_REUSEPORT socket option but
* are different from the BSDs: it _shares_ the port rather than steal it * with semantics that are different from the BSDs: it _shares_ the port rather
* from the current listener. While useful, it's not something we can emulate * than steals it from the current listener. While useful, it's not something we
* on other platforms so we don't enable it. * can emulate on other platforms so we don't enable it.
* *
* zOS does not support getsockname with SO_REUSEPORT option when using * zOS does not support getsockname with SO_REUSEPORT option when using
* AF_UNIX. * AF_UNIX.
@ -461,7 +461,7 @@ static int uv__set_reuse(int fd) {
return UV__ERR(errno); return UV__ERR(errno);
} }
#elif defined(SO_REUSEPORT) && !defined(__linux__) && !defined(__GNU__) && \ #elif defined(SO_REUSEPORT) && !defined(__linux__) && !defined(__GNU__) && \
!defined(__sun__) !defined(__sun__) && !defined(__DragonFly__)
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes))) if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)))
return UV__ERR(errno); return UV__ERR(errno);
#else #else