]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: resolvers: report the expression error in the do-resolve() action parser
authorWilly Tarreau <w@1wt.eu>
Thu, 14 May 2026 22:43:17 +0000 (22:43 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 15:53:00 +0000 (17:53 +0200)
When an expression is used for do-resolve(), an error may be reported.
Unfortunately it was scratched and replaced by the do-resolve() error,
leaving no chance to know exactly what was wrong. Let's report the
contents of the error when available. It will indicate identifiers that
are not found or invalid ranges or types being used.

This can be backported to all versions.

src/resolvers.c

index 463576acb3305f5a3dcc1ba37c038fc9b76e1ed7..a3292ee856465249b5d36c828cdeb3f6ced6f36f 100644 (file)
@@ -3405,8 +3405,8 @@ enum act_parse_ret resolv_parse_do_resolve(const char **args, int *orig_arg, str
        ha_free(&rule->arg.resolv.varname);
        ha_free(&rule->arg.resolv.resolvers_id);
        ha_free(&rule->arg.resolv.opts);
-       memprintf(err, "Can't parse '%s'. Expects 'do-resolve(<varname>,<resolvers>[,<options>]) <expr>'. Available options are 'ipv4' and 'ipv6'",
-                       args[cur_arg]);
+       memprintf(err, "Can't parse '%s'%s%s. Expects 'do-resolve(<varname>,<resolvers>[,<options>]) <expr>'. Available options are 'ipv4' and 'ipv6'",
+                       args[cur_arg], *err ? ": " : "", *err ? *err : "");
        return ACT_RET_PRS_ERR;
 }