mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Remove dependency on pcap-int.h Fixes #426
Windows doesn't support selectable pcap fds, so instead of fiddling with adapter read timeouts via PacketSetReadTimeout, we get an event handle with pcap_get_event and WaitForSIngleObject. This means we don't need to extract the adapter from the pcap_t, which is not part of the libpcap API and was causing crashes switching between the libpcap versions used by WinPcap and Npcap.
This commit is contained in:
22
tcpip.cc
22
tcpip.cc
@@ -146,18 +146,8 @@
|
||||
|
||||
extern NmapOps o;
|
||||
|
||||
#ifdef WIN32
|
||||
#include "pcap-int.h"
|
||||
#endif
|
||||
|
||||
static PacketCounter PktCt;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Create a raw socket and do things that always apply to raw sockets:
|
||||
* Set SO_BROADCAST.
|
||||
* Set IP_HDRINCL.
|
||||
@@ -1669,18 +1659,6 @@ char *readip_pcap(pcap_t *pd, unsigned int *len, long to_usec,
|
||||
}
|
||||
|
||||
do {
|
||||
#ifdef WIN32
|
||||
long to_left;
|
||||
|
||||
if (to_usec > 0) {
|
||||
gettimeofday(&tv_end, NULL);
|
||||
to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
|
||||
} else {
|
||||
to_left = 1;
|
||||
}
|
||||
// Set the timeout (BUGBUG: this is cheating)
|
||||
PacketSetReadTimeout(pd->adapter, to_left);
|
||||
#endif
|
||||
|
||||
p = NULL;
|
||||
/* It may be that protecting this with !pcap_selectable_fd_one_to_one is not
|
||||
|
||||
Reference in New Issue
Block a user