mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Enable Nmap, Nping to use Npcap over Winpcap if available.
This commit is contained in:
10
FPEngine.cc
10
FPEngine.cc
@@ -133,6 +133,10 @@
|
||||
#include "linear.h"
|
||||
#include "FPModel.h"
|
||||
extern NmapOps o;
|
||||
#ifdef WIN32
|
||||
/* from libdnet's intf-win32.c */
|
||||
extern "C" int g_has_npcap_loopback;
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -211,7 +215,11 @@ void FPNetworkControl::init(const char *ifname, devtype iftype) {
|
||||
this->nsock_init = true;
|
||||
|
||||
/* Obtain raw socket or check that we can obtain an eth descriptor. */
|
||||
if ((o.sendpref & PACKET_SEND_ETH) && iftype == devt_ethernet && ifname != NULL) {
|
||||
if ((o.sendpref & PACKET_SEND_ETH) && (iftype == devt_ethernet
|
||||
#ifdef WIN32
|
||||
|| (g_has_npcap_loopback && iftype == devt_loopback)
|
||||
#endif
|
||||
) && ifname != NULL) {
|
||||
/* We don't need to store the eth handler because FPProbes come with a
|
||||
* suitable one (FPProbes::getEthernet()), we just attempt to obtain one
|
||||
* to see if it fails. */
|
||||
|
||||
Reference in New Issue
Block a user