]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: server: move _srv_check_proxy_mode() checks from server init to finalize
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 27 Jun 2025 10:15:24 +0000 (12:15 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 27 Jun 2025 14:41:07 +0000 (16:41 +0200)
_srv_check_proxy_mode() is currently executed during server init (from
_srv_parse_init()), while it used to be fine for current checks, it
seems it occurs a bit too early to be usable for some checks that depend
on server keywords to be evaluated for instance.

As such, to make _srv_check_proxy_mode() more relevant and be extended
with additional checks in the future, let's call it later during server
finalization, once all server keywords were evaluated.

No change of behavior is expected

src/server.c

index 496b00b4c4792be3ba742bd6590f755658ff2539..cfb2db3dfb2f8fb59ddcca92139e2b4210deb63f 100644 (file)
@@ -3680,14 +3680,6 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
        }
 
        free(fqdn);
-       if (!(curproxy->cap & PR_CAP_LB)) {
-               /* No need to wait for effective proxy mode, it is already known:
-                * Only general purpose user-declared proxies ("listen", "frontend", "backend")
-                * offer the possibility to configure the mode of the proxy. Hopefully for us,
-                * they have the PR_CAP_LB set.
-                */
-               return _srv_check_proxy_mode(newsrv, 0);
-       }
        return 0;
 
 out:
@@ -3845,6 +3837,15 @@ static int _srv_parse_finalize(char **args, int cur_arg,
        }
 #endif
 
+       if (!(srv->proxy->cap & PR_CAP_LB)) {
+               /* No need to wait for effective proxy mode, it is already known:
+                * Only general purpose user-declared proxies ("listen", "frontend", "backend")
+                * offer the possibility to configure the mode of the proxy. Hopefully for us,
+                * they have the PR_CAP_LB set.
+                */
+               return _srv_check_proxy_mode(srv, 0);
+       }
+
        srv_lb_commit_status(srv);
 
        return 0;