mbedtls/programs/test
Manuel Pégourié-Gonnard 71ce4ef981 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-06 12:39:43 +02:00
..
cmake_package Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
cmake_package_install Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
cmake_subproject Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
benchmark.c Merge pull request #4694 from gilles-peskine-arm/out_size-3.0 2021-06-29 09:43:17 +02:00
CMakeLists.txt Remove PKCS#11 library wrapper. 2021-04-21 11:05:00 +02:00
cpp_dummy_build.cpp Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
query_compile_time_config.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
query_config.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
selftest.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01: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-06 12:39:43 +02:00
zeroize.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00