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
2024-04-18 22:13:20 +07:00
committed by Cuong Manh Le
parent b5cf0e2b31
commit dd9f2465be
4 changed files with 21 additions and 10 deletions

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
}
}