@@ -123,16 +123,16 @@ func (plugin *PluginForward) Init(proxy *Proxy) error {
123
123
}
124
124
if requiresDHCP {
125
125
if len (proxy .userName ) > 0 {
126
- dlog .Warn ("DHCP/DNS detection may not work when ` user_name` is set or when starting as a non-root user" )
126
+ dlog .Warn ("DHCP/DNS detection may not work when ' user_name' is set or when starting as a non-root user" )
127
127
}
128
128
if proxy .SourceIPv6 {
129
- dlog .Info ("Starting a DHCP/DNS detector for IPv6" )
129
+ dlog .Notice ("Starting a DHCP/DNS detector for IPv6" )
130
130
d6 := & dhcpdns.Detector {RemoteIPPort : "[2001:DB8::53]:80" }
131
131
go d6 .Serve (9 , 10 )
132
132
plugin .dhcpdns = append (plugin .dhcpdns , d6 )
133
133
}
134
134
if proxy .SourceIPv4 {
135
- dlog .Info ("Starting a DHCP/DNS detector for IPv4" )
135
+ dlog .Notice ("Starting a DHCP/DNS detector for IPv4" )
136
136
d4 := & dhcpdns.Detector {RemoteIPPort : "192.0.2.53:80" }
137
137
go d4 .Serve (9 , 10 )
138
138
plugin .dhcpdns = append (plugin .dhcpdns , d4 )
@@ -188,15 +188,16 @@ func (plugin *PluginForward) Eval(pluginsState *PluginsState, msg *dns.Msg) erro
188
188
for _ , dhcpdns := range plugin .dhcpdns {
189
189
inconsistency , ip , dhcpDNS , err := dhcpdns .Status ()
190
190
if err != nil && ip != "" && inconsistency > maxInconsistency {
191
- dhcpDNS = nil
191
+ dlog .Infof ("No response from the DHCP server while resolving [%s]" , qName )
192
+ continue
192
193
}
193
- if len (dhcpDNS ) > 0 {
194
+ if dhcpDNS != nil && len (dhcpDNS ) > 0 {
194
195
server = net .JoinHostPort (dhcpDNS [rand .Intn (len (dhcpDNS ))].String (), "53" )
195
196
break
196
197
}
197
198
}
198
199
if len (server ) == 0 {
199
- dlog .Warn ("DHCP didn't provide any DNS server" )
200
+ dlog .Infof ("DHCP didn't provide any DNS server to forward [%s]" , qName )
200
201
continue
201
202
}
202
203
}
0 commit comments