]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: move TCP_FO to bind_conf
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 18:45:58 +0000 (19:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:20 +0000 (18:00 +0100)
It's set per bind line ("tfo") and only used in tcp_bind_listener() so
there's no point keeping the address family tests, let's just store the
flag in the bind_conf under the name BC_O_TCP_FO.

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

index 6c0c6844c67cba097a7d78fc40b0426fd47cd328..9e180ad4e94749cb92778dce565f22ef30d92b80 100644 (file)
@@ -101,7 +101,7 @@ enum li_status {
 /* unused                       0x0040  */
 #define LI_O_ACC_PROXY          0x0080  /* find the proxied address in the first request line */
 #define LI_O_UNLIMITED          0x0100  /* listener not subject to global limits (peers & stats socket) */
-#define LI_O_TCP_FO             0x0200  /* enable TCP Fast Open (linux >= 3.7) */
+/* unused                       0x0200  */
 /* unused                       0x0400  */
 /* unused                       0x0800  */
 #define LI_O_ACC_CIP            0x1000  /* find the proxied address in the NetScaler Client IP header */
@@ -124,6 +124,7 @@ enum li_status {
 #define BC_O_NOLINGER           0x00000080 /* disable lingering on these listeners */
 #define BC_O_NOQUICKACK         0x00000100 /* disable quick ack of immediate data (linux) */
 #define BC_O_DEF_ACCEPT         0x00000200 /* wait up to 1 second for data before accepting */
+#define BC_O_TCP_FO             0x00000400 /* enable TCP Fast Open (linux >= 3.7) */
 
 
 /* flags used with bind_conf->ssl_options */
index 179f210e6f2c2c559faef2139f9c8e41717de4c5..d753e64e5a387ca57ba0541fde024faa4dddc8fa 100644 (file)
@@ -73,13 +73,7 @@ static int bind_parse_defer_accept(char **args, int cur_arg, struct proxy *px, s
 /* parse the "tfo" bind keyword */
 static int bind_parse_tfo(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
 {
-       struct listener *l;
-
-       list_for_each_entry(l, &conf->listeners, by_bind) {
-               if (l->rx.addr.ss_family == AF_INET || l->rx.addr.ss_family == AF_INET6)
-                       l->options |= LI_O_TCP_FO;
-       }
-
+       conf->options |= BC_O_TCP_FO;
        return 0;
 }
 #endif
index 662e669db021544aa14e107cc738284f5f685473..7a8d83070db620bed2c7294960800bf71664b21e 100644 (file)
@@ -670,7 +670,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
                    sizeof(zero));
 #endif
 #if defined(TCP_FASTOPEN)
-       if (listener->options & LI_O_TCP_FO) {
+       if (listener->bind_conf->options & BC_O_TCP_FO) {
                /* TFO needs a queue length, let's use the configured backlog */
                int qlen = listener_backlog(listener);
                if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) == -1) {