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

Parse IPv6 host & numeric host on Linux #94

Merged
merged 6 commits into from
Nov 30, 2019
Merged

Parse IPv6 host & numeric host on Linux #94

merged 6 commits into from
Nov 30, 2019

Conversation

nahanil
Copy link
Contributor

@nahanil nahanil commented Feb 28, 2019

Inspired by #79

Not sure if I've gone about this the right way, but the odd spacing and bracket placement in Linux with ping6 meant that 'numeric_host' was never getting set. In a project I'm working on I get odd values for 'host' like one.one.one.one(2606:4700:4700::1111)

I wasn't sure how to deal with responses like the following two where the ping command only gives you an IP address or a hostname and not both. In those cases host and numeric_host will be the same, ie:

PING 2606:4700:4700::1111(2606:4700:4700::1111) 56 data bytes
# OR
PING one.one.one.one(one.one.one.one) 56 data bytes

I'm tempted to sit on this PR a while and wait for suggestions, as well as try to find a few more machines that I can grab test fixtures from to make sure it does what it should.

Edit: Oh yeah! https://travis-ci.org/texh/node-ping. Node >=4 are all passing, lower versions bail on an error with grunt using too-modern JS.

@mondwan
Copy link
Collaborator

mondwan commented Mar 9, 2019

As we have a config for v6, is it better for relying on that value to determine whether we should expect a IPV4 address or not?

@nahanil
Copy link
Contributor Author

nahanil commented Mar 9, 2019

@mondwan Not unless the v6 flag actually works across the board. /sbin/ping6 won't neccessarily be the place that ping6 is, and calling regular /bin/ping could do either of v4 or v6 lookup.

Related to: #95 & #79 (comment)
Debian GNU/Linux 9 (stretch)

root@dev:~# /sbin/ping6
-su: /sbin/ping6: No such file or directory
root@dev:~# which ping6
/bin/ping6

Mond Wan added 2 commits June 7, 2019 18:15
As discribed at #95, ping / ping6 may be installed in other system path
in linux system. Therefore, we decided to rely on `shell` option instead
of hard coding the executable path
@mondwan
Copy link
Collaborator

mondwan commented Jun 7, 2019

@texh Please check whether the implementation works on your platform or not. I will merge this MR soon if there are no more feedback. Thanks

@mondwan mondwan mentioned this pull request Jun 7, 2019
@nahanil
Copy link
Contributor Author

nahanil commented Jun 7, 2019

@mondwan At a glance it looks like it should do the business - will try it out in a few hours and report back 😄

@mondwan
Copy link
Collaborator

mondwan commented Jun 22, 2019

It sounds there are no problem. I will merge it soon :)

@mondwan mondwan merged commit cea10f5 into danielzzz:master Nov 30, 2019
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