]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: move the INHERITED flag down to the receiver
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Sep 2020 13:41:59 +0000 (15:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:07 +0000 (22:08 +0200)
It's the receiver's FD that's inherited from the parent process, not
the listener's so the flag must move to the receiver so that appropriate
actions can be taken.

include/haproxy/listener-t.h
include/haproxy/receiver-t.h
src/cli.c
src/listener.c
src/mworker.c
src/proto_tcp.c
src/proto_uxst.c
src/proxy.c

index 36c8cbb0b4bc238abe1244434a16a868aa5d9ff4..45c5a11cc0e164eca18c3cbcf26cc335c94feb9c 100644 (file)
@@ -97,7 +97,7 @@ enum li_state {
 #define LI_O_V6ONLY             0x0400  /* bind to IPv6 only on Linux >= 2.4.21 */
 #define LI_O_V4V6               0x0800  /* bind to IPv4/IPv6 on Linux >= 2.4.21 */
 #define LI_O_ACC_CIP            0x1000  /* find the proxied address in the NetScaler Client IP header */
-#define LI_O_INHERITED          0x2000  /* inherited FD from the parent process (fd@) */
+/* unused                       0x2000 */
 #define LI_O_MWORKER            0x4000  /* keep the FD open in the master but close it in the children */
 #define LI_O_NOSTOP             0x8000  /* keep the listener active even after a soft stop */
 
index 5537d5ab555578b3553318a9e9fb263bee9f79a9..babad44a0f83c537e0c4cffb28c081ae2eff45ab 100644 (file)
@@ -31,6 +31,7 @@
 
 /* Bit values for receiver->options */
 #define RX_F_BOUND              0x00000001  /* receiver already bound */
+#define RX_F_INHERITED          0x00000002  /* inherited FD from the parent process (fd@) */
 
 /* All the settings that are used to configure a receiver */
 struct rx_settings {
index 4cf4cc137d555458ed6729d0417c81bba5365787..977d857102788cc662cc3b75d1bee3d3f1ab2f3d 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2671,7 +2671,7 @@ int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc)
                l->default_target = global.stats_fe->default_target;
                l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
                /* it's a sockpair but we don't want to keep the fd in the master */
-               l->options &= ~LI_O_INHERITED;
+               l->rx.flags &= ~RX_F_INHERITED;
                l->nice = -64;  /* we want to boost priority for local stats */
                global.maxsock++; /* for the listening socket */
        }
index 27476cd7ac2f2cdc5653615ba0f789e764e8ccfe..ededb1aa519160889314256ee86347c7b1e9ca38 100644 (file)
@@ -574,7 +574,7 @@ int create_listeners(struct bind_conf *bc, const struct sockaddr_storage *ss,
                proto->add(l, port);
 
                if (inherited)
-                       l->options |= LI_O_INHERITED;
+                       l->rx.flags |= RX_F_INHERITED;
 
                HA_SPIN_INIT(&l->lock);
                _HA_ATOMIC_ADD(&jobs, 1);
index 1caec10ce47e3b9a80aa077a1fd560d12d7755ee..d6365e120e0d6038c59bcc419ca61351c77bd781 100644 (file)
@@ -426,7 +426,7 @@ void mworker_cleanlisteners()
                                /* unbind the listener but does not close if
                                   the FD is inherited with fd@ from the parent
                                   process */
-                               if (l->options & LI_O_INHERITED)
+                               if (l->rx.flags & RX_F_INHERITED)
                                        unbind_listener_no_close(l);
                                else
                                        unbind_listener(l);
index 84b3635f958d201ceffbfb39aef06fe19f55ab51..fe0fdcad0f1811ec99f609b62f9307265b8b792c 100644 (file)
@@ -777,7 +777,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
                  thread_mask(listener->rx.settings->bind_thread) & all_threads_mask);
 
        /* for now, all regularly bound TCP listeners are exportable */
-       if (!(listener->options & LI_O_INHERITED))
+       if (!(listener->rx.flags & RX_F_INHERITED))
                fdtab[fd].exported = 1;
 
  tcp_return:
index 4378db3ad9e11ac2828d69462eddd1cb5173e8b4..5cabea226a26b839c3b5186c0ddb5d0a9a55c577 100644 (file)
@@ -270,7 +270,7 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
                  thread_mask(listener->rx.settings->bind_thread) & all_threads_mask);
 
        /* for now, all regularly bound UNIX listeners are exportable */
-       if (!(listener->options & LI_O_INHERITED))
+       if (!(listener->rx.flags & RX_F_INHERITED))
                fdtab[fd].exported = 1;
 
        return err;
index 3f25daccb36c9dd1125787a5a57b73cd62b04cf2..21d11ee247cdeb412cce7f0f727c091422d669d8 100644 (file)
@@ -1370,7 +1370,7 @@ void stop_proxy(struct proxy *p)
                        continue;
                }
                /* The master should not close an inherited FD */
-               if (master && (l->options & LI_O_INHERITED))
+               if (master && (l->rx.flags & RX_F_INHERITED))
                        unbind_listener_no_close(l);
                else
                        unbind_listener(l);