mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-13 04:50:41 +01:00
testbench: correctly apply socket options in minitcpsrvr
The option name in setsockopts is not a bitmask, so SO_REUSEADDR and SO_REUSEPORT can't be ORed together. Instead apply the options via separate calls. Fixes: #5456 Thanks: Chris Hofstaedtler <zeha@debian.org>
This commit is contained in:
parent
7f79e4f249
commit
2f12b4cc9b
@ -89,8 +89,11 @@ createListenSocket(void)
|
||||
}
|
||||
// Set SO_REUSEADDR and SO_REUSEPORT options
|
||||
int opt = 1;
|
||||
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
|
||||
errout("setsockopt failed");
|
||||
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
|
||||
errout("setsockopt failed for SO_REUSEADDR");
|
||||
}
|
||||
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
|
||||
errout("setsockopt failed for SO_REUSEPORT");
|
||||
}
|
||||
|
||||
fprintf(stderr, "listen on target port %d\n", targetPort);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user