From c55490c1e6c1b1206457e1c1aae2dc418a60a873 Mon Sep 17 00:00:00 2001 From: Yorgos Thessalonikefs Date: Mon, 2 Dec 2024 12:28:11 +0100 Subject: [PATCH] - Fix #1193: log-servfail fails to log host SERVFAIL responses in Unbound 1.19.2 on Ubuntu 24.04.1 LTS, by not considering cached failures when trying to reply with expired data. --- services/mesh.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/mesh.c b/services/mesh.c index 5b9a02ae4..18a53b4a5 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -2203,8 +2203,13 @@ mesh_serve_expired_callback(void* arg) qstate->serve_expired_data->get_cached_answer)); msg = (*qstate->serve_expired_data->get_cached_answer)(qstate, lookup_qinfo, &is_expired); - if(!msg) + if(!msg || (FLAGS_GET_RCODE(msg->rep->flags) != LDNS_RCODE_NOERROR + && FLAGS_GET_RCODE(msg->rep->flags) != LDNS_RCODE_NXDOMAIN + && FLAGS_GET_RCODE(msg->rep->flags) != LDNS_RCODE_YXDOMAIN)) { + /* We don't care for cached failure answers at this + * stage. */ return; + } /* Reset these in case we pass a second time from here. */ encode_rep = msg->rep; memset(&actinfo, 0, sizeof(actinfo)); -- 2.47.2