Commit Graph

5813 Commits

Author SHA1 Message Date
Jake Cobb
84ab771808 Problem: Throughput calculation underestimates slow messages
Solution: Use a double for messages per second and calculate
Megabits per second using it.  Truncate messages per second
only in the reported output.
2017-08-10 14:30:22 -04:00
Jake Cobb
78b26d7ac2 Problem: Throughput perf tool doesn't support CURVE
Solution: Add extra argument to enable CURVE, use
fixed keys to make local_thr and remote_thr compatible
with CURVE enabled.
2017-08-10 14:29:21 -04:00
Luca Boccassi
6652a0d742 Merge pull request #2672 from jakecobb/cmake_libsodium
Problem: CMake build does not allow static linking libsodium
2017-08-10 18:17:45 +01:00
Jake Cobb
0cbdc18817 Problem: CMake build does not allow static linking libsodium
Solution: Pass along SODIUM_STATIC define if set in CMake config
2017-08-10 13:04:15 -04:00
Luca Boccassi
889a6bff05 Merge pull request #2671 from AlainODea/ao-clarify-null-ZAP-status-code
Problem: log for bad ZAP status code is confusing
2017-08-10 15:01:31 +01:00
Alain O'Dea
454d1eda65
Problem: log for bad ZAP status code is confusing
Solution: log that handler sent bad status code to clarify ZAP debugging
2017-08-10 10:59:18 -02:30
Constantin Rack
82c4792e21 Merge pull request #2668 from bluca/fix_pgm_build 2017-08-08 19:53:58 +02:00
Luca Boccassi
75fba539d0 Problem: PGM/NORM builds broken due to i_engine API change
Solution: implement get_endpoint in the NORM and PGM engines too
2017-08-08 15:18:07 +01:00
Simon Giesecke
a6cef4ef86 Problem: ZAP status codes != 200 do not result in an appropriate monitor event (#2665)
* Problem: missing test for status code 300, inadequate assertion for status code 500

Solution: add test, change assertion (currently test fails)

* Problem: gcc compiler error deprecated conversion from string constant

Solution: declare variable as const

* Problem: in case of ZAP handler returning a status code other than 200, no appropriate event is emitted

Solution: immediately emit event after receiving reply from ZAP handler

* Problem: endpoint address is not included in zap-reply monitor event

Solution: added functions to retrieve endpoint address in zmq::i_engine and zmq::session_base_t
removed unused code block in zmq::stream_engine_t::next_handshake_command

* Problem: wrong formatting

Solution: fix formatting

* Problem: test fails because of EPIPE

Solution: add EPIPE/ECONNRESET/ECONNAGAIN handling for more test cases
2017-08-08 13:10:20 +01:00
Simon Giesecke
834b9e4cd7 Problem: some test cases may still fail because of EPIPE/ECONNABORT/ECONNRESET (#2664)
* Problem: CI failure on Appveyor with err==ECONNRESET

Solution: ignore ECONNRESET analogous to EPIPE

* Problem: blocking test execution

Solution: added more debug output, do not wait for monitor infinitely without output
2017-08-07 17:07:37 +01:00
Jim Klimov
612d81a831 Merge pull request #2659 from bluca/fix_getrandom
Problems: test_security_curve occasionally hangs or fails due to ECONNABORTED
2017-08-07 12:36:59 +02:00
Luca Boccassi
20bbd016c1 Merge pull request #2663 from sigiesec/fix-zap-assertion
Problem: failing assertion on ZAP protocol error
2017-08-07 11:15:54 +01:00
Luca Boccassi
2564c8e5b9 Merge pull request #2662 from sigiesec/fix-hwm-tests-race-2
Problem: occasional test failures due to messages not (yet) received in test assertion
2017-08-07 10:51:11 +01:00
Simon Giesecke
de82cbe4ba Problem: failing assertion on ZAP protocol error
Solution: do not assert on ZAP protocol error when connection was closed by client
2017-08-07 10:59:36 +02:00
Simon Giesecke
8842e0f0a9 Problem: occasional test failures due to messages not (yet) received in test assertion
Solution: add sleep
2017-08-07 10:35:25 +02:00
Luca Boccassi
5f6ff69f62 Problem: test_security_curve fails due to ECONNABORTED
Solution: expect that error, which can happen on very slow machines
due to a client timimng out or RST before the connection is accepted
by the server
2017-08-07 09:26:38 +01:00
Luca Boccassi
1c1f10a25a Problem: test_security_curve occasionally hangs
Solution: refactor the ZAP thread to avoid creating the socket in the
main thread and using it in the ZAP thread, and also to eliminate
races at shutdown use another inproc control socket to signal
termination to the thread
2017-08-07 09:18:37 +01:00
Constantin Rack
02e93492b6 Merge pull request #2661 from jimklimov/brandom
Problem: getrandom usage breaks build
2017-08-07 09:07:13 +02:00
Luca Boccassi
3046fe2053 Problem: getrandom usage breaks build
Solution: add missing flags parameter
2017-08-07 08:43:25 +02:00
Constantin Rack
98a3bb6f24 Merge pull request #2656 from bluca/unwind
Problems: use-before-initialise error in print_backtrace, test_security_curve sometimes fails due to unexpected ECONNRESET
2017-08-06 03:06:06 +02:00
Luca Boccassi
14df80ae3a Problem: test_security_curve does not account for ECONNRESET
Solution: ignore ECONNRESET as with EPIPE - it can happen on very
slow machines when the engine sends data to the peer and then tries
to read from the TCP socket before the peer has read
2017-08-05 18:08:21 +01:00
Luca Boccassi
dc51ebeb1f Problem: valgrind shows unitialised errors in backtrace print
Solution: fix them
2017-08-05 18:04:15 +01:00
Constantin Rack
03c0b2dfe2 Merge pull request #2654 from bluca/appveyor
Problems: timeout in curve test, redundant windows and android CI jobs
2017-08-04 22:48:33 +02:00
Luca Boccassi
0a8775e717 Merge pull request #2655 from sigiesec/fix-curve-produce-error
Problem: zmq::curve_server_t::produce_error sends sizeof std::string instead of status code length
2017-08-04 17:43:24 +01:00
Luca Boccassi
067b7b0d27 Problem: Android build on Travis OSX takes 10 minutes+
Solution: remove it, and test it only on Linux, as the toolchain and
build process is the same.
2017-08-04 16:29:11 +01:00
Luca Boccassi
9c085381ee Problem: test_security_curve timeouts on CMake
Solution: bump timeout from 20 to 60 seconds
2017-08-04 16:25:59 +01:00
Luca Boccassi
8275f6356a Problem: redundant appveyor test
Solution: remove it. No need to do an additional sodium on - curve
off test, as sodium will be disabled anyway
2017-08-04 16:24:40 +01:00
Luca Boccassi
e83abb3de3 Merge pull request #2652 from sigiesec/curve-security-tests-improvement
Problem: open TODOs in test code, CI failures
2017-08-04 16:03:44 +01:00
Simon Giesecke
41108b203e Problem: zmq::curve_server_t::produce_error sends sizeof std::string instead of status code length
Solution: send status code length (always 3) instead
2017-08-04 16:54:46 +02:00
Simon Giesecke
7ba70e95e5 Problem: test failure on CI due to ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL/EPIPE problem
Solution: add workaround at another place, unify two code fragments to remove duplication
2017-08-04 16:05:20 +02:00
Simon Giesecke
aacb219acd Problem: open TODOs in test code
Solution: removed code duplication
improved global variable naming
added assertions on number of ZAP requests handled
added assertion on monitor event to test_curve_security_with_plain_client_credentials
2017-08-04 15:11:14 +02:00
Jim Klimov
e84804d4cc Merge pull request #2647 from bluca/travis_test
Problems: too many OSX travis builds, curve test uses hard-coded TCP port
2017-08-04 13:21:02 +02:00
Luca Boccassi
5c7f56639b Merge pull request #2651 from sigiesec/doc-property-defines
Problem: new ZMQ_MSG_PROPERTY_* defines were not mentioned in the documentation
2017-08-04 11:51:12 +01:00
Luca Boccassi
32085870df Merge pull request #2650 from sigiesec/connection-close-event-workaround
Problem: sporadic failure in test_curve_security_with_null_client_credentials
2017-08-04 11:48:27 +01:00
Simon Giesecke
63779094d3 Problem: new ZMQ_MSG_PROPERTY_* defines were not mentioned in the documentation
Solution: add documentation
2017-08-04 12:46:41 +02:00
Luca Boccassi
b92dc0a674 Merge pull request #2649 from sigiesec/remove-property-literal-duplication
Problem: Message property names are duplicated
2017-08-04 11:09:31 +01:00
Simon Giesecke
4b847f3ff9 Problem: no tests for ZAP handler that has an invalid protocol (#2648)
* Problem: no tests for ZAP protocol errors

Solution: added first test for a bogus version number in ZAP reply

* Problem: no tests for ZAP protocol errors

Solution: added more test cases

* Problem: cannot compile without ZMQ_BUILD_DRAFT_API

Solution: conditionally compile parts that depend on draft API

* Problem: test_security_curve times out in CI

Solution: Increase timeout for this test to 20 seconds
2017-08-04 11:07:41 +01:00
Simon Giesecke
4fec4c99be Problem: sporadic failure in test_curve_security_with_null_client_credentials
Solution: add workaround for EPIPE error
2017-08-04 11:35:00 +02:00
Simon Giesecke
7a16c292b7 Problem: Documentation mentions a message property "Resource", which does not exist
Solution: Remove from documentation
2017-08-04 10:34:48 +02:00
Simon Giesecke
9949965717 Problem: Property names are duplicated at several places
Solution: Define them in zmq.h and use them (currently in DRAFT API)
2017-08-04 10:33:51 +02:00
Luca Boccassi
5b91eb549b Problem: OSX builds are very slow
Solution: avoid running brew update and brew install binutils unless
it's for the android cross-compilation, where it's necessary for
greadelf.
2017-08-03 23:35:51 +01:00
Luca Boccassi
0c5731ac00 Problem: 2 OSX libsodium Travis runs
Solution: remove the non-draft test run, as OSX is very slow and
overcrowded on Travis
2017-08-03 14:43:36 +01:00
Luca Boccassi
d96b0f42a6 Problem: additional doc-build test on Travis
Solution: remove it, as it takes time and it's enough to test once
2017-08-03 14:42:14 +01:00
Luca Boccassi
ccb1250fcc Problem: a curve test uses hard-coded TCP port
Solution: use the wildcard endpoint instead
2017-08-03 14:41:36 +01:00
Simon Giesecke
c191909c0e Problem: Misleading error code in case ZAP handler sends an invalid status code (#2646)
Solution: Use EPROTO instead of EACCES error code in that case
2017-08-03 14:20:35 +01:00
Simon Giesecke
5d4e30eb13 Replace console output by monitoring events for curve security issues (#2645)
* Fixing #2002 one way of doing it

 * Mechanisms can implement a new method `error_detail()`
 * This error detail have three values for the moment: no_detail
 (default), protocol, encryption.
    + generic enough to make sense for all mechanisms.
    - low granularity level on information.

* Fixing #2002: implementation of the error details

The ZMQ_EVENT_HANDSHAKE_FAILED event carries the error details
as value.

* Removed Microsoft extenstion for enum member access

This was leading to compilation error under linux.

* Adaptation of CURVE test cases

* Monitoring event: changed API for detailed events

Removed ZMQ_EVENT_HANDSHAKE_FAILED and replaced it by:
- ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL,
- ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL,
- ZMQ_EVENT_HANDSHAKE_FAILED_ENCRYPTION

Adaptation of text case `security_curve`

* Removed event value comparison

This was introduced for the previous API model adaptation

* Removed the prints in std output and added missing details

`current_error_detail` was not set in every protocol error cases

* Fixed initialization of current_error_detail

* Fixed error in greeting test case

The handshake failure due to mechanism mismatch in greeting is actually
a protocol error. The error handling method consider it like so and
send a protocol handshake failure monitoring event instead of no_detail.

Fixed the test_security_curve expectation as well.

* Upgraded tests of monitoring events

The tests check the number of monitoring events received

* Problem: does not build under Linux or without ZMQ_DRAFT_API

Solution:
- properly use ZMQ_DRAFT_API conditional compilation
- use receive timeouts instead of Sleep

* Problem: duplicate definition of variable 'timeout'

Solution: merged definitions

* Problem: inconsistent timing dependencies

Solution: reduce timing dependency by using timeouts at more places

* Problem: assertion failure under Linux due to unexpected monitor event

Solution: output event type to aid debugging

* Problem: erroneous assertion code

* Problem: assertion failure with a garbage server key due to an extra third event

Solution: changed assertion to expect three events (needs to be checked)

* Problem: extra include directive to non-existent file

Solution: removed include directive

* Problem: assertion failure on appveyor for unknown reason

Solution: improve debug output

* Problem: no build with libsodium and draft api

Solution: add build configurations with libsodium and draft api

* Problem: assertion failure on CI

Solution: change assertion to reflect actual behaviour on CI (at least temporarily)

* Problem: error in condition in assertion code

* Problem: assertion failure on CI

Solution: generalize assertion to match behavior on CI

* Problem: assertion failures on CI

Solution: removed inconsistent assertion on no monitor events before flushing
improved debuggability by converting function into macro

* Problem: diverging test code for three analogous test cases with garbage key

Solution: extract common code into function

* Problem: does not build without ZMQ_BUILD_DRAFT_API

Solution: introduce dummy variable

* Attempt to remove workaround regarding ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL again

* Problem: EAGAIN error after handshake complete if there is no more data in inbuffer

Solution: Skip tcp_read attempt in that case

* Problem: handshaking event emitted after handshaking failed

Solution: use stream_engine_t::handshaking instead of mechanism_t::status() to determine whether still handshaking

* Include error code in debug output

* Improve debugging output: output flushed events

* Split up ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL into ZMQ_EVENT_HANDSHAKE_FAILED_ZMTP and ZMQ_EVENT_HANDSHAKE_FAILED_ZAP

* Fixed compilation without ZMQ_BUILD_DRAFT_API

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Renamed ZMQ_EVENT_HANDSHAKE_SUCCEED to ZMQ_EVENT_HANDSHAKE_SUCCEEDED for language consistency

* Fixed assert_monitor_event (require event instead of allowing no event)
Reverted erroneous change to handshaking condition
Renamed test_wrong_key to test_garbage_key
Generalized assumption in test_garbage_key to allow for ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL with error == EPIPE

* Better isolate test cases from each other by providing a fresh context & server for each

* Added diagnostic output

* Changed assertion to reflect actual behavior on CI

* Fixed formatting, observe maximum line length

* Fixed formatting, observe maximum line length

* Increase timeout to check if this fixes valgrind run

* Close server with close_zero_linger

* Increase timeout to check if this fixes valgrind run

* Increase timeout to check if this fixes valgrind run

* Generalize assertion to also work with valgrind

* Fixed formatting

* Add more diagnostic output

* Generalize assertion to also work with valgrind
2017-08-03 14:15:56 +01:00
Jim Klimov
fda9daa200 Merge pull request #2639 from bluca/wine_doc
Problems: using Wine requires system tuning, ZMQ_BINDTODEVICE not draft
2017-08-01 15:39:45 +02:00
Luca Boccassi
bb0b518e7f Problem: ZMQ_BINDTODEVICE not used for ZMQ_DISH
Solution: apply the option outside of the send/recv_enabled blocks so
that it is used for all types of UDP sockets
2017-07-31 16:31:31 +01:00
Luca Boccassi
415bdbc1b9 Problem: ZMQ_BINDTODEVICE is DRAFT but not DRAFT
Solution: move definition in the DRAFT section of the header
2017-07-31 16:31:31 +01:00
Luca Boccassi
2048ed5dbf Problem: using Wine requires system tuning
Solution: document it in the INSTALL file
Fixes #2638
2017-07-31 15:59:39 +01:00