static struct monitor_host ** hosts = NULL;
static int isVerbose = 0;
static int keepBanging = 0;
-static unsigned short ident;
static int send_delay = 1;
/*
icp->icmp_code = 0;
icp->icmp_cksum = 0;
icp->icmp_seq = p->socket;
- icp->icmp_id = ident;
+ icp->icmp_id = getpid() & 0xFFFF;
if (isVerbose) printf("INFO: Sending ICMP packet to %s.\n", p->name);
return;
}
- if (icmp->icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == ident && icmp->icmp_seq == p->socket) {
+ if (icmp->icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == (getpid() & 0xFFFF) && icmp->icmp_seq == p->socket) {
p->recvdpackets++;
memcpy(&p->last_ping_received, &tv, sizeof(tv));
init_hosts();
- ident = getpid() & 0xFFFF;
-
signal(SIGALRM, pinger);
alarm(send_delay);