Don't log a server for blocked names by pattern (#1218)
* Update plugins.go * reason update moved after reject confirmed added boolean for direct rejects * remove server with direct rejects name pattern blocked cases
This commit is contained in:
parent
a8db53e36f
commit
c17637c026
|
@ -26,9 +26,6 @@ var blockedNames *BlockedNames
|
|||
|
||||
func (blockedNames *BlockedNames) check(pluginsState *PluginsState, qName string, aliasFor *string) (bool, error) {
|
||||
reject, reason, xweeklyRanges := blockedNames.patternMatcher.Eval(qName)
|
||||
if aliasFor != nil {
|
||||
reason = reason + " (alias for [" + *aliasFor + "])"
|
||||
}
|
||||
var weeklyRanges *WeeklyRanges
|
||||
if xweeklyRanges != nil {
|
||||
weeklyRanges = xweeklyRanges.(*WeeklyRanges)
|
||||
|
@ -43,6 +40,11 @@ func (blockedNames *BlockedNames) check(pluginsState *PluginsState, qName string
|
|||
}
|
||||
pluginsState.action = PluginsActionReject
|
||||
pluginsState.returnCode = PluginsReturnCodeReject
|
||||
if aliasFor != nil {
|
||||
reason = reason + " (alias for [" + *aliasFor + "])"
|
||||
} else {
|
||||
pluginsState.noServed = true
|
||||
}
|
||||
if blockedNames.logger != nil {
|
||||
var clientIPStr string
|
||||
if pluginsState.clientProto == "udp" {
|
||||
|
|
|
@ -63,7 +63,7 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err
|
|||
}
|
||||
qName := pluginsState.qName
|
||||
|
||||
if pluginsState.cacheHit {
|
||||
if pluginsState.cacheHit || pluginsState.noServed {
|
||||
pluginsState.serverName = "-"
|
||||
} else {
|
||||
switch pluginsState.returnCode {
|
||||
|
|
|
@ -84,6 +84,7 @@ type PluginsState struct {
|
|||
requestStart time.Time
|
||||
requestEnd time.Time
|
||||
cacheHit bool
|
||||
noServed bool
|
||||
returnCode PluginsReturnCode
|
||||
serverName string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue