]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: resolvers: display the template name instead of "server '(null)'"
authorWilly Tarreau <w@1wt.eu>
Wed, 25 Nov 2026 14:09:21 +0000 (15:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 25 Nov 2026 14:31:50 +0000 (15:31 +0100)
When resolvers fail to create a resolution, the server name is printed,
but for templates, the server is not yet assigned so "server '(null)'"
is printed, which is ugly and not really helpful. Let's just fall back
to the template name and indicate it.

This can be backported to all versions.

src/resolvers.c

index 83f1f17e27c5edfc9ea686923133f3f7533aedcb..233977825750830ddb71d51da3630dee84b0c728 100644 (file)
@@ -299,8 +299,9 @@ struct resolv_srvrq *new_resolv_srvrq(struct server *srv, char *fqdn)
        hostname_dn_len = resolv_str_to_dn_label(fqdn, fqdn_len, trash.area,
                                              trash.size);
        if (hostname_dn_len == -1) {
-               ha_alert("%s '%s', server '%s': failed to parse FQDN '%s'\n",
-                        proxy_type_str(px), px->id, srv->id, fqdn);
+               ha_alert("%s '%s', server %s'%s': failed to parse FQDN '%s'.\n",
+                        proxy_type_str(px), px->id, srv->id ? "" : "template ",
+                        srv->id ? srv->id : srv->tmpl_info.prefix, fqdn);
                goto err;
        }