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.
diff --git a/src/server.c b/src/server.c
index 2b0a5da..796ff51 100644
--- a/src/server.c
+++ b/src/server.c
@@ -221,6 +221,14 @@
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 @@
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 @@
*/
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 @@
= 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 @@
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]);