aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/dnsserver/server_grpc.go3
-rw-r--r--core/dnsserver/server_https.go3
-rw-r--r--core/dnsserver/server_tls.go2
3 files changed, 5 insertions, 3 deletions
diff --git a/core/dnsserver/server_grpc.go b/core/dnsserver/server_grpc.go
index e26eaebfb..599f5c197 100644
--- a/core/dnsserver/server_grpc.go
+++ b/core/dnsserver/server_grpc.go
@@ -129,7 +129,8 @@ func (s *ServergRPC) Query(ctx context.Context, in *pb.DnsPacket) (*pb.DnsPacket
w := &gRPCresponse{localAddr: s.listenAddr, remoteAddr: a, Msg: msg}
- s.ServeDNS(ctx, w, msg)
+ dnsCtx := context.WithValue(ctx, Key{}, s.Server)
+ s.ServeDNS(dnsCtx, w, msg)
packed, err := w.Msg.Pack()
if err != nil {
diff --git a/core/dnsserver/server_https.go b/core/dnsserver/server_https.go
index 6ae6ce6a6..93d62fa84 100644
--- a/core/dnsserver/server_https.go
+++ b/core/dnsserver/server_https.go
@@ -117,7 +117,8 @@ func (s *ServerHTTPS) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// We just call the normal chain handler - all error handling is done there.
// We should expect a packet to be returned that we can send to the client.
- s.ServeDNS(context.Background(), dw, msg)
+ ctx := context.WithValue(context.Background(), Key{}, s.Server)
+ s.ServeDNS(ctx, dw, msg)
// See section 4.2.1 of RFC 8484.
// We are using code 500 to indicate an unexpected situation when the chain
diff --git a/core/dnsserver/server_tls.go b/core/dnsserver/server_tls.go
index a63ac848a..95c2d6912 100644
--- a/core/dnsserver/server_tls.go
+++ b/core/dnsserver/server_tls.go
@@ -44,7 +44,7 @@ func (s *ServerTLS) Serve(l net.Listener) error {
// Only fill out the TCP server for this one.
s.server[tcp] = &dns.Server{Listener: l, Net: "tcp-tls", Handler: dns.HandlerFunc(func(w dns.ResponseWriter, r *dns.Msg) {
- ctx := context.Background()
+ ctx := context.WithValue(context.Background(), Key{}, s.Server)
s.ServeDNS(ctx, w, r)
})}
s.m.Unlock()