Ver código fonte

haproxy: fixes from upstream

 - [PATCH 15/20] BUG/MEDIUM: remove debugging code from systemd-wrapper
 - [PATCH 16/20] BUG/MEDIUM: http: adjust close mode when switching to
 - [PATCH 17/20] BUG/MINOR: config: don't propagate process binding on
 - [PATCH 18/20] BUG/MEDIUM: check: rule-less tcp-check must detect
 - [PATCH 19/20] BUG/MINOR: tcp-check: report the correct failed step in
 - [PATCH 20/20] BUG/MINOR: config: don't propagate process binding for

Signed-off-by: Thomas Heil <heil@terminal-consulting.de>
Thomas Heil 10 anos atrás
pai
commit
a6a3037fbd

+ 1
- 1
net/haproxy/Makefile Ver arquivo

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
10 10
 
11 11
 PKG_NAME:=haproxy
12 12
 PKG_VERSION:=1.5.4
13
-PKG_RELEASE:=15
13
+PKG_RELEASE:=20
14 14
 PKG_SOURCE:=haproxy-$(PKG_VERSION).tar.gz
15 15
 PKG_SOURCE_URL:=http://haproxy.1wt.eu/download/1.5/src/
16 16
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

+ 36
- 0
net/haproxy/patches/0015-BUG-MEDIUM-remove-debugging-code-from-systemd-wrappe.patch Ver arquivo

