CLEANUP: listener: store stream vs dgram at the bind_conf level

Let's collect the set of xprt-level and sock-level dgram/stream protocols
seen on a bind line and store that in the bind_conf itself while they're
being parsed. This will make it much easier to detect incompatibilities
later than the current approch which consists in scanning all listeners
in post-parsing.
This commit is contained in:
Willy Tarreau
2022-05-20 16:15:01 +02:00
parent 787e92a4fb
commit 91b780a455
2 changed files with 13 additions and 0 deletions

View File

@ -117,6 +117,10 @@ enum li_status {
#define BC_O_USE_SSL 0x00000001 /* SSL is being used on this bind_conf */
#define BC_O_GENERATE_CERTS 0x00000002 /* 1 if generate-certificates option is set, else 0 */
#define BC_O_QUIC_FORCE_RETRY 0x00000004 /* always send Retry on reception of Initial without token */
#define BC_O_USE_SOCK_DGRAM 0x00000008 /* at least one datagram-type listener is used */
#define BC_O_USE_SOCK_STREAM 0x00000010 /* at least one stream-type listener is used */
#define BC_O_USE_XPRT_DGRAM 0x00000020 /* at least one dgram-only xprt listener is used */
#define BC_O_USE_XPRT_STREAM 0x00000040 /* at least one stream-only xprt listener is used */
/* flags used with bind_conf->ssl_options */

View File

@ -155,6 +155,15 @@ int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf,
goto fail;
/* OK the address looks correct */
if (proto->proto_type == PROTO_TYPE_DGRAM)
bind_conf->options |= BC_O_USE_SOCK_DGRAM;
else
bind_conf->options |= BC_O_USE_SOCK_STREAM;
if (proto->xprt_type == PROTO_TYPE_DGRAM)
bind_conf->options |= BC_O_USE_XPRT_DGRAM;
else
bind_conf->options |= BC_O_USE_XPRT_STREAM;
#ifdef USE_QUIC
/* The transport layer automatically switches to QUIC when QUIC