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.
This commit is contained in:
Willy Tarreau 2023-01-12 19:48:50 +01:00
parent c492f1b17f
commit f1b4730f7d
3 changed files with 9 additions and 15 deletions

View 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_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 */ #define LI_O_TCP_L5_RULES 0x0020 /* run TCP L5 rules checks on the incoming session */
/* unused 0x0040 */ /* 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) */ #define LI_O_UNLIMITED 0x0100 /* listener not subject to global limits (peers & stats socket) */
/* unused 0x0200 */ /* unused 0x0200 */
/* unused 0x0400 */ /* unused 0x0400 */
/* unused 0x0800 */ /* unused 0x0800 */
#define LI_O_ACC_CIP 0x1000 /* find the proxied address in the NetScaler Client IP header */ /* unused 0x1000 */
/* unused 0x2000 */ /* unused 0x2000 */
/* unused 0x4000 */ /* unused 0x4000 */
#define LI_O_NOSTOP 0x8000 /* keep the listener active even after a soft stop */ #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_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_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_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 */ /* flags used with bind_conf->ssl_options */

View 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 */ /* 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) static int bind_parse_accept_proxy(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{ {
struct listener *l; conf->options |= BC_O_ACC_PROXY;
list_for_each_entry(l, &conf->listeners, by_bind)
l->options |= LI_O_ACC_PROXY;
return 0; return 0;
} }
/* parse the "accept-netscaler-cip" bind keyword */ /* 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) 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; uint32_t val;
if (!*args[cur_arg + 1]) { 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; return ERR_ALERT | ERR_FATAL;
} }
list_for_each_entry(l, &conf->listeners, by_bind) { conf->options |= BC_O_ACC_CIP;
l->options |= LI_O_ACC_CIP; conf->ns_cip_magic = val;
conf->ns_cip_magic = val;
}
return 0; return 0;
} }

View File

@ -169,11 +169,11 @@ int session_accept_fd(struct connection *cli_conn)
conn_ctrl_init(cli_conn); conn_ctrl_init(cli_conn);
/* wait for a PROXY protocol header */ /* 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; cli_conn->flags |= CO_FL_ACCEPT_PROXY;
/* wait for a NetScaler client IP insertion protocol header */ /* 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; cli_conn->flags |= CO_FL_ACCEPT_CIP;
/* Add the handshake pseudo-XPRT */ /* Add the handshake pseudo-XPRT */