diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h index 8ee956c8e..fe13318f8 100644 --- a/include/haproxy/server-t.h +++ b/include/haproxy/server-t.h @@ -175,6 +175,7 @@ enum srv_init_state { /* configured server options for send-proxy (server->pp_opts) */ #define SRV_PP_V1 0x0001 /* proxy protocol version 1 */ #define SRV_PP_V2 0x0002 /* proxy protocol version 2 */ +#define SRV_PP_ENABLED 0x0003 /* proxy protocol version 1 or version 2 */ #define SRV_PP_V2_SSL 0x0004 /* proxy protocol version 2 with SSL */ #define SRV_PP_V2_SSL_CN 0x0008 /* proxy protocol version 2 with CN */ #define SRV_PP_V2_SSL_KEY_ALG 0x0010 /* proxy protocol version 2 with cert key algorithm */ diff --git a/src/backend.c b/src/backend.c index 867c6a850..d8c9df812 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1598,7 +1598,7 @@ int connect_server(struct stream *s) hash_params.src_addr = bind_addr; /* 5. proxy protocol */ - if (srv && srv->pp_opts) { + if (srv && (srv->pp_opts & SRV_PP_ENABLED)) { proxy_line_ret = make_proxy_line(trash.area, trash.size, srv, cli_conn, s, strm_sess(s)); if (proxy_line_ret) { hash_params.proxy_prehash = @@ -1932,7 +1932,7 @@ skip_reuse: /* process the case where the server requires the PROXY protocol to be sent */ srv_conn->send_proxy_ofs = 0; - if (srv && srv->pp_opts) { + if (srv && (srv->pp_opts & SRV_PP_ENABLED)) { srv_conn->flags |= CO_FL_SEND_PROXY; srv_conn->send_proxy_ofs = 1; /* must compute size */ } diff --git a/src/proto_rhttp.c b/src/proto_rhttp.c index ccd56cf85..b81589936 100644 --- a/src/proto_rhttp.c +++ b/src/proto_rhttp.c @@ -84,7 +84,7 @@ static struct connection *new_reverse_conn(struct listener *l, struct server *sr set_host_port(conn->dst, srv->svc_port); conn->send_proxy_ofs = 0; - if (srv->pp_opts) { + if (srv->pp_opts & SRV_PP_ENABLED) { conn->flags |= CO_FL_SEND_PROXY; conn->send_proxy_ofs = 1; /* must compute size */ }