mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Revert r16464.
This commit is contained in:
@@ -378,7 +378,7 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName,
|
|||||||
memcpy(proxy->eth.dstmac, proxy->host.NextHopMACAddress(), 6);
|
memcpy(proxy->eth.dstmac, proxy->host.NextHopMACAddress(), 6);
|
||||||
proxy->eth.ethsd = eth_open_cached(proxy->host.deviceName());
|
proxy->eth.ethsd = eth_open_cached(proxy->host.deviceName());
|
||||||
if (proxy->eth.ethsd == NULL)
|
if (proxy->eth.ethsd == NULL)
|
||||||
fatal_eth_open_failure(__func__, proxy->host.deviceName());
|
fatal("%s: Failed to open ethernet device (%s)", __func__, proxy->host.deviceName());
|
||||||
proxy->rawsd = -1;
|
proxy->rawsd = -1;
|
||||||
proxy->ethptr = &proxy->eth;
|
proxy->ethptr = &proxy->eth;
|
||||||
} else {
|
} else {
|
||||||
@@ -682,7 +682,7 @@ static int idlescan_countopen2(struct idle_proxy_info *proxy,
|
|||||||
memcpy(eth.dstmac, target->NextHopMACAddress(), 6);
|
memcpy(eth.dstmac, target->NextHopMACAddress(), 6);
|
||||||
eth.ethsd = eth_open_cached(target->deviceName());
|
eth.ethsd = eth_open_cached(target->deviceName());
|
||||||
if (eth.ethsd == NULL)
|
if (eth.ethsd == NULL)
|
||||||
fatal_eth_open_failure(__func__, target->deviceName());
|
fatal("%s: Failed to open ethernet device (%s)", __func__, target->deviceName());
|
||||||
} else eth.ethsd = NULL;
|
} else eth.ethsd = NULL;
|
||||||
|
|
||||||
/* I start by sending out the SYN pr0bez */
|
/* I start by sending out the SYN pr0bez */
|
||||||
|
|||||||
@@ -199,26 +199,3 @@ void gh_perror(const char *err, ...) {
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report a failure to open an Ethernet device and exit through fatal. On
|
|
||||||
Windows, shows a hint about privileges. */
|
|
||||||
void fatal_eth_open_failure(const char *func, const char *devname) {
|
|
||||||
#if WIN32
|
|
||||||
error("\
|
|
||||||
On Windows, this problem can be caused by a lack of privileges under\n\
|
|
||||||
User Account Control (UAC). Start an elevated command prompt by\n\
|
|
||||||
right-clicking on the command prompt shortcut and selecting \"Run as\n\
|
|
||||||
Administrator\". Then enter the command\n\
|
|
||||||
\n\
|
|
||||||
net start npf\n\
|
|
||||||
\n\
|
|
||||||
This will load the Netgroup Packet Filter (NPF) service and allow Nmap\n\
|
|
||||||
to run. Running Nmap or Zenmap under \"Run as Administrator\" also has\n\
|
|
||||||
the side effect of loading NPF.\n\
|
|
||||||
\n\
|
|
||||||
You should have to do this only once per reboot. If you're not able to\n\
|
|
||||||
do any of these things, try the --unprivileged option to avoid the use\n\
|
|
||||||
of any raw network operations.\n");
|
|
||||||
#endif
|
|
||||||
fatal("%s: Failed to open ethernet device (%s)", func, devname); \
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -130,8 +130,6 @@ void pfatal(const char *err, ...)
|
|||||||
void gh_perror(const char *err, ...)
|
void gh_perror(const char *err, ...)
|
||||||
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
void fatal_eth_open_failure(const char *func, const char *devname);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1980,7 +1980,7 @@ eth_t *ldnet_eth_open_cached(const char *device)
|
|||||||
dem = (dnet_eth_map *) safe_zalloc(sizeof(dnet_eth_map));
|
dem = (dnet_eth_map *) safe_zalloc(sizeof(dnet_eth_map));
|
||||||
dem->eth = eth_open(device);
|
dem->eth = eth_open(device);
|
||||||
if (!dem->eth)
|
if (!dem->eth)
|
||||||
fatal_eth_open_failure(__func__, device);
|
fatal("Unable to open dnet on ethernet interface %s", device);
|
||||||
dem->references = 1;
|
dem->references = 1;
|
||||||
dnet_eth_cache[key] = dem;
|
dnet_eth_cache[key] = dem;
|
||||||
return dem->eth;
|
return dem->eth;
|
||||||
|
|||||||
@@ -926,7 +926,7 @@ HostOsScan::HostOsScan(Target *t) {
|
|||||||
|
|
||||||
if ((o.sendpref & PACKET_SEND_ETH) && t->ifType() == devt_ethernet) {
|
if ((o.sendpref & PACKET_SEND_ETH) && t->ifType() == devt_ethernet) {
|
||||||
if ((ethsd = eth_open_cached(t->deviceName())) == NULL)
|
if ((ethsd = eth_open_cached(t->deviceName())) == NULL)
|
||||||
fatal_eth_open_failure(__func__, t->deviceName());
|
fatal("%s: Failed to open ethernet device (%s)", __func__, t->deviceName());
|
||||||
rawsd = -1;
|
rawsd = -1;
|
||||||
} else {
|
} else {
|
||||||
/* Init our raw socket */
|
/* Init our raw socket */
|
||||||
|
|||||||
@@ -1616,7 +1616,7 @@ void UltraScanInfo::Init(vector<Target *> &Targets, struct scan_lists *pts, styp
|
|||||||
/* We'll send ethernet packets with dnet */
|
/* We'll send ethernet packets with dnet */
|
||||||
ethsd = eth_open_cached(Targets[0]->deviceName());
|
ethsd = eth_open_cached(Targets[0]->deviceName());
|
||||||
if (ethsd == NULL)
|
if (ethsd == NULL)
|
||||||
fatal_eth_open_failure(__func__, Targets[0]->deviceName());
|
fatal("dnet: Failed to open device %s", Targets[0]->deviceName());
|
||||||
rawsd = -1;
|
rawsd = -1;
|
||||||
} else {
|
} else {
|
||||||
/* Initialize a raw socket */
|
/* Initialize a raw socket */
|
||||||
|
|||||||
4
tcpip.cc
4
tcpip.cc
@@ -1459,7 +1459,7 @@ static int send_ip_packet_eth(struct eth_nfo *eth, u8 *packet, unsigned int pack
|
|||||||
if (!eth->ethsd) {
|
if (!eth->ethsd) {
|
||||||
ethsd = eth_open_cached(eth->devname);
|
ethsd = eth_open_cached(eth->devname);
|
||||||
if (!ethsd)
|
if (!ethsd)
|
||||||
fatal_eth_open_failure(__func__, eth->devname);
|
fatal("%s: Failed to open ethernet device (%s)", __func__, eth->devname);
|
||||||
} else {
|
} else {
|
||||||
ethsd = eth->ethsd;
|
ethsd = eth->ethsd;
|
||||||
}
|
}
|
||||||
@@ -2717,7 +2717,7 @@ static bool doArp(const char *dev, const u8 *srcmac,
|
|||||||
/* Prepare probe and sending stuff */
|
/* Prepare probe and sending stuff */
|
||||||
ethsd = eth_open_cached(dev);
|
ethsd = eth_open_cached(dev);
|
||||||
if (!ethsd)
|
if (!ethsd)
|
||||||
fatal_eth_open_failure(__func__, dev);
|
fatal("%s: failed to open device %s", __func__, dev);
|
||||||
eth_pack_hdr(frame, ETH_ADDR_BROADCAST, *srcmac, ETH_TYPE_ARP);
|
eth_pack_hdr(frame, ETH_ADDR_BROADCAST, *srcmac, ETH_TYPE_ARP);
|
||||||
arp_pack_hdr_ethip(frame + ETH_HDR_LEN, ARP_OP_REQUEST, *srcmac,
|
arp_pack_hdr_ethip(frame + ETH_HDR_LEN, ARP_OP_REQUEST, *srcmac,
|
||||||
srcsin->sin_addr, ETH_ADDR_BROADCAST,
|
srcsin->sin_addr, ETH_ADDR_BROADCAST,
|
||||||
|
|||||||
@@ -764,7 +764,7 @@ TracerouteState::TracerouteState(std::vector<Target *> &targets) {
|
|||||||
if ((o.sendpref & PACKET_SEND_ETH) && targets[0]->ifType() == devt_ethernet) {
|
if ((o.sendpref & PACKET_SEND_ETH) && targets[0]->ifType() == devt_ethernet) {
|
||||||
ethsd = eth_open_cached(targets[0]->deviceName());
|
ethsd = eth_open_cached(targets[0]->deviceName());
|
||||||
if (ethsd == NULL)
|
if (ethsd == NULL)
|
||||||
fatal_eth_open_failure(__func__, targets[0]->deviceName());
|
fatal("dnet: failed to open device %s", targets[0]->deviceName());
|
||||||
rawsd = -1;
|
rawsd = -1;
|
||||||
} else {
|
} else {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
Reference in New Issue
Block a user