Commit Graph

1149 Commits

Author SHA1 Message Date
Luca Boccassi
2347a76413 Problem: build broken on debian/hurd
Solution: fix it
2021-01-16 17:48:29 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Luca Boccassi
41c4ce1817 Problem: ZMQ_PUB broken on ZMQ_WS
Solution: encode subscribe/cancel messages until there are appropriate
opcodes.
Regression introduced by 253e9dd27b

Fixes https://github.com/zeromq/libzmq/issues/4101
2020-12-23 17:44:07 +00:00
Luca Boccassi
d77c60a0db Problem: tests fails to receive with EAGAIN on slow architectures
Solution: remove arbitrary timeouts, as they are testing reliable pipes
with no contention, so if it can connect eventually it has to
work. The overall test timeout covers cases where it doesn't.

If tests want to use receive timeouts, they need to handle EAGAIN
properly.
2020-11-18 13:29:33 +00:00
Luca Boccassi
792ffe4d7a Problem: zmq_ctx_get API broken
Solution: restore EINVAL as errno on unknown option.
Broken by https://github.com/zeromq/libzmq/pull/3642 which started to
return EFAULT instead
2020-09-10 22:37:01 +01:00
Luca Boccassi
e708623c12 Problem: no fuzzing coverage for ZMQ_STREAM
Solution: add tests
2020-09-06 11:05:15 +01:00
Simon Giesecke
2741e93361 Problem: no test for (invalid) too long ipc endpoint name
Solution: add test
2020-09-05 13:17:13 +02:00
Simon Giesecke
90d5cf29d8 Problem: no test for (invalid) empty abstract ipc endpoint name
Solution: add test
2020-09-05 13:17:13 +02:00
Simon Giesecke
c6301206dc Problem: no tests for ZMQ_TCP_ACCEPT_FILTER
Solution: add some tests
2020-09-04 15:51:33 +02:00
Luca Boccassi
5b0956c381 Problem: test_socket_options_fuzzer does not work
Solution: fix it
2020-08-22 17:01:10 +01:00
Luca Boccassi
6386bc13d3 Problem: test_socket_options_fuzzer can pass non-NUL terminated data buffers
Solution: ensure they are valid strings
2020-08-21 16:23:24 +01:00
Luca Boccassi
f43013a7d1 Problem: no fuzz testing for options
Solution: add it
2020-08-21 15:25:55 +01:00
Luca Boccassi
64a575eede Problem: test_bind_ws_fuzzer needs DRAFT sockets
Solution: use ZMQ_DEALER instead
2020-08-21 14:39:08 +01:00
Luca Boccassi
eb9118f0c9 Problem: no fuzz testing for websockets
Solution: add tests for plain WS
2020-07-05 23:43:58 +01:00
Luca Boccassi
e95e57d385 Problem: fuzzer corpus file can be quite large
Solution: move all corpora to the zeromq/libzmq-fuzz-corpora repository
for easier handling, and to avoid inflating the size of zeromq/libzmq.
Clone it for the CI on the fly.
2020-07-04 17:50:35 +01:00
Luca Boccassi
5c5e279108 Problem: test_req_relaxed occasionally fails
Solution: instead of relying on timing to get the order
of connected rep sockets just right, wait for each connection
2020-06-27 21:57:29 +01:00
Luca Boccassi
1ddfeb56ec Problem: formatting errors
Solution: run make clang-format-diff
2020-06-26 23:45:39 +01:00
Bill Torpey
c04f6581e0
rebase reconnect-redux on master (#3960)
* add option to stop reconnecting on failed handshake
2020-06-26 23:41:44 +01:00
Luca Boccassi
3856027da9 Problem: test_bind_fuzzer does not build on OSX
Solution: use POSIX API instead of GNU extension
2020-06-15 23:47:35 +01:00
Luca Boccassi
1ffc21d378 Problem: test_bind_fuzzer clobbers working directory with random socket files
Solution: move to /tmp before running the test
2020-06-07 12:09:17 +01:00
Luca Boccassi
35c4c22c81 Problem: z85 decode test might not always get valid input and pass
Solution: do not fail the test in that case, what's important is checking
for undefined behaviour
2020-05-24 14:26:14 +01:00
Luca Boccassi
85e198c5b4 Problem: wrong testcase name in z85_decode_fuzzer
Solution: fix it
2020-05-21 11:31:24 +01:00
Luca Boccassi
1ac753979a Problem: z85_decode fuzzer does not run regression tests with corpora
Solution: do it to avoid regressions
2020-05-21 10:49:55 +01:00
Luca Boccassi
51c90a6cd5 Problem: z85_decode fuzzer fails if fewer than 5 bytes are passed
Solution: check immediately the size of the input
2020-05-21 10:49:55 +01:00
Luca Boccassi
2d23b599f2 Problem: test_bind_fuzzer does not use corpus for regression tests
Solution: do it
2020-05-16 15:01:15 +01:00
Luca Boccassi
6439d32254 Problem: fuzz tests do not check that legitimate clients work
Solution: add normal client sockets and bounce at the same time as
the mock client
2020-05-15 18:19:38 +01:00
Doron Somech
ad3b36ab95 problem: test_xpub_manual is flapping
The test assumed the subscriptions are arrived in some order, but occasionally the order is not as expected

Solution: fix it
2020-05-14 00:01:06 +03:00
Doron Somech
e7f0090b16 problem: zeromq connects peer before handshake is completed
Solution: delay connecting the peer pipe until the handshake is completed
2020-05-13 19:36:13 +03:00
Luca Boccassi
fb9d055578 Problem: test_bind_curve_fuzzer might get stuck on some input
Solution: receive with MSG_DONTWAIT on the raw TCP socket
2020-05-09 13:17:36 +01:00
Luca Boccassi
abb315a6da Problem: potential memory leak in test_connect_curve_fuzzer
Solution: properly initialize zmq_msg before receive
2020-05-09 12:31:36 +01:00
Doron Somech
3da84c6d06 problem: no thread-safe alternative for ZMQ_PAIR
Solution: create ZMQ_CHANNEL, the thread safe alternative
2020-05-09 08:49:01 +03:00
Luca Boccassi
98efa79f54 Problem: ZMQ_DISABLE_TEST_TIMEOUT does not work anymore
Solution: restore it so that it can be set via CPPFLAGS, to avoid
tests timing out when running in GDB
2020-05-08 18:18:34 +01:00
Luca Boccassi
5fd0711196 Problem: memory leak in test_connect_null_fuzzer
Solution: initialize message before re-using it so that
receive doesn't fail and messages can be deallocated
2020-05-06 22:26:03 +01:00
Luca Boccassi
243503c29e Problem: set infinite timeouts on some tests by mistake
Solution: remove it
2020-05-06 20:56:36 +01:00
Luca Boccassi
346f8b8b20 Problem: uninitialised error in testutil helper
Solution: memset struct addrinfo to be sure
2020-05-06 11:51:55 +01:00
Luca Boccassi
5819867cd3 Problem: fuzzer curve tests use random keys
Solution: use fixed keys to reduce variability and increase the chance
that random data derived from it can break something
2020-05-06 11:47:15 +01:00
Luca Boccassi
2ac5ee7307 Problem: test_hello_msg binds to hard-coded port and fails when it's in use
Solution: use the common wildcard bind pattern instead
2020-05-05 14:13:38 +01:00
Luca Boccassi
96d3cb39e4 Problem: fuzz input which causes extra-large message allocation not stored
Solution: add it
2020-05-05 11:48:11 +01:00
Luca Boccassi
9ab3fbeee2 Problem: we want to have multiple seed corpora per fuzzer binary
Solution: store them each as a single line in the text file and convert them
at install time
2020-05-05 11:48:11 +01:00
Luca Boccassi
c4fd6dfea7 Problem: sanitizer tests cannot allocate much memory
Solution: restrict maximum message size to 64MB in tests
2020-05-05 11:42:06 +01:00
Luca Boccassi
6b259224ee Problem: fuzzer regression tests do very little
Solution: run them with the seed corpora
2020-05-04 11:42:22 +01:00
Luca Boccassi
c8e62cb2e0 Problem: no dictionaries and seed corpora for fuzzers
Solution: add them and install them where oss-fuzz expects them
2020-05-04 02:11:15 +01:00
Luca Boccassi
aa29f7caff
Merge pull request #3889 from bluca/fuzzers
Problem: testutil build broken with gcc 4.4 on CentOS 6
2020-04-28 13:33:03 +01:00
Luca Boccassi
1443c0e787
Merge pull request #3887 from gummif/gfa/unify-fd
Problem: Multiple fd_t definitions
2020-04-28 13:32:52 +01:00
Luca Boccassi
5867d7cf5f
Merge pull request #3888 from gummif/gfa/poller-fd
Problem: Poller event fd unspecified
2020-04-28 11:26:58 +01:00
Gudmundur Adalsteinsson
d426f2ab0c Problem: Multiple fd_t definitions
Solution: Unify definition
2020-04-28 08:50:18 +00:00
Luca Boccassi
a909e7296d Problem: testutil build broken with gcc 4.4 on CentOS 6
Solution: do not alias sockaddr_un, but take a copy

tests/testutil.cpp: In function 'fd_t bind_socket_resolve_port(const char*, const char*, char*, int, int)':
tests/testutil.cpp:468: error: dereferencing pointer 'un_addr' does break strict-aliasing rules
2020-04-28 00:49:37 +01:00
Luca Boccassi
882cb6fdfb Problem: static analysis shows dead store in testutil
Solution: remove it and rework the ifdefs to be safe against uninitialised use
2020-04-28 00:49:37 +01:00
Gudmundur Adalsteinsson
bf22a9f3e9 Problem: Poller event fd unspecified
Solution: Specify an invalid file descriptor for socket events
2020-04-27 21:00:45 +00:00
Luca Boccassi
96787c35f8 Problem: no fuzz testing for API with variable input
Solution: add tests for zmq_bind, zmq_connect and zmq_z85_decode
2020-04-27 01:18:45 +01:00
Luca Boccassi
57df836381 Problem: no fuzz testing for CURVE
Solution: add simple, initial tests for client and server
2020-04-27 01:18:31 +01:00
Luca Boccassi
8e774f3cd6 Problem: no integration with fuzz testing
Solution: port the 2 new tests from oss-fuzz, and wire them up to
be ran manually with a static input in normal builds.
Add a specific configure option to use the external fuzzing engine
from oss-fuzz.
2020-04-27 01:18:08 +01:00
Luca Boccassi
c6d3bc68c8 Problem: ZMTP mocks duplicated across tests
Solution: define buffers in common header
2020-04-26 21:04:53 +01:00
Luca Boccassi
4f35d1af1a Problem: using BSD sockets in test is duplicated across many tests
Solution: refactor in testutil.lib, so that they can be used for fuzzers too
2020-04-26 17:59:26 +01:00
Luca Boccassi
c81a973cd8 Problem: assert macros not detecting errors from syscall that do not return -1 on failure
Solution: add a new TEST_ASSERT_SUCCESS_RAW_ZERO_ERRNO macro so that
it can check explicitly for non-zero values. This will be used
for getaddrinfo().
2020-04-26 17:59:26 +01:00
Luca Boccassi
727637082f Problem: test_shutdown_stress_tipc fails sometimes
Solution: create socket in the same thread where it is used
2020-04-26 15:08:04 +01:00
Luca Boccassi
7cac73401a Problem: test_many_sockets always fails on Windows
Solution: don't run it
2020-04-18 11:03:15 +01:00
Luca Boccassi
ada6f0c058
Merge pull request #3871 from somdoron/DISCONNECT_MSG
problem: router doesn't know when peer disconnected
2020-04-18 10:49:50 +01:00
Gudmundur Adalsteinsson
9c6738bb45 Problem: No support to query poller size
Solution: Add zmq_poller_size that queries the number
of objects registered, allowing safer usages of poller
to avoid livelock situations.
2020-04-17 18:37:01 +00:00
Doron Somech
81444136d5 problem: router doesn't know when peer disconnected
ZMQ_ROUTER_NOTIFY doesn't have a context and doesn't play nice with protocols. with ZMQ_DISCONNECT_MSG we can set it to a protocol message, like DISCONNECT in majordomo. Router will send it when a peer is disconnected. Another advantage of ZMQ_DISCONNECT_MSG is that it also works on inproc.

Together with ZMQ_HEARTBEAT it allows to build very reliable protocols, and much simpler as well.
2020-04-17 18:04:28 +03:00
Doron Somech
93da6763b0 problem: ZMQ_HEARTBEAT is not useful without sending an hello message
When using ZMQ_HEARTBEAT one still needs to implement application-level heartbeat in order to know when to send a hello message.
For example, with the majordomo protocol, the worker needs to send a READY message when connecting to a broker. If the connection to the broker drops, and the heartbeat recognizes it the worker won't know about it and won't send the READY msg.
To solve that, the majordomo worker still has to implement heartbeat. With this new option, whenever the connection drops and reconnects the hello message will be sent, greatly simplify the majordomo protocol, as now READY and HEARTBEAT can be handled by zeromq.
2020-04-17 14:54:58 +03:00
grmt
718ad8ab96
add wss transport and fix tipc tests when building using cmake on linux (#3857)
* Allow CMAKE to generate ws and wss transports
I guess there is little use of just ws transport, so by default
GnuTLS (and libsodium) are enabled

* cmake libzmq including wss transport (ubuntu 19.10 and ubuntu 19.10 + wsl 1.0)
test_security_fails (libsodium assert !?)

* updated relicense

* make external libs gnutls nss sodium optional

* #ifdef WSS classes and functions, build test*ws* only if correct libs are included, warning if libs not present

* make libsodium optional

* cmake fix tests TIPC transport

* clang-format pointed out a wrongly placed #ifdef

* GnuTLS before 3.6.7 is not safe

* msvc doesn't agree with strlen in array declaration, test_socks now at least compiles on windows

* windows: libsodium build fails, missing include dirs set by env var

* ws transport test only works when GnuTLS is found

* Fixed condition to use NSS / built in SHA1, so that test_ws_transport should now pass, also when GnuTLS is not found
2020-04-13 23:03:19 +01:00
Gudmundur Adalsteinsson
458d805eb6 Problem: poller sleeps forever if no events
Solution: Fail with error if no events are active and timeout is infinite
2020-04-13 21:18:12 +00:00
Gudmundur Adalsteinsson
7b1fef28f9
Problem: boilerplate when init msg from data copy (#3860)
* Problem: boilerplate when init msg from data copy

Solution: Add zmq_msg_init_buffer to construct
a message by copying memory from buffer.
2020-04-09 23:59:43 +01:00
Luca Boccassi
4f45ac135a Problem: formatting not up to date
Solution: run make clang-format-diff
2020-02-23 18:25:20 +00:00
Bill Torpey
debbe08fb8
add option to stop trying to reconnect on ECONNREFUSED (#3831)
* add option to stop trying to reconnect on ECONNREFUSED
2020-02-23 17:17:22 +00:00
Luca Boccassi
52044b38f7
Merge pull request #3823 from somdoron/ZMQ_PEER
problem: zeromq doesn't has a thread-safe peer to peer socket
2020-02-09 21:53:18 +00:00
Doron Somech
70bc7dd925 problem: zeromq doesn't has a thread-safe peer to peer socket
Solution: a new socket type, called PEER. Very similar to SERVER, but can only connect to other PEERs. Also a new zmq_connect_peer method, that connect and return a routing-id in thread-safe and atomic operation
2020-02-09 23:20:14 +02:00
Luca Boccassi
821685f249
Merge pull request #3822 from somdoron/GROUPMAXLENGTH
problem: maximum size of group doesn't match the RFC maximum size
2020-02-09 13:10:47 +00:00
Doron Somech
05194eb549 problem: maximum size of group doesn't match the RFC maximum size 2020-02-09 14:46:23 +02:00
Simon Giesecke
f17a794d59
Merge pull request #3814 from bluca/sub_cancel_decoder
Implement ZMTP 3.1 subscribe/cancel via commands
2020-02-07 09:26:21 +01:00
Doron Somech
652834296b problem: ws_transport is missing the path the endpoint name 2020-02-06 17:22:28 +02:00
Doron Somech
7bfd9512e6 problem: ws_encoder allocate a new msg for masking
solution: if msg is not shared or constant, mask the message in place
2020-02-06 09:34:22 +02:00
Luca Boccassi
38b6888c3e Problem: libzmq does not advertise ZMTP 3.1
Solution: bump minor version number in the engine as all 3.1 features
are now implemented
2020-02-05 17:03:39 +00:00
Luca Boccassi
253e9dd27b Problem: libzmq does not send ZMTP 3.1 sub/cancel commands
Solution: if all peers of a socket are >= 3.1 use sub/cancel commands
instead of the old 0/1 messages.
For backward compatibility, move the handling of 0/1 or sub/cancel
command strings to the encoders, so that the right thing can be done
depending on the protocol version.
Do not set the command flag until the encoder, so that we can handle
the inproc case (which skips the encoder).
2020-02-05 17:03:39 +00:00
Simon Giesecke
21b8d5cff7 Problem: duplicated code in tests related to monitoring
Solution: extract new receive_monitor_address function
2020-02-04 18:36:03 +01:00
Simon Giesecke
495fb00b7e Problem: pointee types are unnecessarily non-const
Solution: add const where possible
2020-02-04 18:34:19 +01:00
Luca Boccassi
84ec65482f
Merge pull request #3808 from sigiesec/fix-test-monitor-to-be-checked
Fix intermittent test_monitor and test_security_zap timeouts/deadlocks for now
2020-02-04 15:23:58 +01:00
Simon Giesecke
66094678d1 Problem: intermittent deadlocks/timeouts in test_monitor and test_security_zap
Solution: wait for monitor to stop resp. unregister monitor before
closing monitored socket.
2020-02-04 14:34:36 +01:00
Simon Giesecke
58b636675a Problem: on POSIX systems, all tests have a timeout of 60 seconds; disabling it via ZMQ_DISABLE_TEST_TIMEOUT doesn't work anymore
Solution: remove ZMQ_DISABLE_TEST_TIMEOUT guard but add default parameter to setup_test_environment
2020-02-04 09:48:55 +01:00
Simon Giesecke
577d64c007 Problem: intermittent timeouts on test_heartbeats
Solution: increase number of retries when reading monitor event,
and increase timeout
2020-02-04 09:48:55 +01:00
Luca Boccassi
06bdebfe8d
Merge pull request #3805 from sigiesec/curve-zerocopy
CURVE: Reduce number of memory allocations and message copies
2020-02-04 08:58:31 +01:00
Simon Giesecke
e7043c815d Problem: intermittent timeouts of test_reconnect_ivl
Solution: increase timeout to 15 seconds
2020-02-03 23:19:45 +01:00
Simon Giesecke
78b94a4fcf Problem: testutil.hpp pulls in min/max macro definitions on Windows
Solution: define NOMINMAX
2020-02-03 17:07:15 +01:00
Simon Giesecke
36a8df2f8c Problem: sockets can be created after calling zmq_ctx_shutdown
Solution: fix handling of _starting and _terminate flags

Add tests for this situation.

Clarify documentation of zmq_ctx_shutdown and zmq_socket.

Fixes #3792
2020-01-26 18:06:14 +01:00
Matthias Loy
67adc458df Roundtrip test for websocket url without a path 2020-01-18 23:19:31 +01:00
Doron Somech
b120ec33a9 problem: ws_engine don't support WS RFC ping-pong
Solution: implement both PONG response and producing pings
2020-01-18 18:28:00 +02:00
Luca Boccassi
c560a41473 Problem: mingw build broken
Solution: check correct preprocessor define in test_reconnect_ivl to match the
test invocation
2019-12-28 21:17:09 +01:00
Simon Giesecke
a64c3e6c7d Problem: redundant consecutive return statements
Solution: remove the redundant one
2019-12-24 10:17:10 +01:00
Simon Giesecke
cb2b377d9f Problem: redundant else after return
Solution: remove else
2019-12-08 15:24:48 +01:00
Simon Giesecke
fdabd73da6 Problem: parameters not const where const possible
Solution: add const
2019-12-08 15:24:48 +01:00
Simon Giesecke
cd954e207d Problem: use of C-style casts
Solution: use static_cast/reinterpret_cast instead
2019-12-08 15:24:48 +01:00
Simon Giesecke
a83c57d0bb Problem: identifiers not conformant with naming convention
Solution: fix identifier names
2019-12-08 15:24:48 +01:00
Luca Boccassi
df993d113c
Merge pull request #3751 from sigiesec/windows-domain-sockets-signaler
Use Unix domain sockets for listener when available on Windows
2019-12-07 00:25:21 +00:00
Simon Giesecke
cf7e0fb066 Problem: test_capabilities fails on Windows when IPC support is available
Solution: Fix ifdef for expectation of IPC support
2019-12-06 20:24:41 +01:00
liedtkeInTUM
65d2f1f498 Problem: if IPC enabled libzmq does not compile when in uwp build (#3747)
* Problem: if IPC enabled libzmq does not compile when in uwp build

* Problem 10.0.##### can be valid windows target versions

* Problem: No builds are triggered on uwp platform

* Problem: epoll is set before UWP platform is checked

* Problem: used wrong CMAKE_SYSTEM_NAME specifier

* Problem: build tests fails during cmake configure

* Use Win32 build step for Win32-uwp platform

* Disable compile options that produce warnings that leads to a ci fail

* winnt version is set by cmake, no need for redefinition in windows.hpp

* Eliminate all warning according Incremental and opt:icf are specified

* Prefer to disable opt flags in debug config rather than incremental linking

* CMAKE_GENERATOR should not include uwp definition

* Add release build with uwp configuration

* Problem: pointer potentially uninitialized
2019-12-06 13:27:24 +00:00
Andrij Abyzov
5a854780f2 Problem: cannot send arbitrary data from XSUB to XPUB.
Solution: now if the first frame in a multipart message is not subscribe/unsubscribe,
the rest of the parts are also considered to be not subscribe/unsubscribe.
2019-12-04 16:25:08 +01:00
Luca Boccassi
00a448b1f0 Problem: WS tests bind to hard-coded TCP port and fail when ran in parallel
Solution: bind to wildcard and use ZMQ_LAST_ENDPOINT
2019-11-28 12:37:53 +00:00
Andrij Abyzov
108977c838 Change XSUB -> XPUB multipart message processing.
Now only the first part in a multipart message will be treated as subscribe/unsubscribe.
The rest will be considered user messages regardless of the first byte.
2019-11-19 18:22:12 +01:00
Doron Somech
a1aeae92cd problem: test_wss_transport expired
Solution: generate new keys that last for 100 years
2019-11-10 10:34:43 +02:00