From 7223296092c72c2b10729a6da218897887858dba Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 12 Mar 2024 08:16:16 +0100 Subject: [PATCH] BUG/MINOR: server: fix first server template not being indexed 3.0-dev1 introduced a small regression with commit b4db3be86e ("BUG/MINOR: server: fix server_find_by_name() usage during parsing"). By changing the way servers are indexed and moving it into the server template loop, the first one is no longer indexed because the loop starts at low+1 since it focuses on duplication. Let's index the first one explicitly now. This should not be backported, unless the commit above is backported. --- src/server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server.c b/src/server.c index 8b0d406602..1450b0477a 100644 --- a/src/server.c +++ b/src/server.c @@ -3017,6 +3017,12 @@ static int _srv_parse_tmpl_init(struct server *srv, struct proxy *px) int i; struct server *newsrv; + /* Set the first server's ID. */ + _srv_parse_set_id_from_prefix(srv, srv->tmpl_info.prefix, srv->tmpl_info.nb_low); + srv->conf.name.key = srv->id; + ebis_insert(&curproxy->conf.used_server_name, &srv->conf.name); + + /* then create other servers from this one */ for (i = srv->tmpl_info.nb_low + 1; i <= srv->tmpl_info.nb_high; i++) { newsrv = new_server(px); if (!newsrv) -- 2.39.5