On Thu, Nov 25, 2021 at 12:54:49PM +, Job Snijders wrote:
> Replace MAX_REPO_TIMEOUT with repo_timeout, which is set to 1/4th of
> timeout, or if timeout is disabled set it to 24 hours.
>
> OK?
OK claudio@
> Index: extern.h
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v
> retrieving revision 1.97
> diff -u -p -r1.97 extern.h
> --- extern.h 24 Nov 2021 15:24:16 - 1.97
> +++ extern.h 25 Nov 2021 12:52:05 -
> @@ -627,7 +627,4 @@ int mkpath(const char *);
> /* Maximum allowd repositories per tal */
> #define MAX_REPO_PER_TAL 1000
>
> -/* Timeout for repository synchronisation, in seconds */
> -#define MAX_REPO_TIMEOUT (15 * 60)
> -
> #endif /* ! EXTERN_H */
> Index: main.c
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
> retrieving revision 1.165
> diff -u -p -r1.165 main.c
> --- main.c19 Nov 2021 09:47:30 - 1.165
> +++ main.c25 Nov 2021 12:52:05 -
> @@ -68,6 +68,7 @@ const char *bird_tablename = "ROAS";
> int verbose;
> int noop;
> int rrdpon = 1;
> +int repo_timeout = 15*60;
>
> struct stats stats;
>
> @@ -753,6 +754,12 @@ main(int argc, char *argv[])
> timeout = strtonum(optarg, 0, 24*60*60, &errs);
> if (errs)
> errx(1, "-s: %s", errs);
> + if (timeout == 0)
> + repo_timeout = 24*60*60;
> + else if (timeout < 300)
> + errx(1, "-s: %i too small", timeout);
> + else
> + repo_timeout = timeout / 4;
> break;
> case 't':
> if (talsz >= TALSZ_MAX)
> Index: repo.c
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/repo.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 repo.c
> --- repo.c15 Nov 2021 16:32:15 - 1.12
> +++ repo.c25 Nov 2021 12:52:05 -
> @@ -40,6 +40,7 @@
> extern struct stats stats;
> extern int noop;
> extern int rrdpon;
> +extern int repo_timeout;
>
> enum repo_state {
> REPO_LOADING = 0,
> @@ -620,7 +621,7 @@ repo_alloc(int talid)
>
> rp->id = ++repoid;
> rp->talid = talid;
> - rp->alarm = getmonotime() + MAX_REPO_TIMEOUT;
> + rp->alarm = getmonotime() + repo_timeout;
> TAILQ_INIT(&rp->queue);
> SLIST_INSERT_HEAD(&repos, rp, entry);
>
> @@ -1225,7 +1228,7 @@ static void
> repo_fail(struct repo *rp)
> {
> /* reset the alarm since code may fallback to rsync */
> - rp->alarm = getmonotime() + MAX_REPO_TIMEOUT;
> + rp->alarm = getmonotime() + repo_timeout;
>
> if (rp->ta)
> http_finish(rp->ta->id, HTTP_FAILED, NULL);
> Index: rpki-client.8
> ===
> RCS file: /cvs/src/usr.sbin/rpki-client/rpki-client.8,v
> retrieving revision 1.49
> diff -u -p -r1.49 rpki-client.8
> --- rpki-client.8 26 Oct 2021 13:26:53 - 1.49
> +++ rpki-client.8 25 Nov 2021 12:52:05 -
> @@ -131,6 +131,8 @@ seconds of runtime, because normal pract
> .Xr cron 8 .
> Disable by specifying 0.
> Defaults to 1 hour.
> +Individual Publication Points are timed out after one fourth of
> +.Em timeout .
> .It Fl T Ar table
> For BIRD output generated with the
> .Fl B
>
--
:wq Claudio