]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Change --server.address default
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 23 May 2024 19:05:32 +0000 (13:05 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 23 May 2024 19:05:32 +0000 (13:05 -0600)
The old default had been causing mayhem on Linux since
202e0fe34dc3c8dcb1a0ad12faa7f4d5a7c91b2d.

The new default is OS-sensitive, and binds the socket to all available
IPv4 and IPv6 addresses.

docs/usage.md
man/fort.8
src/config.c

index a56549dc26d0e907987cc4f1a81361d4ac5d4456..71cb04446de82e91bdd5e19e66718f4552c0c712 100644 (file)
@@ -346,18 +346,24 @@ In `standalone` mode, Fort simply performs one immediate RPKI validation, then e
 
 - **Type:** String array
 - **Availability:** `argv` and JSON
-- **Default:** `NULL`
+- **Default:** On Linux, `::`. On everything else, `0.0.0.0, ::`.
 
 List of hostnames or numeric host addresses the RTR server will be bound to. Must resolve to (or be) bindable IP addresses. IPv4 and IPv6 are supported.
 
 The address list must be comma-separated, and each address must have the following format: `<address>[#<port>]`. The port defaults to [`--server.port`](#--serverport).
 
 Here are some examples:
-- `--server.address="localhost"`: Bind to 'localhost', port [`--server.port`](#--serverport).
-- `--server.address="localhost, ::1#8324"`: Same as above, and also bind to IPv6 address '::1', port '8324'.
-- `--server.address="localhost#8323, ::1#8324"`: Bind to 'localhost' at port '8323', and to '::1' port '8324'. [`--server.port`](#--serverport) is ignored.
+- `--server.address="localhost"`: Bind to `localhost`, port [`--server.port`](#--serverport).
+- `--server.address="localhost, ::1#8324"`: Same as above, and also bind to `[::1]:8324`.
+- `--server.address="localhost#8323, ::1#8324"`: Bind to `localhost` on port 8323, and to `[::1]:8324`. ([`--server.port`](#--serverport) is ignored.)
+
+Use wildcards to bind to all available addresses. Note that, for historical reasons, Linux is a bit strange:
 
-If this field is omitted, the server will accept connections on any of the host's network addresses.
+| `--server.address` | Meaning on the BSDs | Meaning on Linux |
+|--------------------|---------------------|------------------|
+| `0.0.0.0` | Bind to all available IPv4 addresses | Bind to all available IPv4 addresses |
+| `::` | Bind to all available IPv6 addresses | Bind to all available IPv4 and IPv6 addresses |
+| `0.0.0.0, ::` | Bind to all available IPv4 and IPv6 addresses | Error |
 
 ### `--server.port`
 
index bac02f984c524b8843f126c4fc64a3b3dd9f53ef..426129c253f7e1479b52b675da0780bd65a6325d 100644 (file)
@@ -340,29 +340,35 @@ By default, the mode is \fIserver\fR.
 
 .B \-\-server.address=\fINODE(S)\fR
 .RS 4
-List of hostnames or numeric host addresses the RTR server will be bound to.
-Must resolve to (or be) bindable IP addresses. IPv4 and IPv6 are supported.
+List of hostnames or numeric host addresses the RTR server will be bound to. Must resolve to (or be) bindable IP addresses. IPv4 and IPv6 are supported.
 .P
-The list of addresses must be comma sepparated, and each address must have the
-following format: \fB<address>[#<port>]\fR. Note that the port is optional; in
-case that a port isn't specified, the value of \fI--server.port\fR will be
-utilized with the corresponding address.
+The address list must be comma-separated, and each address must have the following format: \fB<address>[#<port>]\fR. The port defaults to \fI--server.port\fR.
 .P
-Here are some examples of valid values for this argument:
+Here are some examples:
 .br
-- \fI--server.address="localhost"\fR: will bind to 'localhost' and the
-configured port at \fI--server.port\fR.
+- \fI--server.address="localhost"\fR: Bind to localhost, port \fI--server.port\fR.
 .br
-- \fI--server.address="localhost,::1#8324"\fR: same as the previous example,
-and also will bind to IPv6 address '::1' at the port '8324'.
+- \fI--server.address="localhost, ::1#8324"\fR: Same as above, and also bind to \fI[::1]:8324\fR.
 .br
-- \fI--server.address="localhost#8323,::1#8324"\fR: will bind to 'localhost' at
-port '8323', and to '::1' port '8324'. The value of \fI--server.port\fR isn't
-utilized.
+- \fI--server.address="localhost#8323, ::1#8324"\fR: Bind to \fIlocalhost\fR on port 8323, and to \fI[::1]:8324\fR. (\fI--server.port\fR is ignored.)
 .P
-If this field is omitted, FORT will attempt to bind the server using the IP
-address \fIINADDR_ANY\fR (for an IPv4 address) or \fIIN6ADDR_ANY_INIT\fR (for
-an IPv6 address). See \fBgetaddrinfo(3)\fR.
+Use wildcards to bind to all available addresses. Note that, for historical reasons, Linux is a bit strange:
+.P
+BSDs:
+.P
+- \fI0.0.0.0\fR : Bind to all available IPv4 addresses
+.br
+- \fI::\fR : Bind to all available IPv6 addresses
+.br
+- \fI0.0.0.0, ::\fR : Bind to all available IPv4 and IPv6 addresses
+.P
+Linux:
+.P
+- \fI0.0.0.0\fR : Bind to all available IPv4 addresses
+.br
+- \fI::\fR : Bind to all available IPv4 and IPv6 addresses
+.br
+- \fI0.0.0.0, ::\fR : Error
 .RE
 .P
 
index 69373460a1265f20e36793d26211ade3a3cf9c9e..eb3e84b9f883f048b3198c8eeaddcfc2ec3173c4 100644 (file)
@@ -911,6 +911,13 @@ set_default_values(void)
                "$REMOTE", "$LOCAL",
        };
        static char const *flat_rsync_args[] = { "<deprecated>" };
+       static char const *addrs[] = {
+#ifdef __linux__
+               "::"
+#else
+               "0.0.0.0", "::"
+#endif
+       };
 
        /*
         * Values that might need to be freed WILL be freed, so use heap
@@ -926,7 +933,7 @@ set_default_values(void)
        rpki_config.work_offline = false;
        rpki_config.daemon = false;
 
-       string_array_init(&rpki_config.server.address, NULL, 0);
+       string_array_init(&rpki_config.server.address, addrs, ARRAY_LEN(addrs));
        rpki_config.server.port = pstrdup("323");
        rpki_config.server.backlog = SOMAXCONN;
        rpki_config.server.interval.validation = 3600;