projects
/
icmpmonitor
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c9b16ec
)
Removed 'ident' global from icmpmonitor.c.
author
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 09:38:56 +0000
(
02:38
-0700)
committer
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 09:38:56 +0000
(
02:38
-0700)
icmpmonitor.c
patch
|
blob
|
blame
|
history
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);