diff options
author | ghciv6 <ghciv6@localhost> | 2021-12-20 22:39:57 +0000 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2022-01-29 12:19:23 +0100 |
commit | 986b2479465648c49a7eefc3fbf4df8860e3e4b7 (patch) | |
tree | 51fdf3d530752053cd8be76120249f77c5e540d9 /plugins-root/check_icmp.c | |
parent | ee2a60fc4e26828b115051564706f8fbc4c4b153 (diff) | |
download | monitoring-plugins-986b2479465648c49a7eefc3fbf4df8860e3e4b7.tar.gz |
- delay set_source_ip() until address_family is detected
- add a test to check '-s'
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r-- | plugins-root/check_icmp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 01ae174a..f97b0ed7 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -410,6 +410,7 @@ main(int argc, char **argv) #ifdef SO_TIMESTAMP int on = 1; #endif + char *source_ip = NULL; char * opts_str = "vhVw:c:n:p:t:H:s:i:b:I:l:m:64"; setlocale (LC_ALL, ""); @@ -542,7 +543,7 @@ main(int argc, char **argv) } break; case 's': /* specify source IP address */ - set_source_ip(optarg); + source_ip = optarg; break; case 'V': /* version */ print_revision (progname, NP_VERSION); @@ -597,6 +598,8 @@ main(int argc, char **argv) sockets |= HAVE_ICMP; else icmp_sockerrno = errno; + if( source_ip ) + set_source_ip(source_ip); #ifdef SO_TIMESTAMP if(setsockopt(icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on))) |