From: Frédéric Lécaille Date: Fri, 10 Mar 2017 14:50:49 +0000 (+0100) Subject: MINOR: server: Make 'default-server' support 'non-stick' keyword. X-Git-Tag: v1.8-dev1~46 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=f9bc1d6a13623ac9944983df2233735f9807d940;p=haproxy-2.3.git MINOR: server: Make 'default-server' support 'non-stick' keyword. This patch makes 'default-server' directive support 'non-stick' setting. A new keyword 'stick' has been added so that to disable 'non-stick' setting both in 'server' and 'default-server' directives. --- diff --git a/src/server.c b/src/server.c index 09f196b..c5a4d31 100644 --- a/src/server.c +++ b/src/server.c @@ -277,6 +277,22 @@ static int srv_parse_no_check_send_proxy(char **args, int *cur_arg, return 0; } +/* Parse the "non-stick" server keyword */ +static int srv_parse_non_stick(char **args, int *cur_arg, + struct proxy *curproxy, struct server *newsrv, char **err) +{ + newsrv->flags |= SRV_F_NON_STICK; + return 0; +} + +/* Parse the "stick" server keyword */ +static int srv_parse_stick(char **args, int *cur_arg, + struct proxy *curproxy, struct server *newsrv, char **err) +{ + newsrv->flags &= ~SRV_F_NON_STICK; + return 0; +} + /* Shutdown all connections of a server. The caller must pass a termination * code in , which must be one of SF_ERR_* indicating the reason for the * shutdown. @@ -891,6 +907,8 @@ static struct srv_kw_list srv_kws = { "ALL", { }, { { "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 */ + { "non-stick", srv_parse_non_stick, 0, 1 }, /* Disable stick-table persistence */ + { "stick", srv_parse_stick, 0, 1 }, /* Enable stick-table persistence */ { NULL, NULL, 0 }, }}; @@ -1542,10 +1560,6 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr newsrv->flags |= SRV_F_CHECKPORT; cur_arg += 2; } - else if (!defsrv && !strcmp(args[cur_arg], "non-stick")) { - newsrv->flags |= SRV_F_NON_STICK; - cur_arg ++; - } else if (!defsrv && !strcmp(args[cur_arg], "send-proxy")) { newsrv->pp_opts |= SRV_PP_V1; cur_arg ++;