]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/worker: hotfix to avoid SERVFAIL with unavailable IPv6 docs-develop-rele-tdgndv/deployments/4655
authorOto Šťáva <oto.stava@nic.cz>
Tue, 23 Jul 2024 17:11:54 +0000 (19:11 +0200)
committerOto Šťáva <oto.stava@nic.cz>
Tue, 23 Jul 2024 17:23:46 +0000 (19:23 +0200)
daemon/worker.c

index 46744c123644e509d345c11af6494e798886ba6c..097608b60df09d94e0c117eeb83f8aab0d7b48c0 100644 (file)
@@ -729,6 +729,19 @@ static int qr_task_send(struct qr_task *task, struct session *session,
                ret = kr_error(EINVAL);
        }
 
+       // FIXME: Hack to avoid a SERVFAIL when IPv6 is unavailable on the host
+       // machine. We uncovered this while changing the above writes/sends to
+       // try_writes/try_sends. We originally were not getting the
+       // `ENETUNREACH` from libuv and were just timeouting the request,
+       // falling back to IPv4 eventually.
+       //
+       // Note that this does not happen in Knot Resolver 6 with the rewritten
+       // I/O, so there is probably a bug somewhere in here, but we were not
+       // able to track it down.
+       if (ret == UV_ENETUNREACH) {
+               ret = 0;
+       }
+
        if (ret == 0) {
                if (!session_flags(session)->has_http) { // instead of completion callback
                        qr_task_on_send(task, handle, ret);