fix(rewrite): restore the original question on empty replies (#8212)

Signed-off-by: immanuwell <pchpr.00@list.ru>
This commit is contained in:
Immanuel Tikhonov
2026-06-30 15:05:12 +04:00
committed by GitHub
parent 4faf983fb6
commit 33266a45c7
2 changed files with 67 additions and 1 deletions

View File

@@ -73,7 +73,11 @@ func (r *ResponseReverter) WriteMsg(res1 *dns.Msg) error {
res := res1.Copy()
if r.revertPolicy.DoQuestionRestore() {
res.Question[0] = r.originalQuestion
if len(res.Question) == 0 {
res.Question = []dns.Question{r.originalQuestion}
} else {
res.Question[0] = r.originalQuestion
}
}
if len(r.ResponseRules) > 0 {
for _, rr := range res.Ns {