summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/udp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-12-04 00:36:23 +0000
committergVisor bot <gvisor-bot@google.com>2019-12-04 00:36:23 +0000
commit7a5ea3c74cfed2b1823e2804161f96f4fb67e63b (patch)
tree81e2df5b64c4a94b2116962fdcfaec89c19a1393 /pkg/tcpip/transport/udp
parentd8a02abc0f26e494f3a672dcff827cae3d17e937 (diff)
parentcf7f27c16793eaa41743e96488dad2ddfd1f5d59 (diff)
Merge release-20191114.0-57-gcf7f27c (automated)
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rw-r--r--pkg/tcpip/transport/udp/endpoint.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go
index 24cb88c13..4b161e404 100644
--- a/pkg/tcpip/transport/udp/endpoint.go
+++ b/pkg/tcpip/transport/udp/endpoint.go
@@ -1134,9 +1134,14 @@ func (e *endpoint) GetLocalAddress() (tcpip.FullAddress, *tcpip.Error) {
e.mu.RLock()
defer e.mu.RUnlock()
+ addr := e.ID.LocalAddress
+ if e.state == StateConnected {
+ addr = e.route.LocalAddress
+ }
+
return tcpip.FullAddress{
NIC: e.RegisterNICID,
- Addr: e.ID.LocalAddress,
+ Addr: addr,
Port: e.ID.LocalPort,
}, nil
}