]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: also support "quic+" as an address prefix
authorWilly Tarreau <w@1wt.eu>
Mon, 16 Jan 2023 12:55:27 +0000 (13:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 16 Jan 2023 13:00:51 +0000 (14:00 +0100)
While we do support quic4@ and quic6@ for listening addresses, it was
not possible to specify that we want to use an FD inherited from the
parent with QUIC. It's just a matter of making it possible to enable
a dgram-type socket and a stream-type transport, so let's add this.

Now it becomes possible to write "quic+fd@12", "quic+ipv4@addr" etc.

doc/configuration.txt
src/tools.c

index 3054029fbd7277c3daeabf2303b5f1a370852620..7ee08acc321465b0e47a8cf54625e17e71b39603 100644 (file)
@@ -24078,8 +24078,11 @@ this address but in some cases the user may force it to a different one.
 This is the case for "log" statement where the default is syslog over UDP
 but we could force to use syslog over TCP.
 
-Those prefixes were designed for internal purpose and users should
-instead use aliases of the next section "11.3 Protocol prefixes".
+Those prefixes were designed for internal purpose and users should instead use
+use aliases of the next section "11.3 Protocol prefixes". However these can
+sometimes be convenient, for example in combination with inherited sockets
+known by their file descriptor number, in which case the address family is "fd"
+and the socket type must be declared.
 
 If users need one those prefixes to perform what they expect because
 they can not configure the same using the protocol prefixes, they should
@@ -24091,6 +24094,10 @@ report this to the maintainers.
 'dgram+<family>@<address>'  forces socket type and transport method
                             to "datagram".
 
+'quic+<family>@<address>'   forces socket type to "datagram" and transport
+                            method to "stream".
+
+
 
 11.3 Protocol prefixes
 ----------------------
@@ -24100,14 +24107,16 @@ report this to the maintainers.
                                   "datagram" and the transport method is forced
                                   to "stream". Depending on the statement using
                                   this address, a UDP port or port range can or
-                                  must be specified.
+                                  must be specified. It is equivalent to
+                                  "quic+ipv4@".
 
 'quic6@<address>[:port1[-port2]]' following <address> is always considered as
                                   an IPv6 address but socket type is forced to
                                   "datagram" and the transport method is forced
                                   to "stream". Depending on the statement using
                                   this address, a UDP port or port range can or
-                                  must be specified.
+                                  must be specified. It is equivalent to
+                                  "quic+ipv6@".
 
 'tcp@<address>[:port1[-port2]]' following <address> is considered as an IPv4
                                 or IPv6 address depending of the syntax but
index 1f4fedaaaaf483bbec5e689cb212261734b44d3e..f7fdfff81453b575aa16b582c1c34de3e0e64a20 100644 (file)
@@ -1002,6 +1002,11 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
                proto_type = PROTO_TYPE_DGRAM;
                ctrl_type = SOCK_DGRAM;
        }
+       else if (strncmp(str2, "quic+", 5) == 0) {
+               str2 += 5;
+               proto_type = PROTO_TYPE_DGRAM;
+               ctrl_type = SOCK_STREAM;
+       }
 
        if (strncmp(str2, "unix@", 5) == 0) {
                str2 += 5;