]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: move the NOLINGER option to the bind_conf
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 18:37:07 +0000 (19:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:20 +0000 (18:00 +0100)
It's currently declared per-frontend, though it would make sense to
support it per-line but in no case per-listener. Let's move the option
to a bind_conf option BC_O_NOLINGER.

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

index 33d7541bee707dcc276218bb185d0b3a1b7b6889..8322ef4c6875ddd4e8b9e13ae59bfdcb336df410 100644 (file)
@@ -92,7 +92,7 @@ enum li_status {
 
 /* listener socket options */
 #define LI_O_NONE               0x0000
-#define LI_O_NOLINGER           0x0001  /* disable linger on this socket */
+/* unused                       0x0001  */
 /* unused                       0x0002  */
 #define LI_O_NOQUICKACK         0x0004  /* disable quick ack of immediate data (linux) */
 #define LI_O_DEF_ACCEPT         0x0008  /* wait up to 1 second for data before accepting */
@@ -121,6 +121,7 @@ enum li_status {
 #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 */
+#define BC_O_NOLINGER           0x00000080 /* disable lingering on these listeners */
 
 
 /* flags used with bind_conf->ssl_options */
index 666d5c33b593fc28cb12ace1332e78093c701572..6b0a1e56d95a518e344a17aac4fbb5db7fbb6b29 100644 (file)
@@ -4288,6 +4288,8 @@ init_proxies_list_stage2:
                        if (!bind_conf->maxaccept)
                                bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
                        bind_conf->accept = session_accept_fd;
+                       if (curproxy->options & PR_O_TCP_NOLING)
+                               bind_conf->options |= BC_O_NOLINGER;
                }
 
                /* adjust this proxy's listeners */
@@ -4310,9 +4312,6 @@ init_proxies_list_stage2:
                                        memprintf(&listener->name, "sock-%d", listener->luid);
                        }
 
-                       if (curproxy->options & PR_O_TCP_NOLING)
-                               listener->options |= LI_O_NOLINGER;
-
 #ifdef USE_QUIC
                        if (listener->flags & LI_F_QUIC_LISTENER) {
                                if (!global.cluster_secret) {
index dca1f8d7a4c30469de8ed344beefcf03f74e85f8..30135cc30e8b83ecd42bdfcf01713cea87abfdc8 100644 (file)
@@ -605,7 +605,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
 
        fd = listener->rx.fd;
 
-       if (listener->options & LI_O_NOLINGER)
+       if (listener->bind_conf->options & BC_O_NOLINGER)
                setsockopt(fd, SOL_SOCKET, SO_LINGER, &nolinger, sizeof(struct linger));
        else {
                struct linger tmplinger;