plugin/view: server_ip() fails to compare against local address for UDP packets
Author: KentzoCreated Aug 28, 2026Updated Aug 28, 2026
Labelsbug
What happened:
When CoreDNS is configured to listed on the [::] wildcard, view filter that uses serverip() will not match against local IP for UDP packets. This happens because ResponseWriter.LocalAddr() calls PacketConn.LocalAddr() instead of using PacketControl.
What you expected to happen:
serverip() should match against actual local address that received the packet.
How to reproduce it (as minimally and precisely as possible):
. {
view VIEW {
expr server_ip() == '<ip>'
}
log . "IP MATCHED"
}
. {
view VIEW {
expr server_ip() == '[::]'
}
log . "WILDCARD MATCHED"
}
. {
log . "NOT MATCHED"
}Then make DNS query over UDP via .
Anything else we need to know?:
plugin/log's {local} is also affected.
Environment:
- the version of CoreDNS: 1.14.7
Source: coredns/coredns