diff options
author | Andrei Vagin <avagin@google.com> | 2021-04-23 16:43:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-23 16:45:03 -0700 |
commit | 80cd26c2f43e78d43e2ff769cf0449e67254e673 (patch) | |
tree | 5dd1e5cbeea267597a83023e4e33734b0fdb8566 /pkg/sentry | |
parent | 915b8137981e5acb48b58f378a058b88938d44d4 (diff) |
hostinet: parse the timeval structure from a SO_TIMESTAMP control message
PiperOrigin-RevId: 370181621
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/socket/hostinet/socket.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/socket/hostinet/socket.go b/pkg/sentry/socket/hostinet/socket.go index a784e23b5..0d3b23643 100644 --- a/pkg/sentry/socket/hostinet/socket.go +++ b/pkg/sentry/socket/hostinet/socket.go @@ -528,7 +528,9 @@ func parseUnixControlMessages(unixControlMessages []unix.SocketControlMessage) s switch unixCmsg.Header.Type { case linux.SO_TIMESTAMP: controlMessages.IP.HasTimestamp = true - binary.Unmarshal(unixCmsg.Data[:linux.SizeOfTimeval], hostarch.ByteOrder, &controlMessages.IP.Timestamp) + ts := linux.Timeval{} + ts.UnmarshalBytes(unixCmsg.Data[:linux.SizeOfTimeval]) + controlMessages.IP.Timestamp = ts.ToNsecCapped() } case linux.SOL_IP: |