aboutsummaryrefslogtreecommitdiff
path: root/eperd
diff options
context:
space:
mode:
Diffstat (limited to 'eperd')
-rw-r--r--eperd/eperd.c25
-rw-r--r--eperd/evtdig.c2
-rw-r--r--eperd/httpget.c10
-rw-r--r--eperd/ping.c4
-rw-r--r--eperd/traceroute.c4
5 files changed, 29 insertions, 16 deletions
diff --git a/eperd/eperd.c b/eperd/eperd.c
index 49c5884..30a485d 100644
--- a/eperd/eperd.c
+++ b/eperd/eperd.c
@@ -91,14 +91,14 @@ struct CronLine {
enum {
- OPT_l = (1 << 0),
- OPT_L = (1 << 1),
- OPT_f = (1 << 2),
- OPT_b = (1 << 3),
- OPT_S = (1 << 4),
- OPT_c = (1 << 5),
- OPT_A = (1 << 6),
- OPT_D = (1 << 7),
+ OPT_i = (1 << 0),
+ OPT_l = (1 << 1),
+ OPT_L = (1 << 2),
+ OPT_f = (1 << 3),
+ OPT_c = (1 << 4),
+ OPT_A = (1 << 5),
+ OPT_D = (1 << 6),
+ OPT_P = (1 << 7),
OPT_d = (1 << 8) * ENABLE_FEATURE_CROND_D,
};
#if ENABLE_FEATURE_CROND_D
@@ -196,8 +196,11 @@ static void kick_watchdog(void)
if(do_kick_watchdog)
{
int fdwatchdog = open("/dev/watchdog", O_RDWR);
- write(fdwatchdog, "1", 1);
- close(fdwatchdog);
+ if (fdwatchdog != -1)
+ {
+ write(fdwatchdog, "1", 1);
+ close(fdwatchdog);
+ }
}
}
@@ -263,7 +266,7 @@ int eperd_main(int argc UNUSED_PARAM, char **argv)
/* "-b after -f is ignored", and so on for every pair a-b */
opt_complementary = "f-b:b-f:S-L:L-S" USE_FEATURE_PERD_D(":d-l")
"i:+:l+:d+"; /* -i, -l and -d have numeric param */
- opt = getopt32(argv, "i:l:L:fbSc:A:DP:" USE_FEATURE_PERD_D("d:") "O:",
+ opt = getopt32(argv, "i:l:L:fc:A:DP:" USE_FEATURE_PERD_D("d:") "O:",
&instance_id, &LogLevel, &LogFile, &CDir,
&atlas_id, &PidFileName
USE_FEATURE_PERD_D(,&LogLevel), &out_filename);
diff --git a/eperd/evtdig.c b/eperd/evtdig.c
index de71a6b..0de3541 100644
--- a/eperd/evtdig.c
+++ b/eperd/evtdig.c
@@ -1164,7 +1164,7 @@ static void ready_callback (int unused UNUSED_PARAM, const short event UNUSED_PA
int nrecv;
struct timeval rectime;
- printf("in ready_callback\n");
+ // printf("in ready_callback\n");
qry = arg;
diff --git a/eperd/httpget.c b/eperd/httpget.c
index 1a8fe09..f68ec81 100644
--- a/eperd/httpget.c
+++ b/eperd/httpget.c
@@ -310,6 +310,7 @@ static void timeout_callback(int __attribute((unused)) unused,
const short __attribute((unused)) event, void *s)
{
struct hgstate *state;
+ char errline[256];
state= ENV2STATE(s);
@@ -349,7 +350,16 @@ static void timeout_callback(int __attribute((unused)) unused,
if (state->max_body)
add_str(s, " ]");
#endif
+#if 1
+ snprintf(errline, sizeof(errline),
+ DBQ(err) ":"
+ DBQ(timeout reading chunk: state %d linelen %d lineoffset %d)
+ ", ",
+ state->readstate, state->linelen, state->lineoffset);
+ add_str(state, errline);
+#else
add_str(state, DBQ(err) ":" DBQ(timeout reading chunk) ", ");
+#endif
report(state);
break;
default:
diff --git a/eperd/ping.c b/eperd/ping.c
index 8f7f4e0..53cbbe5 100644
--- a/eperd/ping.c
+++ b/eperd/ping.c
@@ -709,11 +709,11 @@ printf("ready_callback4: too short\n");
icmp = (struct icmphdr *) (base->packet + hlen);
/* Check the ICMP header to drop unexpected packets due to unrecognized id */
- if (icmp->un.echo.id != base->pid)
+ if (icmp->un.echo.id != (base->pid & 0x0fff))
{
#if 0
printf("ready_callback4: bad pid: got %d, expect %d\n",
- icmp->un.echo.id, base->pid);
+ icmp->un.echo.id, base->pid & 0x0fff);
#endif
goto done;
}
diff --git a/eperd/traceroute.c b/eperd/traceroute.c
index fbeb025..26194c0 100644
--- a/eperd/traceroute.c
+++ b/eperd/traceroute.c
@@ -1860,7 +1860,7 @@ printf("curpacksize: %d\n", state->curpacksize);
ind= ntohs(eicmp->icmp_id);
if ((ind >> TRT_ICMP4_INSTANCE_ID_SHIFT) != instance_id)
{
- printf("wrong instance id\n");
+ // printf("wrong instance id\n");
return;
}
ind &= ~TRT_ICMP4_INSTANCE_ID_MASK;
@@ -2143,7 +2143,7 @@ printf("%s, %d: sin6_family = %d\n", __FILE__, __LINE__, state->sin6.sin6_family
ind= ntohs(icmp->icmp_id);
if ((ind >> TRT_ICMP4_INSTANCE_ID_SHIFT) != instance_id)
{
- printf("wrong instance id\n");
+ // printf("wrong instance id\n");
return;
}
ind &= ~TRT_ICMP4_INSTANCE_ID_MASK;