Merge ~ahasenack/ubuntu/+source/haproxy:jammy-haproxy-2414-merge into ubuntu/+source/haproxy:ubuntu/devel
- Git
- lp:~ahasenack/ubuntu/+source/haproxy
- jammy-haproxy-2414-merge
- Merge into ubuntu/devel
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | ~ahasenack/ubuntu/+source/haproxy:jammy-haproxy-2414-merge | ||||
Merge into: | ubuntu/+source/haproxy:ubuntu/devel | ||||
Diff against target: |
1115 lines (+309/-157) (has conflicts) 31 files modified
.github/matrix.py (+3/-0) .github/workflows/compliance.yml (+1/-1) .github/workflows/vtest.yml (+1/-1) .github/workflows/windows.yml (+1/-1) CHANGELOG (+28/-0) SUBVERS (+1/-1) VERDATE (+2/-2) VERSION (+1/-1) debian/changelog (+22/-0) doc/configuration.txt (+1/-1) include/haproxy/compiler.h (+25/-0) include/haproxy/htx.h (+2/-2) include/haproxy/mworker.h (+1/-0) include/haproxy/server-t.h (+4/-4) include/haproxy/sock-t.h (+0/-17) include/haproxy/sock.h (+1/-2) reg-tests/checks/40be_2srv_odd_health_checks.vtc (+91/-84) scripts/build-ssl.sh (+11/-4) src/fd.c (+7/-3) src/haproxy.c (+5/-8) src/mailers.c (+1/-1) src/mux_h1.c (+1/-1) src/mux_h2.c (+1/-1) src/mworker.c (+30/-0) src/proxy.c (+1/-1) src/resolvers.c (+1/-3) src/sink.c (+1/-1) src/sock.c (+35/-1) src/ssl_sock.c (+2/-2) src/stream.c (+16/-12) src/tools.c (+12/-2) Conflict in debian/changelog |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Server | Pending | ||
Canonical Server Core Reviewers | Pending | ||
Review via email: mp+416139@code.launchpad.net |
This proposal has been superseded by a proposal from 2022-02-28.
Commit message
Description of the change
New upstream release.
The upstream changelog[1] only mentions bugfixes and CI changes, so I think this does not need a feature freeze exception.
With this new upstream release, we are able to drop one of the delta bits we have, which was openssl3 compatibility.
PPA: https:/
Unmerged commits
- 7c8df16... by Andreas Hasenack
-
update-maintainer
- 5b165d6... by Andreas Hasenack
-
reconstruct-
changelog - a36d43f... by Andreas Hasenack
-
merge-changelogs
- 2eb4322... by Andreas Hasenack
-
* Dropped:
- d/p/fix-ftbfs-openssl3. patch: Cherry-picked from upstream to fix
the build against OpenSSL3 (LP: #1945773)
[Fixed upstream] - cc5fa1b... by Miriam EspaƱa Acebal
-
- d/{control,rules}: Removing support for OpenTracing due to it is
in universe. - 233891c... by Vincent Bernat
-
2.4.14-1 (patches unapplied)
Imported using git-ubuntu import.
Preview Diff
1 | diff --git a/.github/matrix.py b/.github/matrix.py | |||
2 | index 9900314..116ea98 100644 | |||
3 | --- a/.github/matrix.py | |||
4 | +++ b/.github/matrix.py | |||
5 | @@ -104,6 +104,7 @@ for CC in ["gcc", "clang"]: | |||
6 | 104 | for ssl in [ | 104 | for ssl in [ |
7 | 105 | "stock", | 105 | "stock", |
8 | 106 | "OPENSSL_VERSION=1.0.2u", | 106 | "OPENSSL_VERSION=1.0.2u", |
9 | 107 | "OPENSSL_VERSION=3.0.1", | ||
10 | 107 | "LIBRESSL_VERSION=2.9.2", | 108 | "LIBRESSL_VERSION=2.9.2", |
11 | 108 | "LIBRESSL_VERSION=3.3.3", | 109 | "LIBRESSL_VERSION=3.3.3", |
12 | 109 | # "BORINGSSL=yes", | 110 | # "BORINGSSL=yes", |
13 | @@ -111,6 +112,8 @@ for CC in ["gcc", "clang"]: | |||
14 | 111 | flags = ["USE_OPENSSL=1"] | 112 | flags = ["USE_OPENSSL=1"] |
15 | 112 | if ssl == "BORINGSSL=yes": | 113 | if ssl == "BORINGSSL=yes": |
16 | 113 | flags.append("USE_QUIC=1") | 114 | flags.append("USE_QUIC=1") |
17 | 115 | if "OPENSSL_VERSION=3.0." in ssl: | ||
18 | 116 | flags.append('DEBUG_CFLAGS="-g -Wno-deprecated-declarations"') | ||
19 | 114 | if ssl != "stock": | 117 | if ssl != "stock": |
20 | 115 | flags.append("SSL_LIB=${HOME}/opt/lib") | 118 | flags.append("SSL_LIB=${HOME}/opt/lib") |
21 | 116 | flags.append("SSL_INC=${HOME}/opt/include") | 119 | flags.append("SSL_INC=${HOME}/opt/include") |
22 | diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml | |||
23 | index 9f2bec2..4696c06 100644 | |||
24 | --- a/.github/workflows/compliance.yml | |||
25 | +++ b/.github/workflows/compliance.yml | |||
26 | @@ -30,7 +30,7 @@ jobs: | |||
27 | 30 | ERR=1 \ | 30 | ERR=1 \ |
28 | 31 | TARGET=${{ matrix.TARGET }} \ | 31 | TARGET=${{ matrix.TARGET }} \ |
29 | 32 | CC=${{ matrix.CC }} \ | 32 | CC=${{ matrix.CC }} \ |
31 | 33 | DEBUG=-DDEBUG_STRICT=1 \ | 33 | DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \ |
32 | 34 | USE_OPENSSL=1 | 34 | USE_OPENSSL=1 |
33 | 35 | sudo make install | 35 | sudo make install |
34 | 36 | - name: Show HAProxy version | 36 | - name: Show HAProxy version |
35 | diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml | |||
36 | index cb52f27..8e64995 100644 | |||
37 | --- a/.github/workflows/vtest.yml | |||
38 | +++ b/.github/workflows/vtest.yml | |||
39 | @@ -77,7 +77,7 @@ jobs: | |||
40 | 77 | ERR=1 \ | 77 | ERR=1 \ |
41 | 78 | TARGET=${{ matrix.TARGET }} \ | 78 | TARGET=${{ matrix.TARGET }} \ |
42 | 79 | CC=${{ matrix.CC }} \ | 79 | CC=${{ matrix.CC }} \ |
44 | 80 | DEBUG=-DDEBUG_STRICT=1 \ | 80 | DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \ |
45 | 81 | ${{ join(matrix.FLAGS, ' ') }} \ | 81 | ${{ join(matrix.FLAGS, ' ') }} \ |
46 | 82 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" | 82 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" |
47 | 83 | sudo make install | 83 | sudo make install |
48 | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml | |||
49 | index b5a198a..0449808 100644 | |||
50 | --- a/.github/workflows/windows.yml | |||
51 | +++ b/.github/workflows/windows.yml | |||
52 | @@ -52,7 +52,7 @@ jobs: | |||
53 | 52 | ERR=1 \ | 52 | ERR=1 \ |
54 | 53 | TARGET=${{ matrix.TARGET }} \ | 53 | TARGET=${{ matrix.TARGET }} \ |
55 | 54 | CC=${{ matrix.CC }} \ | 54 | CC=${{ matrix.CC }} \ |
57 | 55 | DEBUG=-DDEBUG_STRICT=1 \ | 55 | DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \ |
58 | 56 | ${{ join(matrix.FLAGS, ' ') }} | 56 | ${{ join(matrix.FLAGS, ' ') }} |
59 | 57 | - name: Show HAProxy version | 57 | - name: Show HAProxy version |
60 | 58 | id: show-version | 58 | id: show-version |
61 | diff --git a/CHANGELOG b/CHANGELOG | |||
62 | index 163070a..341776f 100644 | |||
63 | --- a/CHANGELOG | |||
64 | +++ b/CHANGELOG | |||
65 | @@ -1,6 +1,34 @@ | |||
66 | 1 | ChangeLog : | 1 | ChangeLog : |
67 | 2 | =========== | 2 | =========== |
68 | 3 | 3 | ||
69 | 4 | 2022/02/25 : 2.4.14 | ||
70 | 5 | - MINOR: sock: move the unused socket cleaning code into its own function | ||
71 | 6 | - BUG/MEDIUM: mworker: close unused transferred FDs on load failure | ||
72 | 7 | - BUG/MINOR: mworker: fix a FD leak of a sockpair upon a failed reload | ||
73 | 8 | - BUG/MINOR: sink: Use the right field in appctx context in release callback | ||
74 | 9 | - BUG/MEDIUM: resolvers: Really ignore trailing dot in domain names | ||
75 | 10 | - BUG/MEDIUM: fd: always align fdtab[] to 64 bytes | ||
76 | 11 | - BUG/MAJOR: compiler: relax alignment constraints on certain structures | ||
77 | 12 | - CI: ssl: enable parallel builds for OpenSSL on Linux | ||
78 | 13 | - CI: ssl: do not needlessly build the OpenSSL docs | ||
79 | 14 | - CI: ssl: keep the old method for ancient OpenSSL versions | ||
80 | 15 | - BUILD: fix compilation for OpenSSL-3.0.0-alpha17 | ||
81 | 16 | - BUILD: adopt script/build-ssl.sh for OpenSSL-3.0.0beta2 | ||
82 | 17 | - CI: github actions: add OpenSSL-3.0.0 builds | ||
83 | 18 | - CI: github actions: -Wno-deprecated-declarations with OpenSSL 3.0.0 | ||
84 | 19 | - CI: github actions: relax OpenSSL-3.0.0 version comparision | ||
85 | 20 | - CI: github: switch to OpenSSL 3.0.0 | ||
86 | 21 | - CI: github actions: update OpenSSL to 3.0.1 | ||
87 | 22 | - BUG/MINOR: mailers: negotiate SMTP, not ESMTP | ||
88 | 23 | - BUG/MINOR: tools: url2sa reads ipv4 too far | ||
89 | 24 | - BUG/MEDIUM: htx: Be sure to have a buffer to perform a raw copy of a message | ||
90 | 25 | - BUG/MEDIUM: mux-h1: Don't wake h1s if mux is blocked on lack of output buffer | ||
91 | 26 | - BUG/MAJOR: mux-h2: Be sure to always report HTX parsing error to the app layer | ||
92 | 27 | - BUG/MINOR: proxy: preset the error message pointer to NULL in parse_new_proxy() | ||
93 | 28 | - REGTESTS: fix the race conditions in 40be_2srv_odd_health_checks | ||
94 | 29 | - CI: github: enable pool debugging by default | ||
95 | 30 | - BUG/MEDIUM: stream: Abort processing if response buffer allocation fails | ||
96 | 31 | |||
97 | 4 | 2022/02/16 : 2.4.13 | 32 | 2022/02/16 : 2.4.13 |
98 | 5 | - BUG/MEDIUM: connection: properly leave stopping list on error | 33 | - BUG/MEDIUM: connection: properly leave stopping list on error |
99 | 6 | - BUG/MEDIUM: htx: Adjust length to add DATA block in an empty HTX buffer | 34 | - BUG/MEDIUM: htx: Adjust length to add DATA block in an empty HTX buffer |
100 | diff --git a/SUBVERS b/SUBVERS | |||
101 | index f9dfc31..3c7b54b 100644 | |||
102 | --- a/SUBVERS | |||
103 | +++ b/SUBVERS | |||
104 | @@ -1,2 +1,2 @@ | |||
106 | 1 | -095275f | 1 | -eaa786f |
107 | 2 | 2 | ||
108 | diff --git a/VERDATE b/VERDATE | |||
109 | index 550bed4..cd15a46 100644 | |||
110 | --- a/VERDATE | |||
111 | +++ b/VERDATE | |||
112 | @@ -1,2 +1,2 @@ | |||
115 | 1 | 2022-02-16 16:29:03 +0100 | 1 | 2022-02-25 17:10:23 +0100 |
116 | 2 | 2022/02/16 | 2 | 2022/02/25 |
117 | diff --git a/VERSION b/VERSION | |||
118 | index b40e924..e5f3129 100644 | |||
119 | --- a/VERSION | |||
120 | +++ b/VERSION | |||
121 | @@ -1 +1 @@ | |||
123 | 1 | 2.4.13 | 1 | 2.4.14 |
124 | diff --git a/debian/changelog b/debian/changelog | |||
125 | index 5e4e436..edba303 100644 | |||
126 | --- a/debian/changelog | |||
127 | +++ b/debian/changelog | |||
128 | @@ -1,3 +1,25 @@ | |||
129 | 1 | <<<<<<< debian/changelog | ||
130 | 2 | ======= | ||
131 | 3 | haproxy (2.4.14-1ubuntu1) jammy; urgency=medium | ||
132 | 4 | |||
133 | 5 | * Merge with Debian unstable. Remaining changes: | ||
134 | 6 | - d/{control,rules}: Removing support for OpenTracing due to it is | ||
135 | 7 | in universe. | ||
136 | 8 | * Dropped: | ||
137 | 9 | - d/p/fix-ftbfs-openssl3.patch: Cherry-picked from upstream to fix | ||
138 | 10 | the build against OpenSSL3 (LP: #1945773) | ||
139 | 11 | [Fixed upstream] | ||
140 | 12 | |||
141 | 13 | -- Andreas Hasenack <andreas@canonical.com> Mon, 28 Feb 2022 09:48:35 -0300 | ||
142 | 14 | |||
143 | 15 | haproxy (2.4.14-1) unstable; urgency=medium | ||
144 | 16 | |||
145 | 17 | * New upstream release. | ||
146 | 18 | - Fix compilation with OpenSSL 3.0. Closes: #996423, #1006007. | ||
147 | 19 | |||
148 | 20 | -- Vincent Bernat <bernat@debian.org> Fri, 25 Feb 2022 18:38:27 +0100 | ||
149 | 21 | |||
150 | 22 | >>>>>>> debian/changelog | ||
151 | 1 | haproxy (2.4.13-1ubuntu1) jammy; urgency=medium | 23 | haproxy (2.4.13-1ubuntu1) jammy; urgency=medium |
152 | 2 | 24 | ||
153 | 3 | * Merge with Debian unstable (LP: #1961195). Remaining changes: | 25 | * Merge with Debian unstable (LP: #1961195). Remaining changes: |
154 | diff --git a/doc/configuration.txt b/doc/configuration.txt | |||
155 | index b48b8ad..03420c9 100644 | |||
156 | --- a/doc/configuration.txt | |||
157 | +++ b/doc/configuration.txt | |||
158 | @@ -4,7 +4,7 @@ | |||
159 | 4 | ---------------------- | 4 | ---------------------- |
160 | 5 | version 2.4 | 5 | version 2.4 |
161 | 6 | willy tarreau | 6 | willy tarreau |
163 | 7 | 2022/02/16 | 7 | 2022/02/25 |
164 | 8 | 8 | ||
165 | 9 | 9 | ||
166 | 10 | This document covers the configuration language as implemented in the version | 10 | This document covers the configuration language as implemented in the version |
167 | diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h | |||
168 | index 352da8e..b975412 100644 | |||
169 | --- a/include/haproxy/compiler.h | |||
170 | +++ b/include/haproxy/compiler.h | |||
171 | @@ -203,6 +203,17 @@ | |||
172 | 203 | #define HA_HAVE_CAS_DW | 203 | #define HA_HAVE_CAS_DW |
173 | 204 | #endif | 204 | #endif |
174 | 205 | 205 | ||
175 | 206 | /*********************** IMPORTANT NOTE ABOUT ALIGNMENT **********************\ | ||
176 | 207 | * Alignment works fine for variables. It also works on types and struct * | ||
177 | 208 | * members by propagating the alignment to the container struct itself, * | ||
178 | 209 | * but this requires that variables of the affected type are properly * | ||
179 | 210 | * aligned themselves. While regular variables will always abide, those * | ||
180 | 211 | * allocated using malloc() will not! Most platforms provide posix_memalign()* | ||
181 | 212 | * for this, but it's not available everywhere. As such one ought not to use * | ||
182 | 213 | * these alignment declarations inside structures that are dynamically * | ||
183 | 214 | * allocated. If the purpose is only to avoid false sharing of cache lines * | ||
184 | 215 | * for multi_threading, see THREAD_PAD() below. * | ||
185 | 216 | \*****************************************************************************/ | ||
186 | 206 | 217 | ||
187 | 207 | /* sets alignment for current field or variable */ | 218 | /* sets alignment for current field or variable */ |
188 | 208 | #ifndef ALIGNED | 219 | #ifndef ALIGNED |
189 | @@ -277,6 +288,20 @@ | |||
190 | 277 | #endif | 288 | #endif |
191 | 278 | #endif | 289 | #endif |
192 | 279 | 290 | ||
193 | 291 | /* add optional padding of the specified size between fields in a structure, | ||
194 | 292 | * only when threads are enabled. This is used to avoid false sharing of cache | ||
195 | 293 | * lines for dynamically allocated structures which cannot guarantee alignment. | ||
196 | 294 | */ | ||
197 | 295 | #ifndef THREAD_PAD | ||
198 | 296 | # ifdef USE_THREAD | ||
199 | 297 | # define __THREAD_PAD(x,l) char __pad_##l[x] | ||
200 | 298 | # define _THREAD_PAD(x,l) __THREAD_PAD(x, l) | ||
201 | 299 | # define THREAD_PAD(x) _THREAD_PAD(x, __LINE__) | ||
202 | 300 | # else | ||
203 | 301 | # define THREAD_PAD(x) | ||
204 | 302 | # endif | ||
205 | 303 | #endif | ||
206 | 304 | |||
207 | 280 | /* The THREAD_LOCAL type attribute defines thread-local storage and is defined | 305 | /* The THREAD_LOCAL type attribute defines thread-local storage and is defined |
208 | 281 | * to __thread when threads are enabled or empty when disabled. | 306 | * to __thread when threads are enabled or empty when disabled. |
209 | 282 | */ | 307 | */ |
210 | diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h | |||
211 | index ef9a1bc..ca24213 100644 | |||
212 | --- a/include/haproxy/htx.h | |||
213 | +++ b/include/haproxy/htx.h | |||
214 | @@ -749,8 +749,8 @@ static inline int htx_expect_more(const struct htx *htx) | |||
215 | 749 | */ | 749 | */ |
216 | 750 | static inline int htx_copy_msg(struct htx *htx, const struct buffer *msg) | 750 | static inline int htx_copy_msg(struct htx *htx, const struct buffer *msg) |
217 | 751 | { | 751 | { |
220 | 752 | /* The destination HTX message is empty, we can do a raw copy */ | 752 | /* The destination HTX message is allocated and empty, we can do a raw copy */ |
221 | 753 | if (htx_is_empty(htx)) { | 753 | if (htx_is_empty(htx) && htx_free_space(htx)) { |
222 | 754 | memcpy(htx, msg->area, msg->size); | 754 | memcpy(htx, msg->area, msg->size); |
223 | 755 | return 1; | 755 | return 1; |
224 | 756 | } | 756 | } |
225 | diff --git a/include/haproxy/mworker.h b/include/haproxy/mworker.h | |||
226 | index 279fb08..acabdd3 100644 | |||
227 | --- a/include/haproxy/mworker.h | |||
228 | +++ b/include/haproxy/mworker.h | |||
229 | @@ -42,5 +42,6 @@ int mworker_ext_launch_all(); | |||
230 | 42 | void mworker_kill_max_reloads(int sig); | 42 | void mworker_kill_max_reloads(int sig); |
231 | 43 | 43 | ||
232 | 44 | void mworker_free_child(struct mworker_proc *); | 44 | void mworker_free_child(struct mworker_proc *); |
233 | 45 | void mworker_cleanup_proc(); | ||
234 | 45 | 46 | ||
235 | 46 | #endif /* _HAPROXY_MWORKER_H_ */ | 47 | #endif /* _HAPROXY_MWORKER_H_ */ |
236 | diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h | |||
237 | index 200385f..8882388 100644 | |||
238 | --- a/include/haproxy/server-t.h | |||
239 | +++ b/include/haproxy/server-t.h | |||
240 | @@ -275,7 +275,7 @@ struct server { | |||
241 | 275 | /* The elements below may be changed on every single request by any | 275 | /* The elements below may be changed on every single request by any |
242 | 276 | * thread, and generally at the same time. | 276 | * thread, and generally at the same time. |
243 | 277 | */ | 277 | */ |
245 | 278 | ALWAYS_ALIGN(64); | 278 | THREAD_PAD(63); |
246 | 279 | struct eb32_node idle_node; /* When to next do cleanup in the idle connections */ | 279 | struct eb32_node idle_node; /* When to next do cleanup in the idle connections */ |
247 | 280 | unsigned int curr_idle_conns; /* Current number of orphan idling connections, both the idle and the safe lists */ | 280 | unsigned int curr_idle_conns; /* Current number of orphan idling connections, both the idle and the safe lists */ |
248 | 281 | unsigned int curr_idle_nb; /* Current number of connections in the idle list */ | 281 | unsigned int curr_idle_nb; /* Current number of connections in the idle list */ |
249 | @@ -290,14 +290,14 @@ struct server { | |||
250 | 290 | /* Element below are usd by LB algorithms and must be doable in | 290 | /* Element below are usd by LB algorithms and must be doable in |
251 | 291 | * parallel to other threads reusing connections above. | 291 | * parallel to other threads reusing connections above. |
252 | 292 | */ | 292 | */ |
254 | 293 | ALWAYS_ALIGN(64); | 293 | THREAD_PAD(63); |
255 | 294 | __decl_thread(HA_SPINLOCK_T lock); /* may enclose the proxy's lock, must not be taken under */ | 294 | __decl_thread(HA_SPINLOCK_T lock); /* may enclose the proxy's lock, must not be taken under */ |
256 | 295 | unsigned npos, lpos; /* next and last positions in the LB tree, protected by LB lock */ | 295 | unsigned npos, lpos; /* next and last positions in the LB tree, protected by LB lock */ |
257 | 296 | struct eb32_node lb_node; /* node used for tree-based load balancing */ | 296 | struct eb32_node lb_node; /* node used for tree-based load balancing */ |
258 | 297 | struct server *next_full; /* next server in the temporary full list */ | 297 | struct server *next_full; /* next server in the temporary full list */ |
259 | 298 | 298 | ||
260 | 299 | /* usually atomically updated by any thread during parsing or on end of request */ | 299 | /* usually atomically updated by any thread during parsing or on end of request */ |
262 | 300 | ALWAYS_ALIGN(64); | 300 | THREAD_PAD(63); |
263 | 301 | int cur_sess; /* number of currently active sessions (including syn_sent) */ | 301 | int cur_sess; /* number of currently active sessions (including syn_sent) */ |
264 | 302 | int served; /* # of active sessions currently being served (ie not pending) */ | 302 | int served; /* # of active sessions currently being served (ie not pending) */ |
265 | 303 | int nbpend; /* number of pending connections */ | 303 | int nbpend; /* number of pending connections */ |
266 | @@ -307,7 +307,7 @@ struct server { | |||
267 | 307 | struct be_counters counters; /* statistics counters */ | 307 | struct be_counters counters; /* statistics counters */ |
268 | 308 | 308 | ||
269 | 309 | /* Below are some relatively stable settings, only changed under the lock */ | 309 | /* Below are some relatively stable settings, only changed under the lock */ |
271 | 310 | ALWAYS_ALIGN(64); | 310 | THREAD_PAD(63); |
272 | 311 | 311 | ||
273 | 312 | struct eb_root *lb_tree; /* we want to know in what tree the server is */ | 312 | struct eb_root *lb_tree; /* we want to know in what tree the server is */ |
274 | 313 | struct tree_occ *lb_nodes; /* lb_nodes_tot * struct tree_occ */ | 313 | struct tree_occ *lb_nodes; /* lb_nodes_tot * struct tree_occ */ |
275 | diff --git a/include/haproxy/sock-t.h b/include/haproxy/sock-t.h | |||
276 | index 1a49dfa..b843d44 100644 | |||
277 | --- a/include/haproxy/sock-t.h | |||
278 | +++ b/include/haproxy/sock-t.h | |||
279 | @@ -27,23 +27,6 @@ | |||
280 | 27 | 27 | ||
281 | 28 | #include <haproxy/api-t.h> | 28 | #include <haproxy/api-t.h> |
282 | 29 | 29 | ||
283 | 30 | #define SOCK_XFER_OPT_FOREIGN 0x000000001 | ||
284 | 31 | #define SOCK_XFER_OPT_V6ONLY 0x000000002 | ||
285 | 32 | #define SOCK_XFER_OPT_DGRAM 0x000000004 | ||
286 | 33 | |||
287 | 34 | /* The list used to transfer sockets between old and new processes */ | ||
288 | 35 | struct xfer_sock_list { | ||
289 | 36 | int fd; | ||
290 | 37 | int options; /* socket options as SOCK_XFER_OPT_* */ | ||
291 | 38 | char *iface; | ||
292 | 39 | char *namespace; | ||
293 | 40 | int if_namelen; | ||
294 | 41 | int ns_namelen; | ||
295 | 42 | struct xfer_sock_list *prev; | ||
296 | 43 | struct xfer_sock_list *next; | ||
297 | 44 | struct sockaddr_storage addr; | ||
298 | 45 | }; | ||
299 | 46 | |||
300 | 47 | #endif /* _HAPROXY_SOCK_T_H */ | 30 | #endif /* _HAPROXY_SOCK_T_H */ |
301 | 48 | 31 | ||
302 | 49 | /* | 32 | /* |
303 | diff --git a/include/haproxy/sock.h b/include/haproxy/sock.h | |||
304 | index 1a5b68c..49dffa9 100644 | |||
305 | --- a/include/haproxy/sock.h | |||
306 | +++ b/include/haproxy/sock.h | |||
307 | @@ -30,8 +30,6 @@ | |||
308 | 30 | #include <haproxy/listener-t.h> | 30 | #include <haproxy/listener-t.h> |
309 | 31 | #include <haproxy/sock-t.h> | 31 | #include <haproxy/sock-t.h> |
310 | 32 | 32 | ||
311 | 33 | extern struct xfer_sock_list *xfer_sock_list; | ||
312 | 34 | |||
313 | 35 | int sock_create_server_socket(struct connection *conn); | 33 | int sock_create_server_socket(struct connection *conn); |
314 | 36 | void sock_enable(struct receiver *rx); | 34 | void sock_enable(struct receiver *rx); |
315 | 37 | void sock_disable(struct receiver *rx); | 35 | void sock_disable(struct receiver *rx); |
316 | @@ -40,6 +38,7 @@ int sock_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir); | |||
317 | 40 | int sock_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir); | 38 | int sock_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir); |
318 | 41 | int sock_get_old_sockets(const char *unixsocket); | 39 | int sock_get_old_sockets(const char *unixsocket); |
319 | 42 | int sock_find_compatible_fd(const struct receiver *rx); | 40 | int sock_find_compatible_fd(const struct receiver *rx); |
320 | 41 | void sock_drop_unused_old_sockets(); | ||
321 | 43 | int sock_accepting_conn(const struct receiver *rx); | 42 | int sock_accepting_conn(const struct receiver *rx); |
322 | 44 | struct connection *sock_accept_conn(struct listener *l, int *status); | 43 | struct connection *sock_accept_conn(struct listener *l, int *status); |
323 | 45 | void sock_accept_iocb(int fd); | 44 | void sock_accept_iocb(int fd); |
324 | diff --git a/reg-tests/checks/40be_2srv_odd_health_checks.vtc b/reg-tests/checks/40be_2srv_odd_health_checks.vtc | |||
325 | index 22f80cd..0065c9c 100644 | |||
326 | --- a/reg-tests/checks/40be_2srv_odd_health_checks.vtc | |||
327 | +++ b/reg-tests/checks/40be_2srv_odd_health_checks.vtc | |||
328 | @@ -14,6 +14,8 @@ feature ignore_unknown_macro | |||
329 | 14 | # - so that to ensure that health-checks do not consume any connection | 14 | # - so that to ensure that health-checks do not consume any connection |
330 | 15 | # (any varnishtest server without -repeat <n> with n > 1 accepts | 15 | # (any varnishtest server without -repeat <n> with n > 1 accepts |
331 | 16 | # only one connection). | 16 | # only one connection). |
332 | 17 | # - we take care of sending the clients to the unchecked servers using the | ||
333 | 18 | # "first" lb algo so that servers always receive a valid request | ||
334 | 17 | 19 | ||
335 | 18 | syslog S1 -level notice { | 20 | syslog S1 -level notice { |
336 | 19 | recv | 21 | recv |
337 | @@ -115,254 +117,254 @@ syslog S39 -level notice { | |||
338 | 115 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be39/srv39 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP" | 117 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be39/srv39 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP" |
339 | 116 | } -start | 118 | } -start |
340 | 117 | 119 | ||
363 | 118 | server s0 {} -start | 120 | server s0 { |
342 | 119 | server s2 {} -start | ||
343 | 120 | server s4 {} -start | ||
344 | 121 | server s6 {} -start | ||
345 | 122 | server s8 {} -start | ||
346 | 123 | server s10 {} -start | ||
347 | 124 | server s12 {} -start | ||
348 | 125 | server s14 {} -start | ||
349 | 126 | server s16 {} -start | ||
350 | 127 | server s18 {} -start | ||
351 | 128 | server s20 {} -start | ||
352 | 129 | server s22 {} -start | ||
353 | 130 | server s24 {} -start | ||
354 | 131 | server s26 {} -start | ||
355 | 132 | server s28 {} -start | ||
356 | 133 | server s30 {} -start | ||
357 | 134 | server s32 {} -start | ||
358 | 135 | server s34 {} -start | ||
359 | 136 | server s36 {} -start | ||
360 | 137 | server s38 {} -start | ||
361 | 138 | |||
362 | 139 | server s1 { | ||
364 | 140 | rxreq | 121 | rxreq |
365 | 141 | txresp | 122 | txresp |
366 | 142 | } -start | 123 | } -start |
367 | 143 | 124 | ||
369 | 144 | server s3 { | 125 | server s2 { |
370 | 145 | rxreq | 126 | rxreq |
371 | 146 | txresp | 127 | txresp |
372 | 147 | } -start | 128 | } -start |
373 | 148 | 129 | ||
375 | 149 | server s5 { | 130 | server s4 { |
376 | 150 | rxreq | 131 | rxreq |
377 | 151 | txresp | 132 | txresp |
378 | 152 | } -start | 133 | } -start |
379 | 153 | 134 | ||
381 | 154 | server s7 { | 135 | server s6 { |
382 | 155 | rxreq | 136 | rxreq |
383 | 156 | txresp | 137 | txresp |
384 | 157 | } -start | 138 | } -start |
385 | 158 | 139 | ||
387 | 159 | server s9 { | 140 | server s8 { |
388 | 160 | rxreq | 141 | rxreq |
389 | 161 | txresp | 142 | txresp |
390 | 162 | } -start | 143 | } -start |
391 | 163 | 144 | ||
393 | 164 | server s11 { | 145 | server s10 { |
394 | 165 | rxreq | 146 | rxreq |
395 | 166 | txresp | 147 | txresp |
396 | 167 | } -start | 148 | } -start |
397 | 168 | 149 | ||
399 | 169 | server s13 { | 150 | server s12 { |
400 | 170 | rxreq | 151 | rxreq |
401 | 171 | txresp | 152 | txresp |
402 | 172 | } -start | 153 | } -start |
403 | 173 | 154 | ||
405 | 174 | server s15 { | 155 | server s14 { |
406 | 175 | rxreq | 156 | rxreq |
407 | 176 | txresp | 157 | txresp |
408 | 177 | } -start | 158 | } -start |
409 | 178 | 159 | ||
411 | 179 | server s17 { | 160 | server s16 { |
412 | 180 | rxreq | 161 | rxreq |
413 | 181 | txresp | 162 | txresp |
414 | 182 | } -start | 163 | } -start |
415 | 183 | 164 | ||
417 | 184 | server s19 { | 165 | server s18 { |
418 | 185 | rxreq | 166 | rxreq |
419 | 186 | txresp | 167 | txresp |
420 | 187 | } -start | 168 | } -start |
421 | 188 | 169 | ||
423 | 189 | server s21 { | 170 | server s20 { |
424 | 190 | rxreq | 171 | rxreq |
425 | 191 | txresp | 172 | txresp |
426 | 192 | } -start | 173 | } -start |
427 | 193 | 174 | ||
429 | 194 | server s23 { | 175 | server s22 { |
430 | 195 | rxreq | 176 | rxreq |
431 | 196 | txresp | 177 | txresp |
432 | 197 | } -start | 178 | } -start |
433 | 198 | 179 | ||
435 | 199 | server s25 { | 180 | server s24 { |
436 | 200 | rxreq | 181 | rxreq |
438 | 201 | txresp | 182 | txresp |
439 | 202 | } -start | 183 | } -start |
440 | 203 | 184 | ||
442 | 204 | server s27 { | 185 | server s26 { |
443 | 205 | rxreq | 186 | rxreq |
444 | 206 | txresp | 187 | txresp |
445 | 207 | } -start | 188 | } -start |
446 | 208 | 189 | ||
448 | 209 | server s29 { | 190 | server s28 { |
449 | 210 | rxreq | 191 | rxreq |
450 | 211 | txresp | 192 | txresp |
451 | 212 | } -start | 193 | } -start |
452 | 213 | 194 | ||
454 | 214 | server s31 { | 195 | server s30 { |
455 | 215 | rxreq | 196 | rxreq |
456 | 216 | txresp | 197 | txresp |
457 | 217 | } -start | 198 | } -start |
458 | 218 | 199 | ||
460 | 219 | server s33 { | 200 | server s32 { |
461 | 220 | rxreq | 201 | rxreq |
462 | 221 | txresp | 202 | txresp |
463 | 222 | } -start | 203 | } -start |
464 | 223 | 204 | ||
466 | 224 | server s35 { | 205 | server s34 { |
467 | 225 | rxreq | 206 | rxreq |
468 | 226 | txresp | 207 | txresp |
469 | 227 | } -start | 208 | } -start |
470 | 228 | 209 | ||
472 | 229 | server s37 { | 210 | server s36 { |
473 | 230 | rxreq | 211 | rxreq |
474 | 231 | txresp | 212 | txresp |
475 | 232 | } -start | 213 | } -start |
476 | 233 | 214 | ||
478 | 234 | server s39 { | 215 | server s38 { |
479 | 235 | rxreq | 216 | rxreq |
480 | 236 | txresp | 217 | txresp |
481 | 237 | } -start | 218 | } -start |
482 | 238 | 219 | ||
483 | 220 | server s1 {} -start | ||
484 | 221 | server s3 {} -start | ||
485 | 222 | server s5 {} -start | ||
486 | 223 | server s7 {} -start | ||
487 | 224 | server s9 {} -start | ||
488 | 225 | server s11 {} -start | ||
489 | 226 | server s13 {} -start | ||
490 | 227 | server s15 {} -start | ||
491 | 228 | server s17 {} -start | ||
492 | 229 | server s19 {} -start | ||
493 | 230 | server s21 {} -start | ||
494 | 231 | server s23 {} -start | ||
495 | 232 | server s25 {} -start | ||
496 | 233 | server s27 {} -start | ||
497 | 234 | server s29 {} -start | ||
498 | 235 | server s31 {} -start | ||
499 | 236 | server s33 {} -start | ||
500 | 237 | server s35 {} -start | ||
501 | 238 | server s37 {} -start | ||
502 | 239 | server s39 {} -start | ||
503 | 240 | |||
504 | 239 | haproxy h1 -conf { | 241 | haproxy h1 -conf { |
505 | 240 | defaults | 242 | defaults |
506 | 241 | timeout client 1s | 243 | timeout client 1s |
507 | 242 | timeout server 1s | 244 | timeout server 1s |
508 | 243 | timeout connect 1s | 245 | timeout connect 1s |
509 | 244 | balance first | 246 | balance first |
511 | 245 | default-server no-check inter 5ms downinter 1s rise 1 fall 1 | 247 | default-server no-check inter 20ms downinter 1s rise 1 fall 1 |
512 | 246 | 248 | ||
513 | 247 | backend be1 | 249 | backend be1 |
514 | 248 | option log-health-checks | 250 | option log-health-checks |
515 | 249 | log ${S1_addr}:${S1_port} daemon | 251 | log ${S1_addr}:${S1_port} daemon |
516 | 250 | server srv1 ${s1_addr}:${s1_port} check | ||
517 | 251 | server srv0 ${s0_addr}:${s0_port} | 252 | server srv0 ${s0_addr}:${s0_port} |
518 | 253 | server srv1 ${s1_addr}:${s1_port} check | ||
519 | 252 | 254 | ||
520 | 253 | backend be3 | 255 | backend be3 |
521 | 254 | option log-health-checks | 256 | option log-health-checks |
522 | 255 | log ${S3_addr}:${S3_port} daemon | 257 | log ${S3_addr}:${S3_port} daemon |
523 | 256 | server srv3 ${s3_addr}:${s3_port} check | ||
524 | 257 | server srv2 ${s2_addr}:${s2_port} | 258 | server srv2 ${s2_addr}:${s2_port} |
525 | 259 | server srv3 ${s3_addr}:${s3_port} check | ||
526 | 258 | 260 | ||
527 | 259 | backend be5 | 261 | backend be5 |
528 | 260 | option log-health-checks | 262 | option log-health-checks |
529 | 261 | log ${S5_addr}:${S5_port} daemon | 263 | log ${S5_addr}:${S5_port} daemon |
530 | 262 | server srv5 ${s5_addr}:${s5_port} check | ||
531 | 263 | server srv4 ${s4_addr}:${s4_port} | 264 | server srv4 ${s4_addr}:${s4_port} |
532 | 265 | server srv5 ${s5_addr}:${s5_port} check | ||
533 | 264 | 266 | ||
534 | 265 | backend be7 | 267 | backend be7 |
535 | 266 | option log-health-checks | 268 | option log-health-checks |
536 | 267 | log ${S7_addr}:${S7_port} daemon | 269 | log ${S7_addr}:${S7_port} daemon |
537 | 268 | server srv7 ${s7_addr}:${s7_port} check | ||
538 | 269 | server srv6 ${s6_addr}:${s6_port} | 270 | server srv6 ${s6_addr}:${s6_port} |
539 | 271 | server srv7 ${s7_addr}:${s7_port} check | ||
540 | 270 | 272 | ||
541 | 271 | backend be9 | 273 | backend be9 |
542 | 272 | option log-health-checks | 274 | option log-health-checks |
543 | 273 | log ${S9_addr}:${S9_port} daemon | 275 | log ${S9_addr}:${S9_port} daemon |
544 | 274 | server srv9 ${s9_addr}:${s9_port} check | ||
545 | 275 | server srv8 ${s8_addr}:${s8_port} | 276 | server srv8 ${s8_addr}:${s8_port} |
546 | 277 | server srv9 ${s9_addr}:${s9_port} check | ||
547 | 276 | 278 | ||
548 | 277 | backend be11 | 279 | backend be11 |
549 | 278 | option log-health-checks | 280 | option log-health-checks |
550 | 279 | log ${S11_addr}:${S11_port} daemon | 281 | log ${S11_addr}:${S11_port} daemon |
551 | 280 | server srv11 ${s11_addr}:${s11_port} check | ||
552 | 281 | server srv10 ${s10_addr}:${s10_port} | 282 | server srv10 ${s10_addr}:${s10_port} |
553 | 283 | server srv11 ${s11_addr}:${s11_port} check | ||
554 | 282 | 284 | ||
555 | 283 | backend be13 | 285 | backend be13 |
556 | 284 | option log-health-checks | 286 | option log-health-checks |
557 | 285 | log ${S13_addr}:${S13_port} daemon | 287 | log ${S13_addr}:${S13_port} daemon |
558 | 286 | server srv13 ${s13_addr}:${s13_port} check | ||
559 | 287 | server srv12 ${s12_addr}:${s12_port} | 288 | server srv12 ${s12_addr}:${s12_port} |
560 | 289 | server srv13 ${s13_addr}:${s13_port} check | ||
561 | 288 | 290 | ||
562 | 289 | backend be15 | 291 | backend be15 |
563 | 290 | option log-health-checks | 292 | option log-health-checks |
564 | 291 | log ${S15_addr}:${S15_port} daemon | 293 | log ${S15_addr}:${S15_port} daemon |
565 | 292 | server srv15 ${s15_addr}:${s15_port} check | ||
566 | 293 | server srv14 ${s14_addr}:${s14_port} | 294 | server srv14 ${s14_addr}:${s14_port} |
567 | 295 | server srv15 ${s15_addr}:${s15_port} check | ||
568 | 294 | 296 | ||
569 | 295 | backend be17 | 297 | backend be17 |
570 | 296 | option log-health-checks | 298 | option log-health-checks |
571 | 297 | log ${S17_addr}:${S17_port} daemon | 299 | log ${S17_addr}:${S17_port} daemon |
572 | 298 | server srv17 ${s17_addr}:${s17_port} check | ||
573 | 299 | server srv16 ${s16_addr}:${s16_port} | 300 | server srv16 ${s16_addr}:${s16_port} |
574 | 301 | server srv17 ${s17_addr}:${s17_port} check | ||
575 | 300 | 302 | ||
576 | 301 | backend be19 | 303 | backend be19 |
577 | 302 | option log-health-checks | 304 | option log-health-checks |
578 | 303 | log ${S19_addr}:${S19_port} daemon | 305 | log ${S19_addr}:${S19_port} daemon |
579 | 304 | server srv19 ${s19_addr}:${s19_port} check | ||
580 | 305 | server srv18 ${s18_addr}:${s18_port} | 306 | server srv18 ${s18_addr}:${s18_port} |
581 | 307 | server srv19 ${s19_addr}:${s19_port} check | ||
582 | 306 | 308 | ||
583 | 307 | backend be21 | 309 | backend be21 |
584 | 308 | option log-health-checks | 310 | option log-health-checks |
585 | 309 | log ${S21_addr}:${S21_port} daemon | 311 | log ${S21_addr}:${S21_port} daemon |
586 | 310 | server srv21 ${s21_addr}:${s21_port} check | ||
587 | 311 | server srv20 ${s20_addr}:${s20_port} | 312 | server srv20 ${s20_addr}:${s20_port} |
588 | 313 | server srv21 ${s21_addr}:${s21_port} check | ||
589 | 312 | 314 | ||
590 | 313 | backend be23 | 315 | backend be23 |
591 | 314 | option log-health-checks | 316 | option log-health-checks |
592 | 315 | log ${S23_addr}:${S23_port} daemon | 317 | log ${S23_addr}:${S23_port} daemon |
593 | 316 | server srv23 ${s23_addr}:${s23_port} check | ||
594 | 317 | server srv22 ${s22_addr}:${s22_port} | 318 | server srv22 ${s22_addr}:${s22_port} |
595 | 319 | server srv23 ${s23_addr}:${s23_port} check | ||
596 | 318 | 320 | ||
597 | 319 | backend be25 | 321 | backend be25 |
598 | 320 | option log-health-checks | 322 | option log-health-checks |
599 | 321 | log ${S25_addr}:${S25_port} daemon | 323 | log ${S25_addr}:${S25_port} daemon |
600 | 322 | server srv25 ${s25_addr}:${s25_port} check | ||
601 | 323 | server srv24 ${s24_addr}:${s24_port} | 324 | server srv24 ${s24_addr}:${s24_port} |
602 | 325 | server srv25 ${s25_addr}:${s25_port} check | ||
603 | 324 | 326 | ||
604 | 325 | backend be27 | 327 | backend be27 |
605 | 326 | option log-health-checks | 328 | option log-health-checks |
606 | 327 | log ${S27_addr}:${S27_port} daemon | 329 | log ${S27_addr}:${S27_port} daemon |
607 | 328 | server srv27 ${s27_addr}:${s27_port} check | ||
608 | 329 | server srv26 ${s26_addr}:${s26_port} | 330 | server srv26 ${s26_addr}:${s26_port} |
609 | 331 | server srv27 ${s27_addr}:${s27_port} check | ||
610 | 330 | 332 | ||
611 | 331 | backend be29 | 333 | backend be29 |
612 | 332 | option log-health-checks | 334 | option log-health-checks |
613 | 333 | log ${S29_addr}:${S29_port} daemon | 335 | log ${S29_addr}:${S29_port} daemon |
614 | 334 | server srv29 ${s29_addr}:${s29_port} check | ||
615 | 335 | server srv28 ${s28_addr}:${s28_port} | 336 | server srv28 ${s28_addr}:${s28_port} |
616 | 337 | server srv29 ${s29_addr}:${s29_port} check | ||
617 | 336 | 338 | ||
618 | 337 | backend be31 | 339 | backend be31 |
619 | 338 | option log-health-checks | 340 | option log-health-checks |
620 | 339 | log ${S31_addr}:${S31_port} daemon | 341 | log ${S31_addr}:${S31_port} daemon |
621 | 340 | server srv31 ${s31_addr}:${s31_port} check | ||
622 | 341 | server srv30 ${s30_addr}:${s30_port} | 342 | server srv30 ${s30_addr}:${s30_port} |
623 | 343 | server srv31 ${s31_addr}:${s31_port} check | ||
624 | 342 | 344 | ||
625 | 343 | backend be33 | 345 | backend be33 |
626 | 344 | option log-health-checks | 346 | option log-health-checks |
627 | 345 | log ${S33_addr}:${S33_port} daemon | 347 | log ${S33_addr}:${S33_port} daemon |
628 | 346 | server srv33 ${s33_addr}:${s33_port} check | ||
629 | 347 | server srv32 ${s32_addr}:${s32_port} | 348 | server srv32 ${s32_addr}:${s32_port} |
630 | 349 | server srv33 ${s33_addr}:${s33_port} check | ||
631 | 348 | 350 | ||
632 | 349 | backend be35 | 351 | backend be35 |
633 | 350 | option log-health-checks | 352 | option log-health-checks |
634 | 351 | log ${S35_addr}:${S35_port} daemon | 353 | log ${S35_addr}:${S35_port} daemon |
635 | 352 | server srv35 ${s35_addr}:${s35_port} check | ||
636 | 353 | server srv34 ${s34_addr}:${s34_port} | 354 | server srv34 ${s34_addr}:${s34_port} |
637 | 355 | server srv35 ${s35_addr}:${s35_port} check | ||
638 | 354 | 356 | ||
639 | 355 | backend be37 | 357 | backend be37 |
640 | 356 | option log-health-checks | 358 | option log-health-checks |
641 | 357 | log ${S37_addr}:${S37_port} daemon | 359 | log ${S37_addr}:${S37_port} daemon |
642 | 358 | server srv37 ${s37_addr}:${s37_port} check | ||
643 | 359 | server srv36 ${s36_addr}:${s36_port} | 360 | server srv36 ${s36_addr}:${s36_port} |
644 | 361 | server srv37 ${s37_addr}:${s37_port} check | ||
645 | 360 | 362 | ||
646 | 361 | backend be39 | 363 | backend be39 |
647 | 362 | option log-health-checks | 364 | option log-health-checks |
648 | 363 | log ${S39_addr}:${S39_port} daemon | 365 | log ${S39_addr}:${S39_port} daemon |
649 | 364 | server srv39 ${s39_addr}:${s39_port} check | ||
650 | 365 | server srv38 ${s38_addr}:${s38_port} | 366 | server srv38 ${s38_addr}:${s38_port} |
651 | 367 | server srv39 ${s39_addr}:${s39_port} check | ||
652 | 366 | 368 | ||
653 | 367 | frontend fe1 | 369 | frontend fe1 |
654 | 368 | bind "fd@${fe1}" | 370 | bind "fd@${fe1}" |
655 | @@ -609,30 +611,35 @@ client c35 -wait | |||
656 | 609 | client c37 -wait | 611 | client c37 -wait |
657 | 610 | client c39 -wait | 612 | client c39 -wait |
658 | 611 | 613 | ||
679 | 612 | server s1 -wait | 614 | server s0 -wait |
680 | 613 | server s3 -wait | 615 | server s2 -wait |
681 | 614 | server s5 -wait | 616 | server s4 -wait |
682 | 615 | server s7 -wait | 617 | server s6 -wait |
683 | 616 | server s9 -wait | 618 | server s8 -wait |
684 | 617 | server s11 -wait | 619 | server s10 -wait |
685 | 618 | server s13 -wait | 620 | server s12 -wait |
686 | 619 | server s15 -wait | 621 | server s14 -wait |
687 | 620 | server s17 -wait | 622 | server s16 -wait |
688 | 621 | server s19 -wait | 623 | server s18 -wait |
689 | 622 | server s21 -wait | 624 | server s20 -wait |
690 | 623 | server s23 -wait | 625 | server s22 -wait |
691 | 624 | server s25 -wait | 626 | server s24 -wait |
692 | 625 | server s27 -wait | 627 | server s26 -wait |
693 | 626 | server s29 -wait | 628 | server s28 -wait |
694 | 627 | server s31 -wait | 629 | server s30 -wait |
695 | 628 | server s33 -wait | 630 | server s32 -wait |
696 | 629 | server s35 -wait | 631 | server s34 -wait |
697 | 630 | server s37 -wait | 632 | server s36 -wait |
698 | 631 | server s39 -wait | 633 | server s38 -wait |
699 | 632 | 634 | ||
700 | 633 | 635 | ||
701 | 634 | haproxy h1 -cli { | 636 | haproxy h1 -cli { |
702 | 635 | send "show servers state" | 637 | send "show servers state" |
704 | 636 | expect ~ "# be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord srv_use_ssl srv_check_port srv_check_addr srv_agent_addr srv_agent_port\n2 be1 1 srv1 ${s1_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s1_port} - 0 0 - - 0\n2 be1 2 srv0 ${s0_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s0_port} - 0 0 - - 0\n3 be3 1 srv3 ${s3_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s3_port} - 0 0 - - 0\n3 be3 2 srv2 ${s2_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s2_port} - 0 0 - - 0\n4 be5 1 srv5 ${s5_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s5_port} - 0 0 - - 0\n4 be5 2 srv4 ${s4_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s4_port} - 0 0 - - 0\n5 be7 1 srv7 ${s7_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s7_port} - 0 0 - - 0\n5 be7 2 srv6 ${s6_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s6_port} - 0 0 - - 0\n6 be9 1 srv9 ${s9_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s9_port} - 0 0 - - 0\n6 be9 2 srv8 ${s8_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s8_port} - 0 0 - - 0\n7 be11 1 srv11 ${s11_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s11_port} - 0 0 - - 0\n7 be11 2 srv10 ${s10_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s10_port} - 0 0 - - 0\n8 be13 1 srv13 ${s13_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s13_port} - 0 0 - - 0\n8 be13 2 srv12 ${s12_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s12_port} - 0 0 - - 0\n9 be15 1 srv15 ${s15_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s15_port} - 0 0 - - 0\n9 be15 2 srv14 ${s14_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s14_port} - 0 0 - - 0\n10 be17 1 srv17 ${s17_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s17_port} - 0 0 - - 0\n10 be17 2 srv16 ${s16_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s16_port} - 0 0 - - 0\n11 be19 1 srv19 ${s19_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s19_port} - 0 0 - - 0\n11 be19 2 srv18 ${s18_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s18_port} - 0 0 - - 0\n12 be21 1 srv21 ${s21_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s21_port} - 0 0 - - 0\n12 be21 2 srv20 ${s20_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s20_port} - 0 0 - - 0\n13 be23 1 srv23 ${s23_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s23_port} - 0 0 - - 0\n13 be23 2 srv22 ${s22_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s22_port} - 0 0 - - 0\n14 be25 1 srv25 ${s25_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s25_port} - 0 0 - - 0\n14 be25 2 srv24 ${s24_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s24_port} - 0 0 - - 0\n15 be27 1 srv27 ${s27_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s27_port} - 0 0 - - 0\n15 be27 2 srv26 ${s26_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s26_port} - 0 0 - - 0\n16 be29 1 srv29 ${s29_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s29_port} - 0 0 - - 0\n16 be29 2 srv28 ${s28_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s28_port} - 0 0 - - 0\n17 be31 1 srv31 ${s31_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s31_port} - 0 0 - - 0\n17 be31 2 srv30 ${s30_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s30_port} - 0 0 - - 0\n18 be33 1 srv33 ${s33_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s33_port} - 0 0 - - 0\n18 be33 2 srv32 ${s32_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s32_port} - 0 0 - - 0\n19 be35 1 srv35 ${s35_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s35_port} - 0 0 - - 0\n19 be35 2 srv34 ${s34_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s34_port} - 0 0 - - 0\n20 be37 1 srv37 ${s37_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s37_port} - 0 0 - - 0\n20 be37 2 srv36 ${s36_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s36_port} - 0 0 - - 0\n21 be39 1 srv39 ${s39_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s39_port} - 0 0 - - 0\n21 be39 2 srv38 ${s38_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s38_port} - 0 0 - - 0\n" | 638 | # output produced using the command below (warning, a bug inserts a "be0" every other line: |
705 | 639 | # for ((i=0;i<40;i++)); do id=$((i/2+2)); be=$((i|1)); si=$(((i&1)+1)); | ||
706 | 640 | # if ((i&1)); then chk="6 ([[:digit:]]+ ){3}"; else chk="1 0 1 0 ";fi; | ||
707 | 641 | # printf "%d be%d %d srv%d \${s%d_addr} 2 0 1 1 [[:digit:]]+ %s0 0 0 - \${s%d_port} - 0 0 - - 0\n" "$id" "$be" "$si" "$i" "$i" "$chk" "$i" "$i" ; | ||
708 | 642 | # done|grep -v be0|sed 's,$,\\n,'| tr -d '\n' | ||
709 | 643 | expect ~ "# be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord srv_use_ssl srv_check_port srv_check_addr srv_agent_addr srv_agent_port\n2 be1 1 srv0 ${s0_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s0_port} - 0 0 - - 0\n2 be1 2 srv1 ${s1_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s1_port} - 0 0 - - 0\n3 be3 1 srv2 ${s2_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s2_port} - 0 0 - - 0\n3 be3 2 srv3 ${s3_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s3_port} - 0 0 - - 0\n4 be5 1 srv4 ${s4_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s4_port} - 0 0 - - 0\n4 be5 2 srv5 ${s5_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s5_port} - 0 0 - - 0\n5 be7 1 srv6 ${s6_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s6_port} - 0 0 - - 0\n5 be7 2 srv7 ${s7_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s7_port} - 0 0 - - 0\n6 be9 1 srv8 ${s8_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s8_port} - 0 0 - - 0\n6 be9 2 srv9 ${s9_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s9_port} - 0 0 - - 0\n7 be11 1 srv10 ${s10_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s10_port} - 0 0 - - 0\n7 be11 2 srv11 ${s11_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s11_port} - 0 0 - - 0\n8 be13 1 srv12 ${s12_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s12_port} - 0 0 - - 0\n8 be13 2 srv13 ${s13_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s13_port} - 0 0 - - 0\n9 be15 1 srv14 ${s14_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s14_port} - 0 0 - - 0\n9 be15 2 srv15 ${s15_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s15_port} - 0 0 - - 0\n10 be17 1 srv16 ${s16_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s16_port} - 0 0 - - 0\n10 be17 2 srv17 ${s17_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s17_port} - 0 0 - - 0\n11 be19 1 srv18 ${s18_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s18_port} - 0 0 - - 0\n11 be19 2 srv19 ${s19_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s19_port} - 0 0 - - 0\n12 be21 1 srv20 ${s20_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s20_port} - 0 0 - - 0\n12 be21 2 srv21 ${s21_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s21_port} - 0 0 - - 0\n13 be23 1 srv22 ${s22_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s22_port} - 0 0 - - 0\n13 be23 2 srv23 ${s23_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s23_port} - 0 0 - - 0\n14 be25 1 srv24 ${s24_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s24_port} - 0 0 - - 0\n14 be25 2 srv25 ${s25_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s25_port} - 0 0 - - 0\n15 be27 1 srv26 ${s26_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s26_port} - 0 0 - - 0\n15 be27 2 srv27 ${s27_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s27_port} - 0 0 - - 0\n16 be29 1 srv28 ${s28_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s28_port} - 0 0 - - 0\n16 be29 2 srv29 ${s29_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s29_port} - 0 0 - - 0\n17 be31 1 srv30 ${s30_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s30_port} - 0 0 - - 0\n17 be31 2 srv31 ${s31_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s31_port} - 0 0 - - 0\n18 be33 1 srv32 ${s32_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s32_port} - 0 0 - - 0\n18 be33 2 srv33 ${s33_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s33_port} - 0 0 - - 0\n19 be35 1 srv34 ${s34_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s34_port} - 0 0 - - 0\n19 be35 2 srv35 ${s35_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s35_port} - 0 0 - - 0\n20 be37 1 srv36 ${s36_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s36_port} - 0 0 - - 0\n20 be37 2 srv37 ${s37_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s37_port} - 0 0 - - 0\n21 be39 1 srv38 ${s38_addr} 2 0 1 1 [[:digit:]]+ 1 0 1 0 0 0 0 - ${s38_port} - 0 0 - - 0\n21 be39 2 srv39 ${s39_addr} 2 0 1 1 [[:digit:]]+ 6 ([[:digit:]]+ ){3}0 0 0 - ${s39_port} - 0 0 - - 0\n" | ||
710 | 637 | } | 644 | } |
711 | 638 | 645 | ||
712 | diff --git a/scripts/build-ssl.sh b/scripts/build-ssl.sh | |||
713 | index 9a6a2b2..e1d89a0 100755 | |||
714 | --- a/scripts/build-ssl.sh | |||
715 | +++ b/scripts/build-ssl.sh | |||
716 | @@ -17,11 +17,18 @@ download_openssl () { | |||
717 | 17 | fi | 17 | fi |
718 | 18 | } | 18 | } |
719 | 19 | 19 | ||
720 | 20 | # recent openssl versions support parallel builds and skipping the docs, | ||
721 | 21 | # while older ones require to build everything sequentially. | ||
722 | 20 | build_openssl_linux () { | 22 | build_openssl_linux () { |
723 | 21 | ( | 23 | ( |
724 | 22 | cd "openssl-${OPENSSL_VERSION}/" | 24 | cd "openssl-${OPENSSL_VERSION}/" |
727 | 23 | ./config shared --prefix="${HOME}/opt" --openssldir="${HOME}/opt" -DPURIFY | 25 | ./config shared --prefix="${HOME}/opt" --openssldir="${HOME}/opt" --libdir=lib -DPURIFY |
728 | 24 | make all install_sw | 26 | if [ -z "${OPENSSL_VERSION##1.*}" ]; then |
729 | 27 | make all | ||
730 | 28 | else | ||
731 | 29 | make -j$(nproc) build_sw | ||
732 | 30 | fi | ||
733 | 31 | make install_sw | ||
734 | 25 | ) | 32 | ) |
735 | 26 | } | 33 | } |
736 | 27 | 34 | ||
737 | @@ -29,8 +36,8 @@ build_openssl_osx () { | |||
738 | 29 | ( | 36 | ( |
739 | 30 | cd "openssl-${OPENSSL_VERSION}/" | 37 | cd "openssl-${OPENSSL_VERSION}/" |
740 | 31 | ./Configure darwin64-x86_64-cc shared \ | 38 | ./Configure darwin64-x86_64-cc shared \ |
743 | 32 | --prefix="${HOME}/opt" --openssldir="${HOME}/opt" -DPURIFY | 39 | --prefix="${HOME}/opt" --openssldir="${HOME}/opt" --libdir=lib -DPURIFY |
744 | 33 | make depend all install_sw | 40 | make depend build_sw install_sw |
745 | 34 | ) | 41 | ) |
746 | 35 | } | 42 | } |
747 | 36 | 43 | ||
748 | diff --git a/src/fd.c b/src/fd.c | |||
749 | index 733658c..5f465f0 100644 | |||
750 | --- a/src/fd.c | |||
751 | +++ b/src/fd.c | |||
752 | @@ -114,6 +114,7 @@ THREAD_LOCAL int poller_rd_pipe = -1; // Pipe to wake the thread | |||
753 | 114 | int poller_wr_pipe[MAX_THREADS] __read_mostly; // Pipe to wake the threads | 114 | int poller_wr_pipe[MAX_THREADS] __read_mostly; // Pipe to wake the threads |
754 | 115 | 115 | ||
755 | 116 | volatile int ha_used_fds = 0; // Number of FD we're currently using | 116 | volatile int ha_used_fds = 0; // Number of FD we're currently using |
756 | 117 | static struct fdtab *fdtab_addr; /* address of the allocated area containing fdtab */ | ||
757 | 117 | 118 | ||
758 | 118 | #define _GET_NEXT(fd, off) ((volatile struct fdlist_entry *)(void *)((char *)(&fdtab[fd]) + off))->next | 119 | #define _GET_NEXT(fd, off) ((volatile struct fdlist_entry *)(void *)((char *)(&fdtab[fd]) + off))->next |
759 | 119 | #define _GET_PREV(fd, off) ((volatile struct fdlist_entry *)(void *)((char *)(&fdtab[fd]) + off))->prev | 120 | #define _GET_PREV(fd, off) ((volatile struct fdlist_entry *)(void *)((char *)(&fdtab[fd]) + off))->prev |
760 | @@ -685,11 +686,14 @@ int init_pollers() | |||
761 | 685 | int p; | 686 | int p; |
762 | 686 | struct poller *bp; | 687 | struct poller *bp; |
763 | 687 | 688 | ||
765 | 688 | if ((fdtab = calloc(global.maxsock, sizeof(*fdtab))) == NULL) { | 689 | if ((fdtab_addr = calloc(global.maxsock, sizeof(*fdtab) + 64)) == NULL) { |
766 | 689 | ha_alert("Not enough memory to allocate %d entries for fdtab!\n", global.maxsock); | 690 | ha_alert("Not enough memory to allocate %d entries for fdtab!\n", global.maxsock); |
767 | 690 | goto fail_tab; | 691 | goto fail_tab; |
768 | 691 | } | 692 | } |
769 | 692 | 693 | ||
770 | 694 | /* always provide an aligned fdtab */ | ||
771 | 695 | fdtab = (struct fdtab*)((((size_t)fdtab_addr) + 63) & -(size_t)64); | ||
772 | 696 | |||
773 | 693 | if ((polled_mask = calloc(global.maxsock, sizeof(*polled_mask))) == NULL) { | 697 | if ((polled_mask = calloc(global.maxsock, sizeof(*polled_mask))) == NULL) { |
774 | 694 | ha_alert("Not enough memory to allocate %d entries for polled_mask!\n", global.maxsock); | 698 | ha_alert("Not enough memory to allocate %d entries for polled_mask!\n", global.maxsock); |
775 | 695 | goto fail_polledmask; | 699 | goto fail_polledmask; |
776 | @@ -726,7 +730,7 @@ int init_pollers() | |||
777 | 726 | fail_info: | 730 | fail_info: |
778 | 727 | free(polled_mask); | 731 | free(polled_mask); |
779 | 728 | fail_polledmask: | 732 | fail_polledmask: |
781 | 729 | free(fdtab); | 733 | free(fdtab_addr); |
782 | 730 | fail_tab: | 734 | fail_tab: |
783 | 731 | return 0; | 735 | return 0; |
784 | 732 | } | 736 | } |
785 | @@ -747,7 +751,7 @@ void deinit_pollers() { | |||
786 | 747 | } | 751 | } |
787 | 748 | 752 | ||
788 | 749 | ha_free(&fdinfo); | 753 | ha_free(&fdinfo); |
790 | 750 | ha_free(&fdtab); | 754 | ha_free(&fdtab_addr); |
791 | 751 | ha_free(&polled_mask); | 755 | ha_free(&polled_mask); |
792 | 752 | } | 756 | } |
793 | 753 | 757 | ||
794 | diff --git a/src/haproxy.c b/src/haproxy.c | |||
795 | index ef5021a..d64c0e4 100644 | |||
796 | --- a/src/haproxy.c | |||
797 | +++ b/src/haproxy.c | |||
798 | @@ -714,6 +714,7 @@ void mworker_reload() | |||
799 | 714 | #endif | 714 | #endif |
800 | 715 | setenv("HAPROXY_MWORKER_REEXEC", "1", 1); | 715 | setenv("HAPROXY_MWORKER_REEXEC", "1", 1); |
801 | 716 | 716 | ||
802 | 717 | mworker_cleanup_proc(); | ||
803 | 717 | mworker_proc_list_to_env(); /* put the children description in the env */ | 718 | mworker_proc_list_to_env(); /* put the children description in the env */ |
804 | 718 | 719 | ||
805 | 719 | /* during the reload we must ensure that every FDs that can't be | 720 | /* during the reload we must ensure that every FDs that can't be |
806 | @@ -860,6 +861,9 @@ void reexec_on_failure() | |||
807 | 860 | 861 | ||
808 | 861 | setenv("HAPROXY_MWORKER_WAIT_ONLY", "1", 1); | 862 | setenv("HAPROXY_MWORKER_WAIT_ONLY", "1", 1); |
809 | 862 | 863 | ||
810 | 864 | /* do not keep unused FDs retrieved from the previous process */ | ||
811 | 865 | sock_drop_unused_old_sockets(); | ||
812 | 866 | |||
813 | 863 | ha_warning("Reexecuting Master process in waitpid mode\n"); | 867 | ha_warning("Reexecuting Master process in waitpid mode\n"); |
814 | 864 | mworker_reload(); | 868 | mworker_reload(); |
815 | 865 | } | 869 | } |
816 | @@ -3029,14 +3033,7 @@ int main(int argc, char **argv) | |||
817 | 3029 | /* Ok, all listeners should now be bound, close any leftover sockets | 3033 | /* Ok, all listeners should now be bound, close any leftover sockets |
818 | 3030 | * the previous process gave us, we don't need them anymore | 3034 | * the previous process gave us, we don't need them anymore |
819 | 3031 | */ | 3035 | */ |
828 | 3032 | while (xfer_sock_list != NULL) { | 3036 | sock_drop_unused_old_sockets(); |
821 | 3033 | struct xfer_sock_list *tmpxfer = xfer_sock_list->next; | ||
822 | 3034 | close(xfer_sock_list->fd); | ||
823 | 3035 | free(xfer_sock_list->iface); | ||
824 | 3036 | free(xfer_sock_list->namespace); | ||
825 | 3037 | free(xfer_sock_list); | ||
826 | 3038 | xfer_sock_list = tmpxfer; | ||
827 | 3039 | } | ||
829 | 3040 | 3037 | ||
830 | 3041 | /* prepare pause/play signals */ | 3038 | /* prepare pause/play signals */ |
831 | 3042 | signal_register_fct(SIGTTOU, sig_pause, SIGTTOU); | 3039 | signal_register_fct(SIGTTOU, sig_pause, SIGTTOU); |
832 | diff --git a/src/mailers.c b/src/mailers.c | |||
833 | index 3df02f0..4138bae 100644 | |||
834 | --- a/src/mailers.c | |||
835 | +++ b/src/mailers.c | |||
836 | @@ -195,7 +195,7 @@ static int enqueue_one_email_alert(struct proxy *p, struct server *s, | |||
837 | 195 | goto error; | 195 | goto error; |
838 | 196 | 196 | ||
839 | 197 | { | 197 | { |
841 | 198 | const char * const strs[4] = { "EHLO ", p->email_alert.myhostname, "\r\n" }; | 198 | const char * const strs[4] = { "HELO ", p->email_alert.myhostname, "\r\n" }; |
842 | 199 | if (!add_tcpcheck_send_strs(&alert->rules, strs)) | 199 | if (!add_tcpcheck_send_strs(&alert->rules, strs)) |
843 | 200 | goto error; | 200 | goto error; |
844 | 201 | } | 201 | } |
845 | diff --git a/src/mux_h1.c b/src/mux_h1.c | |||
846 | index 41bd4dc..c362dfd 100644 | |||
847 | --- a/src/mux_h1.c | |||
848 | +++ b/src/mux_h1.c | |||
849 | @@ -2683,7 +2683,7 @@ static int h1_send(struct h1c *h1c) | |||
850 | 2683 | } | 2683 | } |
851 | 2684 | 2684 | ||
852 | 2685 | end: | 2685 | end: |
854 | 2686 | if (!(h1c->flags & H1C_F_OUT_FULL)) | 2686 | if (!(h1c->flags & (H1C_F_OUT_FULL|H1C_F_OUT_ALLOC))) |
855 | 2687 | h1_wake_stream_for_send(h1c->h1s); | 2687 | h1_wake_stream_for_send(h1c->h1s); |
856 | 2688 | 2688 | ||
857 | 2689 | /* We're done, no more to send */ | 2689 | /* We're done, no more to send */ |
858 | diff --git a/src/mux_h2.c b/src/mux_h2.c | |||
859 | index 0476bc3..11c660e 100644 | |||
860 | --- a/src/mux_h2.c | |||
861 | +++ b/src/mux_h2.c | |||
862 | @@ -6357,7 +6357,7 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun | |||
863 | 6357 | 6357 | ||
864 | 6358 | /* transfer possibly pending data to the upper layer */ | 6358 | /* transfer possibly pending data to the upper layer */ |
865 | 6359 | h2s_htx = htx_from_buf(&h2s->rxbuf); | 6359 | h2s_htx = htx_from_buf(&h2s->rxbuf); |
867 | 6360 | if (htx_is_empty(h2s_htx)) { | 6360 | if (htx_is_empty(h2s_htx) && !(h2s_htx->flags & HTX_FL_PARSING_ERROR)) { |
868 | 6361 | /* Here htx_to_buf() will set buffer data to 0 because | 6361 | /* Here htx_to_buf() will set buffer data to 0 because |
869 | 6362 | * the HTX is empty. | 6362 | * the HTX is empty. |
870 | 6363 | */ | 6363 | */ |
871 | diff --git a/src/mworker.c b/src/mworker.c | |||
872 | index 991394c..7a8feda 100644 | |||
873 | --- a/src/mworker.c | |||
874 | +++ b/src/mworker.c | |||
875 | @@ -449,6 +449,36 @@ void mworker_cleanlisteners() | |||
876 | 449 | } | 449 | } |
877 | 450 | } | 450 | } |
878 | 451 | 451 | ||
879 | 452 | /* Upon a configuration loading error some mworker_proc and FDs/server were | ||
880 | 453 | * assigned but the worker was never forked, we must close the FDs and | ||
881 | 454 | * remove the server | ||
882 | 455 | */ | ||
883 | 456 | void mworker_cleanup_proc() | ||
884 | 457 | { | ||
885 | 458 | struct mworker_proc *child, *it; | ||
886 | 459 | |||
887 | 460 | list_for_each_entry_safe(child, it, &proc_list, list) { | ||
888 | 461 | |||
889 | 462 | if (child->pid == -1) { | ||
890 | 463 | /* Close the socketpair master side. We don't need to | ||
891 | 464 | * close the worker side, because it's stored in the | ||
892 | 465 | * GLOBAL cli listener which was supposed to be in the | ||
893 | 466 | * worker and which will be closed in | ||
894 | 467 | * mworker_cleanlisteners() | ||
895 | 468 | */ | ||
896 | 469 | if (child->ipc_fd[0] > -1) | ||
897 | 470 | close(child->ipc_fd[0]); | ||
898 | 471 | if (child->srv) { | ||
899 | 472 | /* only exists if we created a master CLI listener */ | ||
900 | 473 | free_server(child->srv); | ||
901 | 474 | } | ||
902 | 475 | LIST_DELETE(&child->list); | ||
903 | 476 | mworker_free_child(child); | ||
904 | 477 | } | ||
905 | 478 | } | ||
906 | 479 | } | ||
907 | 480 | |||
908 | 481 | |||
909 | 452 | /* Displays workers and processes */ | 482 | /* Displays workers and processes */ |
910 | 453 | static int cli_io_handler_show_proc(struct appctx *appctx) | 483 | static int cli_io_handler_show_proc(struct appctx *appctx) |
911 | 454 | { | 484 | { |
912 | diff --git a/src/proxy.c b/src/proxy.c | |||
913 | index 4e866b1..92b84ef 100644 | |||
914 | --- a/src/proxy.c | |||
915 | +++ b/src/proxy.c | |||
916 | @@ -1754,7 +1754,7 @@ struct proxy *parse_new_proxy(const char *name, unsigned int cap, | |||
917 | 1754 | const struct proxy *defproxy) | 1754 | const struct proxy *defproxy) |
918 | 1755 | { | 1755 | { |
919 | 1756 | struct proxy *curproxy = NULL; | 1756 | struct proxy *curproxy = NULL; |
921 | 1757 | char *errmsg; | 1757 | char *errmsg = NULL; |
922 | 1758 | 1758 | ||
923 | 1759 | if (!(curproxy = alloc_new_proxy(name, cap, &errmsg))) { | 1759 | if (!(curproxy = alloc_new_proxy(name, cap, &errmsg))) { |
924 | 1760 | ha_alert("parsing [%s:%d] : %s\n", file, linenum, errmsg); | 1760 | ha_alert("parsing [%s:%d] : %s\n", file, linenum, errmsg); |
925 | diff --git a/src/resolvers.c b/src/resolvers.c | |||
926 | index 4a306fa..49e16f6 100644 | |||
927 | --- a/src/resolvers.c | |||
928 | +++ b/src/resolvers.c | |||
929 | @@ -1741,10 +1741,8 @@ int resolv_str_to_dn_label(const char *str, int str_len, char *dn, int dn_len) | |||
930 | 1741 | return -1; | 1741 | return -1; |
931 | 1742 | 1742 | ||
932 | 1743 | /* ignore trailing dot */ | 1743 | /* ignore trailing dot */ |
935 | 1744 | if (i + 1 == str_len) { | 1744 | if (i + 1 == str_len) |
934 | 1745 | i++; | ||
936 | 1746 | break; | 1745 | break; |
937 | 1747 | } | ||
938 | 1748 | 1746 | ||
939 | 1749 | dn[offset] = (i - offset); | 1747 | dn[offset] = (i - offset); |
940 | 1750 | offset = i+1; | 1748 | offset = i+1; |
941 | diff --git a/src/sink.c b/src/sink.c | |||
942 | index 6358da5..0f421cc 100644 | |||
943 | --- a/src/sink.c | |||
944 | +++ b/src/sink.c | |||
945 | @@ -604,7 +604,7 @@ void __sink_forward_session_deinit(struct sink_forward_target *sft) | |||
946 | 604 | 604 | ||
947 | 605 | static void sink_forward_session_release(struct appctx *appctx) | 605 | static void sink_forward_session_release(struct appctx *appctx) |
948 | 606 | { | 606 | { |
950 | 607 | struct sink_forward_target *sft = appctx->ctx.peers.ptr; | 607 | struct sink_forward_target *sft = appctx->ctx.sft.ptr; |
951 | 608 | 608 | ||
952 | 609 | if (!sft) | 609 | if (!sft) |
953 | 610 | return; | 610 | return; |
954 | diff --git a/src/sock.c b/src/sock.c | |||
955 | index 9d272cc..399f7b7 100644 | |||
956 | --- a/src/sock.c | |||
957 | +++ b/src/sock.c | |||
958 | @@ -34,8 +34,24 @@ | |||
959 | 34 | #include <haproxy/sock_inet.h> | 34 | #include <haproxy/sock_inet.h> |
960 | 35 | #include <haproxy/tools.h> | 35 | #include <haproxy/tools.h> |
961 | 36 | 36 | ||
962 | 37 | #define SOCK_XFER_OPT_FOREIGN 0x000000001 | ||
963 | 38 | #define SOCK_XFER_OPT_V6ONLY 0x000000002 | ||
964 | 39 | #define SOCK_XFER_OPT_DGRAM 0x000000004 | ||
965 | 40 | |||
966 | 37 | /* the list of remaining sockets transferred from an older process */ | 41 | /* the list of remaining sockets transferred from an older process */ |
968 | 38 | struct xfer_sock_list *xfer_sock_list = NULL; | 42 | struct xfer_sock_list { |
969 | 43 | int fd; | ||
970 | 44 | int options; /* socket options as SOCK_XFER_OPT_* */ | ||
971 | 45 | char *iface; | ||
972 | 46 | char *namespace; | ||
973 | 47 | int if_namelen; | ||
974 | 48 | int ns_namelen; | ||
975 | 49 | struct xfer_sock_list *prev; | ||
976 | 50 | struct xfer_sock_list *next; | ||
977 | 51 | struct sockaddr_storage addr; | ||
978 | 52 | }; | ||
979 | 53 | |||
980 | 54 | static struct xfer_sock_list *xfer_sock_list; | ||
981 | 39 | 55 | ||
982 | 40 | 56 | ||
983 | 41 | /* Accept an incoming connection from listener <l>, and return it, as well as | 57 | /* Accept an incoming connection from listener <l>, and return it, as well as |
984 | @@ -595,6 +611,24 @@ int sock_find_compatible_fd(const struct receiver *rx) | |||
985 | 595 | return ret; | 611 | return ret; |
986 | 596 | } | 612 | } |
987 | 597 | 613 | ||
988 | 614 | /* After all protocols are bound, there may remain some old sockets that have | ||
989 | 615 | * been removed between the previous config and the new one. These ones must | ||
990 | 616 | * be dropped, otherwise they will remain open and may prevent a service from | ||
991 | 617 | * restarting. | ||
992 | 618 | */ | ||
993 | 619 | void sock_drop_unused_old_sockets() | ||
994 | 620 | { | ||
995 | 621 | while (xfer_sock_list != NULL) { | ||
996 | 622 | struct xfer_sock_list *tmpxfer = xfer_sock_list->next; | ||
997 | 623 | |||
998 | 624 | close(xfer_sock_list->fd); | ||
999 | 625 | free(xfer_sock_list->iface); | ||
1000 | 626 | free(xfer_sock_list->namespace); | ||
1001 | 627 | free(xfer_sock_list); | ||
1002 | 628 | xfer_sock_list = tmpxfer; | ||
1003 | 629 | } | ||
1004 | 630 | } | ||
1005 | 631 | |||
1006 | 598 | /* Tests if the receiver supports accepting connections. Returns positive on | 632 | /* Tests if the receiver supports accepting connections. Returns positive on |
1007 | 599 | * success, 0 if not possible, negative if the socket is non-recoverable. The | 633 | * success, 0 if not possible, negative if the socket is non-recoverable. The |
1008 | 600 | * rationale behind this is that inherited FDs may be broken and that shared | 634 | * rationale behind this is that inherited FDs may be broken and that shared |
1009 | diff --git a/src/ssl_sock.c b/src/ssl_sock.c | |||
1010 | index b82ab18..233b520 100644 | |||
1011 | --- a/src/ssl_sock.c | |||
1012 | +++ b/src/ssl_sock.c | |||
1013 | @@ -2270,13 +2270,13 @@ static void ssl_set_TLSv12_func(SSL *ssl, set_context_func c) { | |||
1014 | 2270 | : SSL_set_min_proto_version(ssl, TLS1_2_VERSION); | 2270 | : SSL_set_min_proto_version(ssl, TLS1_2_VERSION); |
1015 | 2271 | } | 2271 | } |
1016 | 2272 | static void ctx_set_TLSv13_func(SSL_CTX *ctx, set_context_func c) { | 2272 | static void ctx_set_TLSv13_func(SSL_CTX *ctx, set_context_func c) { |
1018 | 2273 | #if SSL_OP_NO_TLSv1_3 | 2273 | #if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L) |
1019 | 2274 | c == SET_MAX ? SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) | 2274 | c == SET_MAX ? SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) |
1020 | 2275 | : SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION); | 2275 | : SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION); |
1021 | 2276 | #endif | 2276 | #endif |
1022 | 2277 | } | 2277 | } |
1023 | 2278 | static void ssl_set_TLSv13_func(SSL *ssl, set_context_func c) { | 2278 | static void ssl_set_TLSv13_func(SSL *ssl, set_context_func c) { |
1025 | 2279 | #if SSL_OP_NO_TLSv1_3 | 2279 | #if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L) |
1026 | 2280 | c == SET_MAX ? SSL_set_max_proto_version(ssl, TLS1_3_VERSION) | 2280 | c == SET_MAX ? SSL_set_max_proto_version(ssl, TLS1_3_VERSION) |
1027 | 2281 | : SSL_set_min_proto_version(ssl, TLS1_3_VERSION); | 2281 | : SSL_set_min_proto_version(ssl, TLS1_3_VERSION); |
1028 | 2282 | #endif | 2282 | #endif |
1029 | diff --git a/src/stream.c b/src/stream.c | |||
1030 | index e0ba75e..ea997e0 100644 | |||
1031 | --- a/src/stream.c | |||
1032 | +++ b/src/stream.c | |||
1033 | @@ -775,13 +775,8 @@ static void stream_free(struct stream *s) | |||
1034 | 775 | */ | 775 | */ |
1035 | 776 | static int stream_alloc_work_buffer(struct stream *s) | 776 | static int stream_alloc_work_buffer(struct stream *s) |
1036 | 777 | { | 777 | { |
1037 | 778 | if (LIST_INLIST(&s->buffer_wait.list)) | ||
1038 | 779 | LIST_DEL_INIT(&s->buffer_wait.list); | ||
1039 | 780 | |||
1040 | 781 | if (b_alloc(&s->res.buf)) | 778 | if (b_alloc(&s->res.buf)) |
1041 | 782 | return 1; | 779 | return 1; |
1042 | 783 | |||
1043 | 784 | LIST_APPEND(&ti->buffer_wq, &s->buffer_wait.list); | ||
1044 | 785 | return 0; | 780 | return 0; |
1045 | 786 | } | 781 | } |
1046 | 787 | 782 | ||
1047 | @@ -1710,15 +1705,24 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) | |||
1048 | 1710 | 1705 | ||
1049 | 1711 | resync_stream_interface: | 1706 | resync_stream_interface: |
1050 | 1712 | /* below we may emit error messages so we have to ensure that we have | 1707 | /* below we may emit error messages so we have to ensure that we have |
1052 | 1713 | * our buffers properly allocated. | 1708 | * our buffers properly allocated. If the allocation failed, an error is |
1053 | 1709 | * triggered. | ||
1054 | 1710 | * | ||
1055 | 1711 | * NOTE: An error is returned because the mechanism to queue entities | ||
1056 | 1712 | * waiting for a buffer is totally broken for now. However, this | ||
1057 | 1713 | * part must be refactored. When it will be handled, this part | ||
1058 | 1714 | * must be be reviewed too. | ||
1059 | 1714 | */ | 1715 | */ |
1060 | 1715 | if (!stream_alloc_work_buffer(s)) { | 1716 | if (!stream_alloc_work_buffer(s)) { |
1067 | 1716 | /* No buffer available, we've been subscribed to the list of | 1717 | si_f->flags |= SI_FL_ERR; |
1068 | 1717 | * buffer waiters, let's wait for our turn. | 1718 | si_f->err_type = SI_ET_CONN_RES; |
1069 | 1718 | */ | 1719 | |
1070 | 1719 | si_f->flags &= ~SI_FL_DONT_WAKE; | 1720 | si_b->flags |= SI_FL_ERR; |
1071 | 1720 | si_b->flags &= ~SI_FL_DONT_WAKE; | 1721 | si_b->err_type = SI_ET_CONN_RES; |
1072 | 1721 | goto update_exp_and_leave; | 1722 | |
1073 | 1723 | if (!(s->flags & SF_ERR_MASK)) | ||
1074 | 1724 | s->flags |= SF_ERR_RESOURCE; | ||
1075 | 1725 | sess_set_term_flags(s); | ||
1076 | 1722 | } | 1726 | } |
1077 | 1723 | 1727 | ||
1078 | 1724 | /* 1b: check for low-level errors reported at the stream interface. | 1728 | /* 1b: check for low-level errors reported at the stream interface. |
1079 | diff --git a/src/tools.c b/src/tools.c | |||
1080 | index d14286c..bdf78ff 100644 | |||
1081 | --- a/src/tools.c | |||
1082 | +++ b/src/tools.c | |||
1083 | @@ -1673,12 +1673,20 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli | |||
1084 | 1673 | return end - url; | 1673 | return end - url; |
1085 | 1674 | } | 1674 | } |
1086 | 1675 | else { | 1675 | else { |
1087 | 1676 | /* we need to copy the string into the trash because url2ipv4 | ||
1088 | 1677 | * needs a \0 at the end of the string */ | ||
1089 | 1678 | if (trash.size < ulen) | ||
1090 | 1679 | return -1; | ||
1091 | 1680 | |||
1092 | 1681 | memcpy(trash.area, curr, ulen - (curr - url)); | ||
1093 | 1682 | trash.area[ulen - (curr - url)] = '\0'; | ||
1094 | 1683 | |||
1095 | 1676 | /* We are looking for IP address. If you want to parse and | 1684 | /* We are looking for IP address. If you want to parse and |
1096 | 1677 | * resolve hostname found in url, you can use str2sa_range(), but | 1685 | * resolve hostname found in url, you can use str2sa_range(), but |
1097 | 1678 | * be warned this can slow down global daemon performances | 1686 | * be warned this can slow down global daemon performances |
1098 | 1679 | * while handling lagging dns responses. | 1687 | * while handling lagging dns responses. |
1099 | 1680 | */ | 1688 | */ |
1101 | 1681 | ret = url2ipv4(curr, &((struct sockaddr_in *)addr)->sin_addr); | 1689 | ret = url2ipv4(trash.area, &((struct sockaddr_in *)addr)->sin_addr); |
1102 | 1682 | if (ret) { | 1690 | if (ret) { |
1103 | 1683 | /* Update out. */ | 1691 | /* Update out. */ |
1104 | 1684 | if (out) { | 1692 | if (out) { |
1105 | @@ -1686,7 +1694,9 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli | |||
1106 | 1686 | out->host_len = ret; | 1694 | out->host_len = ret; |
1107 | 1687 | } | 1695 | } |
1108 | 1688 | 1696 | ||
1110 | 1689 | curr += ret; | 1697 | /* we need to assign again curr and end from the trash */ |
1111 | 1698 | url = trash.area; | ||
1112 | 1699 | curr = trash.area + ret; | ||
1113 | 1690 | 1700 | ||
1114 | 1691 | /* Decode port. */ | 1701 | /* Decode port. */ |
1115 | 1692 | if (*curr == ':') { | 1702 | if (*curr == ':') { |