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

feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. #7106

Merged
merged 4 commits into from Aug 8, 2017

Conversation

murrant
Copy link
Member

@murrant murrant commented Aug 2, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

@murrant
Copy link
Member Author

murrant commented Aug 3, 2017

Ready for review, sorry, I wasn't too happy with the initial implementation. Feeling happy with it now.

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5
@laf
Copy link
Member

laf commented Aug 3, 2017

Array ( [0] => 1 [1] => Call to undefined function is_ip() [2] => /opt/librenms/html/includes/dev-overview-data.inc.php [3] => 35 )

That's device overview page.

if ($_POST['search_type'] == 'ipv6') {
list($prefix, $length) = explode('/', $interface['ipv6_network']);
$address = Net_IPv6::compress($interface['ipv6_address']).'/'.$length;
if ($_POST['search_type'] == 'mac') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this is muddled up. Two checks for mac and no ipv4_network now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shit, yeah, I started to change that, then changed it back (apparently only partially)

@laf
Copy link
Member

laf commented Aug 3, 2017

Going through a full discovery now, tested all the webui elements changed + api which are all fine except the one above.

Will see how polling is going after 15 minutes.

@laf
Copy link
Member

laf commented Aug 3, 2017

Checking BGP peer [IPV6 Address here] PHP Fatal error:  Call to undefined method LibreNMS\Util\IPv6::compress() in /opt/librenms/includes/functions.php on line 787

Fatal error: Call to undefined method LibreNMS\Util\IPv6::compress() in /opt/librenms/includes/functions.php on line 787

@laf
Copy link
Member

laf commented Aug 3, 2017

Discovery ran through ok. So just that poller error and that's it.

Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
@murrant
Copy link
Member Author

murrant commented Aug 3, 2017

@laf I only was able to fully test discovery modules ipv4-addresses and ipv6-addresses.

Can you (or anyone) test bgp-peers, cisco-sla, loadbalancers/f5-ltm, ntp/cisco

Edit: looks like laf tested bgp-peers.

@laf
Copy link
Member

laf commented Aug 3, 2017

I could only test arista bgp. The rest are kit I don't have in my test lab.

@murrant
Copy link
Member Author

murrant commented Aug 3, 2017

@laf: I think the parts of bgp I touched are in a common code area. But my kit doesn't support IPv6 peer info via snmp :(

@scrutinizer-notifier
Copy link

The inspection completed: 4 new issues, 38 updated code elements

@murrant murrant changed the title refactor: remove use of pear Net_IPv4 and Net_IPv6 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. Aug 3, 2017
@laf
Copy link
Member

laf commented Aug 4, 2017

Running another full disco to test. After that I can't test anything more.

@laf
Copy link
Member

laf commented Aug 4, 2017

Discovery completed.

@murrant murrant merged commit 1d77769 into librenms:master Aug 8, 2017
@murrant murrant deleted the pear_net_remove branch August 8, 2017 19:15
@BradHooper BradHooper mentioned this pull request Aug 23, 2017
5 tasks
@lock
Copy link

lock bot commented May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants