diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-08-24 19:31:32 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-24 19:31:32 +0000 |
commit | 9e6ec44f211e4f7777154bce00b5c463f9e8d8ee (patch) | |
tree | 75450eed40ba29321687812a842f4d2b3b427040 /pkg/tcpip/stack | |
parent | 5c6a6440ff792f1db57a47dd1580b34e571c2967 (diff) | |
parent | 339d266be4b2043b01ab0db43cafc36785e9978b (diff) |
Merge release-20200818.0-32-g339d266be (automated)
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r-- | pkg/tcpip/stack/nic.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 728292782..aff29f9cc 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -666,8 +666,19 @@ func (n *NIC) getRefOrCreateTemp(protocol tcpip.NetworkProtocolNumber, address t } // A usable reference was not found, create a temporary one if requested by - // the caller or if the address is found in the NIC's subnets. + // the caller or if the address is found in the NIC's subnets and the NIC is + // a loopback interface. createTempEP := spoofingOrPromiscuous + if !createTempEP && n.isLoopback() { + for _, r := range n.mu.endpoints { + addr := r.addrWithPrefix() + subnet := addr.Subnet() + if subnet.Contains(address) { + createTempEP = true + break + } + } + } n.mu.RUnlock() if !createTempEP { |