From: Ondřej Surý Date: Wed, 14 Aug 2024 08:01:33 +0000 (+0200) Subject: Ignore ISC_R_CONNECTIONRESET in the TCP tests X-Git-Tag: v9.21.1~32^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e53cb61cf7346c1f345423cff0a153867f9f8733;p=thirdparty%2Fbind9.git Ignore ISC_R_CONNECTIONRESET in the TCP tests On FreeBSD, the TCP connection callback could spuriously receive ISC_R_CONNECTIONRESET even when connection to the loopback interface. Skip the other checks in such case and graciously shutdown the TCP connection. --- diff --git a/tests/dns/dispatch_test.c b/tests/dns/dispatch_test.c index 8352ca09132..8a94582c4da 100644 --- a/tests/dns/dispatch_test.c +++ b/tests/dns/dispatch_test.c @@ -467,7 +467,14 @@ connected(isc_result_t eresult, isc_region_t *region ISC_ATTR_UNUSED, void *arg) { test_dispatch_t *test = arg; - REQUIRE(eresult == ISC_R_SUCCESS); + switch (eresult) { + case ISC_R_CONNECTIONRESET: + /* Don't send any data if the connection failed */ + test_dispatch_shutdown(test); + return; + default: + assert_int_equal(eresult, ISC_R_SUCCESS); + } dns_dispatch_send(test->dispentry, &testdata.region); } @@ -477,7 +484,13 @@ connected_shutdown(isc_result_t eresult, isc_region_t *region ISC_ATTR_UNUSED, void *arg) { test_dispatch_t *test = arg; - REQUIRE(eresult == ISC_R_SUCCESS); + switch (eresult) { + case ISC_R_CONNECTIONRESET: + /* Skip */ + break; + default: + assert_int_equal(eresult, ISC_R_SUCCESS); + } test_dispatch_shutdown(test); } @@ -551,9 +564,12 @@ timeout_connected(isc_result_t eresult, isc_region_t *region ISC_ATTR_UNUSED, void *arg) { test_dispatch_t *test = arg; - if (eresult == ISC_R_ADDRNOTAVAIL || eresult == ISC_R_CONNREFUSED) { - /* FIXME: Skip */ - } else { + switch (eresult) { + case ISC_R_ADDRNOTAVAIL: + case ISC_R_CONNREFUSED: + /* Skip */ + break; + default: assert_int_equal(eresult, ISC_R_TIMEDOUT); }