Fix: redir-host should lookup hosts

This commit is contained in:
gVisor bot 2020-04-27 21:28:24 +08:00
parent 2a7caf794f
commit 40832885c4

View File

@ -147,6 +147,9 @@ func preHandleMetadata(metadata *C.Metadata) error {
metadata.AddrType = C.AtypDomainName
if enhancedMode.FakeIPEnabled() {
metadata.DstIP = nil
} else if node := resolver.DefaultHosts.Search(host); node != nil {
// redir-host should lookup the hosts
metadata.DstIP = node.Data.(net.IP)
}
} else if enhancedMode.IsFakeIP(metadata.DstIP) {
return fmt.Errorf("fake DNS record %s missing", metadata.DstIP)