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

Factor out a function that reports the failure to open an Ethernet

device and exits. On Windows, print a hint about "net start npf" to
start the NPF service.
This commit is contained in:
david
2010-01-15 00:37:39 +00:00
parent f52b57212b
commit c73b250615
8 changed files with 33 additions and 8 deletions

View File

@@ -1459,7 +1459,7 @@ static int send_ip_packet_eth(struct eth_nfo *eth, u8 *packet, unsigned int pack
if (!eth->ethsd) {
ethsd = eth_open_cached(eth->devname);
if (!ethsd)
fatal("%s: Failed to open ethernet device (%s)", __func__, eth->devname);
fatal_eth_open_failure(__func__, eth->devname);
} else {
ethsd = eth->ethsd;
}
@@ -2717,7 +2717,7 @@ static bool doArp(const char *dev, const u8 *srcmac,
/* Prepare probe and sending stuff */
ethsd = eth_open_cached(dev);
if (!ethsd)
fatal("%s: failed to open device %s", __func__, dev);
fatal_eth_open_failure(__func__, dev);
eth_pack_hdr(frame, ETH_ADDR_BROADCAST, *srcmac, ETH_TYPE_ARP);
arp_pack_hdr_ethip(frame + ETH_HDR_LEN, ARP_OP_REQUEST, *srcmac,
srcsin->sin_addr, ETH_ADDR_BROADCAST,