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

Please add a (n)oping option to ping all IP addresses (i.e. both, IPv4 and IPv6) for given hostnames #52

Open
xtaran opened this issue Dec 2, 2019 · 9 comments
Labels

Comments

@xtaran
Copy link

xtaran commented Dec 2, 2019

A very common noping use case for me is to check when a server comes up after reboot. For that I want to check both, IPv4 and IPv6 addresses of the same host, i.e. for the same hostname.

Currently I do this like this:

noping $(host someserver.example.org | sed -e 's/^.* address //')

It would be nice if noping would have an option to ping all IP addresses a hostname resolves, too, especially A and AAAA records. I suggest to use -5 as it is between -4 and -6, but -a or -A would be fine as well. Would then look like this:

noping -5 someserver.example.org

I guess oping itself (which I nearly never use) should get the same option, too.

@xtaran
Copy link
Author

xtaran commented Dec 13, 2019

I suggest to use -5 as it is between -4 and -6, but -a or -A would be fine as well.

Actually, in hexadecimal, -a or -A would be -4 + -6, so in the meanwhile, I'd prefer and suggest -a or -A as it's even more fitting (and more geeky). ;-)

@cron2
Copy link
Contributor

cron2 commented May 29, 2020

Since this is something I wanted as well, I have a patch for this :-) - octo seems to be quite busy so it did not get review yet.

I'll do a repo-clone-and-pullreq, so you can have a look and test...

@cron2
Copy link
Contributor

cron2 commented May 29, 2020

Rebased to master, polished, split functionality into "multiping" and "canonify output hostnames" - we're using this internally since half a year, so it's generally working (on FreeBSD).

It would be cool if people could test this - then I'll do a PR so we can get this merged, hopefully :-)

https://github.com/cron2/liboping/

has the change, in the "multiping" branch.

@octo octo added the Feature label Jun 1, 2020
@octo
Copy link
Owner

octo commented Jun 1, 2020

Sounds like a great feature! Could you create a PR, @cron2? That would make it easier to test and review.

Personally I would find -a for "all" quite intuitive for this behavior. We would also add -A for "automatic", i.e. the default behavior.

Best regards,
—octo

@cron2
Copy link
Contributor

cron2 commented Jun 1, 2020

I'll rework what I have a bit and open a PR later today.

What I have now modifies the behaviour of ping_host_add() but neglects to update the manpage... I think I will add a ping_host_add_multiple() which takes a "max_hosts" argument - controlled by "-a" - and "ping_host_add()" will then become a wrapper for "ping_host_add_multiple( ... , 1)" with the existing calling convention. And, man page :-)

@xtaran
Copy link
Author

xtaran commented Jun 1, 2020

Hi,

yay on progress here! :-)

Sounds like a great feature! Could you create a PR, @cron2? That would make it easier to test and review.

Thanks to @cron2 for providing an implementation.

Personally I would find -a for "all" quite intuitive for this behavior.

Fine for me. :-)

We would also add -A for "automatic", i.e. the default behavior.

Why would this be needed? Will the default be changed?

@cron2 cron2 mentioned this issue Jun 1, 2020
@xtaran
Copy link
Author

xtaran commented Mar 28, 2021

Since this still didn't make it into liboping proper and hence won't be part of the upcoming Debian 11 Bullseye Stable release, I wrote my own wrapper around noping as I just once again ran into a situation where had to resolve dual-stack IP addresses manually. My wrapper implementation can be found at https://github.com/xtaran/nopinga/.

@barak
Copy link

barak commented Mar 29, 2021

Sorry about that! Would have been happy to cherry-pick that into the library if someone had poked me.

$ echo -{4,6}\ foo
-4 foo -6 foo

@xtaran
Copy link
Author

xtaran commented Mar 30, 2021

Sorry about that! Would have been happy to cherry-pick that into the library if someone had poked me.

Nah, don't worry. I actually would like to see this in liboping proper, not just cherry-picked in Debian. (I actually also have to use other Linux distributions...)

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

No branches or pull requests

4 participants