|
|
@ -430,7 +430,7 @@ int main(int argc, char** argv)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
case 'b':
|
|
|
|
if (!sscanf(optarg, "%i", &ping_data_size))
|
|
|
|
if (!sscanf(optarg, "%u", &ping_data_size))
|
|
|
|
usage(1);
|
|
|
|
usage(1);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -580,7 +580,6 @@ int main(int argc, char** argv)
|
|
|
|
fprintf(stderr, "see 'fping -h' for usage information\n");
|
|
|
|
fprintf(stderr, "see 'fping -h' for usage information\n");
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -600,7 +599,6 @@ int main(int argc, char** argv)
|
|
|
|
if (count_flag && loop_flag) {
|
|
|
|
if (count_flag && loop_flag) {
|
|
|
|
fprintf(stderr, "%s: specify only one of c, l\n", argv[0]);
|
|
|
|
fprintf(stderr, "%s: specify only one of c, l\n", argv[0]);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((interval < MIN_INTERVAL * 100 || perhost_interval < MIN_PERHOST_INTERVAL * 100)
|
|
|
|
if ((interval < MIN_INTERVAL * 100 || perhost_interval < MIN_PERHOST_INTERVAL * 100)
|
|
|
@ -615,14 +613,12 @@ int main(int argc, char** argv)
|
|
|
|
fprintf(stderr, "%s: data size %u not valid, must be lower than %u\n",
|
|
|
|
fprintf(stderr, "%s: data size %u not valid, must be lower than %u\n",
|
|
|
|
prog, ping_data_size, (unsigned int)MAX_PING_DATA);
|
|
|
|
prog, ping_data_size, (unsigned int)MAX_PING_DATA);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((backoff > MAX_BACKOFF_FACTOR) || (backoff < MIN_BACKOFF_FACTOR)) {
|
|
|
|
if ((backoff > MAX_BACKOFF_FACTOR) || (backoff < MIN_BACKOFF_FACTOR)) {
|
|
|
|
fprintf(stderr, "%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n",
|
|
|
|
fprintf(stderr, "%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n",
|
|
|
|
prog, backoff, MIN_BACKOFF_FACTOR, MAX_BACKOFF_FACTOR);
|
|
|
|
prog, backoff, MIN_BACKOFF_FACTOR, MAX_BACKOFF_FACTOR);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (alive_flag || unreachable_flag)
|
|
|
|
if (alive_flag || unreachable_flag)
|
|
|
@ -633,7 +629,6 @@ int main(int argc, char** argv)
|
|
|
|
per_recv_flag = 1;
|
|
|
|
per_recv_flag = 1;
|
|
|
|
|
|
|
|
|
|
|
|
alive_flag = unreachable_flag = verbose_flag = 0;
|
|
|
|
alive_flag = unreachable_flag = verbose_flag = 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (loop_flag) {
|
|
|
|
if (loop_flag) {
|
|
|
@ -641,7 +636,6 @@ int main(int argc, char** argv)
|
|
|
|
per_recv_flag = 1;
|
|
|
|
per_recv_flag = 1;
|
|
|
|
|
|
|
|
|
|
|
|
alive_flag = unreachable_flag = verbose_flag = 0;
|
|
|
|
alive_flag = unreachable_flag = verbose_flag = 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
trials = (count > retry + 1) ? count : retry + 1;
|
|
|
|
trials = (count > retry + 1) ? count : retry + 1;
|
|
|
@ -656,13 +650,11 @@ int main(int argc, char** argv)
|
|
|
|
if (debugging & DBG_RANDOM_LOSE_FEW) {
|
|
|
|
if (debugging & DBG_RANDOM_LOSE_FEW) {
|
|
|
|
randomly_lose_flag = 1;
|
|
|
|
randomly_lose_flag = 1;
|
|
|
|
lose_factor = 1; /* ie, 1/4 */
|
|
|
|
lose_factor = 1; /* ie, 1/4 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (debugging & DBG_RANDOM_LOSE_MANY) {
|
|
|
|
if (debugging & DBG_RANDOM_LOSE_MANY) {
|
|
|
|
randomly_lose_flag = 1;
|
|
|
|
randomly_lose_flag = 1;
|
|
|
|
lose_factor = 5; /* ie, 3/4 */
|
|
|
|
lose_factor = 5; /* ie, 3/4 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (debugging & DBG_PRINT_PER_SYSTEM)
|
|
|
|
if (debugging & DBG_PRINT_PER_SYSTEM)
|
|
|
@ -717,7 +709,6 @@ int main(int argc, char** argv)
|
|
|
|
fprintf(stderr, " outage_flag set\n");
|
|
|
|
fprintf(stderr, " outage_flag set\n");
|
|
|
|
if (netdata_flag)
|
|
|
|
if (netdata_flag)
|
|
|
|
fprintf(stderr, " netdata_flag set\n");
|
|
|
|
fprintf(stderr, " netdata_flag set\n");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* DEBUG || _DEBUG */
|
|
|
|
#endif /* DEBUG || _DEBUG */
|
|
|
|
|
|
|
|
|
|
|
@ -978,19 +969,18 @@ void add_range(char* start, char* end)
|
|
|
|
end_long = ntohl(((struct sockaddr_in *) addr_res->ai_addr)->sin_addr.s_addr);
|
|
|
|
end_long = ntohl(((struct sockaddr_in *) addr_res->ai_addr)->sin_addr.s_addr);
|
|
|
|
freeaddrinfo(addr_res);
|
|
|
|
freeaddrinfo(addr_res);
|
|
|
|
|
|
|
|
|
|
|
|
if(end_long - start_long > MAX_GENERATE) {
|
|
|
|
if (end_long > start_long + MAX_GENERATE) {
|
|
|
|
fprintf(stderr, "Error: -g parameter generates too many addresses\n");
|
|
|
|
fprintf(stderr, "%s: -g parameter generates too many addresses\n", prog);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* generate */
|
|
|
|
/* generate */
|
|
|
|
while (start_long <= end_long) {
|
|
|
|
for (; start_long <= end_long; start_long++) {
|
|
|
|
struct in_addr in_addr_tmp;
|
|
|
|
struct in_addr in_addr_tmp;
|
|
|
|
char buffer[20];
|
|
|
|
char buffer[20];
|
|
|
|
in_addr_tmp.s_addr = htonl(start_long);
|
|
|
|
in_addr_tmp.s_addr = htonl(start_long);
|
|
|
|
inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer));
|
|
|
|
inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer));
|
|
|
|
add_name(buffer);
|
|
|
|
add_name(buffer);
|
|
|
|
start_long++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1823,7 +1813,6 @@ int wait_for_reply(long wait_time)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1864,7 +1853,6 @@ int wait_for_reply(long wait_time)
|
|
|
|
|
|
|
|
|
|
|
|
fflush(stdout);
|
|
|
|
fflush(stdout);
|
|
|
|
return num_jobs;
|
|
|
|
return num_jobs;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
/************************************************************
|
|
|
|