diff --git a/src/cfgparse.c b/src/cfgparse.c index 3fb0fb4a2..703147881 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -165,16 +165,6 @@ int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, else bind_conf->options |= BC_O_USE_XPRT_STREAM; -#ifdef USE_QUIC - /* The transport layer automatically switches to QUIC when QUIC - * is selected, regardless of bind_conf settings. We then need - * to initialize QUIC params. - */ - if (proto->proto_type == PROTO_TYPE_DGRAM && proto->xprt_type == PROTO_TYPE_STREAM) { - bind_conf->xprt = xprt_get(XPRT_QUIC); - quic_transport_params_init(&bind_conf->quic_params, 1); - } -#endif if (!create_listeners(bind_conf, ss2, port, end, fd, proto, err)) { memprintf(err, "%s for address '%s'.\n", *err, str); goto fail; diff --git a/src/listener.c b/src/listener.c index e5cb867ba..3efe6c1c8 100644 --- a/src/listener.c +++ b/src/listener.c @@ -36,6 +36,7 @@ #include #include #include +#include /* List head of all known bind keywords */ @@ -1640,6 +1641,22 @@ int bind_parse_args_list(struct bind_conf *bind_conf, char **args, int cur_arg, goto out; } + /* The transport layer automatically switches to QUIC when QUIC is + * selected, regardless of bind_conf settings. We then need to + * initialize QUIC params. + */ + if ((bind_conf->options & (BC_O_USE_SOCK_DGRAM|BC_O_USE_XPRT_STREAM)) == (BC_O_USE_SOCK_DGRAM|BC_O_USE_XPRT_STREAM)) { +#ifdef USE_QUIC + bind_conf->xprt = xprt_get(XPRT_QUIC); + quic_transport_params_init(&bind_conf->quic_params, 1); +#else + ha_alert("parsing [%s:%d] : '%s %s' in section '%s' : QUIC protocol selected but support not compiled in (check build options).\n", + file, linenum, args[0], args[1], section); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; +#endif + } + out: return err_code; }