diff options
Diffstat (limited to 'src/server.c')
-rw-r--r-- | src/server.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c index 829fbb3..9196fac 100644 --- a/src/server.c +++ b/src/server.c @@ -900,6 +900,11 @@ static int srv_parse_disabled(char **args, int *cur_arg, static int srv_parse_enabled(char **args, int *cur_arg, struct proxy *curproxy, struct server *newsrv, char **err) { + if (newsrv->flags & SRV_F_DYNAMIC) { + ha_warning("Keyword 'enabled' is ignored for dynamic servers. It will be rejected from 3.0 onward."); + return 0; + } + newsrv->next_admin &= ~SRV_ADMF_CMAINT & ~SRV_ADMF_FMAINT; newsrv->next_state = SRV_ST_RUNNING; newsrv->check.state &= ~CHK_ST_PAUSED; @@ -2223,7 +2228,7 @@ void srv_compute_all_admin_states(struct proxy *px) */ static struct srv_kw_list srv_kws = { "ALL", { }, { { "backup", srv_parse_backup, 0, 1, 1 }, /* Flag as backup server */ - { "cookie", srv_parse_cookie, 1, 1, 0 }, /* Assign a cookie to the server */ + { "cookie", srv_parse_cookie, 1, 1, 1 }, /* Assign a cookie to the server */ { "disabled", srv_parse_disabled, 0, 1, 1 }, /* Start the server in 'disabled' state */ { "enabled", srv_parse_enabled, 0, 1, 1 }, /* Start the server in 'enabled' state */ { "error-limit", srv_parse_error_limit, 1, 1, 1 }, /* Configure the consecutive count of check failures to consider a server on error */ @@ -2507,8 +2512,10 @@ static void srv_conn_src_cpy(struct server *srv, const struct server *src) srv->conn_src.bind_hdr_occ = src->conn_src.bind_hdr_occ; srv->conn_src.tproxy_addr = src->conn_src.tproxy_addr; #endif - if (src->conn_src.iface_name != NULL) + if (src->conn_src.iface_name != NULL) { srv->conn_src.iface_name = strdup(src->conn_src.iface_name); + srv->conn_src.iface_len = src->conn_src.iface_len; + } } /* @@ -5528,6 +5535,11 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct */ srv->rid = (srv_id_reuse_cnt) ? (srv_id_reuse_cnt / 2) : 0; + /* generate new server's dynamic cookie if enabled on backend */ + if (be->ck_opts & PR_CK_DYNAMIC) { + srv_set_dyncookie(srv); + } + /* adding server cannot fail when we reach this: * publishing EVENT_HDL_SUB_SERVER_ADD */ @@ -5549,6 +5561,9 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct ha_alert("System might be unstable, consider to execute a reload"); } + if (srv->cklen && be->mode != PR_MODE_HTTP) + ha_warning("Ignoring cookie as HTTP mode is disabled.\n"); + ha_notice("New server registered.\n"); cli_umsg(appctx, LOG_INFO); @@ -5637,7 +5652,7 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap * TODO idle connections should not prevent server deletion. A proper * cleanup function should be implemented to be used here. */ - if (srv->cur_sess || srv->curr_idle_conns || + if (srv->curr_used_conns || srv->curr_idle_conns || !eb_is_empty(&srv->queue.head) || srv_has_streams(srv)) { cli_err(appctx, "Server still has connections attached to it, cannot remove it."); goto out; |