Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
amorozkin opened this issue Dec 14, 2018 · 0 comments

Comments

@amorozkin
Copy link

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++)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant