diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-11-07 17:50:46 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-07 17:50:46 +0000 |
commit | 6e114e15c6429c085a288de360ea073d6e4b99f0 (patch) | |
tree | 7795e5a48ecfa9900bd297cd0fdc8ee36ee4dd5c /pkg/sentry | |
parent | 1cbd3d85c98a0e76fdd3f76028d32ccaca415b42 (diff) | |
parent | 66ebb6575f929a389d3c929977ed5e31d706fcfe (diff) |
Merge release-20190806.1-382-g66ebb65 (automated)
Diffstat (limited to 'pkg/sentry')
-rwxr-xr-x | pkg/sentry/socket/netstack/netstack.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go index 27c6692c4..d92399efd 100755 --- a/pkg/sentry/socket/netstack/netstack.go +++ b/pkg/sentry/socket/netstack/netstack.go @@ -1173,6 +1173,18 @@ func getSockOptTCP(t *kernel.Task, ep commonEndpoint, name, outLen int) (interfa copy(b, v) return b, nil + case linux.TCP_LINGER2: + if outLen < sizeOfInt32 { + return nil, syserr.ErrInvalidArgument + } + + var v tcpip.TCPLingerTimeoutOption + if err := ep.GetSockOpt(&v); err != nil { + return nil, syserr.TranslateNetstackError(err) + } + + return int32(time.Duration(v) / time.Second), nil + default: emitUnimplementedEventTCP(t, name) } @@ -1556,6 +1568,14 @@ func setSockOptTCP(t *kernel.Task, ep commonEndpoint, name int, optVal []byte) * } return nil + case linux.TCP_LINGER2: + if len(optVal) < sizeOfInt32 { + return syserr.ErrInvalidArgument + } + + v := usermem.ByteOrder.Uint32(optVal) + return syserr.TranslateNetstackError(ep.SetSockOpt(tcpip.TCPLingerTimeoutOption(time.Second * time.Duration(v)))) + case linux.TCP_REPAIR_OPTIONS: t.Kernel().EmitUnimplementedEvent(t) |