]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Ignore ISC_R_CONNECTIONRESET in the TCP tests
authorOndřej Surý <ondrej@isc.org>
Wed, 14 Aug 2024 08:01:33 +0000 (10:01 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 20 Aug 2024 12:45:54 +0000 (12:45 +0000)
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.

tests/dns/dispatch_test.c

index 8352ca0913289ca797ec86972a6cc08133975e26..8a94582c4da079d9fce6137f797939489ae92bb2 100644 (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);
        }