MINOR: listener: move the ACC_PROXY and ACC_CIP options to bind_conf
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.
diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h
index 9e180ad..338ab9d 100644
--- a/include/haproxy/listener-t.h
+++ b/include/haproxy/listener-t.h
@@ -99,12 +99,12 @@
#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 @@
#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 */
diff --git a/src/listener.c b/src/listener.c
index 1635576..7ff21f0 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -1506,18 +1506,13 @@
/* 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 @@
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;
}
diff --git a/src/session.c b/src/session.c
index b15907d..bc042b7 100644
--- a/src/session.c
+++ b/src/session.c
@@ -169,11 +169,11 @@
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 */