internal/clientinfo: map ::1 to the right host MAC address

So queries originating from host using ::1 as source will be recognized
properly, and treated the same as other queries from host itself.
This commit is contained in:
Cuong Manh Le authored and Cuong Manh Le committed 2024-04-19 14:32:09 +07:00
1 parent b5cf0e2b31
commit dd9f2465be
4 files changed
+21 -10

No files matched your search

+1 -5
View File
@@ -820,11 +820,7 @@ func (p *prog) getClientInfo(remoteIP string, msg *dns.Msg) *ctrld.ClientInfo {
// If this is a query from self, but ci.IP is not loopback IP,
// try using hostname mapping for lookback IP if presents.
if ci.Self {
loopbackIP := "127.0.0.1"
if isV6 {
loopbackIP = "::1"
}
if name := p.ciTable.LookupHostname(loopbackIP, ""); name != "" {
if name := p.ciTable.LocalHostname(isV6); name != "" {
ci.Hostname = name
}
}