mirror of
https://github.com/nmap/nmap.git
synced 2025-12-16 20:59:02 +00:00
Remove some minor changes to timing updates in connect scans
This change restores the control flow of handling connect() return and error values. This shouldn't result in any real changes, but makes it simpler to see the differences introduced in r33185.
This commit is contained in:
@@ -3150,7 +3150,6 @@ static void handleConnectResult(UltraScanInfo *USI, HostScanStats *hss,
|
|||||||
int connect_errno,
|
int connect_errno,
|
||||||
bool destroy_probe=false) {
|
bool destroy_probe=false) {
|
||||||
bool adjust_timing = true;
|
bool adjust_timing = true;
|
||||||
struct timeval *rcvdtime = &USI->now;
|
|
||||||
int newportstate = PORT_UNKNOWN;
|
int newportstate = PORT_UNKNOWN;
|
||||||
int newhoststate = HOST_UNKNOWN;
|
int newhoststate = HOST_UNKNOWN;
|
||||||
reason_t current_reason = ER_NORESPONSE;
|
reason_t current_reason = ER_NORESPONSE;
|
||||||
@@ -3198,11 +3197,10 @@ static void handleConnectResult(UltraScanInfo *USI, HostScanStats *hss,
|
|||||||
newportstate = PORT_FILTERED;
|
newportstate = PORT_FILTERED;
|
||||||
current_reason = ER_HOSTUNREACH;
|
current_reason = ER_HOSTUNREACH;
|
||||||
break;
|
break;
|
||||||
case ETIMEDOUT:
|
|
||||||
rcvdtime = NULL;
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
case WSAEADDRNOTAVAIL:
|
case WSAEADDRNOTAVAIL:
|
||||||
#endif
|
#endif
|
||||||
|
case ETIMEDOUT:
|
||||||
case EHOSTDOWN:
|
case EHOSTDOWN:
|
||||||
newhoststate = HOST_DOWN;
|
newhoststate = HOST_DOWN;
|
||||||
/* It could be the host is down, or it could be firewalled. We
|
/* It could be the host is down, or it could be firewalled. We
|
||||||
@@ -3225,13 +3223,10 @@ static void handleConnectResult(UltraScanInfo *USI, HostScanStats *hss,
|
|||||||
error("Strange read error from %s (%d - '%s')", hss->target->targetipstr(), connect_errno, strerror(connect_errno));
|
error("Strange read error from %s (%d - '%s')", hss->target->targetipstr(), connect_errno, strerror(connect_errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (newhoststate != HOST_UP) {
|
if (probe->isPing() && newhoststate != HOST_UNKNOWN ) {
|
||||||
adjust_timing = false;
|
ultrascan_ping_update(USI, hss, probeI, &USI->now, adjust_timing);
|
||||||
}
|
|
||||||
if (probe->isPing()) {
|
|
||||||
ultrascan_ping_update(USI, hss, probeI, rcvdtime, adjust_timing);
|
|
||||||
} else if (USI->ping_scan && newhoststate != HOST_UNKNOWN) {
|
} else if (USI->ping_scan && newhoststate != HOST_UNKNOWN) {
|
||||||
ultrascan_host_probe_update(USI, hss, probeI, newhoststate, rcvdtime, adjust_timing);
|
ultrascan_host_probe_update(USI, hss, probeI, newhoststate, &USI->now, adjust_timing);
|
||||||
hss->target->reason.reason_id = current_reason;
|
hss->target->reason.reason_id = current_reason;
|
||||||
/* If the host is up, we can forget our other probes. */
|
/* If the host is up, we can forget our other probes. */
|
||||||
if (newhoststate == HOST_UP)
|
if (newhoststate == HOST_UP)
|
||||||
@@ -3262,7 +3257,7 @@ static void handleConnectResult(UltraScanInfo *USI, HostScanStats *hss,
|
|||||||
hss->markProbeTimedout(probeI);
|
hss->markProbeTimedout(probeI);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ultrascan_port_probe_update(USI, hss, probeI, newportstate, rcvdtime, adjust_timing);
|
ultrascan_port_probe_update(USI, hss, probeI, newportstate, &USI->now, adjust_timing);
|
||||||
hss->target->ports.setStateReason(dport, protocol, current_reason, 0, NULL);
|
hss->target->ports.setStateReason(dport, protocol, current_reason, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user