]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
7 years agoMINOR: h2: provide and use h2s_detach() and h2s_free()
Willy Tarreau [Thu, 1 Mar 2018 15:27:53 +0000 (16:27 +0100)] 
MINOR: h2: provide and use h2s_detach() and h2s_free()

These ones save us from open-coding the cleanup functions on each and
every error path. The code was updated to use them with no functional
change.

7 years agoCLEANUP: h2: rename misleading h2c_stream_close() to h2s_close()
Willy Tarreau [Thu, 1 Mar 2018 15:31:34 +0000 (16:31 +0100)] 
CLEANUP: h2: rename misleading h2c_stream_close() to h2s_close()

This function takes an h2c and an h2s but it never uses the h2c, which
is a bit confusing at some places in the code. Let's make it clear that
it only operates on the h2s instead by renaming it and removing the
unused h2c argument.

7 years agoMINOR: systemd: Add SystemD's SystemCallFilter option to the unit file
Tim Duesterhus [Tue, 27 Feb 2018 19:19:05 +0000 (20:19 +0100)] 
MINOR: systemd: Add SystemD's SystemCallFilter option to the unit file

This option takes away system calls that are unneeded for haproxy's
operation and thus is a good defense in depth measure.

7 years agoMINOR: systemd: Add SystemD's Protect*= options to the unit file
Tim Duesterhus [Tue, 27 Feb 2018 19:19:04 +0000 (20:19 +0100)] 
MINOR: systemd: Add SystemD's Protect*= options to the unit file

While the haproxy workers usually are running chrooted the master
process is not. This patch is a pretty safe defense in depth measure
to ensure haproxy cannot touch sensitive parts of the file system.

ProtectSystem takes non-boolean arguments in newer SystemD versions,
but setting those would leave older systems such as Ubuntu Xenial
unprotected. Distro maintainers and system administrators could
adapt the ProtectSystem value to the SystemD version they ship.

7 years agoMINOR: systemd: Add section for SystemD sandboxing to unit file
Tim Duesterhus [Tue, 27 Feb 2018 19:19:03 +0000 (20:19 +0100)] 
MINOR: systemd: Add section for SystemD sandboxing to unit file

This commit adds a warning for settings that possibly provide better
sandboxing and explains their tradeoffs.

7 years agoMINOR: connection: add proxy-v2-options authority
Emmanuel Hocdet [Thu, 1 Feb 2018 17:29:59 +0000 (18:29 +0100)] 
MINOR: connection: add proxy-v2-options authority

This patch add option PP2_TYPE_AUTHORITY to proxy protocol v2 when a TLS
connection was negotiated. In this case, authority corresponds to the sni.

7 years agoMINOR: connection: add proxy-v2-options ssl-cipher,cert-sig,cert-key
Emmanuel Hocdet [Thu, 1 Feb 2018 14:53:52 +0000 (15:53 +0100)] 
MINOR: connection: add proxy-v2-options ssl-cipher,cert-sig,cert-key

This patch implement proxy protocol v2 options related to crypto information:
ssl-cipher (PP2_SUBTYPE_SSL_CIPHER), cert-sig (PP2_SUBTYPE_SSL_SIG_ALG) and
cert-key (PP2_SUBTYPE_SSL_KEY_ALG).

7 years agoMINOR: ssl: add ssl_sock_get_cert_sig function
Emmanuel Hocdet [Thu, 2 Nov 2017 13:05:23 +0000 (14:05 +0100)] 
MINOR: ssl: add ssl_sock_get_cert_sig function

ssl_sock_get_cert_sig can be used to report cert signature short name
to log and ppv2 (RSA-SHA256).

7 years agoMINOR: ssl: add ssl_sock_get_pkey_algo function
Emmanuel Hocdet [Tue, 31 Oct 2017 14:46:07 +0000 (15:46 +0100)] 
MINOR: ssl: add ssl_sock_get_pkey_algo function

ssl_sock_get_pkey_algo can be used to report pkey algorithm to log
and ppv2 (RSA2048, EC256,...).
Extract pkey information is not free in ssl api (lock/alloc/free):
haproxy can use the pkey information computed in load_certificate.
Store and use this information in a SSL ex_data when available,
compute it if not (SSL multicert bundled and generated cert).

7 years agoMINOR: ssl: extract full pkey info in load_certificate
Emmanuel Hocdet [Fri, 27 Oct 2017 16:43:29 +0000 (18:43 +0200)] 
MINOR: ssl: extract full pkey info in load_certificate

Private key information is used in switchctx to implement native multicert
selection (ecdsa/rsa/anonymous). This patch extract and store full pkey
information: dsa type and pkey size in bits. This can be used for switchctx
or to report pkey informations in ppv2 and log.

7 years agoRevert "BUG/MINOR: send-proxy-v2: string size must include ('\0')"
Emmanuel Hocdet [Wed, 28 Feb 2018 11:02:14 +0000 (12:02 +0100)] 
Revert "BUG/MINOR: send-proxy-v2: string size must include ('\0')"

This reverts commit 82913e4f79a1f1fb25aec84a2ce2f5f0e5ce1959.
TLV string value should not be null-terminated.

This should be backported to 1.8.

7 years agoBUG/MEDIUM: spoe: Remove idle applets from idle list when HAProxy is stopping
Christopher Faulet [Wed, 28 Feb 2018 12:33:26 +0000 (13:33 +0100)] 
BUG/MEDIUM: spoe: Remove idle applets from idle list when HAProxy is stopping

In the SPOE applet's handler, when an applet is switched from the state IDLE to
PROCESSING, it is removed for the list of idle applets. But when HAProxy is
stopping, this applet can be switched to DISCONNECT. In this case, we also need
to remove it from the list of idle applets. Else the applet is removed but still
present in the list. It could lead to a segmentation fault or an infinite loop,
depending the code path.

7 years agoBUG/MEDIUM: buffer: Fix the wrapping case in bi_putblk
Christopher Faulet [Mon, 26 Feb 2018 09:51:28 +0000 (10:51 +0100)] 
BUG/MEDIUM: buffer: Fix the wrapping case in bi_putblk

When the block of data need to be split to support the wrapping, the start of
the second block of data was wrong. We must be sure to skup data copied during
the first memcpy.

This patch must be backported to 1.8.

7 years agoBUG/MEDIUM: buffer: Fix the wrapping case in bo_putblk
Christopher Faulet [Mon, 26 Feb 2018 09:47:03 +0000 (10:47 +0100)] 
BUG/MEDIUM: buffer: Fix the wrapping case in bo_putblk

