Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ping: Allow to disable with environment variable
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 <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
- Loading branch information