Lines 1-45
Link Here
|
1 |
$FreeBSD: ports/security/nmap/files/patch-scan_engine.cc,v 1.1 2006/03/15 14:30:41 sem Exp $ |
|
|
2 |
|
3 |
Patch taken from <20060217013528.GG7214@syn.lnxnet.net>. |
4 |
http://seclists.org/lists/nmap-dev/2006/Jan-Mar/0205.html |
5 |
Will be included in nmap 4.02. |
6 |
|
7 |
--- scan_engine.cc.ORIG Wed Mar 8 13:36:06 2006 |
8 |
+++ scan_engine.cc Wed Mar 8 13:40:44 2006 |
9 |
@@ -807,6 +807,7 @@ |
10 |
|
11 |
/* Returns true if the GLOBAL system says that sending is OK.*/ |
12 |
bool GroupScanStats::sendOK() { |
13 |
+ int recentsends; |
14 |
|
15 |
if (USI->scantype == CONNECT_SCAN && CSI->numSDs >= CSI->maxSocketsAllowed) |
16 |
return false; |
17 |
@@ -815,7 +816,9 @@ |
18 |
the last listen call, at least for systems such as Windoze that |
19 |
don't give us a proper pcap time. Also for connect scans, since |
20 |
we don't get an exact response time with them either. */ |
21 |
- if (USI->scantype == CONNECT_SCAN || !pcap_recv_timeval_valid()) { |
22 |
+ recentsends = USI->gstats->probes_sent - USI->gstats->probes_sent_at_last_wait; |
23 |
+ if (recentsends > 0 && |
24 |
+ (USI->scantype == CONNECT_SCAN || !pcap_recv_timeval_valid())) { |
25 |
int to_ms = (int) MAX(to.srtt * .75 / 1000, 50); |
26 |
if (TIMEVAL_MSEC_SUBTRACT(USI->now, last_wait) > to_ms) |
27 |
return false; |
28 |
@@ -828,7 +831,7 @@ |
29 |
responses when I scan localhost. And half of those are the @#$# |
30 |
sends being received. I think I'll put a limit of 50 sends per |
31 |
wait */ |
32 |
- if (USI->gstats->probes_sent - USI->gstats->probes_sent_at_last_wait >= 50) |
33 |
+ if (recentsends >= 50) |
34 |
return false; |
35 |
|
36 |
/* When there is only one target left, let the host congestion |
37 |
@@ -969,7 +972,7 @@ |
38 |
|
39 |
getTiming(&tmng); |
40 |
if (tmng.cwnd >= num_probes_active + .5 && |
41 |
- (freshPortsLeft() || num_probes_waiting_retransmit)) { |
42 |
+ (freshPortsLeft() || num_probes_waiting_retransmit || !retry_stack.empty())) { |
43 |
if (when) *when = USI->now; |
44 |
return true; |
45 |
} |