From: Godbach Date: Tue, 23 Apr 2013 07:27:57 +0000 (+0800) Subject: BUG/MINOR: config: "source" does not work in defaults section X-Git-Tag: v1.5-dev19~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f04853bd9231bddda2dbde03dae5be21d9b99a9;p=thirdparty%2Fhaproxy.git BUG/MINOR: config: "source" does not work in defaults section Source function will not work with the following line in default section: source 0.0.0.0 usesrc clientip even that related settings by iptables and ip rule have been set correctly. But it can work well in backend setcion. The reason is that the operation in line 1815 in cfgparse.c as below: curproxy->conn_src.opts = defproxy.conn_src.opts & ~CO_SRC_TPROXY_MASK; clears three low bits of conn_src.opts which stores the configuration of 'usesrc'. Without correct bits set, the source address function can not work well. They should be copied to the backend proxy without being modified. Since conn_src.tproxy_addr had not copied from defproxy to backend proxy while initializing backend proxy, source function will not work well with explicit source address set in default section either. Signed-off-by: Godbach Note: the bug was introduced in 1.5-dev16 with commit ef9a3605 --- diff --git a/src/cfgparse.c b/src/cfgparse.c index cc515a2058..efd46bc908 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1812,7 +1812,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) if (defproxy.conn_src.iface_name) curproxy->conn_src.iface_name = strdup(defproxy.conn_src.iface_name); curproxy->conn_src.iface_len = defproxy.conn_src.iface_len; - curproxy->conn_src.opts = defproxy.conn_src.opts & ~CO_SRC_TPROXY_MASK; + curproxy->conn_src.opts = defproxy.conn_src.opts; + curproxy->conn_src.tproxy_addr = defproxy.conn_src.tproxy_addr; } if (curproxy->cap & PR_CAP_FE) {