mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Don't set max parallelism when only --min-paralellism is given.
Setting --min-parallelism without also setting --max-parallelism would force the max parallelism to the same value. So, for example, --min-parallelism=1 would also limit the max parallelism to 1. This patch, based on one by Chris Woodbury, allows the max parallelism to rise above this minimum, up to the maximum defined by each scan phase.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o Setting --min-parallelism by itself no longer forces the maximum
|
||||||
|
parallelism to the same value. [Chris Woodbury, David Fifield]
|
||||||
|
|
||||||
o [NSE] Added an error message indicating script failure, when Nmap is being
|
o [NSE] Added an error message indicating script failure, when Nmap is being
|
||||||
run in non verbose/debug mode. [Patrik Karlsson]
|
run in non verbose/debug mode. [Patrik Karlsson]
|
||||||
|
|
||||||
|
|||||||
@@ -533,10 +533,6 @@ dialog where you can start NPF if you have administrator privileges.";
|
|||||||
fatal("Sorry -- IPv6 support is currently only available for TCP, UDP, and SCTP port scans and list scan (-sL). OS detection, random targets and decoys are also not supported with IPv6. Further support is under consideration.");
|
fatal("Sorry -- IPv6 support is currently only available for TCP, UDP, and SCTP port scans and list scan (-sL). OS detection, random targets and decoys are also not supported with IPv6. Further support is under consideration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prevent performance values from getting out of whack */
|
|
||||||
if (min_parallelism > max_parallelism)
|
|
||||||
max_parallelism = min_parallelism;
|
|
||||||
|
|
||||||
if(ipoptions && osscan)
|
if(ipoptions && osscan)
|
||||||
error("WARNING: Ip options are NOT used while OS scanning!");
|
error("WARNING: Ip options are NOT used while OS scanning!");
|
||||||
|
|
||||||
|
|||||||
@@ -304,8 +304,8 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName,
|
|||||||
initialize_proxy_struct(proxy);
|
initialize_proxy_struct(proxy);
|
||||||
initialize_timeout_info(&proxy->host.to);
|
initialize_timeout_info(&proxy->host.to);
|
||||||
|
|
||||||
proxy->max_groupsz = (o.max_parallelism)? o.max_parallelism : 100;
|
proxy->min_groupsz = o.min_parallelism ? o.min_parallelism : 4;
|
||||||
proxy->min_groupsz = (o.min_parallelism)? o.min_parallelism : 4;
|
proxy->max_groupsz = MAX(proxy->min_groupsz, o.max_parallelism ? o.max_parallelism : 100);
|
||||||
proxy->max_senddelay = 100000;
|
proxy->max_senddelay = 100000;
|
||||||
|
|
||||||
Strncpy(name, proxyName, sizeof(name));
|
Strncpy(name, proxyName, sizeof(name));
|
||||||
|
|||||||
@@ -5904,15 +5904,8 @@ void pos_scan(Target *target, u16 *portarray, int numports, stype scantype) {
|
|||||||
|
|
||||||
memset(&pil, 0, sizeof(pil));
|
memset(&pil, 0, sizeof(pil));
|
||||||
|
|
||||||
if (o.max_parallelism) {
|
ss.min_width = o.min_parallelism ? o.min_parallelism : 1;
|
||||||
ss.max_width = o.max_parallelism;
|
ss.max_width = MAX(ss.min_width, o.max_parallelism ? o.max_parallelism : 150);
|
||||||
} else {
|
|
||||||
ss.max_width = 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o.min_parallelism) {
|
|
||||||
ss.min_width = o.min_parallelism;
|
|
||||||
} else ss.min_width = 1;
|
|
||||||
|
|
||||||
ss.initial_packet_width = box(ss.min_width, ss.max_width, ss.initial_packet_width);
|
ss.initial_packet_width = box(ss.min_width, ss.max_width, ss.initial_packet_width);
|
||||||
ss.numqueries_ideal = ss.initial_packet_width;
|
ss.numqueries_ideal = ss.initial_packet_width;
|
||||||
|
|||||||
@@ -1880,7 +1880,10 @@ ServiceGroup::ServiceGroup(vector<Target *> &Targets, AllProbes *AP) {
|
|||||||
if (o.timing_level == 4) desired_par = 30;
|
if (o.timing_level == 4) desired_par = 30;
|
||||||
if (o.timing_level >= 5) desired_par = 40;
|
if (o.timing_level >= 5) desired_par = 40;
|
||||||
// TODO: Come up with better ways to determine ideal_parallelism
|
// TODO: Come up with better ways to determine ideal_parallelism
|
||||||
ideal_parallelism = box(o.min_parallelism, o.max_parallelism? o.max_parallelism : 100, desired_par);
|
int min_par, max_par;
|
||||||
|
min_par = o.min_parallelism;
|
||||||
|
max_par = MAX(min_par, o.max_parallelism ? o.max_parallelism : 100);
|
||||||
|
ideal_parallelism = box(min_par, max_par, desired_par);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceGroup::~ServiceGroup() {
|
ServiceGroup::~ServiceGroup() {
|
||||||
|
|||||||
@@ -295,9 +295,9 @@ void ultra_timing_vals::drop_group(unsigned in_flight,
|
|||||||
void scan_performance_vars::init() {
|
void scan_performance_vars::init() {
|
||||||
/* TODO: I should revisit these values for tuning. They should probably
|
/* TODO: I should revisit these values for tuning. They should probably
|
||||||
at least be affected by -T. */
|
at least be affected by -T. */
|
||||||
low_cwnd = MAX(o.min_parallelism, 1);
|
low_cwnd = o.min_parallelism ? o.min_parallelism : 1;
|
||||||
max_cwnd = o.max_parallelism? o.max_parallelism : 300;
|
max_cwnd = MAX(low_cwnd, o.max_parallelism ? o.max_parallelism : 300);
|
||||||
group_initial_cwnd = box(o.min_parallelism, max_cwnd, 10);
|
group_initial_cwnd = box(low_cwnd, max_cwnd, 10);
|
||||||
host_initial_cwnd = group_initial_cwnd;
|
host_initial_cwnd = group_initial_cwnd;
|
||||||
slow_incr = 1;
|
slow_incr = 1;
|
||||||
/* The congestion window grows faster with more aggressive timing. */
|
/* The congestion window grows faster with more aggressive timing. */
|
||||||
|
|||||||
Reference in New Issue
Block a user