aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2015-06-23 14:18:02 +0200
committerBjørn Mork <bjorn@mork.no>2015-06-23 14:18:02 +0200
commitf8271f58d0f47f7a7ffa787512c227982eb4d6f2 (patch)
treee322246d7397340bc74b0ae9c6f482ee0a3abb6d
parent8c746b3a2bfb67addbfa4d3d4b7c0dbc2e8ba985 (diff)
ripe-atlas-fw: imported version 47004700
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-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
-rw-r--r--include/libbb.h2
-rw-r--r--networking/telnetd.c2
7 files changed, 31 insertions, 18 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;
diff --git a/include/libbb.h b/include/libbb.h
index 598e74e..98775ae 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -309,7 +309,7 @@ extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC;
#define ATLAS_DATA_OUT ATLAS_HOME "/data/out"
#define ATLAS_DATA_OOQ_OUT ATLAS_HOME "/data/ooq.out"
#define ATLAS_DATA_NEW ATLAS_HOME "/data/new"
-#define ATLAS_TIMESYNC_FILE ATLAS_STATUS "/timesync.vol"
+#define ATLAS_TIMESYNC_FILE ATLAS_DATA_NEW "/timesync.vol"
extern int validate_filename(const char *path, const char *prefix);
extern int validate_atlas_id(const char *atlas_id);
diff --git a/networking/telnetd.c b/networking/telnetd.c
index f7fe1db..7f693eb 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -1268,7 +1268,7 @@ static void end_crontab(struct tsession *ts)
strlcpy(filename1, atlas_dirname, sizeof(filename1));
strlcat(filename1, CRONUPDATE, sizeof(filename1));
- while (fd= open(filename1, O_WRONLY|O_CREAT|O_TRUNC, 0600), fd >= 0)
+ while (fd= open(filename1, O_WRONLY|O_CREAT|O_TRUNC, 0644), fd >= 0)
{
len= strlen(UPDATELINE);
if (write(fd, UPDATELINE, len) != len)