When the block of data need to be split to support the wrapping, the start of
the second block of data was wrong. We must be sure to skip data copied during
the first memcpy.

This patch must be backported to 1.8, 1.7, 1.6 and 1.5.

7 years agoBUG/MEDIUM: h2: always consume any trailing data after end of output buffers
Willy Tarreau [Tue, 27 Feb 2018 14:37:25 +0000 (15:37 +0100)] 
BUG/MEDIUM: h2: always consume any trailing data after end of output buffers

In case a stream tries to emit more data than advertised by the chunks
or content-length headers, the extra data remains in the channel's output
buffer until the channel's timeout expires. It can easily happen when
sending malformed error files making use of a wrong content-length or
having extra CRLFs after the empty chunk. It may also be possible to
forge such a bad response using Lua.

The H1 to H2 encoder must protect itself against this by marking the data
presented to it as consumed if it decides to discard them, so that the
sending stream doesn't wait for the timeout to trigger.

The visible effect of this problem is a huge memory usage and a high
concurrent connection count during benchmarks when using such bad data
(a typical place where this easily happens).

This fix must be backported to 1.8.

7 years agoBUG/MINOR: h2: Set the target of dbuf_wait to h2c
Christopher Faulet [Mon, 26 Feb 2018 12:43:38 +0000 (13:43 +0100)] 
BUG/MINOR: h2: Set the target of dbuf_wait to h2c

In h2_get_dbuf, when the buffer allocation was failing, dbuf_wait.target was
errornously set to the connection (h2c->conn) instead of the h2 connection
descriptor (h2c).

This patch must be backported to 1.8.

7 years agoMINOR: stats: display the number of threads in the statistics.
Yves Lafon [Mon, 26 Feb 2018 10:10:37 +0000 (11:10 +0100)] 
MINOR: stats: display the number of threads in the statistics.

Add the nbthread global variable to the output, matching nbproc.

This may be backported to 1.8

7 years agoMINOR: debug/pools: make DEBUG_UAF also detect underflows
Willy Tarreau [Thu, 22 Feb 2018 13:14:23 +0000 (14:14 +0100)] 
MINOR: debug/pools: make DEBUG_UAF also detect underflows

Since we use padding before the allocated page, it's trivial to place
the allocated address there and see if it gets mangled once we release
it.

This may be backported to stable releases already using DEBUG_UAF.

7 years agoBUG/MINOR: debug/pools: properly handle out-of-memory when building with DEBUG_UAF
Willy Tarreau [Thu, 22 Feb 2018 10:39:23 +0000 (11:39 +0100)] 
BUG/MINOR: debug/pools: properly handle out-of-memory when building with DEBUG_UAF

Commit 158fa75 ("MINOR: pools: implement DEBUG_UAF to detect use after free")
implemented pool use-after-free detection, but the mmap() return value isn't
properly checked, preventing the call to pool_alloc_area() from returning
NULL. So on out-of-memory a mangled pointer is returned, causing a crash on
the pool_alloc() site instead of forcing a GC. It doesn't affect regular
operations however, just complicates complex bug investigations.

This fix should be backported to 1.8 and to 1.7.

7 years agoBUG/MINOR: pools/threads: don't ignore DEBUG_UAF on double-word CAS capable archs
Willy Tarreau [Thu, 22 Feb 2018 13:05:55 +0000 (14:05 +0100)] 
BUG/MINOR: pools/threads: don't ignore DEBUG_UAF on double-word CAS capable archs

