From: Willy Tarreau Date: Thu, 12 Jan 2023 18:40:42 +0000 (+0100) Subject: MINOR: listener: move the NOQUICKACK option to the bind_conf X-Git-Tag: v2.8-dev3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bdcf42922396e43e038fc6e40a79a372fd554b1;p=thirdparty%2Fhaproxy.git MINOR: listener: move the NOQUICKACK option to the bind_conf It solely depends on the bind line so let's move it there under the name BC_O_NOQUICKACK. --- diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h index 8322ef4c68..ecddebcec4 100644 --- a/include/haproxy/listener-t.h +++ b/include/haproxy/listener-t.h @@ -94,7 +94,7 @@ enum li_status { #define LI_O_NONE 0x0000 /* unused 0x0001 */ /* unused 0x0002 */ -#define LI_O_NOQUICKACK 0x0004 /* disable quick ack of immediate data (linux) */ +/* unused 0x0004 */ #define LI_O_DEF_ACCEPT 0x0008 /* wait up to 1 second for data before accepting */ #define LI_O_TCP_L4_RULES 0x0010 /* run TCP L4 rules checks on the incoming connection */ #define LI_O_TCP_L5_RULES 0x0020 /* run TCP L5 rules checks on the incoming session */ @@ -122,6 +122,7 @@ enum li_status { #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 */ #define BC_O_NOLINGER 0x00000080 /* disable lingering on these listeners */ +#define BC_O_NOQUICKACK 0x00000100 /* disable quick ack of immediate data (linux) */ /* flags used with bind_conf->ssl_options */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 6b0a1e56d9..b98f645295 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4290,6 +4290,12 @@ init_proxies_list_stage2: bind_conf->accept = session_accept_fd; if (curproxy->options & PR_O_TCP_NOLING) bind_conf->options |= BC_O_NOLINGER; + + /* smart accept mode is automatic in HTTP mode */ + if ((curproxy->options2 & PR_O2_SMARTACC) || + ((curproxy->mode == PR_MODE_HTTP || (bind_conf->options & BC_O_USE_SSL)) && + !(curproxy->no_options2 & PR_O2_SMARTACC))) + bind_conf->options |= BC_O_NOQUICKACK; } /* adjust this proxy's listeners */ @@ -4331,12 +4337,6 @@ init_proxies_list_stage2: if (!LIST_ISEMPTY(&curproxy->tcp_req.l5_rules)) listener->options |= LI_O_TCP_L5_RULES; - - /* smart accept mode is automatic in HTTP mode */ - if ((curproxy->options2 & PR_O2_SMARTACC) || - ((curproxy->mode == PR_MODE_HTTP || (listener->bind_conf->options & BC_O_USE_SSL)) && - !(curproxy->no_options2 & PR_O2_SMARTACC))) - listener->options |= LI_O_NOQUICKACK; } /* Release unused SSL configs */ diff --git a/src/http_ana.c b/src/http_ana.c index 8cee6f9122..af519a5b9a 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -707,7 +707,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit) * in case we previously disabled it, otherwise we might cause * the client to delay further data. */ - if ((sess->listener && (sess->listener->options & LI_O_NOQUICKACK)) && !(htx->flags & HTX_FL_EOM)) + if ((sess->listener && (sess->listener->bind_conf->options & BC_O_NOQUICKACK)) && !(htx->flags & HTX_FL_EOM)) conn_set_quickack(cli_conn, 1); /************************************************************* diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 30135cc30e..d0850bdb62 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -717,7 +717,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) } #endif #if defined(TCP_QUICKACK) - if (listener->options & LI_O_NOQUICKACK) + if (listener->bind_conf->options & BC_O_NOQUICKACK) setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &zero, sizeof(zero)); else setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));