sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
4b78db449c
commit
bf0676207f
2406 changed files with 6353 additions and 434004 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: main.c,v 1.236 2023/04/27 08:37:53 beck Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.241 2023/05/30 16:02:28 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
|
@ -74,7 +74,7 @@ int rrdpon = 1;
|
|||
int repo_timeout;
|
||||
time_t deadline;
|
||||
|
||||
int64_t evaluation_time;
|
||||
int64_t evaluation_time = X509_TIME_MIN;
|
||||
|
||||
struct stats stats;
|
||||
|
||||
|
@ -126,6 +126,14 @@ entity_free(struct entity *ent)
|
|||
free(ent);
|
||||
}
|
||||
|
||||
time_t
|
||||
get_current_time(void)
|
||||
{
|
||||
if (evaluation_time > X509_TIME_MIN)
|
||||
return (time_t) evaluation_time;
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read a queue entity from the descriptor.
|
||||
* Matched by entity_buffer_req().
|
||||
|
@ -551,6 +559,7 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
|
|||
struct aspa *aspa;
|
||||
struct repo *rp;
|
||||
char *file;
|
||||
time_t mtime;
|
||||
unsigned int id;
|
||||
int talid;
|
||||
int c;
|
||||
|
@ -565,12 +574,13 @@ entity_process(struct ibuf *b, struct stats *st, struct vrp_tree *tree,
|
|||
io_read_buf(b, &id, sizeof(id));
|
||||
io_read_buf(b, &talid, sizeof(talid));
|
||||
io_read_str(b, &file);
|
||||
io_read_buf(b, &mtime, sizeof(mtime));
|
||||
|
||||
/* in filemode messages can be ignored, only the accounting matters */
|
||||
if (filemode)
|
||||
goto done;
|
||||
|
||||
if (filepath_add(&fpt, file) == 0) {
|
||||
if (filepath_add(&fpt, file, mtime) == 0) {
|
||||
warnx("%s: File already visited", file);
|
||||
goto done;
|
||||
}
|
||||
|
@ -755,6 +765,7 @@ sum_repostats(const struct repo *rp, const struct repostats *in, void *arg)
|
|||
|
||||
out->del_files += in->del_files;
|
||||
out->extra_files += in->extra_files;
|
||||
out->del_extra_files += in->del_extra_files;
|
||||
out->del_dirs += in->del_dirs;
|
||||
timespecadd(&in->sync_time, &out->sync_time, &out->sync_time);
|
||||
}
|
||||
|
@ -965,8 +976,6 @@ main(int argc, char *argv[])
|
|||
"proc exec unveil", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
|
||||
evaluation_time = time(NULL);
|
||||
|
||||
while ((c = getopt(argc, argv, "Ab:Bcd:e:fH:jmnoP:rRs:S:t:T:vV")) != -1)
|
||||
switch (c) {
|
||||
case 'A':
|
||||
|
@ -1008,7 +1017,7 @@ main(int argc, char *argv[])
|
|||
outformats |= FORMAT_OPENBGPD;
|
||||
break;
|
||||
case 'P':
|
||||
evaluation_time = strtonum(optarg, X509_TIME_MIN,
|
||||
evaluation_time = strtonum(optarg, X509_TIME_MIN + 1,
|
||||
X509_TIME_MAX, &errs);
|
||||
if (errs)
|
||||
errx(1, "-P: time in seconds %s", errs);
|
||||
|
@ -1449,9 +1458,10 @@ main(int argc, char *argv[])
|
|||
printf("Ghostbuster records: %u\n", stats.repo_tal_stats.gbrs);
|
||||
printf("Trust Anchor Keys: %u\n", stats.repo_tal_stats.taks);
|
||||
printf("Repositories: %u\n", stats.repos);
|
||||
printf("Cleanup: removed %u files, %u directories, %u superfluous\n",
|
||||
printf("Cleanup: removed %u files, %u directories\n"
|
||||
"Repository cleanup: kept %u and removed %u superfluous files\n",
|
||||
stats.repo_stats.del_files, stats.repo_stats.del_dirs,
|
||||
stats.repo_stats.extra_files);
|
||||
stats.repo_stats.extra_files, stats.repo_stats.del_extra_files);
|
||||
printf("VRP Entries: %u (%u unique)\n", stats.repo_tal_stats.vrps,
|
||||
stats.repo_tal_stats.vrps_uniqs);
|
||||
printf("VAP Entries: %u (%u unique)\n", stats.repo_tal_stats.vaps,
|
||||
|
@ -1466,9 +1476,9 @@ usage:
|
|||
fprintf(stderr,
|
||||
"usage: rpki-client [-ABcjmnoRrVv] [-b sourceaddr] [-d cachedir]"
|
||||
" [-e rsync_prog]\n"
|
||||
" [-H fqdn] [-S skiplist] [-s timeout] [-T table]"
|
||||
" [-t tal]\n"
|
||||
" [outputdir]\n"
|
||||
" [-H fqdn] [-P epoch] [-S skiplist] [-s timeout]"
|
||||
" [-T table]\n"
|
||||
" [-t tal] [outputdir]\n"
|
||||
" rpki-client [-Vv] [-d cachedir] [-j] [-t tal] -f file ..."
|
||||
"\n");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue