projects
/
icmpmonitor
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed 'ident' global from icmpmonitor.c.
[icmpmonitor]
/
icmpmonitor.c
diff --git
a/icmpmonitor.c
b/icmpmonitor.c
index
04aa91c
..
36a1ce6
100644
(file)
--- a/
icmpmonitor.c
+++ b/
icmpmonitor.c
@@
-54,7
+54,6
@@
struct monitor_host {
static struct monitor_host ** hosts = NULL;
static int isVerbose = 0;
static int keepBanging = 0;
static struct monitor_host ** hosts = NULL;
static int isVerbose = 0;
static int keepBanging = 0;
-static unsigned short ident;
static int send_delay = 1;
/*
static int send_delay = 1;
/*
@@
-151,7
+150,7
@@
pinger(int ignore)
icp->icmp_code = 0;
icp->icmp_cksum = 0;
icp->icmp_seq = p->socket;
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);
if (isVerbose) printf("INFO: Sending ICMP packet to %s.\n", p->name);
@@
-208,7
+207,7
@@
read_icmp_data(struct monitor_host * p)
return;
}
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));
p->recvdpackets++;
memcpy(&p->last_ping_received, &tv, sizeof(tv));
@@
-421,8
+420,6
@@
main(int argc, char ** argv)
init_hosts();
init_hosts();
- ident = getpid() & 0xFFFF;
-
signal(SIGALRM, pinger);
alarm(send_delay);
signal(SIGALRM, pinger);
alarm(send_delay);