diff options
Diffstat (limited to 'plugins-root')
-rw-r--r-- | plugins-root/check_icmp.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 937bc102..139aeff3 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -249,7 +249,7 @@ static void finish(int sign, check_icmp_mode_switches modes, int min_hosts_alive | |||
249 | mp_check overall[static 1]); | 249 | mp_check overall[static 1]); |
250 | 250 | ||
251 | /* Error exit */ | 251 | /* Error exit */ |
252 | static void crash(const char *fmt, ...); | 252 | static void crash(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); |
253 | 253 | ||
254 | /** global variables **/ | 254 | /** global variables **/ |
255 | static int debug = 0; | 255 | static int debug = 0; |
@@ -575,7 +575,7 @@ static void crash(const char *fmt, ...) { | |||
575 | puts(""); | 575 | puts(""); |
576 | 576 | ||
577 | exit(3); | 577 | exit(3); |
578 | } | 578 | } |
579 | 579 | ||
580 | static const char *get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) { | 580 | static const char *get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) { |
581 | const char *msg = "unreachable"; | 581 | const char *msg = "unreachable"; |
@@ -899,8 +899,8 @@ int main(int argc, char **argv) { | |||
899 | gettimeofday(&prog_start, NULL); | 899 | gettimeofday(&prog_start, NULL); |
900 | 900 | ||
901 | time_t max_completion_time = | 901 | time_t max_completion_time = |
902 | ((config.number_of_targets * config.number_of_packets * config.pkt_interval) + | 902 | ((config.pkt_interval *config.number_of_targets * config.number_of_packets) + |
903 | (config.number_of_targets * config.target_interval)) + | 903 | (config.target_interval * config.number_of_targets)) + |
904 | (config.number_of_targets * config.number_of_packets * config.crit.rta) + config.crit.rta; | 904 | (config.number_of_targets * config.number_of_packets * config.crit.rta) + config.crit.rta; |
905 | 905 | ||
906 | if (debug) { | 906 | if (debug) { |
@@ -1136,8 +1136,9 @@ static int wait_for_reply(check_icmp_socket_set sockset, const time_t time_inter | |||
1136 | if (recv_foo.received < (hlen + ICMP_MINLEN)) { | 1136 | if (recv_foo.received < (hlen + ICMP_MINLEN)) { |
1137 | char address[INET6_ADDRSTRLEN]; | 1137 | char address[INET6_ADDRSTRLEN]; |
1138 | parse_address(&resp_addr, address, sizeof(address)); | 1138 | parse_address(&resp_addr, address, sizeof(address)); |
1139 | crash("received packet too short for ICMP (%d bytes, expected %d) from %s\n", | 1139 | crash("received packet too short for ICMP (%ld bytes, expected %d) from %s\n", |
1140 | recv_foo.received, hlen + icmp_pkt_size, address); | 1140 | recv_foo.received, hlen + icmp_pkt_size, address); |
1141 | |||
1141 | } | 1142 | } |
1142 | /* check the response */ | 1143 | /* check the response */ |
1143 | memcpy(packet.buf, buf + hlen, icmp_pkt_size); | 1144 | memcpy(packet.buf, buf + hlen, icmp_pkt_size); |
@@ -1271,7 +1272,7 @@ static int send_icmp_ping(const check_icmp_socket_set sockset, ping_target *host | |||
1271 | data.ping_id = 10; /* host->icmp.icmp_sent; */ | 1272 | data.ping_id = 10; /* host->icmp.icmp_sent; */ |
1272 | memcpy(&data.stime, ¤t_time, sizeof(current_time)); | 1273 | memcpy(&data.stime, ¤t_time, sizeof(current_time)); |
1273 | 1274 | ||
1274 | socklen_t addrlen; | 1275 | socklen_t addrlen = 0; |
1275 | 1276 | ||
1276 | if (host->address.ss_family == AF_INET) { | 1277 | if (host->address.ss_family == AF_INET) { |
1277 | struct icmp *icp = (struct icmp *)buf; | 1278 | struct icmp *icp = (struct icmp *)buf; |
@@ -1317,7 +1318,7 @@ static int send_icmp_ping(const check_icmp_socket_set sockset, ping_target *host | |||
1317 | } | 1318 | } |
1318 | } else { | 1319 | } else { |
1319 | // unknown address family | 1320 | // unknown address family |
1320 | crash("unknown address family in ", __func__); | 1321 | crash("unknown address family in %s", __func__); |
1321 | } | 1322 | } |
1322 | 1323 | ||
1323 | struct iovec iov; | 1324 | struct iovec iov; |