From 40832885c445b8d5c644979c0188a19b621728e3 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 27 Apr 2020 21:28:24 +0800 Subject: [PATCH] Fix: redir-host should lookup hosts --- tunnel/tunnel.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 7dbb61e0..c5e4abab 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -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)