diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-08-25 14:22:08 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-25 14:22:08 +0000 |
commit | b4b7accd934e853384bc896b9c7e388162b8ca29 (patch) | |
tree | 84de0a1485ca0e744670c7b666d2b7d54a3499db /pkg/sentry/socket/netstack | |
parent | 063b02982e1cff93013b3829fb03fe2cd99cc68a (diff) | |
parent | ae332d96e4bd8b37be16901317d83e24e31c24d7 (diff) |
Merge release-20200818.0-39-gae332d96e (automated)
Diffstat (limited to 'pkg/sentry/socket/netstack')
-rw-r--r-- | pkg/sentry/socket/netstack/netstack.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go index 4d0e33696..921464f5d 100644 --- a/pkg/sentry/socket/netstack/netstack.go +++ b/pkg/sentry/socket/netstack/netstack.go @@ -1409,8 +1409,12 @@ func getSockOptTCP(t *kernel.Task, ep commonEndpoint, name, outLen int) (marshal if err := ep.GetSockOpt(&v); err != nil { return nil, syserr.TranslateNetstackError(err) } - - lingerTimeout := primitive.Int32(time.Duration(v) / time.Second) + var lingerTimeout primitive.Int32 + if v >= 0 { + lingerTimeout = primitive.Int32(time.Duration(v) / time.Second) + } else { + lingerTimeout = -1 + } return &lingerTimeout, nil case linux.TCP_DEFER_ACCEPT: @@ -1967,7 +1971,7 @@ func setSockOptTCP(t *kernel.Task, ep commonEndpoint, name int, optVal []byte) * return syserr.ErrInvalidArgument } - v := usermem.ByteOrder.Uint32(optVal) + v := int32(usermem.ByteOrder.Uint32(optVal)) return syserr.TranslateNetstackError(ep.SetSockOpt(tcpip.TCPLingerTimeoutOption(time.Second * time.Duration(v)))) case linux.TCP_DEFER_ACCEPT: |