]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Synchronze udp_ready() and tcp_connected() functions entry behavior
authorAram Sargsyan <aram@isc.org>
Tue, 29 Mar 2022 20:58:15 +0000 (20:58 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Fri, 1 Apr 2022 10:56:27 +0000 (10:56 +0000)
The `udp_ready()` and `tcp_connected()` functions in dighost.c are
used for similar purposes for UDP and TCP respectively.

Synchronize the `udp_ready()` function entry code to behave like
`tcp_connected()` by adding input validation, debug messages and
early exit code when `cancel_now` is `true`.

bin/dig/dighost.c

index 6d710adb49afeb3c188ca81f218049b0e27bba44..6f99f540647d2bbfb7a77944b0bddf631426d436 100644 (file)
@@ -3097,8 +3097,22 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
        dig_query_t *readquery = NULL;
        int local_timeout = timeout * 1000;
 
+       REQUIRE(DIG_VALID_QUERY(query));
+       REQUIRE(query->handle == NULL);
+
+       debug("udp_ready()");
+
        query->started = true;
 
+       if (atomic_load(&cancel_now)) {
+               return;
+       }
+
+       INSIST(!free_now);
+
+       debug("udp_ready(%p, %s, %p)", handle, isc_result_totext(eresult),
+             query);
+
        if (eresult == ISC_R_CANCELED || query->canceled) {
                dig_lookup_t *l = query->lookup;