mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Remove the unused HOST_FIREWALLED and HOST_BROADCAST flags. The only flags used
are HOST_UNKNOWN, HOST_UP, and HOST_DOWN, and they're not "flags" as such because they are mutually exclusive.
This commit is contained in:
4
Target.h
4
Target.h
@@ -254,10 +254,8 @@ class Target {
|
||||
FingerPrintResults *FPR; /* FP results get by the OS scan system. */
|
||||
PortList ports;
|
||||
|
||||
// unsigned int up;
|
||||
// unsigned int down;
|
||||
int weird_responses; /* echo responses from other addresses, Ie a network broadcast address */
|
||||
unsigned int flags; /* HOST_UP, HOST_DOWN, HOST_FIREWALLED, HOST_BROADCAST (instead of HOST_BROADCAST use weird_responses */
|
||||
unsigned int flags; /* HOST_UNKNOWN, HOST_UP, or HOST_DOWN. */
|
||||
struct timeout_info to;
|
||||
char *hostname; // Null if unable to resolve or unset
|
||||
char * targetname; // The name of the target host given on the commmand line if it is a named host
|
||||
|
||||
2
nmap.h
2
nmap.h
@@ -332,8 +332,6 @@ void *realloc();
|
||||
#define HOST_UNKNOWN 0
|
||||
#define HOST_UP 1
|
||||
#define HOST_DOWN 2
|
||||
#define HOST_FIREWALLED 4
|
||||
#define HOST_BROADCAST 8 /* use the weird_responses member of hoststruct instead */
|
||||
|
||||
#define PINGTYPE_UNKNOWN 0
|
||||
#define PINGTYPE_NONE 1
|
||||
|
||||
@@ -2560,8 +2560,6 @@ static const char *readhoststate(int state) {
|
||||
return "HOST_UP";
|
||||
case HOST_DOWN:
|
||||
return "HOST_DOWN";
|
||||
case HOST_FIREWALLED:
|
||||
return "HOST_FIREWALLED";
|
||||
default:
|
||||
return "COMBO";
|
||||
}
|
||||
@@ -2572,16 +2570,10 @@ static const char *readhoststate(int state) {
|
||||
/* Update state of the host in hss based on its current state and newstate. */
|
||||
static void ultrascan_host_pspec_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
const probespec *pspec, int newstate) {
|
||||
/* Adjust the target flags to note the new state. */
|
||||
if ((hss->target->flags & HOST_UP) == 0) {
|
||||
if (newstate == HOST_UP) {
|
||||
/* Clear any HOST_DOWN or HOST_FIREWALLED flags */
|
||||
hss->target->flags &= ~(HOST_DOWN|HOST_FIREWALLED);
|
||||
hss->target->flags |= HOST_UP;
|
||||
} else if (newstate == HOST_DOWN) {
|
||||
hss->target->flags &= ~HOST_FIREWALLED;
|
||||
hss->target->flags |= HOST_DOWN;
|
||||
} else assert(0);
|
||||
/* If the host is already up, ignore any further updates. */
|
||||
if (hss->target->flags != HOST_UP) {
|
||||
assert(newstate == HOST_UP || newstate == HOST_DOWN);
|
||||
hss->target->flags = newstate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
targets.cc
20
targets.cc
@@ -130,20 +130,6 @@ static inline int gethostnum(Target *hostbatch[], Target *target) {
|
||||
return 0; // Unreached
|
||||
}
|
||||
|
||||
const char *readhoststate(int state) {
|
||||
switch(state) {
|
||||
case HOST_UP:
|
||||
return "HOST_UP";
|
||||
case HOST_DOWN:
|
||||
return "HOST_DOWN";
|
||||
case HOST_FIREWALLED:
|
||||
return "HOST_FIREWALLED";
|
||||
default:
|
||||
return "UNKNOWN/COMBO";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Conducts an ARP ping sweep of the given hosts to determine which ones
|
||||
are up on a local ethernet network */
|
||||
static void arpping(Target *hostbatch[], int num_hosts) {
|
||||
@@ -163,15 +149,13 @@ static void arpping(Target *hostbatch[], int num_hosts) {
|
||||
log_write(LOG_STDOUT|LOG_NORMAL,
|
||||
"ARP ping: Considering %s UP because it is a local IP, despite no MAC address for device %s\n",
|
||||
hostbatch[targetno]->NameIP(), hostbatch[targetno]->deviceName());
|
||||
hostbatch[targetno]->flags &= ~(HOST_DOWN|HOST_FIREWALLED);
|
||||
hostbatch[targetno]->flags |= HOST_UP;
|
||||
hostbatch[targetno]->flags = HOST_UP;
|
||||
} else {
|
||||
log_write(LOG_STDOUT|LOG_NORMAL,
|
||||
"ARP ping: Considering %s DOWN because no MAC address found for device %s.\n",
|
||||
hostbatch[targetno]->NameIP(),
|
||||
hostbatch[targetno]->deviceName());
|
||||
hostbatch[targetno]->flags &= ~HOST_FIREWALLED;
|
||||
hostbatch[targetno]->flags |= HOST_DOWN;
|
||||
hostbatch[targetno]->flags = HOST_DOWN;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user