From: Yorgos Thessalonikefs Date: Mon, 2 Dec 2024 11:28:11 +0000 (+0100) Subject: - Fix #1193: log-servfail fails to log host SERVFAIL responses in X-Git-Tag: release-1.23.0rc1~85^2~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c55490c1e6c1b1206457e1c1aae2dc418a60a873;p=thirdparty%2Funbound.git - 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. --- 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));