summaryrefslogtreecommitdiffstats
path: root/plugins-root/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-root/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 6119823..f8f1535 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -213,7 +213,7 @@ static int mode, protocols, sockets, debug = 0, timeout = 10;
213static unsigned short icmp_data_size = DEFAULT_PING_DATA_SIZE; 213static unsigned short icmp_data_size = DEFAULT_PING_DATA_SIZE;
214static unsigned short icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN; 214static unsigned short icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN;
215 215
216static unsigned int icmp_sent = 0, icmp_recv = 0, icmp_lost = 0; 216static unsigned int icmp_sent = 0, icmp_recv = 0, icmp_lost = 0, ttl = 0;
217#define icmp_pkts_en_route (icmp_sent - (icmp_recv + icmp_lost)) 217#define icmp_pkts_en_route (icmp_sent - (icmp_recv + icmp_lost))
218static unsigned short targets_down = 0, targets = 0, packets = 0; 218static unsigned short targets_down = 0, targets = 0, packets = 0;
219#define targets_alive (targets - targets_down) 219#define targets_alive (targets - targets_down)
@@ -223,7 +223,6 @@ static pid_t pid;
223static struct timezone tz; 223static struct timezone tz;
224static struct timeval prog_start; 224static struct timeval prog_start;
225static unsigned long long max_completion_time = 0; 225static unsigned long long max_completion_time = 0;
226static unsigned char ttl = 0; /* outgoing ttl */
227static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */ 226static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */
228static int min_hosts_alive = -1; 227static int min_hosts_alive = -1;
229float pkt_backoff_factor = 1.5; 228float pkt_backoff_factor = 1.5;
@@ -520,7 +519,7 @@ main(int argc, char **argv)
520 add_target(optarg); 519 add_target(optarg);
521 break; 520 break;
522 case 'l': 521 case 'l':
523 ttl = (unsigned char)strtoul(optarg, NULL, 0); 522 ttl = (int)strtoul(optarg, NULL, 0);
524 break; 523 break;
525 case 'm': 524 case 'm':
526 min_hosts_alive = (int)strtoul(optarg, NULL, 0); 525 min_hosts_alive = (int)strtoul(optarg, NULL, 0);
@@ -948,6 +947,7 @@ static int
948send_icmp_ping(int sock, struct rta_host *host) 947send_icmp_ping(int sock, struct rta_host *host)
949{ 948{
950 long int len; 949 long int len;
950 size_t addrlen;
951 struct icmp_ping_data data; 951 struct icmp_ping_data data;
952 struct msghdr hdr; 952 struct msghdr hdr;
953 struct iovec iov; 953 struct iovec iov;
@@ -979,6 +979,7 @@ send_icmp_ping(int sock, struct rta_host *host)
979 979
980 if (address_family == AF_INET) { 980 if (address_family == AF_INET) {
981 struct icmp *icp = (struct icmp*)buf; 981 struct icmp *icp = (struct icmp*)buf;
982 addrlen = sizeof(struct sockaddr_in);
982 983
983 memcpy(&icp->icmp_data, &data, sizeof(data)); 984 memcpy(&icp->icmp_data, &data, sizeof(data));
984 985
@@ -995,7 +996,10 @@ send_icmp_ping(int sock, struct rta_host *host)
995 } 996 }
996 else { 997 else {
997 struct icmp6_hdr *icp6 = (struct icmp6_hdr*)buf; 998 struct icmp6_hdr *icp6 = (struct icmp6_hdr*)buf;
999 addrlen = sizeof(struct sockaddr_in6);
1000
998 memcpy(&icp6->icmp6_dataun.icmp6_un_data8[4], &data, sizeof(data)); 1001 memcpy(&icp6->icmp6_dataun.icmp6_un_data8[4], &data, sizeof(data));
1002
999 icp6->icmp6_type = ICMP6_ECHO_REQUEST; 1003 icp6->icmp6_type = ICMP6_ECHO_REQUEST;
1000 icp6->icmp6_code = 0; 1004 icp6->icmp6_code = 0;
1001 icp6->icmp6_cksum = 0; 1005 icp6->icmp6_cksum = 0;
@@ -1016,7 +1020,7 @@ send_icmp_ping(int sock, struct rta_host *host)
1016 1020
1017 memset(&hdr, 0, sizeof(hdr)); 1021 memset(&hdr, 0, sizeof(hdr));
1018 hdr.msg_name = (struct sockaddr *)&host->saddr_in; 1022 hdr.msg_name = (struct sockaddr *)&host->saddr_in;
1019 hdr.msg_namelen = sizeof(struct sockaddr_storage); 1023 hdr.msg_namelen = addrlen;
1020 hdr.msg_iov = &iov; 1024 hdr.msg_iov = &iov;
1021 hdr.msg_iovlen = 1; 1025 hdr.msg_iovlen = 1;
1022 1026