ソースを参照

haproxy: fixes from upstream

 - [PATCH 22/25] DOC: minor fix on {sc,src}_kbytes_{in,out}
 - [PATCH 23/25] DOC: fix alphabetical sort of converters
 - [PATCH 24/25] BUG/MAJOR: http: correctly rewind the request body
 - [PATCH 25/25] DOC: remove references to CPU=native in the README

Signed-off-by: Thomas Heil <heil@terminal-consulting.de>
Thomas Heil 10 年 前
コミット
10d9b68c49

+ 1
- 1
net/haproxy/Makefile ファイルの表示

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
10 10
 
11 11
 PKG_NAME:=haproxy
12 12
 PKG_VERSION:=1.5.1
13
-PKG_RELEASE:=21
13
+PKG_RELEASE:=25
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_MD5SUM:=49640cf3ddd793a05fbd3394481a1ed4

+ 75
- 0
net/haproxy/patches/0022-DOC-minor-fix-on-sc-src-_kbytes_-in-out.patch ファイルの表示

@@ -0,0 +1,75 @@
1
+From 911780c5f0e20760164cb0f9b92318185651237c Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 10 Jul 2014 15:29:24 +0200
4
+Subject: [PATCH 22/25] DOC: minor fix on {sc,src}_kbytes_{in,out}
5
+
6
+These ones report total amount of bytes, not byte rates.
7
+This fix should be backported into 1.5 which has the same error.
8
+(cherry picked from commit a01b974d5f5a067d99f288dcb3e05b78fe780a76)
9
+---
10
+ doc/configuration.txt | 35 ++++++++++++++++-------------------
11
+ 1 file changed, 16 insertions(+), 19 deletions(-)
12
+
13
+diff --git a/doc/configuration.txt b/doc/configuration.txt
14
+index 8407500..b6d1b3b 100644
15
+--- a/doc/configuration.txt
16
++++ b/doc/configuration.txt
17
+@@ -10386,19 +10386,17 @@ sc_kbytes_in(<ctr>[,<table>]) : integer
18
+ sc0_kbytes_in([<table>]) : integer
19
+ sc1_kbytes_in([<table>]) : integer
20
+ sc2_kbytes_in([<table>]) : integer
21
+-  Returns the amount of client-to-server data from the currently tracked
22
+-  counters, measured in kilobytes over the period configured in the table. The
23
+-  test is currently performed on 32-bit integers, which limits values to 4
24
+-  terabytes. See also src_kbytes_in.
25
++  Returns the total amount of client-to-server data from the currently tracked
26
++  counters, measured in kilobytes. The test is currently performed on 32-bit
27
++  integers, which limits values to 4 terabytes. See also src_kbytes_in.
28
+ 
29
+ sc_kbytes_out(<ctr>[,<table>]) : integer
30
+ sc0_kbytes_out([<table>]) : integer
31
+ sc1_kbytes_out([<table>]) : integer
32
+ sc2_kbytes_out([<table>]) : integer
33
+-  Returns the amount of server-to-client data from the currently tracked
34
+-  counters, measured in kilobytes over the period configured in the table. The
35
+-  test is currently performed on 32-bit integers, which limits values to 4
36
+-  terabytes. See also src_kbytes_out.
37
++  Returns the total amount of server-to-client data from the currently tracked
38
++  counters, measured in kilobytes. The test is currently performed on 32-bit
39
++  integers, which limits values to 4 terabytes. See also src_kbytes_out.
40
+ 
41
+ sc_sess_cnt(<ctr>[,<table>]) : integer
42
+ sc0_sess_cnt([<table>]) : integer
43
+@@ -10562,19 +10560,18 @@ src_inc_gpc0([<table>]) : integer
44
+         tcp-request connection reject if abuse kill
45
+ 
46
+ src_kbytes_in([<table>]) : integer
47
+-  Returns the amount of data received from the incoming connection's source
48
+-  address in the current proxy's stick-table or in the designated stick-table,
49
+-  measured in kilobytes over the period configured in the table. If the address
50
+-  is not found, zero is returned. The test is currently performed on 32-bit
51
+-  integers, which limits values to 4 terabytes. See also
52
+-  sc/sc0/sc1/sc2_kbytes_in.
53
++  Returns the total amount of data received from the incoming connection's
54
++  source address in the current proxy's stick-table or in the designated
55
++  stick-table, measured in kilobytes. If the address is not found, zero is
56
++  returned. The test is currently performed on 32-bit integers, which limits
57
++  values to 4 terabytes. See also sc/sc0/sc1/sc2_kbytes_in.
58
+ 
59
+ src_kbytes_out([<table>]) : integer
60
+-  Returns the amount of data sent to the incoming connection's source address
61
+-  in the current proxy's stick-table or in the designated stick-table, measured
62
+-  in kilobytes over the period configured in the table. If the address is not
63
+-  found, zero is returned. The test is currently performed on 32-bit integers,
64
+-  which limits values to 4 terabytes. See also sc/sc0/sc1/sc2_kbytes_out.
65
++  Returns the total amount of data sent to the incoming connection's source
66
++  address in the current proxy's stick-table or in the designated stick-table,
67
++  measured in kilobytes. If the address is not found, zero is returned. The
68
++  test is currently performed on 32-bit integers, which limits values to 4
69
++  terabytes. See also sc/sc0/sc1/sc2_kbytes_out.
70
+ 
71
+ src_port : integer
72
+   Returns an integer value corresponding to the TCP source port of the
73
+-- 
74
+1.8.5.5
75
+

+ 84
- 0
net/haproxy/patches/0023-DOC-fix-alphabetical-sort-of-converters.patch ファイルの表示

@@ -0,0 +1,84 @@
1
+From 644d9ef5af4f8010412007374c345f7465c97391 Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 10 Jul 2014 16:29:08 +0200
4
+Subject: [PATCH 23/25] DOC: fix alphabetical sort of converters
5
+
6
+For an unknown reason, these ones were not sorted.
7
+(cherry picked from commit ffcb2e4b42acd710121a57eb39651a373d904e5b)
8
+---
9
+ doc/configuration.txt | 32 ++++++++++++++++----------------
10
+ 1 file changed, 16 insertions(+), 16 deletions(-)
11
+
12
+diff --git a/doc/configuration.txt b/doc/configuration.txt
13
+index b6d1b3b..f8199b9 100644
14
+--- a/doc/configuration.txt
15
++++ b/doc/configuration.txt
16
+@@ -9887,28 +9887,12 @@ base64
17
+   transfer binary content in a way that can be reliably transferred (eg:
18
+   an SSL ID can be copied in a header).
19
+ 
20
+-lower
21
+-  Convert a string sample to lower case. This can only be placed after a string
22
+-  sample fetch function or after a transformation keyword returning a string
23
+-  type. The result is of type string.
24
+-
25
+-upper
26
+-  Convert a string sample to upper case. This can only be placed after a string
27
+-  sample fetch function or after a transformation keyword returning a string
28
+-  type. The result is of type string.
29
+-
30
+ hex
31
+   Converts a binary input sample to an hex string containing two hex digits per
32
+   input byte. It is used to log or transfer hex dumps of some binary input data
33
+   in a way that can be reliably transferred (eg: an SSL ID can be copied in a
34
+   header).
35
+ 
36
+-ipmask(<mask>)
37
+-  Apply a mask to an IPv4 address, and use the result for lookups and storage.
38
+-  This can be used to make all hosts within a certain mask to share the same
39
+-  table entries and as such use the same server. The mask can be passed in
40
+-  dotted form (eg: 255.255.255.0) or in CIDR form (eg: 24).
41
+-
42
+ http_date([<offset>])
43
+   Converts an integer supposed to contain a date since epoch to a string
44
+   representing this date in a format suitable for use in HTTP header fields. If
45
+@@ -9917,6 +9901,12 @@ http_date([<offset>])
46
+   emit Date header fields, Expires values in responses when combined with a
47
+   positive offset, or Last-Modified values when the offset is negative.
48
+ 
49
++ipmask(<mask>)
50
++  Apply a mask to an IPv4 address, and use the result for lookups and storage.
51
++  This can be used to make all hosts within a certain mask to share the same
52
++  table entries and as such use the same server. The mask can be passed in
53
++  dotted form (eg: 255.255.255.0) or in CIDR form (eg: 24).
54
++
55
+ language(<value>[,<default>])
56
+   Returns the value with the highest q-factor from a list as extracted from the
57
+   "accept-language" header using "req.fhdr". Values with no q-factor have a
58
+@@ -9944,6 +9934,11 @@ language(<value>[,<default>])
59
+     use_backend english if en
60
+     default_backend choose_your_language
61
+ 
62
++lower
63
++  Convert a string sample to lower case. This can only be placed after a string
64
++  sample fetch function or after a transformation keyword returning a string
65
++  type. The result is of type string.
66
++
67
+ map(<map_file>[,<default_value>])
68
+ map_<match_type>(<map_file>[,<default_value>])
69
+ map_<match_type>_<output_type>(<map_file>[,<default_value>])
70
+@@ -10001,6 +9996,11 @@ map_<match_type>_<output_type>(<map_file>[,<default_value>])
71
+       |       `---------------------------- key
72
+       `------------------------------------ leading spaces ignored
73
+ 
74
++upper
75
++  Convert a string sample to upper case. This can only be placed after a string
76
++  sample fetch function or after a transformation keyword returning a string
77
++  type. The result is of type string.
78
++
79
+ 
80
+ 7.3.2. Fetching samples from internal states
81
+ --------------------------------------------
82
+-- 
83
+1.8.5.5
84
+

+ 167
- 0
net/haproxy/patches/0024-BUG-MAJOR-http-correctly-rewind-the-request-body-aft.patch ファイルの表示

@@ -0,0 +1,167 @@
1
+From 5bebcd06287be9024f0fba25f350393f02e050c1 Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 10 Jul 2014 19:06:10 +0200
4
+Subject: [PATCH 24/25] BUG/MAJOR: http: correctly rewind the request body
5
+ after start of forwarding
6
+
7
+Daniel Dubovik reported an interesting bug showing that the request body
8
+processing was still not 100% fixed. If a POST request contained short
9
+enough data to be forwarded at once before trying to establish the
10
+connection to the server, we had no way to correctly rewind the body.
11
+
12
+The first visible case is that balancing on a header does not always work
13
+on such POST requests since the header cannot be found. But there are even
14
+nastier implications which are that http-send-name-header would apply to
15
+the wrong location and possibly even affect part of the request's body
16
+due to an incorrect rewinding.
17
+
18
+There are two options to fix the problem :
19
+  - first one is to force the HTTP_MSG_F_WAIT_CONN flag on all hash-based
20
+    balancing algorithms and http-send-name-header, but there's always a
21
+    risk that any new algorithm forgets to set it ;
22
+
23
+  - the second option is to account for the amount of skipped data before
24
+    the connection establishes so that we always know the position of the
25
+    request's body relative to the buffer's origin.
26
+
27
+The second option is much more reliable and fits very well in the spirit
28
+of the past changes to fix forwarding. Indeed, at the moment we have
29
+msg->sov which points to the start of the body before headers are forwarded
30
+and which equals zero afterwards (so it still points to the start of the
31
+body before forwarding data). A minor change consists in always making it
32
+point to the start of the body even after data have been forwarded. It means
33
+that it can get a negative value (so we need to change its type to signed)..
34
+
35
+In order to avoid wrapping, we only do this as long as the other side of
36
+the buffer is not connected yet.
37
+
38
+Doing this definitely fixes the issues above for the requests. Since the
39
+response cannot be rewound we don't need to perform any change there.
40
+
41
+This bug was introduced/remained unfixed in 1.5-dev23 so the fix must be
42
+backported to 1.5.
43
+(cherry picked from commit bb2e669f9e73531ac9cc9277b40066b701eec918)
44
+---
45
+ doc/internals/body-parsing.txt | 20 +++++++++++++-------
46
+ include/types/proto_http.h     | 11 ++++++-----
47
+ src/proto_http.c               |  9 +++++++--
48
+ 3 files changed, 26 insertions(+), 14 deletions(-)
49
+
50
+diff --git a/doc/internals/body-parsing.txt b/doc/internals/body-parsing.txt
51
+index e9c8b4b..5baa549 100644
52
+--- a/doc/internals/body-parsing.txt
53
++++ b/doc/internals/body-parsing.txt
54
+@@ -67,12 +67,17 @@ msg.next : points to the next byte to inspect. This offset is automatically
55
+            automatically adjusted to the number of bytes already inspected.
56
+ 
57
+ msg.sov  : start of value. First character of the header's value in the header
58
+-           states, start of the body in the data states until headers are
59
+-           forwarded. This offset is automatically adjusted when inserting or
60
+-           removing some headers. In data states, it always constains the size
61
+-           of the whole HTTP headers (including the trailing CRLF) that needs
62
+-           to be forwarded before the first byte of body. Once the headers are
63
+-           forwarded, this value drops to zero.
64
++           states, start of the body in the data states. Strictly positive
65
++           values indicate that headers were not forwarded yet (<buf.p> is
66
++           before the start of the body), and null or positive values are seen
67
++           after headers are forwarded (<buf.p> is at or past the start of the
68
++           body). The value stops changing when data start to leave the buffer
69
++           (in order to avoid integer overflows). So the maximum possible range
70
++           is -<buf.size> to +<buf.size>. This offset is automatically adjusted
71
++           when inserting or removing some headers. It is useful to rewind the
72
++           request buffer to the beginning of the body at any phase. The
73
++           response buffer does not really use it since it is immediately
74
++           forwarded to the client.
75
+ 
76
+ msg.sol  : start of line. Points to the beginning of the current header line
77
+            while parsing headers. It is cleared to zero in the BODY state,
78
+@@ -97,7 +102,8 @@ msg.eol  : end of line. Points to the CRLF or LF of the current header line
79
+            states nor by forwarding.
80
+ 
81
+ The beginning of the message headers can always be found this way even after
82
+-headers have been forwarded :
83
++headers or data have been forwarded, provided that everything is still present
84
++in the buffer :
85
+ 
86
+             headers = buf.p + msg->sov - msg->eoh - msg->eol
87
+ 
88
+diff --git a/include/types/proto_http.h b/include/types/proto_http.h
89
+index 12e1141..c53c7fd 100644
90
+--- a/include/types/proto_http.h
91
++++ b/include/types/proto_http.h
92
+@@ -329,7 +329,8 @@ enum {
93
+  * message or a response message.
94
+  *
95
+  * The values there are a little bit obscure, because their meaning can change
96
+- * during the parsing :
97
++ * during the parsing. Please read carefully doc/internal/body-parsing.txt if
98
++ * you need to manipulate them. Quick reminder :
99
+  *
100
+  *  - eoh (End of Headers)   : relative offset in the buffer of first byte that
101
+  *                             is not part of a completely processed header.
102
+@@ -344,9 +345,9 @@ enum {
103
+  *  - sov (start of value)   : Before HTTP_MSG_BODY, points to the value of
104
+  *                             the header being parsed. Starting from
105
+  *                             HTTP_MSG_BODY, will point to the start of the
106
+- *                             body (relative to buffer's origin), or to data
107
+- *                             following a chunk size. Thus <sov> bytes of
108
+- *                             headers will have to be sent only once.
109
++ *                             body (relative to buffer's origin). It can be
110
++ *                             negative when forwarding data. It stops growing
111
++ *                             once data start to leave the buffer.
112
+  *
113
+  *  - next (parse pointer)   : next relative byte to be parsed. Always points
114
+  *                             to a byte matching the current state.
115
+@@ -372,7 +373,7 @@ struct http_msg {
116
+ 	/* 6 bytes unused here */
117
+ 	struct channel *chn;                   /* pointer to the channel transporting the message */
118
+ 	unsigned int next;                     /* pointer to next byte to parse, relative to buf->p */
119
+-	unsigned int sov;                      /* current header: start of value */
120
++	int sov;                               /* current header: start of value ; data: start of body */
121
+ 	unsigned int eoh;                      /* End Of Headers, relative to buffer */
122
+ 	unsigned int sol;                      /* start of current line during parsing otherwise zero */
123
+ 	unsigned int eol;                      /* end of line */
124
+diff --git a/src/proto_http.c b/src/proto_http.c
125
+index 4a862b0..94afed7 100644
126
+--- a/src/proto_http.c
127
++++ b/src/proto_http.c
128
+@@ -5315,7 +5315,7 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit
129
+ 	 * an "Expect: 100-continue" header.
130
+ 	 */
131
+ 
132
+-	if (msg->sov) {
133
++	if (msg->sov > 0) {
134
+ 		/* we have msg->sov which points to the first byte of message
135
+ 		 * body, and req->buf.p still points to the beginning of the
136
+ 		 * message. We forward the headers now, as we don't need them
137
+@@ -5429,6 +5429,8 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit
138
+ 			 * such as last chunk of data or trailers.
139
+ 			 */
140
+ 			b_adv(req->buf, msg->next);
141
++			if (unlikely(!(s->rep->flags & CF_READ_ATTACHED)))
142
++				msg->sov -= msg->next;
143
+ 			msg->next = 0;
144
+ 
145
+ 			/* for keep-alive we don't want to forward closes on DONE */
146
+@@ -5479,6 +5481,9 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit
147
+  missing_data:
148
+ 	/* we may have some pending data starting at req->buf->p */
149
+ 	b_adv(req->buf, msg->next);
150
++	if (unlikely(!(s->rep->flags & CF_READ_ATTACHED)))
151
++		msg->sov -= msg->next + MIN(msg->chunk_len, req->buf->i);
152
++
153
+ 	msg->next = 0;
154
+ 	msg->chunk_len -= channel_forward(req, msg->chunk_len);
155
+ 
156
+@@ -6493,7 +6498,7 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi
157
+ 	/* in most states, we should abort in case of early close */
158
+ 	channel_auto_close(res);
159
+ 
160
+-	if (msg->sov) {
161
++	if (msg->sov > 0) {
162
+ 		/* we have msg->sov which points to the first byte of message
163
+ 		 * body, and res->buf.p still points to the beginning of the
164
+ 		 * message. We forward the headers now, as we don't need them
165
+-- 
166
+1.8.5.5
167
+

+ 48
- 0
net/haproxy/patches/0025-DOC-remove-references-to-CPU-native-in-the-README.patch ファイルの表示

@@ -0,0 +1,48 @@
1
+From 94fb38fbb77e664e4f41343257a26ae5bab40d1d Mon Sep 17 00:00:00 2001
2
+From: Willy Tarreau <w@1wt.eu>
3
+Date: Thu, 10 Jul 2014 20:24:25 +0200
4
+Subject: [PATCH 25/25] DOC: remove references to CPU=native in the README
5
+
6
+Certain compilers running in virtualized environments may produce code
7
+that the same processor cannot execute with -march=native, either because
8
+of hypervisor bugs reporting wrong CPU features, or because of compiler
9
+bugs forgetting to check CPU features. So better stop recommending this
10
+combination so that users don't get trapped anymore.
11
+(cherry picked from commit 817dad50b02d1a82d495dfea4eab9e3a91127391)
12
+---
13
+ README | 9 +++++----
14
+ 1 file changed, 5 insertions(+), 4 deletions(-)
15
+
16
+diff --git a/README b/README
17
+index 0ef0179..e2b8570 100644
18
+--- a/README
19
++++ b/README
20
+@@ -53,8 +53,9 @@ one of the following choices to the CPU variable :
21
+   - i686 for intel PentiumPro, Pentium 2 and above, AMD Athlon
22
+   - i586 for intel Pentium, AMD K6, VIA C3.
23
+   - ultrasparc : Sun UltraSparc I/II/III/IV processor
24
+-  - native : use the build machine's specific processor optimizations
25
+-  - generic : any other processor or no specific optimization. (default)
26
++  - native : use the build machine's specific processor optimizations. Use with
27
++    extreme care, and never in virtualized environments (known to break).
28
++  - generic : any other processor or no CPU-specific optimization. (default)
29
+ 
30
+ Alternatively, you may just set the CPU_CFLAGS value to the optimal GCC options
31
+ for your platform.
32
+@@ -132,11 +133,11 @@ And I build it this way on OpenBSD or FreeBSD :
33
+ 
34
+ And on a classic Linux with SSL and ZLIB support (eg: Red Hat 5.x) :
35
+ 
36
+-    $ make TARGET=linux26 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
37
++    $ make TARGET=linux26 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
38
+ 
39
+ And on a recent Linux >= 2.6.28 with SSL and ZLIB support :
40
+ 
41
+-    $ make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
42
++    $ make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1
43
+ 
44
+ In order to build a 32-bit binary on an x86_64 Linux system with SSL support
45
+ without support for compression but when OpenSSL requires ZLIB anyway :
46
+-- 
47
+1.8.5.5
48
+