Overwrite the server name only when we need to send an upstream query

This commit is contained in:
Frank Denis 2020-03-13 17:50:58 +01:00
parent c17637c026
commit 19647e03a6
5 changed files with 13 additions and 14 deletions

View file

@ -84,7 +84,6 @@ type PluginsState struct {
requestStart time.Time
requestEnd time.Time
cacheHit bool
noServed bool
returnCode PluginsReturnCode
serverName string
}
@ -238,14 +237,14 @@ func NewPluginsState(proxy *Proxy, clientProto string, clientAddr *net.Addr, sta
rejectTTL: proxy.rejectTTL,
questionMsg: nil,
qName: "",
serverName: "-",
requestStart: start,
maxUnencryptedUDPSafePayloadSize: MaxDNSUDPSafePacketSize,
sessionData: make(map[string]interface{}),
}
}
func (pluginsState *PluginsState) ApplyQueryPlugins(pluginsGlobals *PluginsGlobals, packet []byte, serverName string, needsEDNS0Padding bool) ([]byte, error) {
pluginsState.serverName = serverName
func (pluginsState *PluginsState) ApplyQueryPlugins(pluginsGlobals *PluginsGlobals, packet []byte, needsEDNS0Padding bool) ([]byte, error) {
msg := dns.Msg{}
if err := msg.Unpack(packet); err != nil {
return packet, err