From 9f04853bd9231bddda2dbde03dae5be21d9b99a9 Mon Sep 17 00:00:00 2001 From: Godbach Date: Tue, 23 Apr 2013 15:27:57 +0800 Subject: [PATCH] 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 --- src/cfgparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index cc515a205..efd46bc90 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) {