1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Ensure we don't use --send-eth for localhost

This commit is contained in:
dmiller
2025-08-28 19:28:41 +00:00
parent 72b6830067
commit 9bd68008df

View File

@@ -956,6 +956,13 @@ void UltraScanInfo::Init(std::vector<Target *> &Targets, const struct scan_lists
assert(!(sendpref & PACKET_SEND_IP_STRONG));
sendpref = PACKET_SEND_ETH;
}
#ifndef WIN32
/* Windows does loopback via Npcap (eth),
* but we want to avoid that for everyone else. */
if (Targets[0]->ifType() == devt_loopback) {
sendpref = PACKET_SEND_IP;
}
#endif
if (!raw_socket_or_eth(sendpref, Targets[0]->deviceName(), &rawsd, &ethsd)) {
fatal("Couldn't open a raw socket or eth handle.");
}