|
|
|
@ -793,16 +793,16 @@ int main( int argc, char **argv )
|
|
|
|
|
fclose( ping_file );
|
|
|
|
|
}
|
|
|
|
|
else if( *argv && generate_flag ) {
|
|
|
|
|
if(argc == 1) {
|
|
|
|
|
/* one target: we expect a cidr range (n.n.n.n/m) */
|
|
|
|
|
add_cidr(argv[0]);
|
|
|
|
|
}
|
|
|
|
|
else if(argc == 2) {
|
|
|
|
|
add_range(argv[0], argv[1]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
usage(1);
|
|
|
|
|
}
|
|
|
|
|
if(argc == 1) {
|
|
|
|
|
/* one target: we expect a cidr range (n.n.n.n/m) */
|
|
|
|
|
add_cidr(argv[0]);
|
|
|
|
|
}
|
|
|
|
|
else if(argc == 2) {
|
|
|
|
|
add_range(argv[0], argv[1]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
usage(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
usage(1);
|
|
|
|
@ -1019,7 +1019,7 @@ void main_loop()
|
|
|
|
|
h = ev_dequeue();
|
|
|
|
|
|
|
|
|
|
/* Send the ping */
|
|
|
|
|
/*printf("Sending ping after %d ms\n", lt/100); */
|
|
|
|
|
/*printf("Sending ping after %d ms\n", lt/100); */
|
|
|
|
|
send_ping(s, h);
|
|
|
|
|
|
|
|
|
|
/* Check what needs to be done next */
|
|
|
|
@ -1075,24 +1075,24 @@ void main_loop()
|
|
|
|
|
/* When can we expect the next event? */
|
|
|
|
|
if(ev_first) {
|
|
|
|
|
if(ev_first->ev_time.tv_sec == 0) {
|
|
|
|
|
wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wait_time = timeval_diff(&ev_first->ev_time, ¤t_time);
|
|
|
|
|
if(wait_time < 0) wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
if(ev_first->ev_type == EV_TYPE_PING) {
|
|
|
|
|
/* make sure that we wait enough, so that the inter-ping delay is
|
|
|
|
|
* bigger than 'interval' */
|
|
|
|
|
if(wait_time < 0) wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
if(ev_first->ev_type == EV_TYPE_PING) {
|
|
|
|
|
/* make sure that we wait enough, so that the inter-ping delay is
|
|
|
|
|
* bigger than 'interval' */
|
|
|
|
|
if(wait_time < interval) {
|
|
|
|
|
lt = timeval_diff(¤t_time, &last_send_time);
|
|
|
|
|
if(lt < interval) {
|
|
|
|
|
wait_time = interval-lt;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lt = timeval_diff(¤t_time, &last_send_time);
|
|
|
|
|
if(lt < interval) {
|
|
|
|
|
wait_time = interval-lt;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
wait_time = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined( DEBUG ) || defined( _DEBUG )
|
|
|
|
|