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

Support parsing IPv6 output in OpenSSHJunOSPing Plugin #398

Merged
merged 2 commits into from
May 1, 2024

Conversation

zimage
Copy link
Contributor

@zimage zimage commented Apr 18, 2024

When pinging by DNS name on Junos, the ping may use IPv4 or IPv6 and the output is different between the two

IPv4 output

PING dns.google (8.8.8.8): 64 data bytes
72 bytes from 8.8.8.8: icmp_seq=0 ttl=122 time=0.549 ms
72 bytes from 8.8.8.8: icmp_seq=1 ttl=122 time=0.503 ms
72 bytes from 8.8.8.8: icmp_seq=2 ttl=122 time=0.853 ms
72 bytes from 8.8.8.8: icmp_seq=3 ttl=122 time=0.839 ms
72 bytes from 8.8.8.8: icmp_seq=4 ttl=122 time=0.850 ms

--- dns.google ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.503/0.719/0.853/0.158 ms

IPv6 output

PING6(112=40+8+64 bytes) 2605:ce80::2 --> 2001:4860:4860::8844
72 bytes from 2001:4860:4860::8844, icmp_seq=0 hlim=122 time=0.631 ms
72 bytes from 2001:4860:4860::8844, icmp_seq=1 hlim=122 time=0.601 ms
72 bytes from 2001:4860:4860::8844, icmp_seq=2 hlim=122 time=0.617 ms
72 bytes from 2001:4860:4860::8844, icmp_seq=3 hlim=122 time=35.073 ms
72 bytes from 2001:4860:4860::8844, icmp_seq=4 hlim=122 time=3.637 ms

--- dns.google ping6 statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/std-dev = 0.601/8.112/35.073/13.531 ms

This patch changes the regular expression used to parse out the "time" value.
TBH, the expression could be simplified to /^.* time=(\d+\.\d+) ms$/ and push @times,$1;, but I didn't want to change too much.

Support parsing IPv6 output.
@oetiker oetiker self-requested a review April 25, 2024 16:11
@oetiker
Copy link
Owner

oetiker commented Apr 25, 2024

please also update the changes file!

@oetiker
Copy link
Owner

oetiker commented May 1, 2024

thanks!

@oetiker oetiker merged commit 98d1bd2 into oetiker:master May 1, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants