all: imp docs
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled

This commit is contained in:
f.setrakov 2026-07-13 15:27:07 +03:00
parent 941bdabebe
commit 70a703c312
2 changed files with 10 additions and 4 deletions

View file

@ -42,7 +42,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Fixed
- Blocked requests do not contain an EDNS(0) OPT record ([#8183]).
- Blocked requests without an EDNS(0) OPT record ([#8183]).
- Invalid AA flag in DNS responses ([#7955]).

View file

@ -17,6 +17,8 @@ import (
// template. Also extract all the methods to a separate entity.
// reply creates a DNS response for req.
//
// NOTE: If req uses EDNS(0), the response copies its UDP size and DO flag.
func (*Server) reply(req *dns.Msg, code int) (resp *dns.Msg) {
resp = (&dns.Msg{}).SetRcode(req, code)
resp.RecursionAvailable = true
@ -409,8 +411,9 @@ func (s *Server) NewMsgSERVFAIL(req *dns.Msg) (resp *dns.Msg) {
// NewMsgNOTIMPLEMENTED implements the [proxy.MessageConstructor] interface for
// *Server.
func (s *Server) NewMsgNOTIMPLEMENTED(req *dns.Msg) (resp *dns.Msg) {
// NOTE: [Server.reply] must not be used there, because it appends an EDNS0
// OPT record to the reply.
// NOTE: [Server.reply] must not be used there, because it unconditionally
// copies UDP size and DO bit from the request, when in this case we want to
// use constant values.
resp = (&dns.Msg{}).SetRcode(req, dns.RcodeNotImplemented)
resp.RecursionAvailable = true
@ -423,7 +426,10 @@ func (s *Server) NewMsgNOTIMPLEMENTED(req *dns.Msg) (resp *dns.Msg) {
// NOTIMPLEMENTED without EDNS is treated as 'we don't support EDNS', so
// explicitly set it.
resp.SetEdns0(maxUDPPayload, false)
opt := req.IsEdns0()
if opt != nil {
resp.SetEdns0(maxUDPPayload, false)
}
return resp
}