]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: Constify source server to copy its settings
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 09:21:14 +0000 (11:21 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Aug 2022 09:28:23 +0000 (11:28 +0200)
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.

src/server.c

index 5cf0eacdfd4947f8e4be89ffc053c2e08ab833c3..73a73232e41a2fced6579f1fd0a17ff490bbd38d 100644 (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);
 }
 
-static void srv_conn_src_sport_range_cpy(struct server *srv,
-                                            struct server *src)
+static void srv_conn_src_sport_range_cpy(struct server *srv, const struct server *src)
 {
        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.
  */
-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.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.
  */
 #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 */
        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,
  * 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 */
        srv_conn_src_cpy(srv, src);