summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-07-07 20:34:33 +0000
committergVisor bot <gvisor-bot@google.com>2021-07-07 20:34:33 +0000
commitd4e5be7022aeaf1a87d997a70e13c45baf9725cf (patch)
treeb7ebd819f866d86f3ab48ca9a605c2948e5350c7 /pkg/tcpip/link
parent44cb4590ada570e735c5816319034798b4ba986f (diff)
parent02fec8dba5a6148e44da2715e26246a5d91e64fa (diff)
Merge release-20210628.0-27-g02fec8dba (automated)
Diffstat (limited to 'pkg/tcpip/link')
-rw-r--r--pkg/tcpip/link/sniffer/pcap.go3
-rw-r--r--pkg/tcpip/link/sniffer/sniffer.go2
2 files changed, 2 insertions, 3 deletions
diff --git a/pkg/tcpip/link/sniffer/pcap.go b/pkg/tcpip/link/sniffer/pcap.go
index c16c19647..45475dcf1 100644
--- a/pkg/tcpip/link/sniffer/pcap.go
+++ b/pkg/tcpip/link/sniffer/pcap.go
@@ -55,8 +55,7 @@ type pcapPacketHeader struct {
OriginalLength uint32
}
-func newPCAPPacketHeader(incLen, orgLen uint32) pcapPacketHeader {
- now := time.Now()
+func newPCAPPacketHeader(now time.Time, incLen, orgLen uint32) pcapPacketHeader {
return pcapPacketHeader{
Seconds: uint32(now.Unix()),
Microseconds: uint32(now.Nanosecond() / 1000),
diff --git a/pkg/tcpip/link/sniffer/sniffer.go b/pkg/tcpip/link/sniffer/sniffer.go
index 530d737ba..232a26a18 100644
--- a/pkg/tcpip/link/sniffer/sniffer.go
+++ b/pkg/tcpip/link/sniffer/sniffer.go
@@ -155,7 +155,7 @@ func (e *endpoint) dumpPacket(dir direction, protocol tcpip.NetworkProtocolNumbe
if max := int(e.maxPCAPLen); length > max {
length = max
}
- if err := binary.Write(writer, binary.BigEndian, newPCAPPacketHeader(uint32(length), uint32(totalLength))); err != nil {
+ if err := binary.Write(writer, binary.BigEndian, newPCAPPacketHeader(time.Now(), uint32(length), uint32(totalLength))); err != nil {
panic(err)
}
write := func(b []byte) {