summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-24 19:31:32 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-24 19:31:32 +0000
commit9e6ec44f211e4f7777154bce00b5c463f9e8d8ee (patch)
tree75450eed40ba29321687812a842f4d2b3b427040 /pkg/tcpip
parent5c6a6440ff792f1db57a47dd1580b34e571c2967 (diff)
parent339d266be4b2043b01ab0db43cafc36785e9978b (diff)
Merge release-20200818.0-32-g339d266be (automated)
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/stack/nic.go13
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 {