]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add "no-quic" global option
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 12 Jan 2023 14:23:54 +0000 (15:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Jan 2023 15:35:20 +0000 (16:35 +0100)
Add "no-quic" to "global" section to disable the use of QUIC transport protocol
by all configured QUIC listeners. This is listeners with QUIC addresses on their
"bind" lines. Internally, the socket addresses binding is skipped by
protocol_bind_all() for receivers with <proto_quic4> or <proto_quic6> as
protocol (see protocol struct).
Add information about "no-quic" global option to the documentation.

Must be backported to 2.7.

doc/configuration.txt
include/haproxy/global-t.h
src/cfgparse-global.c
src/protocol.c

index 7ee08acc321465b0e47a8cf54625e17e71b39603..9bd2627217f813293494f9c8bb8ac68df41474cf 100644 (file)
@@ -1982,6 +1982,14 @@ nbthread <number>
   Otherwise, this value defaults to 1. The default value is reported in the
   output of "haproxy -vv".
 
+no-quic
+  Warning: QUIC support in HAProxy is currently experimental. Configuration may
+  change without deprecation in the future.
+
+  Disable QUIC transport protocol. All the QUIC listeners will still be created.
+  But they will not bind their addresses. Hence, no QUIC traffic will be
+  processed by haproxy. See also "quic_enabled" sample fetch.
+
 numa-cpu-mapping
   If running on a NUMA-aware platform, HAProxy inspects on startup the CPU
   topology of the machine. If a multi-socket machine is detected, the affinity
index dec16a21ac547cd3930d6669502c3bfa8c2b81ae..9b567974af0757d57efb44c355a91604196c9ccd 100644 (file)
@@ -79,6 +79,7 @@
 #define GTUNE_DISABLE_ACTIVE_CLOSE (1<<22)
 #define GTUNE_QUICK_EXIT         (1<<23)
 #define GTUNE_QUIC_SOCK_PER_CONN (1<<24)
+#define GTUNE_NO_QUIC            (1<<25)
 
 /* SSL server verify mode */
 enum {
index 6cc4afe13551a12394cf49953782686313bd5a3e..3f4c877e9ab54768270c43c5ba4de606469db8d3 100644 (file)
@@ -45,7 +45,7 @@ static const char *common_kw_list[] = {
        "log-tag", "spread-checks", "max-spread-checks", "cpu-map", "setenv",
        "presetenv", "unsetenv", "resetenv", "strict-limits", "localpeer",
        "numa-cpu-mapping", "defaults", "listen", "frontend", "backend",
-       "peers", "resolvers", "cluster-secret",
+       "peers", "resolvers", "cluster-secret", "no-quic",
        NULL /* must be last */
 };
 
@@ -111,6 +111,12 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                        goto out;
                global.tune.options &= ~GTUNE_USE_POLL;
        }
+       else if (strcmp(args[0], "no-quic") == 0) {
+               if (alertif_too_many_args(0, file, linenum, args, &err_code))
+                       goto out;
+
+               global.tune.options |= GTUNE_NO_QUIC;
+       }
        else if (strcmp(args[0], "busy-polling") == 0) { /* "no busy-polling" or "busy-polling" */
                if (alertif_too_many_args(0, file, linenum, args, &err_code))
                        goto out;
index 03f70859133ffff5b646f8bab9ba4c514e3d570c..cafaa72e702b5543469d914825fc5107c3ec17ab 100644 (file)
 
 #include <haproxy/api.h>
 #include <haproxy/errors.h>
+#include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/proto_quic.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proxy.h>
 #include <haproxy/tools.h>
@@ -75,6 +77,11 @@ int protocol_bind_all(int verbose)
        HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
        list_for_each_entry(proto, &protocols, list) {
                list_for_each_entry(receiver, &proto->receivers, proto_list) {
+#ifdef USE_QUIC
+                       if ((global.tune.options & GTUNE_NO_QUIC) &&
+                           (proto == &proto_quic4 || proto == &proto_quic6))
+                               continue;
+#endif
                        listener = LIST_ELEM(receiver, struct listener *, rx);
 
                        lerr = proto->fam->bind(receiver, &errmsg);