Nmap Development mailing list archives

Re: --min-parallelism sets max parallelism too


From: David Fifield <david () bamsoftware com>
Date: Sun, 2 Sep 2007 08:55:56 -0600

On Sun, Sep 02, 2007 at 09:45:23AM -0500, Kris Katterjohn wrote:
On 9/2/07, David Fifield <david () bamsoftware com> wrote:

All this talk about parallelism made me look deeper into how its works.
And I found something a little surprising. Due to a quirk in how options
are processed, when you specify --min-parallelism without also
specifying --max-parallelism, the maximum parallelism is also set to the
minimum. In other words, the parallelism stays the same for the whole
scan, never dropping below the minimum but never rising above it either.

The relevant code is in NmapOps.cc:

        max_parallelism = 0;

        ...

        /* Prevent performance values from getting out of whack */
        if (min_parallelism > max_parallelism)
                max_parallelism = min_parallelism;

This assignment should only take place if max_parallelism has been
defined, I think. Or is this the intended behavior?

Well, there is also this line above that:

  if (max_parallelism && min_parallelism && (min_parallelism >
max_parallelism)) {
    fatal("--min-parallelism=%i must be less than or equal to
--max-parallelism=%i",min_parallelism,max_parallelism);

So if they are both set, and min > max, then it bails.

But otherwise, max = min because you need to have max >= min and (I guess)
you can't really gauge how much the user wants for a max.

Right, but when I set --min-parallelism, I expect the parallelism to
actually be able to increase above the minimum.

We can just use the convention that 0 for min_parallelism and
max_parallelism means "unset". The other parts of the code already work
that way. ultra_scan, for example, uses 300 for the maximum congestion
window if o.max_parallelism is 0.

Or else we could just initialize the maximum to be something huge like
100000, like what is already done with o.max_host_group_sz.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: