396 |
*/ |
*/ |
397 |
int check_remote_host(Service_T s) { |
int check_remote_host(Service_T s) { |
398 |
|
|
399 |
Port_T p= NULL; |
Port_T p = NULL; |
400 |
Icmp_T icmp; |
Icmp_T icmp = NULL; |
401 |
|
Icmp_T last_ping = NULL; |
402 |
|
|
403 |
ASSERT(s); |
ASSERT(s); |
404 |
|
|
423 |
Event_post(s, EVENT_ICMP, STATE_PASSED, icmp->action, |
Event_post(s, EVENT_ICMP, STATE_PASSED, icmp->action, |
424 |
"'%s' passed ICMP test [%s]", s->name, icmpnames[icmp->type]); |
"'%s' passed ICMP test [%s]", s->name, icmpnames[icmp->type]); |
425 |
} |
} |
426 |
|
last_ping = icmp; |
427 |
break; |
break; |
428 |
|
|
429 |
default: |
default: |
434 |
} |
} |
435 |
} |
} |
436 |
|
|
437 |
|
/* If we could not ping the host we assume it's down and do not |
438 |
|
* continue to check any port connections */ |
439 |
|
if(last_ping && !last_ping->is_available) { |
440 |
|
DEBUG("'%s' icmp ping failed, skipping any port connection tests\n", |
441 |
|
s->name); |
442 |
|
return FALSE; |
443 |
|
} |
444 |
|
|
445 |
/* Test each host:port and protocol in the service's portlist */ |
/* Test each host:port and protocol in the service's portlist */ |
446 |
if(s->portlist) |
if(s->portlist) |
447 |
for(p= s->portlist; p; p= p->next) |
for(p= s->portlist; p; p= p->next) |