]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Remove SO_REUSEPORT from the RTR socket bind
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 28 Sep 2023 22:32:53 +0000 (16:32 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 28 Sep 2023 22:34:37 +0000 (16:34 -0600)
This option is causing portability issues, and I can't figure out why it
was introduced. None of the Github issues mention it, and
6401a4739ac512985158e63499e037dc2f2078db says

> Use SO_REUSEPORT at sockopts so that the RTR port can be reused

But reused when? For what purpose?

I think this might be an allusion to
ac56d70c954caf49382f5f28ff4a017e859e2e0a:

> SO_REUSEADDR sockopt allows to reuse server address and port at once
> when the service has been stoped (or killed).

But that doesn't need SO_REUSEPORT for anything.

src/rtr/rtr.c

index 17c5cf488679b2852849840ac44271d4803d4e89..c6b1a3291f44cfc8e5953e16e2266deece17f5b6 100644 (file)
@@ -239,15 +239,6 @@ create_server_socket(char const *input_addr, char const *hostname,
                        continue;
                }
 
-               /* enable SO_REUSEPORT */
-               if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &reuse,
-                   sizeof(int)) < 0) {
-                       pr_op_err("setsockopt(SO_REUSEPORT) failed: %s",
-                           strerror(errno));
-                       close(fd);
-                       continue;
-               }
-
                if (bind(fd, addr->ai_addr, addr->ai_addrlen) < 0) {
                        pr_op_err("bind() failed: %s", strerror(errno));
                        close(fd);