]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: move the ACC_PROXY and ACC_CIP options to bind_conf
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 18:48:50 +0000 (19:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:20 +0000 (18:00 +0100)
These are only set per bind line and used when creating a sessions,
we can move them to the bind_conf under the names BC_O_ACC_PROXY and
BC_O_ACC_CIP respectively.

include/haproxy/listener-t.h
src/listener.c
src/session.c

index 9e180ad4e94749cb92778dce565f22ef30d92b80..338ab9de677bb54ece8f478058eac34e191b5982 100644 (file)
@@ -99,12 +99,12 @@ enum li_status {
 #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 */
 /* unused                       0x0040  */
-#define LI_O_ACC_PROXY          0x0080  /* find the proxied address in the first request line */
+/* unused                       0x0080  */
 #define LI_O_UNLIMITED          0x0100  /* listener not subject to global limits (peers & stats socket) */
 /* unused                       0x0200  */
 /* unused                       0x0400  */
 /* unused                       0x0800  */
-#define LI_O_ACC_CIP            0x1000  /* find the proxied address in the NetScaler Client IP header */
+/* unused                       0x1000  */
 /* unused                       0x2000  */
 /* unused                       0x4000  */
 #define LI_O_NOSTOP             0x8000  /* keep the listener active even after a soft stop */
@@ -125,6 +125,8 @@ enum li_status {
 #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) */
+#define BC_O_ACC_PROXY          0x00000800 /* find the proxied address in the first request line */
+#define BC_O_ACC_CIP            0x00001000 /* find the proxied address in the NetScaler Client IP header */
 
 
 /* flags used with bind_conf->ssl_options */
index 1635576d03b62cec486268c4399cf7ad013c3400..7ff21f0a77ff63c06c0423a798ed049bc815a5f9 100644 (file)
@@ -1506,18 +1506,13 @@ smp_fetch_so_name(const struct arg *args, struct sample *smp, const char *kw, vo
 /* parse the "accept-proxy" bind keyword */
 static int bind_parse_accept_proxy(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)
-               l->options |= LI_O_ACC_PROXY;
-
+       conf->options |= BC_O_ACC_PROXY;
        return 0;
 }
 
 /* parse the "accept-netscaler-cip" bind keyword */
 static int bind_parse_accept_netscaler_cip(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
 {
-       struct listener *l;
        uint32_t val;
 
        if (!*args[cur_arg + 1]) {
@@ -1531,11 +1526,8 @@ static int bind_parse_accept_netscaler_cip(char **args, int cur_arg, struct prox
                return ERR_ALERT | ERR_FATAL;
        }
 
-       list_for_each_entry(l, &conf->listeners, by_bind) {
-               l->options |= LI_O_ACC_CIP;
-               conf->ns_cip_magic = val;
-       }
-
+       conf->options |= BC_O_ACC_CIP;
+       conf->ns_cip_magic = val;
        return 0;
 }
 
index b15907d5e51bb6ec8980f39da461bf46a7dcf7e0..bc042b7a101cd876c850a2a37ca95ba1174f4645 100644 (file)
@@ -169,11 +169,11 @@ int session_accept_fd(struct connection *cli_conn)
        conn_ctrl_init(cli_conn);
 
        /* wait for a PROXY protocol header */
-       if (l->options & LI_O_ACC_PROXY)
+       if (l->bind_conf->options & BC_O_ACC_PROXY)
                cli_conn->flags |= CO_FL_ACCEPT_PROXY;
 
        /* wait for a NetScaler client IP insertion protocol header */
-       if (l->options & LI_O_ACC_CIP)
+       if (l->bind_conf->options & BC_O_ACC_CIP)
                cli_conn->flags |= CO_FL_ACCEPT_CIP;
 
        /* Add the handshake pseudo-XPRT */