mbedtls/programs/test
Manuel Pégourié-Gonnard 14134281df Fix bug with UDP proxy not forwarding enough
We previously introduced a safety check ensuring that if a datagram had
already been dropped twice, it would no longer be dropped or delayed
after that.

This missed an edge case: if a datagram is dropped once, it can be
delayed any number of times. Since "delay" is not defined in terms of
time (x seconds) but in terms of ordering with respect to other messages
(will be forwarded after the next message is forwarded), depending on
the RNG results this could result in an endless loop where all messages
are delayed until the next, which is itself delayed, etc. and no message
is ever forwarded.

The probability of this happening n times in a row is (1/d)^n, where d
is the value passed as delay=d, so for delay=5 and n=5 it's around 0.03%
which seems small but we still happened on such an occurrence in real
life:

    tests/ssl-opt.sh --seed 1625061502 -f 'DTLS proxy: 3d, min handshake, resumption$'

results (according to debug statements added for the investigation) in
the ClientHello of the second handshake being dropped once then delayed
5 times, after which the client stops re-trying and the test fails for
no interesting reason.

Make sure this doesn't happen again by putting a cap on the number of
times we fail to forward a given datagram immediately.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-07-08 12:42:59 +02:00
..
cmake_subproject Build: Add MBEDTLS_TARGET_PREFIX 2020-10-20 13:44:44 +01:00
benchmark.c Support running the benchmark with a single curve 2020-12-07 22:51:25 +01:00
CMakeLists.txt cmake: Fix added sources to targets 2020-11-18 16:28:00 -07:00
cpp_dummy_build.cpp Add missing header to cpp_dummy_build.cpp test 2021-02-19 14:19:51 -07:00
query_compile_time_config.c Move the declaration of query_config() to a dedicated header file 2021-01-13 14:19:43 +01:00
query_config.c Implement support for MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS 2021-04-15 15:04:26 +02:00
query_config.h Move the declaration of query_config() to a dedicated header file 2021-01-13 14:19:43 +01:00
selftest.c Fix GCC warning about test_snprintf 2020-11-25 01:13:12 -03:00
udp_proxy_wrapper.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
udp_proxy.c Fix bug with UDP proxy not forwarding enough 2021-07-08 12:42:59 +02:00
zeroize.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00