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

fix: bgp-peers fails when ip parsing fails #7773

Merged
merged 1 commit into from Nov 21, 2017

Conversation

Projects
None yet
4 participants
@murrant
Member

murrant commented Nov 20, 2017

Don't try to call ->getFamily() if we didn't parse an IP
Stops the discovery after this is encountered.

We have a junos device returning '&hT' for a peer, tracking down the source, but fixing this is advised in the meantime.

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

fix: bgp-peers fails when ip parsing fails
Don't try to call ->getFamily() if we didn't parse an IP
@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Nov 20, 2017

The inspection completed: No new issues

scrutinizer-notifier commented Nov 20, 2017

The inspection completed: No new issues

@murrant murrant added the Bug 🐞 label Nov 20, 2017

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Nov 20, 2017

Member

Doesn't cause issues on Arista.

However should the lack of IP being returned not be handled in IP::fromHexString otherwise this check will have to be repeated anywhere else this is used.

Member

laf commented Nov 20, 2017

Doesn't cause issues on Arista.

However should the lack of IP being returned not be handled in IP::fromHexString otherwise this check will have to be repeated anywhere else this is used.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Nov 21, 2017

Member

Most of the time we just convert it to a string afterwards. So, null -> ''. This tries to call a method on the object, which is null when it fails.

Try catch is much better, otherwise you have to add in if not null else.

Member

murrant commented Nov 21, 2017

Most of the time we just convert it to a string afterwards. So, null -> ''. This tries to call a method on the object, which is null when it fails.

Try catch is much better, otherwise you have to add in if not null else.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Nov 21, 2017

Member

Test by user that reported the issue.

Member

murrant commented Nov 21, 2017

Test by user that reported the issue.

@murrant murrant merged commit d10047c into master Nov 21, 2017

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@murrant murrant deleted the handle-ip-parse-failure branch Nov 21, 2017

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Nov 21, 2017

Member

@laf there is a check inside IP::fromHexString, it throws an invalid IP exception. However, we had enabled the ignore errors parameter on this call previously.

Member

murrant commented Nov 21, 2017

@laf there is a check inside IP::fromHexString, it throws an invalid IP exception. However, we had enabled the ignore errors parameter on this call previously.

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Nov 21, 2017

Member

Maybe we shouldn't return null then and instead an empty string?

Ignoring errors is correct though, we should never break polling or discovery from completing.

Member

laf commented Nov 21, 2017

Maybe we shouldn't return null then and instead an empty string?

Ignoring errors is correct though, we should never break polling or discovery from completing.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Nov 21, 2017

Member

''->addressFamily() would still cause a fatal error ;)

Ignoring errors was incorrect here, because it caused a fatal error when we tried to use it as an IP object. When an exception is triggered it skips the rest of the code in the try block (usually code that would have fatal errors or similar) and goes right to the catch block.

Member

murrant commented Nov 21, 2017

''->addressFamily() would still cause a fatal error ;)

Ignoring errors was incorrect here, because it caused a fatal error when we tried to use it as an IP object. When an exception is triggered it skips the rest of the code in the try block (usually code that would have fatal errors or similar) and goes right to the catch block.

@BradHooper

This comment has been minimized.

Show comment
Hide comment
@BradHooper

BradHooper Nov 21, 2017

This fixed the lack of BGP prefix graphs on Juniper devices. Thank you.

BradHooper commented Nov 21, 2017

This fixed the lack of BGP prefix graphs on Juniper devices. Thank you.

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot May 16, 2018

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

lock bot commented May 16, 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 16, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.