From f8271f58d0f47f7a7ffa787512c227982eb4d6f2 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Tue, 23 Jun 2015 14:18:02 +0200 Subject: ripe-atlas-fw: imported version 4700 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- eperd/eperd.c | 25 ++++++++++++++----------- eperd/evtdig.c | 2 +- eperd/httpget.c | 10 ++++++++++ eperd/ping.c | 4 ++-- eperd/traceroute.c | 4 ++-- include/libbb.h | 2 +- networking/telnetd.c | 2 +- 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) -- cgit v1.2.3