This commit switches check_icmp from getopt to getopt_long
to provide long options too and (most importantly) homogenize
option parsing between the different plugins.
Refactor check_icmp:
- Far less global variables
- Proper IPv6/legacy IP dual stack functionality (allowed mixed v4/v6 hosts)
- Improved readability/understandability
- General cleanup
The timeout option was redundant in that the runtime
of check_icmp was always limited by the input parameters
and therefore timeout gets removed with this commit to
avoid that confusion.
The rest of the signal handlings was removed too, since
the added complexity does not provide sufficient returns.
If check_icmp gets a signal, it now dies like most other
programs instead of trying to save some things and return a
(arguably wrong) result.
fping 5.2 and 5.3 add some new useful command line options
which this commit add to check_fping.
These are:
* --fwmark - sets a firewall mark in the packages to make them
identifiable (fping 5.2)
* --icmp-timestamp - fping uses ICMP timestamp instead of ICMP
Echo (fping 5.2)
* --check-source - fping discards replies which originate not from
the target address (fping 5.2)
The fping release notes describe theses options ( https://github.com/schweikert/fping/releases )
in a little bit more detail.
Currently the help display for those options is only shown
when fping was available in the appropriate version during
compilation.
Improve handling of -4/-6
This changes the handling of `-4`/`-6` flags for check_fping to make it more explicit which IP stack is used in which case.
Additionally, the deprecated `fping6` command is removed wholesale and the explicit `-4`/`-6` flags are used instead.
If fping is used with a target that has dual stack v4/v6, then due to
the logic during command construction, ipv4 will never be checked as v6
is preferred by fping.
This explicitly flags -4/-6 when it is requested by the user.