Ask Your Question
0

Frame Arrival Time drift

asked 2018-12-07 17:13:18 +0000

PaulOfford gravatar image

Hi,

We run instances of dumpcap for long periods (weeks or months) on Dell 1U servers with Windows 10 or Windows 10 VMs. We are using WinPcap. Our understanding is that npf grabs the system time when loading and then maintains its own timestamp clock. The result is a steady drift away from the system clock.

I noticed that there is a --time-stamp-type option for dumpcap. I've tried listing supported timestamp types on my Dell XPS running Windows 10 but get nothing listed.

Is there a way to force npf to periodically check the system clock and resync its internal timestamp?

Does npcap address the issue of arrival time drift?

Thanks and regards...Paul

edit retag flag offensive close merge delete

Comments

Christian_R gravatar imageChristian_R ( 2018-12-07 20:49:04 +0000 )edit

As far as I know the clock isn't updated, and I don't think it can be forced to resync. I also assume that npcap doesn't help much, as it's primary design goal is to replace WinPCAP for nmap, not for high precision packet capture.

But I am sure @Guy Harris knows much more about this than I do :-)

Jasper gravatar imageJasper ( 2018-12-07 21:03:55 +0000 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-12-08 05:14:49 +0000

Guy Harris gravatar image

updated 2020-05-20 20:31:09 +0000

Does npcap address the issue of arrival time drift?

With Npcap 0.9989 or later, if you set the registry key HKLM\System\CurrentControlSet\Services\NPF\TimestampMode to 4, then:

  1. on Windows 8 or later, you will get high-resolution time stamps that are synchronized to the system time;
  2. on Windows 7, you will get low-resolution time stamps that are synchronized to the system time.

On Windows 7, due to the lack of a kernel interface to get high-resolution system time (KeQuerySystemTimePrecise()), high-resolution time stamps synchronized to the system time aren't available; you have a choice between high-resolution time stamps not synchronized to the system time (that's the default) or low-resolution time stamps that are synchronized to the system time. KeQuerySystemTimePrecise() was introduced in Windows 8.

(See my comment on Npcap pull request #19 for links to Microsoft documentation telling you more about time stamping on Windows, both in the kernel and in userland, than you probably ever wanted to know.)

I noticed that there is a --time-stamp-type option for dumpcap. I've tried listing supported timestamp types on my Dell XPS running Windows 10 but get nothing listed.

Currently, Linux is the only OS on which time stamp types other than the default "system time, at whatever precision you get" are supported.

I filed an npcap issue suggesting that they support the libpcap time-stamp-type APIs, default to "host time stamp" just as happens with packet capture on UN*Xes, and offer, for what it's worth, a high-resolution time stamp using the system clock on Windows 8. Some of the necessary plumbing is present in Npcap 0.9989, but more is needed - and it's not clear whether Windows 8 and later should offer any choices other than "high-precision time stamps synchronized with the system clock".

Is there a way to force npf to periodically check the system clock and resync its internal timestamp?

No, but there's a way to get WinPcap to use the system time to time stamp packets; the advantage is that the time stamps don't drift relative to the system clock and the disadvantage is that the call the driver makes to get the system clock value (KeQuerySystemTime()) gives system clock interrupt precision (i.e., it fetches a system variable that's updated on every clock interrupt), with clock interrupts happening at intervals in the millisecond range, so packet time stamps aren't very high-resolution.

(Given that the time between the arrival of the last octet of the packet on the network adapter and the time-stamping of the packet in the network stack is variable, high-resolution host time stamps may not be as useful as some might want. This also applies to high-resolution time stamps using the x86 time stamp counter and Windows kernel performance counter. BTW, the x86 time stamp counter is only available on 32-bit x86 - when the code was written, at least, the compiler didn't support in-line assembler for 64-bit x86, so they didn't bother implementing ... (more)

edit flag offensive delete link more

Comments

Chuckc gravatar imageChuckc ( 2020-03-20 20:53:40 +0000 )edit

I'd be tempted to document it only in the Wiki for now, because 1) this is subject to change and 2) as the Npcap people stated in Npcap issue #46, "[they] haven't officially documented it because setting the timestamp mode system-wide is not a great approach. It could cause issues if multiple applications are using Npcap and each wants a different mode."

In the longer run, Npcap should probably 1) default to mode 4 on Windows 8 and later and perhaps 2) offer the standard pcap APIs for querying the available time stamp types and setting the type on a per-adapter basis if it's useful. There's only one change they'd need to make for that; I'd then add the support to libpcap, and they'd pick that up.

Note that the only support for those APIs in Wireshark is that dumpcap and TShark support ...(more)

Guy Harris gravatar imageGuy Harris ( 2020-03-20 21:17:03 +0000 )edit
1

Current versions of Npcap support a high-resolution, synchronized-with-the-system-clock time stamp on Windows 8, 8.1, and 10; you must set the HKLM\System\CurrentControlSet\Services\NPF\TimestampMode Registry key to 4.

Guy Harris gravatar imageGuy Harris ( 2020-05-20 20:41:12 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2018-12-07 17:13:18 +0000

Seen: 2,126 times

Last updated: May 20 '20