summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-07-31 14:01:03 -0700
committergVisor bot <gvisor-bot@google.com>2020-07-31 14:01:03 -0700
commitb22c2ab1d769c65bdb8ec789668587559e98f1ae (patch)
tree172ee05cec57bb21bc594d3bf6316faeefbc5d2a /pkg/tcpip/transport/tcp
parent8908baaf79fdd137241596fd2444828d1a33fe27 (diff)
parent2a7b2a61e3ea32129c26eeaa6fab3d81a5d8ad6e (diff)
Merge pull request #3348 from kevinGC:so-orig-dst
PiperOrigin-RevId: 324279280
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r--pkg/tcpip/transport/tcp/endpoint.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go
index 0f7487963..682687ebe 100644
--- a/pkg/tcpip/transport/tcp/endpoint.go
+++ b/pkg/tcpip/transport/tcp/endpoint.go
@@ -2017,6 +2017,17 @@ func (e *endpoint) GetSockOpt(opt interface{}) *tcpip.Error {
*o = tcpip.TCPDeferAcceptOption(e.deferAccept)
e.UnlockUser()
+ case *tcpip.OriginalDestinationOption:
+ ipt := e.stack.IPTables()
+ addr, port, err := ipt.OriginalDst(e.ID)
+ if err != nil {
+ return err
+ }
+ *o = tcpip.OriginalDestinationOption{
+ Addr: addr,
+ Port: port,
+ }
+
default:
return tcpip.ErrUnknownProtocolOption
}