summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-01-26 20:48:14 +0000
committergVisor bot <gvisor-bot@google.com>2021-01-26 20:48:14 +0000
commitfcb89d2d2954a0a1c6d5c6087f1de3af9eff77af (patch)
treedb4cfd7fdcbc1f1014d2fefa6f2ed9cb45c448f9 /pkg
parentc67edcefda27e4413eb7949343293234fbe1f825 (diff)
parenta90661654d14e77b6442c4a34ced900e2cd9953e (diff)
Merge release-20210112.0-95-ga90661654 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/raw/endpoint.go5
-rw-r--r--pkg/tcpip/transport/udp/endpoint.go5
2 files changed, 9 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/raw/endpoint.go b/pkg/tcpip/transport/raw/endpoint.go
index 9a5f10263..30644e92d 100644
--- a/pkg/tcpip/transport/raw/endpoint.go
+++ b/pkg/tcpip/transport/raw/endpoint.go
@@ -413,7 +413,10 @@ func (e *endpoint) Connect(addr tcpip.FullAddress) *tcpip.Error {
e.RegisterNICID = nic
}
- // Save the route we've connected via.
+ if e.route != nil {
+ // If the endpoint was previously connected then release any previous route.
+ e.route.Release()
+ }
e.route = route
e.connected = true
diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go
index ea8a7017e..a3e513ff7 100644
--- a/pkg/tcpip/transport/udp/endpoint.go
+++ b/pkg/tcpip/transport/udp/endpoint.go
@@ -1009,6 +1009,11 @@ func (e *endpoint) Connect(addr tcpip.FullAddress) *tcpip.Error {
e.ID = id
e.boundBindToDevice = btd
+ if e.route != nil {
+ // If the endpoint was already connected then make sure we release the
+ // previous route.
+ e.route.Release()
+ }
e.route = r
e.dstPort = addr.Port
e.RegisterNICID = nicID