Repository navigation
ping: Allow to disable with environment variable - #553
Conversation
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default:
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
Update man page.
Implements: iputils#531
Closes: iputils#553
Signed-off-by: Petr Vorel <pvorel@suse.cz>
e77e040 to
7c18b97
Compare
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
Update man page.
Implements: iputils#531
Closes: iputils#553
Signed-off-by: Petr Vorel <pvorel@suse.cz>
7c18b97 to
adc753a
Compare
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
Update man page.
Implements: iputils#531
Closes: iputils#553
Signed-off-by: Petr Vorel <pvorel@suse.cz>
adc753a to
57acd64
Compare
|
Thank you for this PR! |
|
Thanks for your review!
I wanted to be obvious that change is not for some other implementation (e.g. fping, busybox, inetutils). Most of the people will copy paste variable from man page anyway. |
| if (env && !strcmp(env, "0")) { | ||
| rts.opt_numeric = 1; | ||
| if (rts.opt_verbose) | ||
| error(0, 0, _("WARNING: reverse DNS resolution (PTR lookup) disabled, enforce with -H")); |
There was a problem hiding this comment.
So we are checking the opt_verbose before the getopt() loop that sets it?
There was a problem hiding this comment.
Thank you, I'll move it below.
There was a problem hiding this comment.
Warning moved below, don't print on -q (enabled by default, no need to put -v).
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
Update man page.
Implements: iputils#531
Closes: iputils#553
Signed-off-by: Petr Vorel <pvorel@suse.cz>
57acd64 to
e0b31a5
Compare
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
NOTE: variable needs to be parsed before getopts, therefore the
optional warning is printed afterwards (only if the lookup disabled due
environment variable and if not -q).
Update man page.
Implements: iputils#531
Closes: iputils#553
Signed-off-by: Petr Vorel <pvorel@suse.cz>
e0b31a5 to
5ffec05
Compare
metan-ucw
left a comment
There was a problem hiding this comment.
Now it looks good.
Reviewed-by: Cyril Hrubis chrubis@suse.cz
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.37.110: icmp_seq=1 ttl=116 time=11.1 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=18.6 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from prg03s13-in-f14.1e100.net (142.251.37.110): icmp_seq=1 ttl=116 time=17.1 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (142.251.37.110) 56(84) bytes of data.
64 bytes from 142.251.36.142: icmp_seq=1 ttl=116 time=15.8 ms
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
NOTE: variable needs to be parsed before getopts, therefore the
optional warning is printed afterwards (only if the lookup disabled due
environment variable and if not -q).
Update man page.
Implements: iputils#531
Closes: iputils#553
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
5ffec05 to
ff14b5d
Compare
Allow to disable reverse DNS resolution (PTR lookup) with
IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 google.com
./builddir/ping/ping: WARNING: reverse DNS resolution (PTR lookup) disabled, enforce with -H
PING google.com (172.217.17.110) 56(84) bytes of data.
64 bytes from 172.217.17.110: icmp_seq=1 ttl=113 time=45.5 ms
It's off by default (we are conservative, most of the users does not
have problem thus why to loose the functionality):
$ ./builddir/ping/ping -c1 google.com
PING google.com (172.217.17.110) 56(84) bytes of data.
64 bytes from ams15s29-in-f110.1e100.net (172.217.17.110): icmp_seq=1 ttl=113 time=46.1 ms
-H/-n override the variable:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -H google.com
./builddir/ping/ping: WARNING: reverse DNS resolution (PTR lookup) disabled, enforce with -H
PING google.com (172.217.17.110) 56(84) bytes of data.
64 bytes from ams15s29-in-f14.1e100.net (172.217.17.110): icmp_seq=1 ttl=113 time=46.3 ms
$ IPUTILS_PING_PTR_LOOKUP= ./builddir/ping/ping -c1 -n google.com
PING google.com (172.217.17.110) 56(84) bytes of data.
64 bytes from 172.217.17.110: icmp_seq=1 ttl=113 time=47.1 ms
-q suppresses the warning:
$ IPUTILS_PING_PTR_LOOKUP=0 ./builddir/ping/ping -c1 -q google.com
PING google.com (172.217.17.110) 56(84) bytes of data.
This help users to easier disable reverse DNS resolution than alias ping='ping -H'
which would not work in scripts.
NOTE: variable needs to be parsed before getopts, therefore the
optional warning is printed afterwards (only if the lookup disabled due
environment variable and if not -q).
Update man page.
Implements: iputils#531
Closes: iputils#553
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
ff14b5d to
6fc68b1
Compare
Allow to disable reverse DNS resolution (PTR lookup) with IPUTILS_PING_PTR_LOOKUP environment variable set to 0:
It's off by default:
-H/-noverride the variable:Update man page.
NOTE: variable needs to be parsed before getopts, therefore the optional warning is printed afterwards (only if the lookup disabled due environment variable and if not
-q).Implements: #531