Since commit cf975d4 ("MINOR: pools/threads: Implement lockless memory
pools."), we support lockless pools. However the parts dedicated to
detecting use-after-free are not present in this part, making DEBUG_UAF
useless in this situation.

The present patch sets a new define CONFIG_HAP_LOCKLESS_POOLS when such
a compatible architecture is detected, and when pool debugging is not
requested, then makes use of this everywhere in pools and buffers
functions. This way enabling DEBUG_UAF will automatically disable the
lockless version.

No backport is needed as this is purely 1.9-dev.

7 years agoCLEANUP: standard: Fix typo in IPv6 mask example
Tim Duesterhus [Tue, 20 Feb 2018 16:02:18 +0000 (17:02 +0100)] 
CLEANUP: standard: Fix typo in IPv6 mask example

IPv6 addresses with two double colons are invalid.

This typo was introduced in commit 471851713af20d84b67b8966471ea758dc8c12b9.

7 years agoCLEANUP: pools: Remove unused end label in memory.h
Tim Duesterhus [Mon, 19 Feb 2018 23:49:46 +0000 (00:49 +0100)] 
CLEANUP: pools: Remove unused end label in memory.h

This removes the end label from memory.h.

The labels are unused as of cf975d46bca2515056a4f55e55fedbbc7b4eda59
which is unreleased (and incidentally the first commit containing
those labels, thus they never have been used).

7 years agoCLEANUP: h2: Remove unused labels from mux_h2.c
Tim Duesterhus [Mon, 19 Feb 2018 23:49:45 +0000 (00:49 +0100)] 
CLEANUP: h2: Remove unused labels from mux_h2.c

This removes the unused next_header_block and try_again labels
from mux_h2.c.

try_again is unused as of a76e4c21839cafd036fbe755416569206502c1d9,
which first appeared in haproxy 1.8.0.
next_header_block is unused as of 872855998bd03d5224e0e5cd6aef9b91e2a6de1d,
which was backported to haproxy 1.8.0 as
59fcb216085a7aa9744cffe39567c80de4ebd6bf.

7 years agoCLEANUP: spoe: Remove unused label retry
Tim Duesterhus [Mon, 19 Feb 2018 23:49:44 +0000 (00:49 +0100)] 
CLEANUP: spoe: Remove unused label retry

This removes the retry labels from spoe_send_frame and spoe_recv_frame
which are unused since d5216d474d69856a282e4443f180af2093a80d6c, which
is unreleased, but was backported to haproxy 1.8 as
f13f3a4babdb1ce23a7e982c765704bca728111a.

7 years agoCLEANUP: cfgparse: Remove unused label end
Tim Duesterhus [Mon, 19 Feb 2018 23:49:43 +0000 (00:49 +0100)] 
CLEANUP: cfgparse: Remove unused label end

This removes the end label from parse_process_number() which
is unused since 5ab51775e736511b7e54f42e080dcef76a284da9, which
first was released in haproxy 1.8.0.

7 years agoMINOR: ssl/sample: adds ssl_bc_is_resumed fetch keyword.
Emeric Brun [Mon, 19 Feb 2018 15:14:12 +0000 (16:14 +0100)] 
MINOR: ssl/sample: adds ssl_bc_is_resumed fetch keyword.

Returns true when the back connection was made over an SSL/TLS transport
layer and the newly created SSL session was resumed using a cached
session or a TLS ticket.

7 years agoBUG/MEDIUM: ssl/sample: ssl_bc_* fetch keywords are broken.
Emeric Brun [Mon, 19 Feb 2018 14:59:48 +0000 (15:59 +0100)] 
BUG/MEDIUM: ssl/sample: ssl_bc_* fetch keywords are broken.

Since the split between connections and conn-stream objects, this
keywords are broken.

This patch must be backported in 1.8

7 years agoBUG/MEDIUM: http: Switch the HTTP response in tunnel mode as earlier as possible
Christopher Faulet [Fri, 2 Feb 2018 14:54:15 +0000 (15:54 +0100)] 
BUG/MEDIUM: http: Switch the HTTP response in tunnel mode as earlier as possible

When the body length is undefined (no Content-Length or Transfer-Encoding
headers), The reponse remains in ending mode, waiting the request is done. So,
most of time this is not a problem because the resquest is done before the
response. But when a client sends data to a server that replies without waiting
all the data, it is really not desirable to wait the end of the request to
finish the response.

This bug was introduced when the tunneling of the request and the reponse was
refactored, in commit 4be980391 ("MINOR: http: Switch requests/responses in
TUNNEL mode only by checking txn flag").

This patch should be backported in 1.8 and 1.7.

7 years agoBUG/MEDIUM: ssl: Shutdown the connection for reading on SSL_ERROR_SYSCALL
Christopher Faulet [Mon, 19 Feb 2018 13:25:15 +0000 (14:25 +0100)] 
BUG/MEDIUM: ssl: Shutdown the connection for reading on SSL_ERROR_SYSCALL

When SSL_read returns SSL_ERROR_SYSCALL and errno is unset or set to EAGAIN, the
connection must be shut down for reading. Else, the connection loops infinitly,
consuming all the CPU.

The bug was introduced in the commit 7e2e50500 ("BUG/MEDIUM: ssl: Don't always
treat SSL_ERROR_SYSCALL as unrecovarable."). This patch must be backported in
1.8 too.

7 years agoMINOR: sample: add a new "concat" converter
Willy Tarreau [Mon, 19 Feb 2018 14:34:12 +0000 (15:34 +0100)] 
MINOR: sample: add a new "concat" converter

It's always a pain not to be able to combine variables. This commit
introduces the "concat" converter, which appends a delimiter, a variable's
contents and another delimiter to an existing string. The result is a string.
This makes it easier to build composite variables made of other variables.

7 years agoBUG/MINOR: ssl/threads: Make management of the TLS ticket keys files thread-safe
Christopher Faulet [Fri, 16 Feb 2018 10:23:49 +0000 (11:23 +0100)] 
BUG/MINOR: ssl/threads: Make management of the TLS ticket keys files thread-safe

A TLS ticket keys file can be updated on the CLI and used in same time. So we
need to protect it to be sure all accesses are thread-safe. Because updates are
infrequent, a R/W lock has been used.

This patch must be backported in 1.8

7 years agoDOC: cfgparse: Warn on option (tcp|http)log in backend
Tim Duesterhus [Mon, 5 Feb 2018 19:52:27 +0000 (20:52 +0100)] 
DOC: cfgparse: Warn on option (tcp|http)log in backend

The option does not seem to have any effect since at least haproxy
1.3. Also the `log-format` directive already warns when being used
in a backend.

7 years agoDOC: lua: new prototype for function "register_action()"
Thierry FOURNIER [Mon, 12 Feb 2018 13:46:54 +0000 (14:46 +0100)] 
DOC: lua: new prototype for function "register_action()"

This patch should be backported to version 1.8.

7 years agoBUG/MINOR: init: Add missing brackets in the code parsing -sf/-st
Aurélien Nephtali [Sat, 17 Feb 2018 19:53:11 +0000 (20:53 +0100)] 
BUG/MINOR: init: Add missing brackets in the code parsing -sf/-st

The codes tries to strip trailing spaces of arguments but due to missing
brackets, it will always exit.

It can be reproduced with this (silly) example:

$ haproxy -f /etc/haproxy/haproxy.cfg -sf 1234 "1235 " 1236
$ echo $?
1

This was introduced in commit 236062f7c ("MINOR: init: emit warning when
-sf/-sd cannot parse argument")

Signed-off-by: Aurélien Nephtali <aurelien.nephtali@gmail.com>
7 years agoBUILD/MINOR: memory: stdint is needed for uintptr_t
David Carlier [Sun, 18 Feb 2018 19:36:42 +0000 (19:36 +0000)] 
BUILD/MINOR: memory: stdint is needed for uintptr_t

stdint.h is needed on OpenBSD for uintptr_t type.

7 years agoBUG/MEDIUM: ssl: Don't always treat SSL_ERROR_SYSCALL as unrecovarable.
Olivier Houchard [Tue, 13 Feb 2018 14:17:23 +0000 (15:17 +0100)] 
BUG/MEDIUM: ssl: Don't always treat SSL_ERROR_SYSCALL as unrecovarable.

Bart Geesink reported some random errors appearing under the form of
termination flags SD in the logs for connections involving SSL traffic
to reach the servers.

Tomek Gacek and Mateusz Malek finally narrowed down the problem to commit
c2aae74 ("MEDIUM: ssl: Handle early data with OpenSSL 1.1.1"). It happens
that the special case of SSL_ERROR_SYSCALL isn't handled anymore since
this commit.

SSL_read() might return <= 0, and SSL_get_erro() return SSL_ERROR_SYSCALL,
without meaning the connection is gone. Before flagging the connection
as in error, check the errno value.

This should be backported to 1.8.

7 years agoBUG/MEDIUM: threads: fix the double CAS implementation for ARMv7
Willy Tarreau [Wed, 14 Feb 2018 13:16:28 +0000 (14:16 +0100)] 
BUG/MEDIUM: threads: fix the double CAS implementation for ARMv7

Commit f61f0cb ("MINOR: threads: Introduce double-width CAS on x86_64
and arm.") introduced the double CAS. But the ARMv7 version is bogus,
it uses the value of the pointers instead of dereferencing them. When
lucky, it simply doesn't build due to impossible registers combinations.
Otherwise it will immediately crash at run time when facing traffic.

No backport is needed, this bug was introduced in 1.9-dev.

7 years agoBUG/MINOR: fd/threads: properly lock the FD before adding it to the fd cache.
Olivier Houchard [Thu, 8 Feb 2018 16:03:33 +0000 (16:03 +0000)] 
BUG/MINOR: fd/threads: properly lock the FD before adding it to the fd cache.

It was believed that it was useless to lock the "prev" field when adding a
FD. However, if there's only one element in the FD cache, and that element
removes itself from the fd cache, and another FD is added before the first
add completed, there's a risk of losing elements. To prevent that, lock the
"prev" field, so that such a removal will wait until the add completed.

7 years agoBUG/MINOR: config: don't emit a warning when global stats is incompletely configured
Willy Tarreau [Thu, 8 Feb 2018 08:55:09 +0000 (09:55 +0100)] 
BUG/MINOR: config: don't emit a warning when global stats is incompletely configured

Martin Brauer reported an unexpected warning when some parts of the
global stats are defined but not the listening address, like below :

  global
    #stats socket run/admin.sock mode 660 level admin
    stats timeout 30s

Then haproxy complains :
  [WARNING] 334/150131 (23086) : config : frontend 'GLOBAL' has no
'bind' directive. Please declare it as a backend if this was intended.

This is because of the check for a bind-less frontend (the global section
creates a frontend for the stats). There's no clean fix for this one, so
here we're simply checking that the frontend is not the global stats one
before emitting the warning.

This patch should be backported to all stable versions.

7 years agoDOC: Mention -Ws in the list of available options
Pavlos Parissis [Wed, 7 Feb 2018 20:42:16 +0000 (21:42 +0100)] 
DOC: Mention -Ws in the list of available options

7 years agoDOC: Describe routing impact of using interface keyword on bind lines
Jérôme Magnin [Wed, 7 Feb 2018 10:39:58 +0000 (11:39 +0100)] 
DOC: Describe routing impact of using interface keyword on bind lines

7 years agoBUILD: fd/threads: fix breakage build breakage without threads
Willy Tarreau [Tue, 6 Feb 2018 11:00:27 +0000 (12:00 +0100)] 
BUILD: fd/threads: fix breakage build breakage without threads

The last fix for the volatile dereference made use of pl_deref_int()
which is unknown when building without threads. Let's simply open-code
it instead. No backport needed.

7 years agoMINOR: init: emit warning when -sf/-sd cannot parse argument
Chris Lane [Mon, 5 Feb 2018 23:15:44 +0000 (23:15 +0000)] 
MINOR: init: emit warning when -sf/-sd cannot parse argument

Previously, -sf and -sd command line parsing used atol which cannot
detect errors.  I had a problem where I was doing -sf "$pid1 $pid2 $pid"
and it was sending the gracefully terminate signal only to the first pid.
The change uses strtol and checks endptr and errno to see if the parsing
worked.  It will exit when the pid list is not parsed.

[wt: this should be backported to 1.8]

7 years agoBUG/MEDIUM: standard: Fix memory leak in str2ip2()
Tim Duesterhus [Sun, 21 Jan 2018 21:11:17 +0000 (22:11 +0100)] 
BUG/MEDIUM: standard: Fix memory leak in str2ip2()

An haproxy compiled with:

> make -j4 all TARGET=linux2628 USE_GETADDRINFO=1

And running with a configuration like this:

  defaults
   log global
   mode http
   option httplog
   option dontlognull
   timeout connect 5000
   timeout client  50000
   timeout server  50000

  frontend fe
   bind :::8080 v4v6

   default_backend be

  backend be
   server s example.com:80 check

Will leak memory inside `str2ip2()`, because the list `result` is not
properly freed in success cases:

==18875== 140 (76 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 87 of 111
==18875==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18875==    by 0x537A565: gaih_inet (getaddrinfo.c:1223)
==18875==    by 0x537DD5D: getaddrinfo (getaddrinfo.c:2425)
==18875==    by 0x4868E5: str2ip2 (standard.c:733)
==18875==    by 0x43F28B: srv_set_addr_via_libc (server.c:3767)
==18875==    by 0x43F50A: srv_iterate_initaddr (server.c:3879)
==18875==    by 0x43F50A: srv_init_addr (server.c:3944)
==18875==    by 0x475B30: init (haproxy.c:1595)
==18875==    by 0x40406D: main (haproxy.c:2479)

The exists as long as the usage of getaddrinfo in that function exists,
it was introduced in commit:
d5f4328efd5f4eaa7c89cad9773124959195430a

v1.5-dev8 is the first tag containing this comment, the fix
should be backported to haproxy 1.5 and newer.

7 years agoBUG/MINOR: time/threads: ensure the adjusted time is always correct
Willy Tarreau [Mon, 5 Feb 2018 19:11:38 +0000 (20:11 +0100)] 
BUG/MINOR: time/threads: ensure the adjusted time is always correct

In the time offset calculation loop, we ensure we only commit the new
date once it's futher in the future than the current one. However there
is a small issue here on 32-bit platforms : if global_now is written in
two cycles by another thread, starting with the tv_sec part, and the
current thread reads it in the middle of a change, it may compute a
wrong "adjusted" value on the first round, with the new (larger) tv_sec
and the old (large) tv_usec. This will be detected as the CAS will fail,
and another attempt will be made, but this time possibly with too large
an adusted value, pushing the date further than needed (at worst almost
one second).

This patch addresses this by using a temporary adjusted time in the loop
that always restarts from the last known one, and by assigning the result
to the final value only once the CAS succeeds.

The impact is very limited, it may cause the time to advance in small
jumps on 32 bit platforms and in the worst case some timeouts might
expire 1 second too early.

This fix should be backported to 1.8.

7 years agoMINOR: fd: reorder fd_add_to_fd_list()
Willy Tarreau [Mon, 5 Feb 2018 16:52:24 +0000 (17:52 +0100)] 
MINOR: fd: reorder fd_add_to_fd_list()

The function was cleaned up a bit from duplicated parts inherited from
the initial attempt at getting it to work. It's a bit smaller and cleaner
this way.

7 years agoMINOR: fd: remove the unneeded last CAS when adding an fd to the list
Willy Tarreau [Mon, 5 Feb 2018 16:40:21 +0000 (17:40 +0100)] 
MINOR: fd: remove the unneeded last CAS when adding an fd to the list

This was a leftover from the initial code where two threads could fight
for the list's tail.

7 years agoBUG/MINOR: fd/threads: properly dereference fdcache as volatile
Willy Tarreau [Mon, 5 Feb 2018 18:43:30 +0000 (19:43 +0100)] 
BUG/MINOR: fd/threads: properly dereference fdcache as volatile

In fd_rm_from_fd_list(), we have loops waiting for another change to
complete, in case we don't have support for a double CAS. But these
ones fail to place a compiler barrier or to dereference the fdcache
as a volatile, resulting in an endless loop on the first collision,
which is visible when run on MIPS32.

No backport needed.

7 years agoMINOR: fd: move the fd_{add_to,rm_from}_fdlist functions to fd.c
Willy Tarreau [Mon, 5 Feb 2018 16:14:55 +0000 (17:14 +0100)] 
MINOR: fd: move the fd_{add_to,rm_from}_fdlist functions to fd.c

There's not point inlining these huge functions, better move them to real
functions in fd.c.

7 years agoMEDIUM: poller: use atomic ops to update the fdtab mask
Willy Tarreau [Thu, 25 Jan 2018 17:06:46 +0000 (18:06 +0100)] 
MEDIUM: poller: use atomic ops to update the fdtab mask

We don't need to lock the fdtab[].lock anymore since we only have one
modification left (update update_mask). Let's use an atomic AND instead.

7 years agoMEDIUM: fd: make updt_fd_polling() use atomics
Willy Tarreau [Wed, 17 Jan 2018 21:57:54 +0000 (22:57 +0100)] 
MEDIUM: fd: make updt_fd_polling() use atomics

It only needed a test-and-set and an atomic increment so we can take it
out of the fd lock now.

7 years agoCLEANUP: fd: remove the now unused fd_compute_new_polled_status() function
Willy Tarreau [Thu, 25 Jan 2018 16:16:55 +0000 (17:16 +0100)] 
CLEANUP: fd: remove the now unused fd_compute_new_polled_status() function

It's not used anymore since the new state is calculated on the fly
during every update. Let's remove this function.

7 years agoMINOR: select: get rid of the now useless fd_compute_new_polled_status()
Willy Tarreau [Thu, 25 Jan 2018 16:15:43 +0000 (17:15 +0100)] 
MINOR: select: get rid of the now useless fd_compute_new_polled_status()

Do not call it anymore and avoid updating the fdstate.

7 years agoMINOR: poll: get rid of the now useless fd_compute_new_polled_status()
Willy Tarreau [Thu, 25 Jan 2018 16:15:18 +0000 (17:15 +0100)] 
MINOR: poll: get rid of the now useless fd_compute_new_polled_status()

Do not call it anymore and avoid updating the fdstate.

7 years agoMINOR: kqueue: get rid of the now useless fd_compute_new_polled_status()
Willy Tarreau [Thu, 25 Jan 2018 13:57:25 +0000 (14:57 +0100)] 
MINOR: kqueue: get rid of the now useless fd_compute_new_polled_status()

Do not call it anymore and avoid updating the fdstate.

7 years agoMINOR: epoll: get rid of the now useless fd_compute_new_polled_status()
Willy Tarreau [Wed, 17 Jan 2018 20:51:21 +0000 (21:51 +0100)] 
MINOR: epoll: get rid of the now useless fd_compute_new_polled_status()

Do not call it anymore and avoid updating the fdstate. We're not very far
from removing the fd lock it seems.

7 years agoMAJOR: fd: compute the new fd polling state out of the fd lock
Willy Tarreau [Wed, 17 Jan 2018 20:25:57 +0000 (21:25 +0100)] 
MAJOR: fd: compute the new fd polling state out of the fd lock

Each fd_{may|cant|stop|want}_{recv|send} function sets or resets a
single bit at once, then recomputes the need for updates, and then
the new cache state. Later, pollers will compute the new polling
state based on the resulting operations here. In fact the conditions
are so simple that they can be performed by a single "if", or sometimes
even optimized away.

This means that in practice a simple compare-and-swap operation if often
enough to set the new value inluding the new polling state, and that only
the cache and fdupdt have to be performed under the lock. Better, for the
most common operations (fd_may_{recv,send}, used by the pollers), a simple
atomic OR is needed.

This patch does this for the fd_* functions above and it doesn't yet
remove the now useless fd_compute_new_polling_status() because it's still
used by other pollers. A pure connection rate test shows a 1% performance
increase.

7 years agoMEDIUM: fd/threads: Make sure we don't miss a fd cache entry.
Olivier Houchard [Wed, 31 Jan 2018 17:07:29 +0000 (18:07 +0100)] 
MEDIUM: fd/threads: Make sure we don't miss a fd cache entry.

An fd cache entry might be removed and added at the end of the list, while
another thread is parsing it, if that happens, we may miss fd cache entries,
to avoid that, add a new field in the struct fdtab, "added_mask", which
contains a mask for potentially affected threads, if it is set, the
corresponding thread will set its bit in fd_cache_mask, to avoid waiting in
poll while it may have more work to do.

7 years agoMAJOR: fd/threads: Make the fdcache mostly lockless.
Olivier Houchard [Wed, 24 Jan 2018 17:17:56 +0000 (18:17 +0100)] 
MAJOR: fd/threads: Make the fdcache mostly lockless.

Create a local, per-thread, fdcache, for file descriptors that only belongs
to one thread, and make the global fd cache mostly lockless, as we can get
a lot of contention on the fd cache lock.

7 years agoMINOR: pools/threads: Implement lockless memory pools.
Olivier Houchard [Wed, 24 Jan 2018 17:38:31 +0000 (18:38 +0100)] 
MINOR: pools/threads: Implement lockless memory pools.

On CPUs that support a double-width compare-and-swap, implement lockless
pools.

7 years agoMINOR: threads: add test and set/reset operations
Willy Tarreau [Thu, 25 Jan 2018 16:43:58 +0000 (17:43 +0100)] 
MINOR: threads: add test and set/reset operations

This just adds a set of naive bts/btr operations based on OR/AND. Later
it could rely on pl_bts/btr to use arch-specific versions if needed.

7 years agoMINOR: threads: Introduce double-width CAS on x86_64 and arm.
Olivier Houchard [Thu, 21 Dec 2017 16:13:05 +0000 (17:13 +0100)] 
MINOR: threads: Introduce double-width CAS on x86_64 and arm.

Introduce double-width compare-and-swap on arches that support it, right now
x86_64, arm, and aarch64.
Also introduce functions to do memory barriers.

7 years agoMINOR: compiler: introduce offsetoff().
Olivier Houchard [Wed, 24 Jan 2018 17:17:06 +0000 (18:17 +0100)] 
MINOR: compiler: introduce offsetoff().

Add a offsetof() macro, if it is no there already.

7 years agoMINOR: early data: Never remove the CO_FL_EARLY_DATA flag.
Olivier Houchard [Wed, 29 Nov 2017 18:51:19 +0000 (19:51 +0100)] 
MINOR: early data: Never remove the CO_FL_EARLY_DATA flag.

It may be useful to keep the CO_FL_EARLY_DATA flag, so that we know early
data were used, so instead of doing this, only add the Early-data header,
and have the sample fetch ssl_fc_has_early return 1, if CO_FL_EARLY_DATA is
set, and if the handshake isn't done yet.

7 years agoMINOR: early data: Don't rely on CO_FL_EARLY_DATA to wake up streams.
Olivier Houchard [Mon, 27 Nov 2017 17:41:32 +0000 (18:41 +0100)] 
MINOR: early data: Don't rely on CO_FL_EARLY_DATA to wake up streams.

Instead of looking for CO_FL_EARLY_DATA to know if we have to try to wake
up a stream, because it is waiting for a SSL handshake, instead add a new
conn_stream flag, CS_FL_WAIT_FOR_HS. This way we don't have to rely on
CO_FL_EARLY_DATA, and we will only wake streams that are actually waiting.

7 years agoMINOR: init: make stdout unbuffered
Olivier Houchard [Sat, 3 Feb 2018 14:15:21 +0000 (15:15 +0100)] 
MINOR: init: make stdout unbuffered

printf is unusable for debugging without this, and printf() is not used
for anything else.

7 years agoMINOR: spoe: Add max-waiting-frames directive in spoe-agent configuration
Christopher Faulet [Thu, 25 Jan 2018 14:32:22 +0000 (15:32 +0100)] 
MINOR: spoe: Add max-waiting-frames directive in spoe-agent configuration

This is the maximum number of frames waiting for an acknowledgement on the same
connection. This value is only used when the pipelinied or asynchronus exchanges
between HAProxy and SPOA are enabled. By default, it is set to 20.

7 years agoMINOR: spoa_example: Count the number of frames processed by each worker
Christopher Faulet [Tue, 23 Jan 2018 13:46:51 +0000 (14:46 +0100)] 
MINOR: spoa_example: Count the number of frames processed by each worker

This is done for debug purpose. This way, it is easy to know if the load is
equally distributed between workers.

7 years agoMEDIUM: spoe: Use an ebtree to manage idle applets
Christopher Faulet [Wed, 24 Jan 2018 15:37:57 +0000 (16:37 +0100)] 
MEDIUM: spoe: Use an ebtree to manage idle applets

Instead of using a list of applets with idle ones in front, we now use an
ebtree. Aapplets in the tree are idle by definition. And the key is the applet's
weight. When a new frame is queued, the first idle applet (with the lowest
weight) is woken up and its weight is increased by one. And when an applet sends
a frame to a SPOA, its weight is decremented by one.

This is empirical, but it should avoid to overuse a very few number of applets
and increase the balancing between idle applets.

7 years agoMINOR: spoe: Count the number of frames waiting for an ack for each applet
Christopher Faulet [Wed, 24 Jan 2018 15:23:03 +0000 (16:23 +0100)] 
MINOR: spoe: Count the number of frames waiting for an ack for each applet

So it is easier to respect the max_fpa value. This is no more the maximum frames
processed by an applet at each loop but the maximum frames waiting for an ack
for a specific applet.

The function spoe_handle_processing_appctx has been rewritten accordingly.

7 years agoMINOR: spoe: Replace sending_rate by a frequency counter
Christopher Faulet [Wed, 24 Jan 2018 15:13:48 +0000 (16:13 +0100)] 
MINOR: spoe: Replace sending_rate by a frequency counter

sending_rate was a counter used to evaluate the SPOE capacity to process
frames. Because it was not really accurrate, it has been replaced by a frequency
counter representing the number of frames handled by the SPOE per second. We
just check this counter is higher than the number of streams waiting for a
reply. If not, a new applet is created.

7 years agoMINOR: spoe: Always link a SPOE context with the applet processing it
Christopher Faulet [Wed, 24 Jan 2018 14:59:32 +0000 (15:59 +0100)] 
MINOR: spoe: Always link a SPOE context with the applet processing it

This was already done for fragmented frames. Now, this is true for all
frames.

7 years agoMINOR: spoe: Remove check on min_applets number when a SPOE context is queued
Christopher Faulet [Wed, 24 Jan 2018 14:49:45 +0000 (15:49 +0100)] 
MINOR: spoe: Remove check on min_applets number when a SPOE context is queued

The calculation of a minimal number of active applets was really empirical and
finally useless. On heavy load, there are always many active applets (most of
time, more than the minimal required) and when the load is low, there is no
reason to keep unused applets opened.

Because of this change, the flag SPOE_APPCTX_FL_PERSIST is now unused. So it has
been removed.

7 years agoBUG/MEDIUM: spoe: Allow producer to read and to forward shutdown on request side
Christopher Faulet [Thu, 1 Feb 2018 07:45:45 +0000 (08:45 +0100)] 
BUG/MEDIUM: spoe: Allow producer to read and to forward shutdown on request side

This is mandatory to correctly set right timeout on the stream. Else the client
timeout is never set. So only SPOE processing timeout will be evaluated. If it
is not defined (ie infinity), the stream can be blocked for a while, waiting the
SPOA reply. Of course, this is not a good idea to let the SPOE processing
timeout undefined, but it can happen.

This patch must be backported in 1.8.

7 years agoBUG/MEDIUM: spoe: Always try to receive or send the frame to detect shutdowns
Christopher Faulet [Thu, 1 Feb 2018 07:45:22 +0000 (08:45 +0100)] 
BUG/MEDIUM: spoe: Always try to receive or send the frame to detect shutdowns

Before, we checked if the buffer was allocated or not to avoid sending or
receiving a frame. This was done to not call ci_putblk or co_getblk if there is
nothing to do. But the checks on the buffers are also done in these
functions. So this is not mandatory here. But in these functions, the channel
state is also checked, so an error is returned if it is closed. By skipping the
call, we also skip the checks on the channel state, delaying shutdowns
detection.

Now, we always try to send or receive a frame. So if the corresponding channel
is closed, we can immediatly handle the error.

This patch must be backported in 1.8

7 years agoMINOR: introduce proxy-v2-options for send-proxy-v2
Emmanuel Hocdet [Thu, 1 Feb 2018 14:20:32 +0000 (15:20 +0100)] 
MINOR: introduce proxy-v2-options for send-proxy-v2

Proxy protocol v2 can transport many optional informations. To avoid
send-proxy-v2-* explosion, this patch introduce proxy-v2-options parameter
and will allow to write: "send-proxy-v2 proxy-v2-options ssl,cert-cn".

7 years agoDOC: don't suggest using http-server-close
Lukas Tribus [Thu, 1 Feb 2018 22:58:59 +0000 (23:58 +0100)] 
DOC: don't suggest using http-server-close

Remove the old suggestion to use http-server-close mode, from the
beginnings of keep-alive mode in commit 16bfb021 "MINOR: config: add
option http-keep-alive").

We made http-keep-alive default in commit 70dffdaa "MAJOR: http:
switch to keep-alive mode by default".

7 years agoBUG/MINOR: epoll/threads: only call epoll_ctl(DEL) on polled FDs
Willy Tarreau [Wed, 31 Jan 2018 08:49:29 +0000 (09:49 +0100)] 
BUG/MINOR: epoll/threads: only call epoll_ctl(DEL) on polled FDs

Commit d9e7e36 ("BUG/MEDIUM: epoll/threads: use one epoll_fd per thread")
addressed an issue with the polling and required that cloned FDs are removed
from all polling threads on close. But in fact it does it for all bound
threads, some of which may not necessarily poll the FD. This is harmless,
but it may also make it harder later to deal with FD migration between
threads. Better use polled_mask which only reports threads still aware
of the FD instead of thread_mask.

This fix should be backported to 1.8.

7 years agoMINOR: stick-tables: Adds support for new "gpc1" and "gpc1_rate" counters.
Frédéric Lécaille [Mon, 29 Jan 2018 14:22:53 +0000 (15:22 +0100)] 
MINOR: stick-tables: Adds support for new "gpc1" and "gpc1_rate" counters.

Implement exactly the same code as this has been done for "gpc0" and "gpc0_rate"
counters.

7 years agoBUG/MINOR: threads: Update labels array because of changes in lock_label enum
Christopher Faulet [Tue, 30 Jan 2018 10:04:29 +0000 (11:04 +0100)] 
BUG/MINOR: threads: Update labels array because of changes in lock_label enum

Recent changes to the enum were not synchronized with the lock debugging
code. Now we use a switch/case instead of an array so that the compiler
throws a warning if there is any inconsistency.

To be backported to 1.8 (at least to add the START entry).

7 years agoMINOR: fd: pass the iocb and owner to fd_insert()
Willy Tarreau [Thu, 25 Jan 2018 06:22:13 +0000 (07:22 +0100)] 
MINOR: fd: pass the iocb and owner to fd_insert()

fd_insert() is currently called just after setting the owner and iocb,
but proceeding like this prevents the operation from being atomic and
requires a lock to protect the maxfd computation in another thread from
meeting an incompletely initialized FD and computing a wrong maxfd.
Fortunately for now all fdtab[].owner are set before calling fd_insert(),
and the first lock in fd_insert() enforces a memory barrier so the code
is safe.

This patch moves the initialization of the owner and iocb to fd_insert()
so that the function will be able to properly arrange its operations and
remain safe even when modified to become lockless. There's no other change
beyond the internal API.

7 years agoMEDIUM: poll: don't use the old FD state anymore
Willy Tarreau [Thu, 25 Jan 2018 16:11:33 +0000 (17:11 +0100)] 
MEDIUM: poll: don't use the old FD state anymore

The polling updates are now performed exactly like the epoll/kqueue
ones : only the new polled state is considered, and the previous one
is checked using polled_mask. The only specific stuff here is that
the fd state is shared between all threads, so an FD removal has to
be done only once.

7 years agoMEDIUM: select: don't use the old FD state anymore
Willy Tarreau [Thu, 25 Jan 2018 16:09:33 +0000 (17:09 +0100)] 
MEDIUM: select: don't use the old FD state anymore

The polling updates are now performed exactly like the epoll/kqueue
ones : only the new polled state is considered, and the previous one
is checked using polled_mask. The only specific stuff here is that
the fd state is shared between all threads, so an FD removal has to
be done only once.

7 years agoMEDIUM: fd: use atomic ops for hap_fd_{clr,set} and remove poll_lock
Willy Tarreau [Thu, 25 Jan 2018 15:59:09 +0000 (16:59 +0100)] 
MEDIUM: fd: use atomic ops for hap_fd_{clr,set} and remove poll_lock

Now that we can use atomic ops to set/clear an fd occurrence in an
fd_set, we don't need the poll_lock anymore. Let's remove it.

7 years agoMEDIUM: select: make use of hap_fd_* functions
Willy Tarreau [Thu, 25 Jan 2018 15:48:46 +0000 (16:48 +0100)] 
MEDIUM: select: make use of hap_fd_* functions

Given that FD_{CLR,SET} are not always guaranteed to be thread safe,
let's fall back to using the hap_fd_* functions as we used to till
1.5-dev18 and as poll() continues to use. This will make it easier
to remove the poll_lock.

7 years agoMINOR: fd: move the hap_fd_{clr,set,isset} functions to fd.h
Willy Tarreau [Thu, 25 Jan 2018 15:37:04 +0000 (16:37 +0100)] 
MINOR: fd: move the hap_fd_{clr,set,isset} functions to fd.h

These functions were created for poll() in 1.5-dev18 (commit 80da05a4) to
replace the previous FD_{CLR,SET,ISSET} that were shared with select()
because some libcs enforce a limit on FD_SET. But FD_SET doesn't seem
to be universally MT-safe, requiring locks in the select() code that
are not needed in the poll code. So let's move back to the initial
situation where we used to only use bit fields, since that has been in
use since day one without a problem, and let's use these hap_fd_*
functions instead of FD_*.

This patch only moves the functions to fd.h and revives hap_fd_isset()
that was recently removed to kill an "unused" warning.

7 years agoCLEANUP: fd: remove the unused "new" field
Willy Tarreau [Sat, 20 Jan 2018 22:59:40 +0000 (23:59 +0100)] 
CLEANUP: fd: remove the unused "new" field

This field has been unused since 1.6, it's only updated and never
tested. Let's remove it.

7 years agoMINOR: poll: more accurately compute the new maxfd in the loop
Willy Tarreau [Mon, 29 Jan 2018 14:56:24 +0000 (15:56 +0100)] 
MINOR: poll: more accurately compute the new maxfd in the loop

Last commit 173d995 ("MEDIUM: polling: start to move maxfd computation
to the pollers") moved the maxfd computation to the polling loop, but
it still adds an entry when removing an fd, forcing the next loop to
seek from further away than necessary. Let's only update the max when
actually adding an entry.

7 years agoCLEANUP: fd/threads: remove the now unused fdtab_lock
Willy Tarreau [Mon, 29 Jan 2018 14:24:37 +0000 (15:24 +0100)] 
CLEANUP: fd/threads: remove the now unused fdtab_lock

It was only used to protect maxfd computation and is not needed
anymore.

7 years agoMEDIUM: polling: start to move maxfd computation to the pollers
Willy Tarreau [Fri, 26 Jan 2018 20:48:23 +0000 (21:48 +0100)] 
MEDIUM: polling: start to move maxfd computation to the pollers

Since only select() and poll() still make use of maxfd, let's move
its computation right there in the pollers themselves, and only
during each fd update pass. The computation doesn't need a lock
anymore, only a few atomic ops. It will be accurate, be done much
less often and will not be required anymore in the FD's fast patch.

This provides a small performance increase of about 1% in connection
rate when using epoll since we get rid of this computation which was
performed under a lock.

7 years agoMINOR: fd: don't report maxfd in alert messages
Willy Tarreau [Mon, 29 Jan 2018 14:06:04 +0000 (15:06 +0100)] 
MINOR: fd: don't report maxfd in alert messages

The listeners and connectors may complain that process-wide or
system-wide FD limits have been reached and will in this case report
maxfd as the limit. This is wrong in fact since there's no reason for
the whole FD space to be contiguous when the total # of FD is reached.
A better approach would consist in reporting the accurate number of
opened FDs, but this is pointless as what matters here is to give a
hint about what might be wrong. So let's simply report the configured
maxsock, which will generally explain why the process' limits were
reached, which is the most common reason. This removes another
dependency on maxfd.

7 years agoMINOR: polling: make epoll and kqueue not depend on maxfd anymore
Willy Tarreau [Mon, 29 Jan 2018 13:58:02 +0000 (14:58 +0100)] 
MINOR: polling: make epoll and kqueue not depend on maxfd anymore

Maxfd is really only useful to poll() and select(), yet epoll and
kqueue reference it almost by mistake :
  - cloning of the initial FDs (maxsock should be used here)
  - max polled events, it's maxpollevents which should be used here.

Let's fix these places.

7 years agoBUG/MINOR: cli: use global.maxsock and not maxfd to list all FDs
Willy Tarreau [Mon, 29 Jan 2018 14:17:05 +0000 (15:17 +0100)] 
BUG/MINOR: cli: use global.maxsock and not maxfd to list all FDs

The "show fd" command on the CLI doesn't list the last FD in use since
it doesn't include maxfd. We don't need to use maxfd here anyway as
global.maxsock will do the job pretty well and removes this dependency.
This patch may be backported to 1.8.

7 years agoMINOR: config: Enable tracking of up to MAX_SESS_STKCTR stick counters.
Frédéric Lécaille [Mon, 29 Jan 2018 11:05:07 +0000 (12:05 +0100)] 
MINOR: config: Enable tracking of up to MAX_SESS_STKCTR stick counters.

This patch really adds support for up to MAX_SESS_STKCTR stick counters.

7 years agoMEDIUM: sample: Add IPv6 support to the ipmask converter
Tim Duesterhus [Thu, 25 Jan 2018 15:24:51 +0000 (16:24 +0100)] 
MEDIUM: sample: Add IPv6 support to the ipmask converter

Add an optional second parameter to the ipmask converter that specifies
the number of bits to mask off IPv6 addresses.

If the second parameter is not given IPv6 addresses fail to mask (resulting
in an empty string), preserving backwards compatibility: Previously
a sample like `src,ipmask(24)` failed to give a result for IPv6 addresses.

This feature can be tested like this:

  defaults
   log global
   mode http
   option httplog
   option dontlognull
   timeout connect 5000
   timeout client  50000
   timeout server  50000

  frontend fe
   bind :::8080 v4v6

   # Masked IPv4 for IPv4, empty for IPv6 (with and without this commit)
   http-response set-header Test %[src,ipmask(24)]
   # Correctly masked IP addresses for both IPv4 and IPv6
   http-response set-header Test2 %[src,ipmask(24,ffff:ffff:ffff:ffff::)]
   # Correctly masked IP addresses for both IPv4 and IPv6
   http-response set-header Test3 %[src,ipmask(24,64)]

   default_backend be

  backend be
   server s example.com:80

Tested-By: Jarno Huuskonen <jarno.huuskonen@uef.fi>
7 years agoMINOR: config: Add support for ARGT_MSK6
Tim Duesterhus [Thu, 25 Jan 2018 15:24:50 +0000 (16:24 +0100)] 
MINOR: config: Add support for ARGT_MSK6

This commit adds support for ARGT_MSK6 to make_arg_list().

7 years agoMINOR: standard: Add str2mask6 function
Tim Duesterhus [Thu, 25 Jan 2018 15:24:49 +0000 (16:24 +0100)] 
MINOR: standard: Add str2mask6 function

This new function mirrors the str2mask() function for IPv4 addresses.

This commit is in preparation to support ARGT_MSK6.

7 years agoCLEANUP: standard: Use len2mask4 in str2mask
Tim Duesterhus [Thu, 25 Jan 2018 15:24:48 +0000 (16:24 +0100)] 
CLEANUP: standard: Use len2mask4 in str2mask

The len2mask4 function was introduced in commit:
70473a5f8c56d8ec2e837b9b66443dc252b24da9
which is about six years later than the commit that introduced the
str2mask function:
2937c0dd20f2f3c0065b671bbfe3fafcd8862eaf

This is a clean up in preparation for a str2mask6 function which
will use len2mask6.

7 years agoCLEANUP: Fix typo in ARGT_MSK6 comment
Tim Duesterhus [Thu, 25 Jan 2018 15:24:47 +0000 (16:24 +0100)] 
CLEANUP: Fix typo in ARGT_MSK6 comment

The incorrect comment was introduced in commit:
2ac5718dbd4ec722ece228e9f613d2be74eee9da

v1.5-dev9 is the first tag containing this comment, the fix
should be backported to haproxy 1.5 and newer.

7 years agoBUG/MINOR: sample: Fix output type of c_ipv62ip
Tim Duesterhus [Thu, 25 Jan 2018 15:24:46 +0000 (16:24 +0100)] 
BUG/MINOR: sample: Fix output type of c_ipv62ip

c_ipv62ip failed to set the output type of the cast to SMP_T_IPV4
even for a successful conversion.

This bug exists as of commit cc4d1716a2e72516c2505a6459a9ddbbfb186da2
which is the first commit adding this function.

v1.6-dev4 is the first tag containing this commit, the fix should
be backported to haproxy 1.6 and newer.