]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: move the NOQUICKACK option to the bind_conf
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 18:40:42 +0000 (19:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:20 +0000 (18:00 +0100)
It solely depends on the bind line so let's move it there under the
name BC_O_NOQUICKACK.

include/haproxy/listener-t.h
src/cfgparse.c
src/http_ana.c
src/proto_tcp.c

index 8322ef4c6875ddd4e8b9e13ae59bfdcb336df410..ecddebcec4500b59f79a074ff8ec927d57133ea3 100644 (file)
@@ -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 */
index 6b0a1e56d95a518e344a17aac4fbb5db7fbb6b29..b98f64529561a3820b08394574765df7ff274152 100644 (file)
@@ -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 */
index 8cee6f91225cd425eb16a6d7cff586b83d80b779..af519a5b9ac9e424b5aaeb735b4b4f1dddcd9eaf 100644 (file)
@@ -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);
 
        /*************************************************************
index 30135cc30e8b83ecd42bdfcf01713cea87abfdc8..d0850bdb62a022fa3329762fce6c4387b47b3305 100644 (file)
@@ -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));