]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: enforce QUIC MUX compat on server line
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 7 Jul 2025 09:20:28 +0000 (11:20 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 7 Jul 2025 12:29:24 +0000 (14:29 +0200)
Add postparsing checks to control server line conformity regarding QUIC
both on the server address and the MUX protocol. An error is reported in
the following case :
* proto quic is explicitely specified but server address does not
  specify quic4/quic6 prefix
* another proto is explicitely specified but server address uses
  quic4/quic6 prefix

src/cfgparse.c

index a1ea79c5ca84d7ee4b78ffc71e60d334c69ad22b..ac505300ac830b461889dfccce80b0bcfbb2276f 100644 (file)
@@ -4130,6 +4130,24 @@ out_uri_auth_compat:
                                         newsrv->id, newsrv->conf.file, newsrv->conf.line);
                                cfgerr++;
                        }
+                       else {
+                               if ((mux_ent->mux->flags & MX_FL_FRAMED) && !srv_is_quic(newsrv)) {
+                                       ha_alert("%s '%s' : MUX protocol '%.*s' is incompatible with stream transport used by server '%s' at [%s:%d].\n",
+                                                proxy_type_str(curproxy), curproxy->id,
+                                                (int)newsrv->mux_proto->token.len,
+                                                newsrv->mux_proto->token.ptr,
+                                                newsrv->id, newsrv->conf.file, newsrv->conf.line);
+                                       cfgerr++;
+                               }
+                               else if (!(mux_ent->mux->flags & MX_FL_FRAMED) && srv_is_quic(newsrv)) {
+                                       ha_alert("%s '%s' : MUX protocol '%.*s' is incompatible with framed transport used by server '%s' at [%s:%d].\n",
+                                                proxy_type_str(curproxy), curproxy->id,
+                                                (int)newsrv->mux_proto->token.len,
+                                                newsrv->mux_proto->token.ptr,
+                                                newsrv->id, newsrv->conf.file, newsrv->conf.line);
+                                       cfgerr++;
+                               }
+                       }
 
                        /* update the mux */
                        newsrv->mux_proto = mux_ent;