summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-09-14 02:47:42 +0000
committergVisor bot <gvisor-bot@google.com>2021-09-14 02:47:42 +0000
commit7baf282b26abcde8aadac58b6815548ac607f1ef (patch)
tree41e82b9366397c8e4b55eccc203f2aa43e4a9328 /pkg
parent41a6a3a8dbd94ec8dce730ca35c80fe920de574e (diff)
parent226e7d32cb855e69b3bf7a28791a17235074e49a (diff)
Merge release-20210906.0-16-g226e7d32c (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/raw/endpoint.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/tcpip/transport/raw/endpoint.go b/pkg/tcpip/transport/raw/endpoint.go
index 3bf6c0a8f..4a5858bdd 100644
--- a/pkg/tcpip/transport/raw/endpoint.go
+++ b/pkg/tcpip/transport/raw/endpoint.go
@@ -562,8 +562,6 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
return
}
- remoteAddr := pkt.Network().SourceAddress()
-
if e.bound {
// If bound to a NIC, only accept data for that NIC.
if e.BindNICID != 0 && e.BindNICID != pkt.NICID {
@@ -572,16 +570,17 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
return
}
// If bound to an address, only accept data for that address.
- if e.BindAddr != "" && e.BindAddr != remoteAddr {
+ if e.BindAddr != "" && e.BindAddr != pkt.Network().DestinationAddress() {
e.rcvMu.Unlock()
e.mu.RUnlock()
return
}
}
+ srcAddr := pkt.Network().SourceAddress()
// If connected, only accept packets from the remote address we
// connected to.
- if e.connected && e.route.RemoteAddress() != remoteAddr {
+ if e.connected && e.route.RemoteAddress() != srcAddr {
e.rcvMu.Unlock()
e.mu.RUnlock()
return
@@ -593,7 +592,7 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) {
packet := &rawPacket{
senderAddr: tcpip.FullAddress{
NIC: pkt.NICID,
- Addr: remoteAddr,
+ Addr: srcAddr,
},
}