From fc9d35fed9b674768cf318166b09bbdfdb651052 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 17 Sep 2010 16:46:09 +0000 Subject: [PATCH] Add a symbolic constant for INITIAL_ARP_RTT_TIMEOUT. --- nmap.h | 1 + scan_engine.cc | 2 +- targets.cc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nmap.h b/nmap.h index 4d804fada..e222010a2 100644 --- a/nmap.h +++ b/nmap.h @@ -320,6 +320,7 @@ void *realloc(); #endif #define INITIAL_RTT_TIMEOUT 1000 /* Allow 1 second initially for packet responses */ +#define INITIAL_ARP_RTT_TIMEOUT 100 /* The initial timeout for ARP is lower */ #ifndef MAX_RETRANSMISSIONS #define MAX_RETRANSMISSIONS 10 /* 11 probes to port at maximum */ diff --git a/scan_engine.cc b/scan_engine.cc index 380d06095..3e5bada3a 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -924,7 +924,7 @@ GroupScanStats::GroupScanStats(UltraScanInfo *UltraSI) { initialize_timeout_info(&to); /* Default timout should be much lower for arp */ if (USI->ping_scan_arp) - to.timeout = MAX(o.minRttTimeout(), MIN(o.initialRttTimeout(), 100)) * 1000; + to.timeout = MAX(o.minRttTimeout(), MIN(o.initialRttTimeout(), INITIAL_ARP_RTT_TIMEOUT)) * 1000; num_probes_active = 0; numtargets = USI->numIncompleteHosts(); // They are all incomplete at the beginning numprobes = USI->numProbesPerHost(); diff --git a/targets.cc b/targets.cc index 2d884afbf..616a002e6 100644 --- a/targets.cc +++ b/targets.cc @@ -117,7 +117,7 @@ static void arpping(Target *hostbatch[], int num_hosts) { for (targetno = 0; targetno < num_hosts; targetno++) { initialize_timeout_info(&hostbatch[targetno]->to); /* Default timout should be much lower for arp */ - hostbatch[targetno]->to.timeout = MAX(o.minRttTimeout(), MIN(o.initialRttTimeout(), 100)) * 1000; + hostbatch[targetno]->to.timeout = MAX(o.minRttTimeout(), MIN(o.initialRttTimeout(), INITIAL_ARP_RTT_TIMEOUT)) * 1000; if (!hostbatch[targetno]->SrcMACAddress()) { bool islocal = islocalhost(hostbatch[targetno]->v4hostip()); if (islocal) {