]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: resolvers: Use the right server to init DNS streams
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Sep 2026 15:51:07 +0000 (17:51 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Sep 2026 15:56:07 +0000 (17:56 +0200)
During TCP nameservers parsing, the wrong server was selected to initialize
the DNS stream. After the server addition, the first server of the proxy was
selected instead of the last one. So when several TCP nameservers was
defined, only the first one was properly initialized. All others was using
the server created for the first one.

The regression was introduced when the server insertion in the proxy's list
was inverted. The change was not made on the resolvers part. The
proxy_last_server() function must be used instead.

It is a 3.5-specific issue. No backported needed.

src/resolvers.c

index 06fb19c415ead3a6350f3c62c435969ec03d8213..b4812f3a0363f6df57d7de7ade917befbd33bcee 100644 (file)
@@ -3803,7 +3803,7 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
                                goto out;
                        }
 
-                       if (dns_stream_init(newnameserver, proxy_first_server(curr_resolvers->px)) < 0) {
+                       if (dns_stream_init(newnameserver, proxy_last_server(curr_resolvers->px)) < 0) {
                                ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
                                err_code |= ERR_ALERT|ERR_ABORT;
                                free(newnameserver);