]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: reject conf with QUIC servers if not compiled
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 31 Oct 2025 08:57:54 +0000 (09:57 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 31 Oct 2025 10:32:20 +0000 (11:32 +0100)
Ensure that QUIC support is compiled into haproxy when a QUIC server is
configured. This check is performed during _srv_parse_finalize() so that
it is detected both on configuration parsing and when adding a dynamic
server via the CLI.

Note that this changes the behavior of srv_is_quic() utility function.
Previously, it always returned false when QUIC support wasn't compiled.
With this new check introduced, it is now guaranteed that a QUIC server
won't exist if compilation support is not active. Hence srv_is_quic()
does not rely anymore on USE_QUIC define.

include/haproxy/server.h
src/server.c

index cf5c5584cf1a9b082a005120d0e3d63190b54b87..39f71e05edfefa20a3dc730000f15c817666acef 100644 (file)
@@ -383,12 +383,8 @@ static inline struct server *server_find_by_id(struct proxy *bk, int id)
 
 static inline int srv_is_quic(const struct server *srv)
 {
-#ifdef USE_QUIC
        return srv->addr_type.proto_type == PROTO_TYPE_DGRAM &&
               srv->addr_type.xprt_type == PROTO_TYPE_STREAM;
-#else
-       return 0;
-#endif
 }
 
 #endif /* _HAPROXY_SERVER_H */
index 26103cf18514373562b43f6ca1e8d5b972d7a212..02980db729f8c2e2294cbbfa4292ab8897081cdc 100644 (file)
@@ -3928,8 +3928,8 @@ static int _srv_parse_finalize(char **args, int cur_arg,
                }
        }
 
-#ifdef USE_QUIC
        if (srv_is_quic(srv)) {
+#ifdef USE_QUIC
                if (!srv->use_ssl) {
                        srv->use_ssl = 1;
                        ha_warning("QUIC protocol detected, enabling ssl. Use 'ssl' to shut this warning.\n");
@@ -3940,8 +3940,11 @@ static int _srv_parse_finalize(char **args, int cur_arg,
                                        &srv->ssl_ctx.alpn_len, &errmsg) != 0) {
                        return ERR_ALERT | ERR_FATAL;
                }
-       }
+#else
+               ha_alert("QUIC protocol selected but support not compiled in (check build options).\n");
+               return ERR_ALERT | ERR_FATAL;
 #endif
+       }
 
        if (!(srv->proxy->cap & PR_CAP_LB)) {
                /* No need to wait for effective proxy mode, it is already known: