Skip to content

Not all subnets are scanned due to error in function 'mysql_scan_discover_hosts_fping()' (class.phpipamAgent.php) #51

Open
@amorozkin

Description

@amorozkin

Function 'mysql_scan_discover_hosts_fping()' of class.phpipamAgent.php takes $subnet array as one of its arguments. Then it makes a loop with nested one while counters for both of them < sizeof($subnets).
But as $subnets array has gaps in its indexes (some of subnets were excluded from array in function 'mysql_fetch_subnets()' because of being masterSubnets) - total number of elements in array is less then maximum index value and theretofore addressing array elements by loop counter leads to skipping part of subnets from being scanned.

One of possible fixes - this one:

Change outer loop condintion from:
for ($m=0; $m<=sizeof($subnets); $m += $this->config->threads)
to
for ($m=0; $m<=max(array_keys($subnets)); $m += $this->config->threads)

And change inner loop condition from:
for ($i = 0; $i < $this->config->threads && $zz <= sizeof($subnets); $i++)
to
for ($i = 0; $i < $this->config->threads && $zz <= max(array_keys($subnets)); $i++)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions