diff options
author | Guy Harris <gharris@sonic.net> | 2021-11-06 15:15:08 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-11-06 15:15:08 -0700 |
commit | 4ba0bf4f6f2f43107f62dd742b0d5e06422276a9 (patch) | |
tree | 4c067a1fc34b68a7e73b94d2a81eb27237d24711 /pcap-npf.c | |
parent | 2aaaef7d3a802d4379d7e994d16ac428e5faefe5 (diff) | |
download | libpcap-4ba0bf4f6f2f43107f62dd742b0d5e06422276a9.tar.gz |
NPF: handle ERROR_INVALID_FUNCTION from PacketGetTimestampModes().
This is probably due to the driver that Packet.dll is using being a
driver for an older version of Npcap, or for WinPcap, so that the
BIOCGTIMESTAMPMODES DeviceIoControl is rejected as being unsupported.
Tell the user to try unindtalling Npcap - and WinPcap if it's installed
- and re-installing from npcap.org.
Diffstat (limited to 'pcap-npf.c')
-rw-r--r-- | pcap-npf.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1577,6 +1577,29 @@ pcap_create_interface(const char *device _U_, char *ebuf) error = GetLastError(); if (error != ERROR_MORE_DATA) { /* + * No, did it fail with ERROR_INVALID_FUNCTION? + */ + if (error == ERROR_INVALID_FUNCTION) { + /* + * This is probably due to + * the driver with which Packet.dll + * communicates being older, or + * being a WinPcap driver, so + * that it doesn't support + * BIOCGTIMESTAMPMODES. + * + * Tell the user to try uninstalling + * Npcap - and WinPcap if installed - + * and re-installing it, to flush + * out all older drivers. + */ + snprintf(errbuf, PCAP_ERRBUF_SIZE, + "PacketGetTimestampModes() failed with ERROR_INVALID_FUNCTION; try uninstalling Npcap, and WinPcap if installed, and re-installing it from npcap.org"); + pcap_close(p); + return (NULL); + } + + /* * No, some other error. Fail. */ pcap_fmt_errmsg_for_win32_err(ebuf, |