]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] the "source" keyword must first clear optional settings
authorWilly Tarreau <w@1wt.eu>
Sun, 1 Mar 2009 07:27:21 +0000 (08:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 1 Mar 2009 07:27:21 +0000 (08:27 +0100)
Problem reported by John Lauro. When "source ... usesrc ..." is
set in the defaults section, it is not possible anymore to remove
the "usesrc" part when declaring a more precise "source" in a
backend. The only workaround was to declare it by server.

We need to clear optional settings when declaring a new "source".
The problem was the same with the "interface" declaration.

src/cfgparse.c

index e427a6ffdfb965f312132a4b6caf2b12683ea65b..5f1f0bb53ba8a2085c793d80f9a73fbd4fb5ba8f 100644 (file)
@@ -2199,7 +2199,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
                              file, linenum, "source", "usesrc", "interface");
                        return -1;
                }
-       
+
+               /* we must first clear any optional default setting */  
+               curproxy->options &= ~PR_O_TPXY_MASK;
+               free(curproxy->iface_name);
+               curproxy->iface_name = NULL;
+               curproxy->iface_len = 0;
+
                curproxy->source_addr = *str2sa(args[1]);
                curproxy->options |= PR_O_BIND_SRC;