diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-10-07 21:09:10 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-10-07 21:09:10 +0000 |
commit | e73679d58c108590c22a2ec269cd2d7e9aff50dd (patch) | |
tree | 1da5000a87e4a31ce17fd9f1af2a196df1fced12 /pkg/sentry/socket/socket.go | |
parent | d3d3a0f6cd35fd3f7175667d4babc3a81cb27177 (diff) | |
parent | a7045f051f7bcdca079cdb0636f728a18b609121 (diff) |
Merge release-20210927.0-44-ga7045f051 (automated)
Diffstat (limited to 'pkg/sentry/socket/socket.go')
-rw-r--r-- | pkg/sentry/socket/socket.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/sentry/socket/socket.go b/pkg/sentry/socket/socket.go index 2f0eb4a6c..d4b80a39d 100644 --- a/pkg/sentry/socket/socket.go +++ b/pkg/sentry/socket/socket.go @@ -21,6 +21,7 @@ import ( "bytes" "fmt" "sync/atomic" + "time" "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" @@ -51,8 +52,8 @@ type ControlMessages struct { func packetInfoToLinux(packetInfo tcpip.IPPacketInfo) linux.ControlMessageIPPacketInfo { var p linux.ControlMessageIPPacketInfo p.NIC = int32(packetInfo.NIC) - copy(p.LocalAddr[:], []byte(packetInfo.LocalAddr)) - copy(p.DestinationAddr[:], []byte(packetInfo.DestinationAddr)) + copy(p.LocalAddr[:], packetInfo.LocalAddr) + copy(p.DestinationAddr[:], packetInfo.DestinationAddr) return p } @@ -60,7 +61,7 @@ func packetInfoToLinux(packetInfo tcpip.IPPacketInfo) linux.ControlMessageIPPack // format. func ipv6PacketInfoToLinux(packetInfo tcpip.IPv6PacketInfo) linux.ControlMessageIPv6PacketInfo { var p linux.ControlMessageIPv6PacketInfo - if n := copy(p.Addr[:], []byte(packetInfo.Addr)); n != len(p.Addr) { + if n := copy(p.Addr[:], packetInfo.Addr); n != len(p.Addr) { panic(fmt.Sprintf("got copy(%x, %x) = %d, want = %d", p.Addr, packetInfo.Addr, n, len(p.Addr))) } p.NIC = uint32(packetInfo.NIC) @@ -156,9 +157,9 @@ type IPControlMessages struct { // HasTimestamp indicates whether Timestamp is valid/set. HasTimestamp bool - // Timestamp is the time (in ns) that the last packet used to create - // the read data was received. - Timestamp int64 + // Timestamp is the time that the last packet used to create the read data + // was received. + Timestamp time.Time `state:".(int64)"` // HasInq indicates whether Inq is valid/set. HasInq bool |