From 1461dbaff09b76c3c823c7161f740b1f1573e7a5 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Thu, 26 Nov 2026 15:45:43 +0300 Subject: [PATCH] dnspr: a name server's answer with no records relayed as it is (#1292) --- src/dnspr.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/dnspr.c b/src/dnspr.c index 418655b..a51ed39 100644 --- a/src/dnspr.c +++ b/src/dnspr.c @@ -117,8 +117,8 @@ static void dnscache(struct clientparam *param, struct dnsquery *q, unsigned cha } } -/* An answer from a name server: to the client as it is if it has answers, - else as the name not found. 1: the query is done. */ +/* An answer from a name server: to the client as it is, whatever it + says. 1: the query is done. */ static int dnsreply(struct udploop *u, struct udpsession *ss, unsigned char *buf, int len){ struct clientparam *param = ss->param; struct dnsquery *q = ss->data; @@ -131,13 +131,10 @@ static int dnsreply(struct udploop *u, struct udpsession *ss, unsigned char *buf buf[1] = q->cid[1]; param->statssrv64 += len; param->nreads++; - if(buf[6] || buf[7]){ - dnscache(param, q, buf, len); - param->res = (udpanswer(u, param, buf, len) == len)? 0 : 822; - return 1; - } - q->ip = 0; - param->res = dnsanswer(u, param, q, buf, len); + /* the answer goes to the client as it is, its code with no records + among them: the name not found is the server's word, not ours */ + if(buf[6] || buf[7]) dnscache(param, q, buf, len); + param->res = (udpanswer(u, param, buf, len) == len)? 0 : 822; return 1; }