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.
This commit is contained in:
Ondřej Surý
2024-08-14 10:01:33 +02:00
parent db9d3b8207
commit e53cb61cf7

View File

@@ -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);
}