MINOR: server: Make 'default-server' support 'check-send-proxy' keyword.

This patch makes 'default-server' directive support 'check-send-proxy' setting.
A new keyword 'no-check-send-proxy' has been added so that to disable
'check-send-proxy' setting both in 'server' and 'default-server' directives.
This commit is contained in:
Frdric Lcaille 2017-03-10 14:04:31 +01:00 committed by Willy Tarreau
parent f5bf903be6
commit 25df89066b

View File

@ -221,6 +221,14 @@ static int srv_parse_backup(char **args, int *cur_arg,
return 0;
}
/* Parse the "check-send-proxy" server keyword */
static int srv_parse_check_send_proxy(char **args, int *cur_arg,
struct proxy *curproxy, struct server *newsrv, char **err)
{
newsrv->check.send_proxy = 1;
return 0;
}
/* parse the "id" server keyword */
static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struct server *newsrv, char **err)
{
@ -261,6 +269,14 @@ static int srv_parse_no_backup(char **args, int *cur_arg,
return 0;
}
/* Parse the "no-check-send-proxy" server keyword */
static int srv_parse_no_check_send_proxy(char **args, int *cur_arg,
struct proxy *curproxy, struct server *newsrv, char **err)
{
newsrv->check.send_proxy = 0;
return 0;
}
/* Shutdown all connections of a server. The caller must pass a termination
* code in <why>, which must be one of SF_ERR_* indicating the reason for the
* shutdown.
@ -871,8 +887,10 @@ void srv_compute_all_admin_states(struct proxy *px)
*/
static struct srv_kw_list srv_kws = { "ALL", { }, {
{ "backup", srv_parse_backup, 0, 1 }, /* Flag as backup server */
{ "check-send-proxy", srv_parse_check_send_proxy, 0, 1 }, /* enable PROXY protocol for health checks */
{ "id", srv_parse_id, 1, 0 }, /* set id# of server */
{ "no-backup", srv_parse_no_backup, 0, 1 }, /* Flag as non-backup server */
{ "no-check-send-proxy", srv_parse_no_check_send_proxy, 0, 1 }, /* disable PROXY protol for health checks */
{ NULL, NULL, 0 },
}};
@ -1191,6 +1209,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
= curproxy->defsrv.iweight;
newsrv->check.status = HCHK_STATUS_INI;
newsrv->check.send_proxy = curproxy->defsrv.check.send_proxy;
newsrv->check.rise = curproxy->defsrv.check.rise;
newsrv->check.fall = curproxy->defsrv.check.fall;
newsrv->check.health = newsrv->check.rise; /* up, but will fall down at first failure */
@ -1535,10 +1554,6 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv->pp_opts |= SRV_PP_V2;
cur_arg ++;
}
else if (!defsrv && !strcmp(args[cur_arg], "check-send-proxy")) {
newsrv->check.send_proxy = 1;
cur_arg ++;
}
else if (!strcmp(args[cur_arg], "weight")) {
int w;
w = atol(args[cur_arg + 1]);