MINOR: server: Constify source server to copy its settings

The source server used to initialize a new server, in srv_settings_cpy() and
sub-functions, is now a constant.

This patch is mandatory to fix a bug.
This commit is contained in:
Christopher Faulet 2022-08-03 11:21:14 +02:00
parent bc6b23813f
commit 0b365e3cb5

View File

@ -2000,8 +2000,7 @@ static void display_parser_err(const char *file, int linenum, char **args, int c
ha_alert("%s%s%s%s.\n", msg, quote, token, quote); ha_alert("%s%s%s%s.\n", msg, quote, token, quote);
} }
static void srv_conn_src_sport_range_cpy(struct server *srv, static void srv_conn_src_sport_range_cpy(struct server *srv, const struct server *src)
struct server *src)
{ {
int range_sz; int range_sz;
@ -2022,7 +2021,7 @@ static void srv_conn_src_sport_range_cpy(struct server *srv,
/* /*
* Copy <src> server connection source settings to <srv> server everything needed. * Copy <src> server connection source settings to <srv> server everything needed.
*/ */
static void srv_conn_src_cpy(struct server *srv, struct server *src) static void srv_conn_src_cpy(struct server *srv, const struct server *src)
{ {
srv->conn_src.opts = src->conn_src.opts; srv->conn_src.opts = src->conn_src.opts;
srv->conn_src.source_addr = src->conn_src.source_addr; srv->conn_src.source_addr = src->conn_src.source_addr;
@ -2048,7 +2047,7 @@ static void srv_conn_src_cpy(struct server *srv, struct server *src)
* everything needed. * everything needed.
*/ */
#if defined(USE_OPENSSL) #if defined(USE_OPENSSL)
static void srv_ssl_settings_cpy(struct server *srv, struct server *src) static void srv_ssl_settings_cpy(struct server *srv, const struct server *src)
{ {
/* <src> is the current proxy's default server and SSL is enabled */ /* <src> is the current proxy's default server and SSL is enabled */
BUG_ON(src->ssl_ctx.ctx != NULL); /* the SSL_CTX must never be initialized in a default-server */ BUG_ON(src->ssl_ctx.ctx != NULL); /* the SSL_CTX must never be initialized in a default-server */
@ -2170,7 +2169,7 @@ int srv_prepare_for_resolution(struct server *srv, const char *hostname)
* <srv_tmpl> distinguishes these two cases (must be 1 if <srv> is a template, * <srv_tmpl> distinguishes these two cases (must be 1 if <srv> is a template,
* 0 if not). * 0 if not).
*/ */
static void srv_settings_cpy(struct server *srv, struct server *src, int srv_tmpl) static void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl)
{ {
/* Connection source settings copy */ /* Connection source settings copy */
srv_conn_src_cpy(srv, src); srv_conn_src_cpy(srv, src);