]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: ensure server postparse tasks are run for dynamic servers
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 7 May 2025 21:50:46 +0000 (23:50 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 8 May 2025 00:03:50 +0000 (02:03 +0200)
commit 29b76cae4 ("BUG/MEDIUM: server/log: "mode log" after server
keyword causes crash") introduced some postparsing checks/tasks for
server

Initially they were mainly meant for "mode log" servers postparsing, but
we already have a check dedicated to "tcp/http" servers (ie: only tcp
proto supported)

However when dynamic servers are added they bypass _srv_postparse() since
the REGISTER_POST_SERVER_CHECK() is only executed for servers defined in
the configuration.

To ensure consistency between dynamic and static servers, and ensure no
post-check init routine is missed, let's manually invoke _srv_postparse()
after creating a dynamic server added via the cli.

src/server.c

index 06c4e997977872b03fdf75cbbfbe99a73cfcb6d0..6b984029a4144435fa2ca4ef5c749f5803882822 100644 (file)
@@ -5883,6 +5883,10 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
        if (errcode)
                goto out;
 
+       errcode = _srv_postparse(srv);
+       if (errcode)
+               goto out;
+
        /* A dynamic server does not currently support resolution.
         *
         * Initialize it explicitly to the "none" method to ensure no