diff options
author | ghciv6 <ghciv6@localhost> | 2021-12-20 22:39:57 (GMT) |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2022-01-29 11:19:23 (GMT) |
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 01ae174..f97b0ed 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -410,6 +410,7 @@ main(int argc, char **argv) | |||
410 | #ifdef SO_TIMESTAMP | 410 | #ifdef SO_TIMESTAMP |
411 | int on = 1; | 411 | int on = 1; |
412 | #endif | 412 | #endif |
413 | char *source_ip = NULL; | ||
413 | char * opts_str = "vhVw:c:n:p:t:H:s:i:b:I:l:m:64"; | 414 | char * opts_str = "vhVw:c:n:p:t:H:s:i:b:I:l:m:64"; |
414 | 415 | ||
415 | setlocale (LC_ALL, ""); | 416 | setlocale (LC_ALL, ""); |
@@ -542,7 +543,7 @@ main(int argc, char **argv) | |||
542 | } | 543 | } |
543 | break; | 544 | break; |
544 | case 's': /* specify source IP address */ | 545 | case 's': /* specify source IP address */ |
545 | set_source_ip(optarg); | 546 | source_ip = optarg; |
546 | break; | 547 | break; |
547 | case 'V': /* version */ | 548 | case 'V': /* version */ |
548 | print_revision (progname, NP_VERSION); | 549 | print_revision (progname, NP_VERSION); |
@@ -597,6 +598,8 @@ main(int argc, char **argv) | |||
597 | sockets |= HAVE_ICMP; | 598 | sockets |= HAVE_ICMP; |
598 | else icmp_sockerrno = errno; | 599 | else icmp_sockerrno = errno; |
599 | 600 | ||
601 | if( source_ip ) | ||
602 | set_source_ip(source_ip); | ||
600 | 603 | ||
601 | #ifdef SO_TIMESTAMP | 604 | #ifdef SO_TIMESTAMP |
602 | if(setsockopt(icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on))) | 605 | if(setsockopt(icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on))) |