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