]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: detect and warn on init_addr/resolvers/check/agent-check
authorWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 07:42:44 +0000 (09:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 07:42:44 +0000 (09:42 +0200)
Some server keywords are currently silently ignored in the peers
section, which is not good because it wastes time on user-side, trying
to make something work while it cannot by design.

With this patch we at least report a few of them (the most common ones),
which are init_addr, resolvers, check, agent-check. Others might follow.

This may be backported to 2.5 to encourage some cleaning of bogus configs.

src/cfgparse.c

index 94823114da37c7421cb1fb4c6c4ac60c97746d3a..72512d89846637494b8afe4fd8dab07609a133a9 100644 (file)
@@ -896,6 +896,12 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
                        goto out;
                }
 
+               if (curpeers->peers_fe->srv->init_addr_methods || curpeers->peers_fe->srv->resolvers_id ||
+                   curpeers->peers_fe->srv->do_check || curpeers->peers_fe->srv->do_agent) {
+                       ha_warning("parsing [%s:%d] : '%s %s' : init_addr, resolvers, check and agent are ignored for peers.\n", file, linenum, args[0], args[1]);
+                       err_code |= ERR_WARN;
+               }
+
                /* If the peer address has just been parsed, let's copy it to <newpeer>
                 * and initializes ->proto.
                 */