@@ -0,0 +1,36 @@
1
+From 575e299cc07f5f2b314d91dfac8671834cbdd2a7 Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Wed, 24 Sep 2014 12:59:25 +0200
4
+Subject: [PATCH 15/20] BUG/MEDIUM: remove debugging code from systemd-wrapper
5
+MIME-Version: 1.0
6
+Content-Type: text/plain; charset=UTF-8
7
+Content-Transfer-Encoding: 8bit
8
+
9
+Kristoffer Grönlund reported that after my recent update to the
10
+systemd-wrapper, I accidentely left the debugging code which
11
+consists in disabling the fork :-(
12
+
13
+The fix needs to be backported to 1.5 as well since I pushed it
14
+there as well.
15
+(cherry picked from commit a55bbc64d8272e4066a67b6d190ffebaff2b300a)
16
+---
17
+ src/haproxy-systemd-wrapper.c | 3 +--
18
+ 1 file changed, 1 insertion(+), 2 deletions(-)
19
+
20
+diff --git a/src/haproxy-systemd-wrapper.c b/src/haproxy-systemd-wrapper.c
21
+index 446f28f..8602881 100644
22
+--- a/src/haproxy-systemd-wrapper.c
23
++++ b/src/haproxy-systemd-wrapper.c
24
+@@ -70,8 +70,7 @@ static void spawn_haproxy(char **pid_strv, int nb_pid)
25
+ 	main_argc = wrapper_argc - 1;
26
+ 	main_argv = wrapper_argv + 1;
27
+ 
28
+-	//pid = fork();
29
+-	pid=0;
30
++	pid = fork();
31
+ 	if (!pid) {
32
+ 		/* 3 for "haproxy -Ds -sf" */
33
+ 		char **argv = calloc(4 + main_argc + nb_pid + 1, sizeof(char *));
34
+-- 
35
+2.0.4
36
+

+ 188
- 0
net/haproxy/patches/0016-BUG-MEDIUM-http-adjust-close-mode-when-switching-to-.patch Ver arquivo

@@ -0,0 +1,188 @@
1
+From 2e47a3ab11188239abadb6bba7bd901d764aa4fb Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Tue, 30 Sep 2014 18:44:22 +0200
4
+Subject: [PATCH 16/20] BUG/MEDIUM: http: adjust close mode when switching to
5
+ backend
6
+
7
+Commit 179085c ("MEDIUM: http: move Connection header processing earlier")
8
+introduced a regression : the backend's HTTP mode is not considered anymore
9
+when setting the session's HTTP mode, because wait_for_request() is only
10
+called once, when the frontend receives the request (or when the frontend
11
+is in TCP mode, when the backend receives the request).
12
+
13
+The net effect is that in some situations when the frontend and the backend
14
+do not work in the same mode (eg: keep-alive vs close), the backend's mode
15
+is ignored.
16
+
17
+This patch moves all that processing to a dedicated function, which is
18
+called from the original place, as well as from session_set_backend()
19
+when switching from an HTTP frontend to an HTTP backend in different
20
+modes.
21
+
22
+This fix must be backported to 1.5.
23
+(cherry picked from commit 4e21ff9244aefa56bcf0793a9e07edba2c3c1960)
24
+---
25
+ include/proto/proto_http.h |   1 +
26
+ src/proto_http.c           | 107 +++++++++++++++++++++++----------------------
27
+ src/proxy.c                |   8 ++++
28
+ 3 files changed, 64 insertions(+), 52 deletions(-)
29
+
30
+diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
31
+index e898ca8..8014310 100644
32
+--- a/include/proto/proto_http.h
33
++++ b/include/proto/proto_http.h
34
+@@ -112,6 +112,7 @@ unsigned int http_get_hdr(const struct http_msg *msg, const char *hname, int hle
35
+ void http_init_txn(struct session *s);
36
+ void http_end_txn(struct session *s);
37
+ void http_reset_txn(struct session *s);
38
++void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_msg *msg);
39
+ 
40
+ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
41
+ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
42
+diff --git a/src/proto_http.c b/src/proto_http.c
43
+index 7e35c8b..20e7088 100644
44
+--- a/src/proto_http.c
45
++++ b/src/proto_http.c
46
+@@ -2393,6 +2393,59 @@ fail:
47
+ 	return 0;
48
+ }
49
+ 
50
++void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_msg *msg)
51
++{
52
++	int tmp = TX_CON_WANT_KAL;
53
++
54
++	if (!((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)) {
55
++		if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN ||
56
++		    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN)
57
++			tmp = TX_CON_WANT_TUN;
58
++
59
++		if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
60
++		    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
61
++			tmp = TX_CON_WANT_TUN;
62
++	}
63
++
64
++	if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL ||
65
++	    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL) {
66
++		/* option httpclose + server_close => forceclose */
67
++		if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
68
++		    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
69
++			tmp = TX_CON_WANT_CLO;
70
++		else
71
++			tmp = TX_CON_WANT_SCL;
72
++	}
73
++
74
++	if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL ||
75
++	    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL)
76
++		tmp = TX_CON_WANT_CLO;
77
++
78
++	if ((txn->flags & TX_CON_WANT_MSK) < tmp)
79
++		txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | tmp;
80
++
81
++	if (!(txn->flags & TX_HDR_CONN_PRS) &&
82
++	    (txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) {
83
++		/* parse the Connection header and possibly clean it */
84
++		int to_del = 0;
85
++		if ((msg->flags & HTTP_MSGF_VER_11) ||
86
++		    ((txn->flags & TX_CON_WANT_MSK) >= TX_CON_WANT_SCL &&
87
++		     !((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)))
88
++			to_del |= 2; /* remove "keep-alive" */
89
++		if (!(msg->flags & HTTP_MSGF_VER_11))
90
++			to_del |= 1; /* remove "close" */
91
++		http_parse_connection_header(txn, msg, to_del);
92
++	}
93
++
94
++	/* check if client or config asks for explicit close in KAL/SCL */
95
++	if (((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL ||
96
++	     (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL) &&
97
++	    ((txn->flags & TX_HDR_CONN_CLO) ||                         /* "connection: close" */
98
++	     (!(msg->flags & HTTP_MSGF_VER_11) && !(txn->flags & TX_HDR_CONN_KAL)) || /* no "connection: k-a" in 1.0 */
99
++	     !(msg->flags & HTTP_MSGF_XFER_LEN) ||                     /* no length known => close */
100
++	     s->fe->state == PR_STSTOPPED))                            /* frontend is stopping */
101
++		txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
102
++}
103
+ 
104
+ /* This stream analyser waits for a complete HTTP request. It returns 1 if the
105
+  * processing can continue on next analysers, or zero if it either needs more
106
+@@ -2929,58 +2982,8 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit)
107
+ 	 * time.
108
+ 	 */
109
+ 	if (!(txn->flags & TX_HDR_CONN_PRS) ||
110
+-	    ((s->fe->options & PR_O_HTTP_MODE) != (s->be->options & PR_O_HTTP_MODE))) {
111
+-		int tmp = TX_CON_WANT_KAL;
112
+-
113
+-		if (!((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)) {
114
+-			if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN ||
115
+-			    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN)
116
+-				tmp = TX_CON_WANT_TUN;
117
+-
118
+-			if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
119
+-			    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
120
+-				tmp = TX_CON_WANT_TUN;
121
+-		}
122
+-
123
+-		if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL ||
124
+-		    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL) {
125
+-			/* option httpclose + server_close => forceclose */
126
+-			if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
127
+-			    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
128
+-				tmp = TX_CON_WANT_CLO;
129
+-			else
130
+-				tmp = TX_CON_WANT_SCL;
131
+-		}
132
+-
133
+-		if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL ||
134
+-		    (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL)
135
+-			tmp = TX_CON_WANT_CLO;
136
+-
137
+-		if ((txn->flags & TX_CON_WANT_MSK) < tmp)
138
+-			txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | tmp;
139
+-
140
+-		if (!(txn->flags & TX_HDR_CONN_PRS) &&
141
+-		    (txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) {
142
+-			/* parse the Connection header and possibly clean it */
143
+-			int to_del = 0;
144
+-			if ((msg->flags & HTTP_MSGF_VER_11) ||
145
+-			    ((txn->flags & TX_CON_WANT_MSK) >= TX_CON_WANT_SCL &&
146
+-			     !((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)))
147
+-				to_del |= 2; /* remove "keep-alive" */
148
+-			if (!(msg->flags & HTTP_MSGF_VER_11))
149
+-				to_del |= 1; /* remove "close" */
150
+-			http_parse_connection_header(txn, msg, to_del);
151
+-		}
152
+-
153
+-		/* check if client or config asks for explicit close in KAL/SCL */
154
+-		if (((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL ||
155
+-		     (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL) &&
156
+-		    ((txn->flags & TX_HDR_CONN_CLO) ||                         /* "connection: close" */
157
+-		     (!(msg->flags & HTTP_MSGF_VER_11) && !(txn->flags & TX_HDR_CONN_KAL)) || /* no "connection: k-a" in 1.0 */
158
+-		     !(msg->flags & HTTP_MSGF_XFER_LEN) ||                     /* no length known => close */
159
+-		     s->fe->state == PR_STSTOPPED))                            /* frontend is stopping */
160
+-		    txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
161
+-	}
162
++	    ((s->fe->options & PR_O_HTTP_MODE) != (s->be->options & PR_O_HTTP_MODE)))
163
++		http_adjust_conn_mode(s, txn, msg);
164
+ 
165
+ 	/* end of job, return OK */
166
+ 	req->analysers &= ~an_bit;
167
+diff --git a/src/proxy.c b/src/proxy.c
168
+index 02103ee..405c4c4 100644
169
+--- a/src/proxy.c
170
++++ b/src/proxy.c
171
+@@ -955,6 +955,14 @@ int session_set_backend(struct session *s, struct proxy *be)
172
+ 		http_init_txn(s);
173
+ 	}
174
+ 
175
++	/* If we chain to an HTTP backend running a different HTTP mode, we
176
++	 * have to re-adjust the desired keep-alive/close mode to accommodate
177
++	 * both the frontend's and the backend's modes.
178
++	 */
179
++	if (s->fe->mode == PR_MODE_HTTP && be->mode == PR_MODE_HTTP &&
180
++	    ((s->fe->options & PR_O_HTTP_MODE) != (be->options & PR_O_HTTP_MODE)))
181
++		http_adjust_conn_mode(s, &s->txn, &s->txn.req);
182
++
183
+ 	/* If an LB algorithm needs to access some pre-parsed body contents,
184
+ 	 * we must not start to forward anything until the connection is
185
+ 	 * confirmed otherwise we'll lose the pointer to these data and
186
+-- 
187
+2.0.4
188
+

+ 46
- 0
net/haproxy/patches/0017-BUG-MINOR-config-don-t-propagate-process-binding-on-.patch Ver arquivo

@@ -0,0 +1,46 @@
1
+From b3228c83e320ad168f5b3e6884e771530a68a449 Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Wed, 1 Oct 2014 20:50:17 +0200
4
+Subject: [PATCH 17/20] BUG/MINOR: config: don't propagate process binding on
5
+ fatal errors.
6
+
7
+propagate_processes() must not be called with unresolved proxies, but
8
+nothing prevents it from being called in check_config_validity(). The
9
+resulting effect is that an unresolved proxy can cause a recursion
10
+loop if called in such a situation, ending with a segfault after the
11
+fatal error report. There's no side effect beyond this.
12
+
13
+This patch refrains from calling the function when any error was met.
14
+
15
+This bug also affects 1.5, it should be backported.
16
+(cherry picked from commit acbe8ab38a638a076f8cf9fe2635db0e729d6a1f)
17
+---
18
+ src/cfgparse.c | 12 ++++++++----
19
+ 1 file changed, 8 insertions(+), 4 deletions(-)
20
+
21
+diff --git a/src/cfgparse.c b/src/cfgparse.c
22
+index f723a3a..6e962c8 100644
23
+--- a/src/cfgparse.c
24
++++ b/src/cfgparse.c
25
+@@ -7112,10 +7112,14 @@ out_uri_auth_compat:
26
+ 			global.stats_fe->bind_proc = ~0UL;
27
+ 	}
28
+ 
29
+-	/* propagate bindings from frontends to backends */
30
+-	for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
31
+-		if (curproxy->cap & PR_CAP_FE)
32
+-			propagate_processes(curproxy, NULL);
33
++	/* propagate bindings from frontends to backends. Don't do it if there
34
++	 * are any fatal errors as we must not call it with unresolved proxies.
35
++	 */
36
++	if (!cfgerr) {
37
++		for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
38
++			if (curproxy->cap & PR_CAP_FE)
39
++				propagate_processes(curproxy, NULL);
40
++		}
41
+ 	}
42
+ 
43
+ 	/* Bind each unbound backend to all processes when not specified. */
44
+-- 
45
+2.0.4
46
+

+ 102
- 0
net/haproxy/patches/0018-BUG-MEDIUM-check-rule-less-tcp-check-must-detect-con.patch Ver arquivo

@@ -0,0 +1,102 @@
1
+From e61737a721c3b91c79484e51fc1789293b269f9f Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 2 Oct 2014 14:30:14 +0200
4
+Subject: [PATCH 18/20] BUG/MEDIUM: check: rule-less tcp-check must detect
5
+ connect failures
6
+
7
+When "option tcp-check" is specified without any tcp-check rules, the
8
+documentation says that it's the same as the default check method. But
9
+the code path is a bit different, and we used to consider that since
10
+the end of rules was reached, the check is always successful regardless
11
+of the connection status.
12
+
13
+This patch reorganizes the error detection, and considers the special
14
+case where there's no tcp-check rule as a real L4 check. It also avoids
15
+dereferencing the rule list head as a rule by itself.
16
+
17
+While fixing this bug, another one related to the output messages'
18
+accuracy was noticed, it will be fixed in a separate commit and is
19
+much less important.
20
+
21
+This bug is also present in 1.5, so this fix must be backported.
22
+(cherry picked from commit ef953953e7f33c6a72c432fce8d47c2d84c69512)
23
+---
24
+ src/checks.c | 40 +++++++++++++++++++++++++---------------
25
+ 1 file changed, 25 insertions(+), 15 deletions(-)
26
+
27
+diff --git a/src/checks.c b/src/checks.c
28
+index f3b2b54..9c1a866 100644
29
+--- a/src/checks.c
30
++++ b/src/checks.c
31
+@@ -1837,20 +1837,34 @@ static int tcpcheck_get_step_id(struct server *s)
32
+ static void tcpcheck_main(struct connection *conn)
33
+ {
34
+ 	char *contentptr;
35
+-	struct list *head = NULL;
36
+ 	struct tcpcheck_rule *cur = NULL;
37
+ 	int done = 0, ret = 0;
38
+-
39
+ 	struct check *check = conn->owner;
40
+ 	struct server *s = check->server;
41
+ 	struct task *t = check->task;
42
++	struct list *head = &s->proxy->tcpcheck_rules;
43
+ 
44
+-	/*
45
+-	 * don't do anything until the connection is established but if we're running
46
+-	 * first step which must be a connect
47
++	/* here, we know that the check is complete or that it failed */
48
++	if (check->result != CHK_RES_UNKNOWN)
49
++		goto out_end_tcpcheck;
50
++
51
++	/* We have 4 possibilities here :
52
++	 *   1. we've not yet attempted step 1, and step 1 is a connect, so no
53
++	 *      connection attempt was made yet ;
54
++	 *   2. we've not yet attempted step 1, and step 1 is a not connect or
55
++	 *      does not exist (no rule), so a connection attempt was made
56
++	 *      before coming here.
57
++	 *   3. we're coming back after having started with step 1, so we may
58
++	 *      be waiting for a connection attempt to complete.
59
++	 *   4. the connection + handshake are complete
60
++	 *
61
++	 * #2 and #3 are quite similar, we want both the connection and the
62
++	 * handshake to complete before going any further. Thus we must always
63
++	 * wait for a connection to complete unless we're before and existing
64
++	 * step 1.
65
+ 	 */
66
+-	if (check->current_step && (!(conn->flags & CO_FL_CONNECTED))) {
67
+-		/* update expire time, should be done by process_chk */
68
++	if ((!(conn->flags & CO_FL_CONNECTED) || (conn->flags & CO_FL_HANDSHAKE)) &&
69
++	    (check->current_step || LIST_ISEMPTY(head))) {
70
+ 		/* we allow up to min(inter, timeout.connect) for a connection
71
+ 		 * to establish but only when timeout.check is set
72
+ 		 * as it may be to short for a full check otherwise
73
+@@ -1867,12 +1881,11 @@ static void tcpcheck_main(struct connection *conn)
74
+ 		return;
75
+ 	}
76
+ 
77
+-	/* here, we know that the connection is established */
78
+-	if (check->result != CHK_RES_UNKNOWN)
79
++	/* special case: option tcp-check with no rule, a connect is enough */
80
++	if (LIST_ISEMPTY(head)) {
81
++		set_server_check_status(check, HCHK_STATUS_L4OK, NULL);
82
+ 		goto out_end_tcpcheck;
83
+-
84
+-	/* head is be the first element of the double chained list */
85
+-	head = &s->proxy->tcpcheck_rules;
86
++	}
87
+ 
88
+ 	/* no step means first step
89
+ 	 * initialisation */
90
+@@ -1891,9 +1904,6 @@ static void tcpcheck_main(struct connection *conn)
91
+ 		cur = check->current_step;
92
+ 	}
93
+ 
94
+-	if (conn->flags & CO_FL_HANDSHAKE)
95
+-		return;
96
+-
97
+ 	/* It's only the rules which will enable send/recv */
98
+ 	__conn_data_stop_both(conn);
99
+ 
100
+-- 
101
+2.0.4
102
+

+ 111
- 0
net/haproxy/patches/0019-BUG-MINOR-tcp-check-report-the-correct-failed-step-i.patch Ver arquivo

@@ -0,0 +1,111 @@
1
+From 90055f28a7a0c86cfb37ccb23a548a1da7229551 Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 2 Oct 2014 14:51:02 +0200
4
+Subject: [PATCH 19/20] BUG/MINOR: tcp-check: report the correct failed step in
5
+ the status
6
+
7
+The step number was reported by checking only last_started_step, which
8
+was not set in case of error during the initial connection phase, and
9
+caused "step 1" to be returned with an invalid check type (typically
10
+SEND). So now we first verify that a test was started before returning
11
+this.
12
+
13
+In addition to this, the indication of the test type was taken from
14
+current_step instead of last_started_step, so the error description
15
+was matching the next action instead of the one reported in the step
16
+ID. Thus we could get the confusing "step 1 (send)" report below :
17
+
18
+      tcp-check connect
19
+      tcp-check send foo
20
+
21
+In order to ease debugging, when the port number is known for a connect,
22
+it is indicated in the error report.
23
+
24
+Note that this only affects asynchronous error messages, synchronous ones
25
+are correct.
26
+
27
+This fix must be backported to 1.5.
28
+(cherry picked from commit 213c6785614d0228d7e96e982e5189e1d0777059)
29
+---
30
+ src/checks.c | 43 ++++++++++++++++++++++++++++---------------
31
+ 1 file changed, 28 insertions(+), 15 deletions(-)
32
+
33
+diff --git a/src/checks.c b/src/checks.c
34
+index 9c1a866..5318f35 100644
35
+--- a/src/checks.c
36
++++ b/src/checks.c
37
+@@ -580,6 +580,7 @@ static void chk_report_conn_err(struct connection *conn, int errno_bck, int expi
38
+ 	struct check *check = conn->owner;
39
+ 	const char *err_msg;
40
+ 	struct chunk *chk;
41
++	int step;
42
+ 
43
+ 	if (check->result != CHK_RES_UNKNOWN)
44
+ 		return;
45
+@@ -599,19 +600,27 @@ static void chk_report_conn_err(struct connection *conn, int errno_bck, int expi
46
+ 	chk = get_trash_chunk();
47
+ 
48
+ 	if (check->type == PR_O2_TCPCHK_CHK) {
49
+-		chunk_printf(chk, " at step %d of tcp-check", tcpcheck_get_step_id(check->server));
50
+-		/* we were looking for a string */
51
+-		if (check->current_step && check->current_step->action == TCPCHK_ACT_CONNECT) {
52
+-			chunk_appendf(chk, " (connect)");
53
+-		}
54
+-		else if (check->current_step && check->current_step->action == TCPCHK_ACT_EXPECT) {
55
+-			if (check->current_step->string)
56
+-				chunk_appendf(chk, " (string '%s')", check->current_step->string);
57
+-			else if (check->current_step->expect_regex)
58
+-				chunk_appendf(chk, " (expect regex)");
59
+-		}
60
+-		else if (check->current_step && check->current_step->action == TCPCHK_ACT_SEND) {
61
+-			chunk_appendf(chk, " (send)");
62
++		step = tcpcheck_get_step_id(check->server);
63
++		if (!step)
64
++			chunk_printf(chk, " at initial connection step of tcp-check");
65
++		else {
66
++			chunk_printf(chk, " at step %d of tcp-check", step);
67
++			/* we were looking for a string */
68
++			if (check->last_started_step && check->last_started_step->action == TCPCHK_ACT_CONNECT) {
69
++				if (check->last_started_step->port)
70
++					chunk_appendf(chk, " (connect port %d)" ,check->last_started_step->port);
71
++				else
72
++					chunk_appendf(chk, " (connect)");
73
++			}
74
++			else if (check->last_started_step && check->last_started_step->action == TCPCHK_ACT_EXPECT) {
75
++				if (check->last_started_step->string)
76
++					chunk_appendf(chk, " (string '%s')", check->last_started_step->string);
77
++				else if (check->last_started_step->expect_regex)
78
++					chunk_appendf(chk, " (expect regex)");
79
++			}
80
++			else if (check->last_started_step && check->last_started_step->action == TCPCHK_ACT_SEND) {
81
++				chunk_appendf(chk, " (send)");
82
++			}
83
+ 		}
84
+ 	}
85
+ 
86
+@@ -1818,6 +1827,10 @@ static int tcpcheck_get_step_id(struct server *s)
87
+ 	struct tcpcheck_rule *cur = NULL, *next = NULL;
88
+ 	int i = 0;
89
+ 
90
++	/* not even started anything yet => step 0 = initial connect */
91
++	if (!s->check.current_step)
92
++		return 0;
93
++
94
+ 	cur = s->check.last_started_step;
95
+ 
96
+ 	/* no step => first step */
97
+@@ -1887,9 +1900,9 @@ static void tcpcheck_main(struct connection *conn)
98
+ 		goto out_end_tcpcheck;
99
+ 	}
100
+ 
101
+-	/* no step means first step
102
+-	 * initialisation */
103
++	/* no step means first step initialisation */
104
+ 	if (check->current_step == NULL) {
105
++		check->last_started_step = NULL;
106
+ 		check->bo->p = check->bo->data;
107
+ 		check->bo->o = 0;
108
+ 		check->bi->p = check->bi->data;
109
+-- 
110
+2.0.4
111
+

+ 34
- 0
net/haproxy/patches/0020-BUG-MINOR-config-don-t-propagate-process-binding-for.patch Ver arquivo

@@ -0,0 +1,34 @@
1
+From c8d57dec6173430bd5602bb76efff302c51e7803 Mon Sep 17 00:00:00 2001
2
+From: =?UTF-8?q?Cyril=20Bont=C3=A9?= <cyril.bonte@free.fr>
3
+Date: Thu, 2 Oct 2014 19:56:25 +0200
4
+Subject: [PATCH 20/20] BUG/MINOR: config: don't propagate process binding for
5
+ dynamic use_backend
6
+
7
+A segfault was reported with the introduction of the propagate_processes()
8
+function. It was caused when a use_backend rule was declared with a dynamic
9
+name, using a log-format string. The backend is not resolved during the
10
+configuration, which lead to the segfault.
11
+
12
+The patch prevents the process binding propagation for such dynamic rules, it
13
+should also be backported to 1.5.
14
+(cherry picked from commit 51639696e0a112ea3612e905a5722ad912b3869f)
15
+---
16
+ src/cfgparse.c | 2 ++
17
+ 1 file changed, 2 insertions(+)
18
+
19
+diff --git a/src/cfgparse.c b/src/cfgparse.c
20
+index 6e962c8..ec6d923 100644
21
+--- a/src/cfgparse.c
22
++++ b/src/cfgparse.c
23
+@@ -6015,6 +6015,8 @@ void propagate_processes(struct proxy *from, struct proxy *to)
24
+ 
25
+ 	/* use_backend */
26
+ 	list_for_each_entry(rule, &from->switching_rules, list) {
27
++		if (rule->dynamic)
28
++			continue;
29
+ 		to = rule->be.backend;
30
+ 		propagate_processes(from, to);
31
+ 	}
32
+-- 
33
+2.0.4
34
+