Codebase list rpki-client / upstream/7.5
New upstream version 7.5 Marco d'Itri 2 years ago
21 changed file(s) with 480 addition(s) and 455 deletion(s). Raw diff Collapse all Expand all
0 7.4
0 7.5
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for rpki-client 7.4.
2 # Generated by GNU Autoconf 2.69 for rpki-client 7.5.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
586586 # Identity of this package.
587587 PACKAGE_NAME='rpki-client'
588588 PACKAGE_TARNAME='rpki-client'
589 PACKAGE_VERSION='7.4'
590 PACKAGE_STRING='rpki-client 7.4'
589 PACKAGE_VERSION='7.5'
590 PACKAGE_STRING='rpki-client 7.5'
591591 PACKAGE_BUGREPORT=''
592592 PACKAGE_URL=''
593593
13981398 # Omit some internal or obsolete options to make the list less imposing.
13991399 # This message is too long to be a string in the A/UX 3.1 sh.
14001400 cat <<_ACEOF
1401 \`configure' configures rpki-client 7.4 to adapt to many kinds of systems.
1401 \`configure' configures rpki-client 7.5 to adapt to many kinds of systems.
14021402
14031403 Usage: $0 [OPTION]... [VAR=VALUE]...
14041404
14691469
14701470 if test -n "$ac_init_help"; then
14711471 case $ac_init_help in
1472 short | recursive ) echo "Configuration of rpki-client 7.4:";;
1472 short | recursive ) echo "Configuration of rpki-client 7.5:";;
14731473 esac
14741474 cat <<\_ACEOF
14751475
15961596 test -n "$ac_init_help" && exit $ac_status
15971597 if $ac_init_version; then
15981598 cat <<\_ACEOF
1599 rpki-client configure 7.4
1599 rpki-client configure 7.5
16001600 generated by GNU Autoconf 2.69
16011601
16021602 Copyright (C) 2012 Free Software Foundation, Inc.
19611961 This file contains any messages produced by compilers while
19621962 running configure, to aid debugging if configure makes a mistake.
19631963
1964 It was created by rpki-client $as_me 7.4, which was
1964 It was created by rpki-client $as_me 7.5, which was
19651965 generated by GNU Autoconf 2.69. Invocation command line was
19661966
19671967 $ $0 $@
28912891
28922892 # Define the identity of the package.
28932893 PACKAGE='rpki-client'
2894 VERSION='7.4'
2894 VERSION='7.5'
28952895
28962896
28972897 cat >>confdefs.h <<_ACEOF
1423814238 # report actual input values of CONFIG_FILES etc. instead of their
1423914239 # values after options handling.
1424014240 ac_log="
14241 This file was extended by rpki-client $as_me 7.4, which was
14241 This file was extended by rpki-client $as_me 7.5, which was
1424214242 generated by GNU Autoconf 2.69. Invocation command line was
1424314243
1424414244 CONFIG_FILES = $CONFIG_FILES
1429514295 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1429614296 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1429714297 ac_cs_version="\\
14298 rpki-client config.status 7.4
14298 rpki-client config.status 7.5
1429914299 configured by $0, generated by GNU Autoconf 2.69,
1430014300 with options \\"\$ac_cs_config\\"
1430114301
0 /* $OpenBSD: cert.c,v 1.43 2021/10/28 09:02:19 beck Exp $ */
0 /* $OpenBSD: cert.c,v 1.47 2021/11/05 10:50:41 claudio Exp $ */
11 /*
22 * Copyright (c) 2021 Job Snijders <job@openbsd.org>
33 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
10831083 goto out;
10841084 }
10851085 if (p.res->ipsz > 0) {
1086 warnx("%s: unexpected IP resources in BGPsec cert", p.fn);
1086 warnx("%s: unexpected IP resources in BGPsec cert",
1087 p.fn);
10871088 goto out;
10881089 }
10891090 if (sia_present) {
1090 warnx("%s: unexpected SIA extension in BGPsec cert", p.fn);
1091 warnx("%s: unexpected SIA extension in BGPsec cert",
1092 p.fn);
1093 goto out;
1094 }
1095 if (ta) {
1096 warnx("%s: BGPsec cert can not be a trust anchor",
1097 p.fn);
10911098 goto out;
10921099 }
10931100 break;
12121219 free(p->aia);
12131220 free(p->aki);
12141221 free(p->ski);
1215 free(p->tal);
12161222 free(p->pubkey);
12171223 X509_free(p->x509);
12181224 free(p);
12191225 }
12201226
1221 static void
1222 cert_ip_buffer(struct ibuf *b, const struct cert_ip *p)
1223 {
1224 io_simple_buffer(b, &p->afi, sizeof(enum afi));
1225 io_simple_buffer(b, &p->type, sizeof(enum cert_ip_type));
1226
1227 if (p->type != CERT_IP_INHERIT) {
1228 io_simple_buffer(b, &p->min, sizeof(p->min));
1229 io_simple_buffer(b, &p->max, sizeof(p->max));
1230 }
1231
1232 if (p->type == CERT_IP_RANGE)
1233 ip_addr_range_buffer(b, &p->range);
1234 else if (p->type == CERT_IP_ADDR)
1235 ip_addr_buffer(b, &p->ip);
1236 }
1237
1238 static void
1239 cert_as_buffer(struct ibuf *b, const struct cert_as *p)
1240 {
1241 io_simple_buffer(b, &p->type, sizeof(enum cert_as_type));
1242 if (p->type == CERT_AS_RANGE) {
1243 io_simple_buffer(b, &p->range.min, sizeof(uint32_t));
1244 io_simple_buffer(b, &p->range.max, sizeof(uint32_t));
1245 } else if (p->type == CERT_AS_ID)
1246 io_simple_buffer(b, &p->id, sizeof(uint32_t));
1247 }
1248
12491227 /*
12501228 * Write certificate parsed content into buffer.
12511229 * See cert_read() for the other side of the pipe.
12531231 void
12541232 cert_buffer(struct ibuf *b, const struct cert *p)
12551233 {
1256 size_t i;
1257
1258 io_simple_buffer(b, &p->valid, sizeof(int));
1259 io_simple_buffer(b, &p->expires, sizeof(time_t));
1260 io_simple_buffer(b, &p->purpose, sizeof(enum cert_purpose));
1261 io_simple_buffer(b, &p->ipsz, sizeof(size_t));
1262 for (i = 0; i < p->ipsz; i++)
1263 cert_ip_buffer(b, &p->ips[i]);
1264
1265 io_simple_buffer(b, &p->asz, sizeof(size_t));
1266 for (i = 0; i < p->asz; i++)
1267 cert_as_buffer(b, &p->as[i]);
1234 io_simple_buffer(b, &p->expires, sizeof(p->expires));
1235 io_simple_buffer(b, &p->purpose, sizeof(p->purpose));
1236 io_simple_buffer(b, &p->talid, sizeof(p->talid));
1237 io_simple_buffer(b, &p->ipsz, sizeof(p->ipsz));
1238 io_simple_buffer(b, &p->asz, sizeof(p->asz));
1239
1240 io_simple_buffer(b, p->ips, p->ipsz * sizeof(p->ips[0]));
1241 io_simple_buffer(b, p->as, p->asz * sizeof(p->as[0]));
1242
12681243 io_str_buffer(b, p->mft);
12691244 io_str_buffer(b, p->notify);
12701245 io_str_buffer(b, p->repo);
12721247 io_str_buffer(b, p->aia);
12731248 io_str_buffer(b, p->aki);
12741249 io_str_buffer(b, p->ski);
1275 io_str_buffer(b, p->tal);
12761250 io_str_buffer(b, p->pubkey);
1277 }
1278
1279 static void
1280 cert_ip_read(struct ibuf *b, struct cert_ip *p)
1281 {
1282 io_read_buf(b, &p->afi, sizeof(enum afi));
1283 io_read_buf(b, &p->type, sizeof(enum cert_ip_type));
1284
1285 if (p->type != CERT_IP_INHERIT) {
1286 io_read_buf(b, &p->min, sizeof(p->min));
1287 io_read_buf(b, &p->max, sizeof(p->max));
1288 }
1289
1290 if (p->type == CERT_IP_RANGE)
1291 ip_addr_range_read(b, &p->range);
1292 else if (p->type == CERT_IP_ADDR)
1293 ip_addr_read(b, &p->ip);
1294 }
1295
1296 static void
1297 cert_as_read(struct ibuf *b, struct cert_as *p)
1298 {
1299 io_read_buf(b, &p->type, sizeof(enum cert_as_type));
1300 if (p->type == CERT_AS_RANGE) {
1301 io_read_buf(b, &p->range.min, sizeof(uint32_t));
1302 io_read_buf(b, &p->range.max, sizeof(uint32_t));
1303 } else if (p->type == CERT_AS_ID)
1304 io_read_buf(b, &p->id, sizeof(uint32_t));
13051251 }
13061252
13071253 /*
13131259 cert_read(struct ibuf *b)
13141260 {
13151261 struct cert *p;
1316 size_t i;
13171262
13181263 if ((p = calloc(1, sizeof(struct cert))) == NULL)
13191264 err(1, NULL);
13201265
1321 io_read_buf(b, &p->valid, sizeof(int));
1322 io_read_buf(b, &p->expires, sizeof(time_t));
1323 io_read_buf(b, &p->purpose, sizeof(enum cert_purpose));
1324 io_read_buf(b, &p->ipsz, sizeof(size_t));
1266 io_read_buf(b, &p->expires, sizeof(p->expires));
1267 io_read_buf(b, &p->purpose, sizeof(p->purpose));
1268 io_read_buf(b, &p->talid, sizeof(p->talid));
1269 io_read_buf(b, &p->ipsz, sizeof(p->ipsz));
1270 io_read_buf(b, &p->asz, sizeof(p->asz));
13251271
13261272 p->ips = calloc(p->ipsz, sizeof(struct cert_ip));
13271273 if (p->ips == NULL)
13281274 err(1, NULL);
1329 for (i = 0; i < p->ipsz; i++)
1330 cert_ip_read(b, &p->ips[i]);
1331
1332 io_read_buf(b, &p->asz, sizeof(size_t));
1275 io_read_buf(b, p->ips, p->ipsz * sizeof(p->ips[0]));
1276
13331277 p->as = calloc(p->asz, sizeof(struct cert_as));
13341278 if (p->as == NULL)
13351279 err(1, NULL);
1336 for (i = 0; i < p->asz; i++)
1337 cert_as_read(b, &p->as[i]);
1280 io_read_buf(b, p->as, p->asz * sizeof(p->as[0]));
13381281
13391282 io_read_str(b, &p->mft);
13401283 io_read_str(b, &p->notify);
13431286 io_read_str(b, &p->aia);
13441287 io_read_str(b, &p->aki);
13451288 io_read_str(b, &p->ski);
1346 io_read_str(b, &p->tal);
13471289 io_read_str(b, &p->pubkey);
13481290
13491291 assert(p->mft != NULL || p->purpose == CERT_PURPOSE_BGPSEC_ROUTER);
13641306 return RB_FIND(auth_tree, auths, &a);
13651307 }
13661308
1309 int
1310 auth_insert(struct auth_tree *auths, struct cert *cert, struct auth *parent)
1311 {
1312 struct auth *na;
1313
1314 na = malloc(sizeof(*na));
1315 if (na == NULL)
1316 err(1, NULL);
1317
1318 na->parent = parent;
1319 na->cert = cert;
1320
1321 if (RB_INSERT(auth_tree, auths, na) != NULL)
1322 err(1, "auth tree corrupted");
1323
1324 return 1;
1325 }
1326
13671327 static inline int
13681328 authcmp(struct auth *a, struct auth *b)
13691329 {
13821342
13831343 b->asid = asid;
13841344 b->expires = cert->expires;
1385 if ((b->tal = strdup(cert->tal)) == NULL)
1386 err(1, NULL);
1345 b->talid = cert->talid;
13871346 if ((b->ski = strdup(cert->ski)) == NULL)
13881347 err(1, NULL);
13891348 if ((b->pubkey = strdup(cert->pubkey)) == NULL)
13961355 if ((found = RB_INSERT(brk_tree, tree, b)) != NULL) {
13971356 if (found->expires < b->expires) {
13981357 found->expires = b->expires;
1399 free(found->tal);
1400 found->tal = b->tal;
1401 b->tal = NULL;
1358 found->talid = b->talid;
14021359 }
14031360 free(b->ski);
14041361 free(b->pubkey);
1405 free(b->tal);
14061362 free(b);
14071363 }
14081364 }
0 /* $OpenBSD: encoding.c,v 1.8 2021/10/28 11:57:00 claudio Exp $ */
0 /* $OpenBSD: encoding.c,v 1.9 2021/10/31 16:00:14 claudio Exp $ */
11 /*
22 * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
33 *
1616 #include <sys/stat.h>
1717
1818 #include <err.h>
19 #include <errno.h>
1920 #include <fcntl.h>
2021 #include <limits.h>
2122 #include <stdlib.h>
3637 struct stat st;
3738 ssize_t n;
3839 size_t size;
39 int fd;
40 int fd, saved_errno;
4041
4142 *len = 0;
4243
4445 return NULL;
4546 if (fstat(fd, &st) != 0)
4647 goto err;
47 if (st.st_size < 0 || st.st_size > MAX_FILE_SIZE)
48 if (st.st_size <= 0 || st.st_size > MAX_FILE_SIZE) {
49 errno = EFBIG;
4850 goto err;
51 }
4952 size = (size_t)st.st_size;
5053 if ((buf = malloc(size)) == NULL)
5154 goto err;
5255 n = read(fd, buf, size);
53 if (n < 0 || (size_t)n != size)
56 if (n == -1)
5457 goto err;
58 if ((size_t)n != size) {
59 errno = EIO;
60 goto err;
61 }
5562 close(fd);
5663 *len = size;
5764 return buf;
5865
5966 err:
67 saved_errno = errno;
6068 close(fd);
6169 free(buf);
70 errno = saved_errno;
6271 return NULL;
6372 }
6473
0 /* $OpenBSD: extern.h,v 1.86 2021/10/29 09:27:36 claudio Exp $ */
0 /* $OpenBSD: extern.h,v 1.95 2021/11/09 11:03:39 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
117117 size_t ipsz; /* length of "ips" */
118118 struct cert_as *as; /* list of AS numbers and ranges */
119119 size_t asz; /* length of "asz" */
120 int talid; /* cert is covered by which TAL */
120121 char *repo; /* CA repository (rsync:// uri) */
121122 char *mft; /* manifest (rsync:// uri) */
122123 char *notify; /* RRDP notify (https:// uri) */
124125 char *aia; /* AIA (or NULL, for trust anchor) */
125126 char *aki; /* AKI (or NULL, for trust anchor) */
126127 char *ski; /* SKI */
127 char *tal; /* basename of TAL for this cert */
128 enum cert_purpose purpose; /* Certificate Purpose (BGPSec or CA) */
128 enum cert_purpose purpose; /* BGPSec or CA */
129129 char *pubkey; /* Subject Public Key Info */
130 int valid; /* validated resources */
131130 X509 *x509; /* the cert */
132131 time_t expires; /* do not use after */
133132 };
145144 unsigned char *pkey; /* DER-encoded public key */
146145 size_t pkeysz; /* length of pkey */
147146 char *descr; /* basename of tal file */
147 int id; /* ID of this TAL */
148148 };
149149
150150 /*
192192 uint32_t asid; /* asID of ROA (if 0, RFC 6483 sec 4) */
193193 struct roa_ip *ips; /* IP prefixes */
194194 size_t ipsz; /* number of IP prefixes */
195 int talid; /* ROAs are covered by which TAL */
195196 int valid; /* validated resources */
196197 char *aia; /* AIA */
197198 char *aki; /* AKI */
198199 char *ski; /* SKI */
199 char *tal; /* basename of TAL for this cert */
200200 time_t expires; /* do not use after */
201201 };
202202
216216 struct vrp {
217217 RB_ENTRY(vrp) entry;
218218 struct ip_addr addr;
219 int talid; /* covered by which TAL */
219220 uint32_t asid;
220 char *tal; /* basename of TAL for this cert */
221221 enum afi afi;
222222 unsigned char maxlength;
223223 time_t expires; /* transitive expiry moment */
234234 struct brk {
235235 RB_ENTRY(brk) entry;
236236 uint32_t asid;
237 char *tal; /* basename of TAL for this key */
237 int talid; /* covered by which TAL */
238238 char *ski; /* Subject Key Identifier */
239239 char *pubkey; /* Subject Public Key Info */
240240 time_t expires; /* transitive expiry moment */
269269 RB_ENTRY(auth) entry;
270270 struct cert *cert; /* owner information */
271271 struct auth *parent; /* pointer to parent or NULL for TA cert */
272 char *tal; /* basename of TAL for this cert */
273 char *fn; /* FIXME: debugging */
274272 };
275273 /*
276274 * Tree of auth sorted by ski
278276 RB_HEAD(auth_tree, auth);
279277 RB_PROTOTYPE(auth_tree, auth, entry, authcmp);
280278
281 struct auth *auth_find(struct auth_tree *, const char *);
279 struct auth *auth_find(struct auth_tree *, const char *);
280 int auth_insert(struct auth_tree *, struct cert *, struct auth *);
282281
283282 /*
284283 * Resource types specified by the RPKI profiles.
341340 int has_data; /* whether data blob is specified */
342341 unsigned char *data; /* optional data blob */
343342 size_t datasz; /* length of optional data blob */
344 char *descr; /* tal description */
343 int talid; /* tal identifier */
345344 TAILQ_ENTRY(entity) entries;
346345 };
347346 TAILQ_HEAD(entityq, entity);
360359 size_t mfts_fail; /* failing syntactic parse */
361360 size_t mfts_stale; /* stale manifests */
362361 size_t certs; /* certificates */
363 size_t certs_fail; /* failing syntactic parse */
364 size_t certs_invalid; /* invalid resources */
362 size_t certs_fail; /* invalid certificate */
365363 size_t roas; /* route origin authorizations */
366364 size_t roas_fail; /* failing syntactic parse */
367365 size_t roas_invalid; /* invalid resources */
379377 size_t del_files; /* number of files removed in cleanup */
380378 size_t del_dirs; /* number of directories removed in cleanup */
381379 size_t brks; /* number of BGPsec Router Key (BRK) certificates */
382 size_t brks_invalids; /* invalid BGPsec certs */
383 char *talnames;
384380 struct timeval elapsed_time;
385381 struct timeval user_time;
386382 struct timeval system_time;
391387
392388 /* global variables */
393389 extern int verbose;
390 extern const char *tals[];
391 extern const char *taldescs[];
392 extern unsigned int talrepocnt[];
393 extern size_t talsz;
394394
395395 /* Routines for RPKI entities. */
396396
463463 enum afi, const char *, struct ip_addr *);
464464 void ip_addr_print(const struct ip_addr *, enum afi, char *,
465465 size_t);
466 void ip_addr_buffer(struct ibuf *, const struct ip_addr *);
467 void ip_addr_range_buffer(struct ibuf *,
468 const struct ip_addr_range *);
469 void ip_addr_read(struct ibuf *, struct ip_addr *);
470 void ip_addr_range_read(struct ibuf *, struct ip_addr_range *);
471466 int ip_addr_cmp(const struct ip_addr *, const struct ip_addr *);
472467 int ip_addr_check_overlap(const struct cert_ip *,
473468 const char *, const struct cert_ip *, size_t);
506501 int rrdp_handle_file(size_t, enum publish_type, char *,
507502 char *, size_t, char *, size_t);
508503 char *repo_filename(const struct repo *, const char *);
509 struct repo *ta_lookup(struct tal *);
510 struct repo *repo_lookup(const char *, const char *);
504 struct repo *ta_lookup(int, struct tal *);
505 struct repo *repo_lookup(int, const char *, const char *);
511506 int repo_queued(struct repo *, struct entity *);
512507 void repo_cleanup(struct filepath_tree *);
513508 void repo_free(void);
522517 struct rrdp_session *);
523518 void rrdp_http_done(size_t, enum http_result, const char *);
524519
520 int repo_next_timeout(int);
521 void repo_check_timeout(void);
525522
526523 /* Logging (though really used for OpenSSL errors). */
527524
599596
600597 void logx(const char *fmt, ...)
601598 __attribute__((format(printf, 1, 2)));
599 time_t getmonotime(void);
602600
603601 int mkpath(const char *);
604602
605603 #ifndef RPKI_PATH_TAL_DIR
606 #define RPKI_PATH_TAL_DIR "/etc/rpki"
604 #define RPKI_PATH_TAL_DIR "/etc/rpki"
607605 #endif
608606
609607 #ifndef RPKI_PATH_OUT_DIR
610 #define RPKI_PATH_OUT_DIR "/var/db/rpki-client"
608 #define RPKI_PATH_OUT_DIR "/var/db/rpki-client"
611609 #endif
612610
613611 #ifndef RPKI_PATH_BASE_DIR
614 #define RPKI_PATH_BASE_DIR "/var/cache/rpki-client"
612 #define RPKI_PATH_BASE_DIR "/var/cache/rpki-client"
615613 #endif
616614
617615 #ifndef RPKI_CLIENT_USER
618 #define RPKI_CLIENT_USER "_rpki-client"
616 #define RPKI_CLIENT_USER "_rpki-client"
619617 #endif
620618
621619 #ifndef RPKI_RSYNC_CMD
622 #define RPKI_RSYNC_CMD "openrsync"
620 #define RPKI_RSYNC_CMD "openrsync"
623621 #endif
624622
625 /*
626 * Maximum number of ip ranges and AS ranges we will accept in
627 * any single file
628 */
629 #define MAX_IP_SIZE 200000
630 #define MAX_AS_SIZE 200000
631
632 /*
633 * Maximum URI length we will accept
634 */
635 #define MAX_URI_LENGTH 2048
636
637 /*
638 * Maximum File Size we will accept
639 */
640 #define MAX_FILE_SIZE 2000000
641
642 /*
643 * Maximum number of FileAndHash entries per Manifest.
644 */
645 #define MAX_MANIFEST_ENTRIES 100000
623 /* Maximum number of IP and AS ranges accepted in any single file */
624 #define MAX_IP_SIZE 200000
625 #define MAX_AS_SIZE 200000
626
627 /* Maximum acceptable URI length */
628 #define MAX_URI_LENGTH 2048
629
630 /* Maximum acceptable file size */
631 #define MAX_FILE_SIZE 2000000
632
633 /* Maximum number of FileAndHash entries per manifest. */
634 #define MAX_MANIFEST_ENTRIES 100000
635
636 /* Maximum depth of the RPKI tree. */
637 #define MAX_CERT_DEPTH 12
638
639 /* Maximum number of concurrent rsync processes. */
640 #define MAX_RSYNC_PROCESSES 16
641
642 /* Maximum allowd repositories per tal */
643 #define MAX_REPO_PER_TAL 1000
644
645 /* Timeout for repository synchronisation, in seconds */
646 #define MAX_REPO_TIMEOUT (15 * 60)
646647
647648 #endif /* ! EXTERN_H */
0 /* $OpenBSD: http.c,v 1.46 2021/10/29 08:51:20 claudio Exp $ */
0 /* $OpenBSD: http.c,v 1.49 2021/11/09 11:00:43 claudio Exp $ */
11 /*
22 * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
33 * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
160160 #endif
161161
162162 /* HTTP request API */
163 static void http_req_new(size_t, char *, char *, int);
163 static void http_req_new(size_t, char *, char *, int, int);
164164 static void http_req_free(struct http_request *);
165165 static void http_req_done(size_t, enum http_result, const char *);
166166 static void http_req_fail(size_t);
193193 static enum res proxy_read(struct http_connection *);
194194 static enum res proxy_write(struct http_connection *);
195195 static enum res data_write(struct http_connection *);
196
197 static time_t
198 getmonotime(void)
199 {
200 struct timespec ts;
201
202 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
203 err(1, "clock_gettime");
204 return (ts.tv_sec);
205 }
206196
207197 /*
208198 * Return a string that can be used in error message to identify the
518508 * Create and queue a new request.
519509 */
520510 static void
521 http_req_new(size_t id, char *uri, char *modified_since, int outfd)
511 http_req_new(size_t id, char *uri, char *modified_since, int count, int outfd)
522512 {
523513 struct http_request *req;
524514 char *host, *port, *path;
541531 req->path = path;
542532 req->uri = uri;
543533 req->modified_since = modified_since;
534 req->redirect_loop = count;
544535
545536 TAILQ_INSERT_TAIL(&queue, req, entry);
546537 }
11461137 err(1, NULL);
11471138
11481139 logx("redirect to %s", http_info(uri));
1149 http_req_new(conn->req->id, uri, mod_since, outfd);
1140 http_req_new(conn->req->id, uri, mod_since, conn->req->redirect_loop,
1141 outfd);
11501142
11511143 /* clear request before moving connection to idle */
11521144 http_req_free(conn->req);
16801672
16811673 /* all data written, switch back to read */
16821674 if (conn->bufpos == 0 || conn->iosz == 0) {
1683 if (conn->chunked)
1675 if (conn->chunked && conn->iosz == 0)
16841676 conn->state = STATE_RESPONSE_CHUNKED_TRAILER;
16851677 else
16861678 conn->state = STATE_RESPONSE_DATA;
18801872 io_read_str(b, &mod);
18811873
18821874 /* queue up new requests */
1883 http_req_new(id, uri, mod, b->fd);
1875 http_req_new(id, uri, mod, 0, b->fd);
18841876 ibuf_free(b);
18851877 }
18861878 }
0 /* $OpenBSD: ip.c,v 1.18 2021/10/23 16:06:04 claudio Exp $ */
0 /* $OpenBSD: ip.c,v 1.19 2021/11/05 10:50:41 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
281281 ip4_addr2str(addr, buf, bufsz);
282282 else
283283 ip6_addr2str(addr, buf, bufsz);
284 }
285
286 /*
287 * Serialise an ip_addr for sending over the wire.
288 * Matched with ip_addr_read().
289 */
290 void
291 ip_addr_buffer(struct ibuf *b, const struct ip_addr *p)
292 {
293 size_t sz = PREFIX_SIZE(p->prefixlen);
294
295 assert(sz <= 16);
296 io_simple_buffer(b, &p->prefixlen, sizeof(unsigned char));
297 io_simple_buffer(b, p->addr, sz);
298 }
299
300 /*
301 * Serialise an ip_addr_range for sending over the wire.
302 * Matched with ip_addr_range_read().
303 */
304 void
305 ip_addr_range_buffer(struct ibuf *b, const struct ip_addr_range *p)
306 {
307 ip_addr_buffer(b, &p->min);
308 ip_addr_buffer(b, &p->max);
309 }
310
311 /*
312 * Read an ip_addr from the wire.
313 * Matched with ip_addr_buffer().
314 */
315 void
316 ip_addr_read(struct ibuf *b, struct ip_addr *p)
317 {
318 size_t sz;
319
320 io_read_buf(b, &p->prefixlen, sizeof(unsigned char));
321 sz = PREFIX_SIZE(p->prefixlen);
322 assert(sz <= 16);
323 io_read_buf(b, p->addr, sz);
324 }
325
326 /*
327 * Read an ip_addr_range from the wire.
328 * Matched with ip_addr_range_buffer().
329 */
330 void
331 ip_addr_range_read(struct ibuf *b, struct ip_addr_range *p)
332 {
333 ip_addr_read(b, &p->min);
334 ip_addr_read(b, &p->max);
335284 }
336285
337286 /*
0 /* $OpenBSD: main.c,v 1.157 2021/10/28 19:02:36 claudio Exp $ */
0 /* $OpenBSD: main.c,v 1.164 2021/11/09 11:03:39 claudio Exp $ */
11 /*
22 * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
33 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
4848 */
4949 #define TALSZ_MAX 8
5050
51 const char *tals[TALSZ_MAX];
52 const char *taldescs[TALSZ_MAX];
53 unsigned int talrepocnt[TALSZ_MAX];
54 size_t talsz;
55
5156 size_t entity_queue;
5257 int timeout = 60*60;
5358 volatile sig_atomic_t killme;
8186 }
8287 }
8388
89 time_t
90 getmonotime(void)
91 {
92 struct timespec ts;
93
94 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
95 err(1, "clock_gettime");
96 return (ts.tv_sec);
97 }
98
8499 void
85100 entity_free(struct entity *ent)
86101 {
89104
90105 free(ent->data);
91106 free(ent->file);
92 free(ent->descr);
93107 free(ent);
94108 }
95109
102116 entity_read_req(struct ibuf *b, struct entity *ent)
103117 {
104118 io_read_buf(b, &ent->type, sizeof(ent->type));
119 io_read_buf(b, &ent->talid, sizeof(ent->talid));
105120 io_read_str(b, &ent->file);
106 io_read_str(b, &ent->descr);
107121 io_read_buf(b, &ent->has_data, sizeof(ent->has_data));
108122 if (ent->has_data)
109123 io_read_buf_alloc(b, (void **)&ent->data, &ent->datasz);
126140
127141 b = io_new_buffer();
128142 io_simple_buffer(b, &ent->type, sizeof(ent->type));
143 io_simple_buffer(b, &ent->talid, sizeof(ent->talid));
129144 io_str_buffer(b, ent->file);
130 io_str_buffer(b, ent->descr);
131145 io_simple_buffer(b, &ent->has_data, sizeof(int));
132146 if (ent->has_data)
133147 io_buf_buffer(b, ent->data, ent->datasz);
168182 */
169183 static void
170184 entityq_add(char *file, enum rtype type, struct repo *rp,
171 unsigned char *data, size_t datasz, char *descr)
185 unsigned char *data, size_t datasz, int talid)
172186 {
173187 struct entity *p;
174188
176190 err(1, NULL);
177191
178192 p->type = type;
193 p->talid = talid;
179194 p->file = file;
180195 p->has_data = data != NULL;
181196 if (p->has_data) {
182197 p->data = data;
183198 p->datasz = datasz;
184199 }
185 if (descr != NULL)
186 if ((p->descr = strdup(descr)) == NULL)
187 err(1, NULL);
188200
189201 entity_queue++;
190202
335347 * that the repository has already been loaded.
336348 */
337349
338 entityq_add(nfile, type, NULL, NULL, 0, NULL);
350 entityq_add(nfile, type, NULL, NULL, 0, -1);
339351 }
340352
341353 /*
383395 * Add a local TAL file (RFC 7730) to the queue of files to fetch.
384396 */
385397 static void
386 queue_add_tal(const char *file)
398 queue_add_tal(const char *file, int id)
387399 {
388400 unsigned char *buf;
389401 char *nfile;
392404 if ((nfile = strdup(file)) == NULL)
393405 err(1, NULL);
394406 buf = load_file(file, &len);
395
396 /* Record tal for later reporting */
397 if (stats.talnames == NULL) {
398 if ((stats.talnames = strdup(file)) == NULL)
399 err(1, NULL);
400 } else {
401 char *tmp;
402
403 if (asprintf(&tmp, "%s %s", stats.talnames, file) == -1)
404 err(1, NULL);
405 free(stats.talnames);
406 stats.talnames = tmp;
407 if (buf == NULL) {
408 warn("%s", file);
409 return;
407410 }
408411
409412 /* Not in a repository, so directly add to queue. */
410 entityq_add(nfile, RTYPE_TAL, NULL, buf, len, buf);
413 entityq_add(nfile, RTYPE_TAL, NULL, buf, len, id);
411414 }
412415
413416 /*
421424
422425 assert(tal->urisz);
423426
427 if ((taldescs[tal->id] = strdup(tal->descr)) == NULL)
428 err(1, NULL);
429
424430 /* Look up the repository. */
425 repo = ta_lookup(tal);
431 repo = ta_lookup(tal->id, tal);
432 if (repo == NULL)
433 return;
426434
427435 /* steal the pkey from the tal structure */
428436 data = tal->pkey;
429437 tal->pkey = NULL;
430438 entityq_add(NULL, RTYPE_CER, repo, data,
431 tal->pkeysz, tal->descr);
439 tal->pkeysz, tal->id);
432440 }
433441
434442 /*
440448 struct repo *repo;
441449 char *nfile;
442450
443 repo = repo_lookup(cert->repo, rrdpon ? cert->notify : NULL);
444 if (repo == NULL) {
445 warnx("%s: repository lookup failed", cert->repo);
451 repo = repo_lookup(cert->talid, cert->repo,
452 rrdpon ? cert->notify : NULL);
453 if (repo == NULL)
446454 return;
447 }
448455
449456 if ((nfile = strdup(cert->mft)) == NULL)
450457 err(1, NULL);
451 entityq_add(nfile, RTYPE_MFT, repo, NULL, 0, NULL);
458 entityq_add(nfile, RTYPE_MFT, repo, NULL, 0, -1);
452459 }
453460
454461 /*
492499 }
493500 cert = cert_read(b);
494501 if (cert->purpose == CERT_PURPOSE_CA) {
495 if (cert->valid) {
496 /*
497 * Process the revocation list from the
498 * certificate *first*, since it might mark that
499 * we're revoked and then we don't want to
500 * process the MFT.
501 */
502 queue_add_from_cert(cert);
503 } else
504 st->certs_invalid++;
502 /*
503 * Process the revocation list from the
504 * certificate *first*, since it might mark that
505 * we're revoked and then we don't want to
506 * process the MFT.
507 */
508 queue_add_from_cert(cert);
505509 } else if (cert->purpose == CERT_PURPOSE_BGPSEC_ROUTER) {
506 if (cert->valid) {
507 cert_insert_brks(brktree, cert);
508 st->brks++;
509 } else
510 st->brks_invalids++;
510 cert_insert_brks(brktree, cert);
511 st->brks++;
511512 } else
512 st->certs_invalid++;
513 st->certs_fail++;
513514 cert_free(cert);
514515 break;
515516 case RTYPE_MFT:
610611 * Don't exceded "max" filenames.
611612 */
612613 static size_t
613 tal_load_default(const char *tals[], size_t max)
614 tal_load_default(void)
614615 {
615616 static const char *confdir = RPKI_PATH_TAL_DIR;
616617 size_t s = 0;
624625 while ((dp = readdir(dirp)) != NULL) {
625626 if (fnmatch("*.tal", dp->d_name, FNM_PERIOD) == FNM_NOMATCH)
626627 continue;
627 if (s >= max)
628 if (s >= TALSZ_MAX)
628629 err(1, "too many tal files found in %s",
629630 confdir);
630631 if (asprintf(&path, "%s/%s", confdir, dp->d_name) == -1)
673674 {
674675 int rc, c, st, proc, rsync, http, rrdp, ok, hangup = 0;
675676 int fl = SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK;
676 size_t i, id, talsz = 0;
677 size_t i, id;
677678 pid_t pid, procpid, rsyncpid, httppid, rrdppid;
678679 int fd[2];
679680 struct pollfd pfd[NPFD];
683684 char *rsync_prog = RPKI_RSYNC_CMD;
684685 char *bind_addr = NULL;
685686 const char *cachedir = NULL, *outputdir = NULL;
686 const char *tals[TALSZ_MAX], *errs, *name;
687 const char *errs, *name;
687688 const char *file = NULL;
688689 struct vrp_tree vrps = RB_INITIALIZER(&vrps);
689690 struct brk_tree brks = RB_INITIALIZER(&brks);
802803 | FORMAT_BIRD;
803804
804805 if (talsz == 0)
805 talsz = tal_load_default(tals, TALSZ_MAX);
806 talsz = tal_load_default();
806807 if (talsz == 0)
807808 err(1, "no TAL files found in %s", RPKI_PATH_TAL_DIR);
808809
10021003 */
10031004
10041005 for (i = 0; i < talsz; i++)
1005 queue_add_tal(tals[i]);
1006 queue_add_tal(tals[i], i);
10061007
10071008 /* change working directory to the cache directory */
10081009 if (fchdir(cachefd) == -1)
10091010 err(1, "fchdir");
10101011
10111012 while (entity_queue > 0 && !killme) {
1013 int polltim;
1014
10121015 for (i = 0; i < NPFD; i++) {
10131016 pfd[i].events = POLLIN;
10141017 if (queues[i]->queued)
10151018 pfd[i].events |= POLLOUT;
10161019 }
10171020
1018 if ((c = poll(pfd, NPFD, INFTIM)) == -1) {
1021 polltim = repo_next_timeout(INFTIM);
1022
1023 if ((c = poll(pfd, NPFD, polltim)) == -1) {
10191024 if (errno == EINTR)
10201025 continue;
10211026 err(1, "poll");
10221027 }
10231028
10241029 for (i = 0; i < NPFD; i++) {
1025 if (pfd[i].revents & (POLLERR|POLLNVAL))
1026 errx(1, "poll[%zu]: bad fd", i);
1027 if (pfd[i].revents & POLLHUP) {
1028 warnx("poll[%zu]: hangup", i);
1030 if (pfd[i].revents & (POLLERR|POLLNVAL)) {
1031 warnx("poll[%zu]: bad fd", i);
10291032 hangup = 1;
10301033 }
1034 if (pfd[i].revents & POLLHUP)
1035 hangup = 1;
10311036 if (pfd[i].revents & POLLOUT) {
10321037 switch (msgbuf_write(queues[i])) {
10331038 case 0:
1034 errx(1, "write[%zu]: "
1039 warnx("write[%zu]: "
10351040 "connection closed", i);
1041 hangup = 1;
1042 break;
10361043 case -1:
1037 err(1, "write[%zu]", i);
1044 warn("write[%zu]", i);
1045 hangup = 1;
1046 break;
10381047 }
10391048 }
10401049 }
10411050 if (hangup)
10421051 break;
1052
1053 repo_check_timeout();
10431054
10441055 /*
10451056 * Check the rsync and http process.
11491160
11501161 /* processing did not finish because of error */
11511162 if (entity_queue != 0)
1152 return 1;
1163 errx(1, "not all files processed, giving up");
11531164
11541165 logx("all files parsed: generating output");
11551166
11721183
11731184 if (outputfiles(&vrps, &brks, &stats))
11741185 rc = 1;
1175
11761186
11771187 logx("Processing time %lld seconds "
11781188 "(%lld seconds user, %lld seconds system)",
11811191 (long long)stats.system_time.tv_sec);
11821192 logx("Route Origin Authorizations: %zu (%zu failed parse, %zu invalid)",
11831193 stats.roas, stats.roas_fail, stats.roas_invalid);
1184 logx("BGPsec Router Certificates: %zu (%zu invalid)",
1185 stats.brks, stats.brks_invalids);
1186 logx("Certificates: %zu (%zu failed parse, %zu invalid)",
1187 stats.certs, stats.certs_fail, stats.certs_invalid);
1188 logx("Trust Anchor Locators: %zu", stats.tals);
1194 logx("BGPsec Router Certificates: %zu", stats.brks);
1195 logx("Certificates: %zu (%zu invalid)",
1196 stats.certs, stats.certs_fail);
1197 logx("Trust Anchor Locators: %zu (%zu invalid)",
1198 stats.tals, talsz - stats.tals);
11891199 logx("Manifests: %zu (%zu failed parse, %zu stale)",
11901200 stats.mfts, stats.mfts_fail, stats.mfts_stale);
11911201 logx("Certificate revocation lists: %zu", stats.crls);
0 /* $OpenBSD: output-csv.c,v 1.11 2021/10/11 16:50:03 job Exp $ */
0 /* $OpenBSD: output-csv.c,v 1.12 2021/11/04 11:32:55 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
33 *
3333 ip_addr_print(&v->addr, v->afi, buf, sizeof(buf));
3434
3535 if (fprintf(out, "AS%u,%s,%u,%s,%lld\n", v->asid, buf,
36 v->maxlength, v->tal, (long long)v->expires) < 0)
36 v->maxlength, taldescs[v->talid],
37 (long long)v->expires) < 0)
3738 return -1;
3839 }
3940 return 0;
0 /* $OpenBSD: output-json.c,v 1.20 2021/10/15 08:48:18 job Exp $ */
0 /* $OpenBSD: output-json.c,v 1.22 2021/11/04 11:32:55 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
33 *
2727 char hn[NI_MAXHOST], tbuf[26];
2828 struct tm *tp;
2929 time_t t;
30 size_t i;
3031
3132 time(&t);
3233 setenv("TZ", "UTC", 1);
4647 "\t\t\"failedroas\": %zu,\n"
4748 "\t\t\"invalidroas\": %zu,\n"
4849 "\t\t\"bgpsec_pubkeys\": %zu,\n"
49 "\t\t\"invalidbgpsec_pubkeys\": %zu,\n"
5050 "\t\t\"certificates\": %zu,\n"
51 "\t\t\"failcertificates\": %zu,\n"
5251 "\t\t\"invalidcertificates\": %zu,\n"
5352 "\t\t\"tals\": %zu,\n"
54 "\t\t\"talfiles\": \"%s\",\n"
53 "\t\t\"invalidtals\": %zu,\n"
54 "\t\t\"talfiles\": [\n",
55 hn, tbuf, (long long)st->elapsed_time.tv_sec,
56 (long long)st->user_time.tv_sec, (long long)st->system_time.tv_sec,
57 st->roas, st->roas_fail, st->roas_invalid,
58 st->brks, st->certs, st->certs_fail,
59 st->tals, talsz - st->tals) < 0)
60 return -1;
61
62 for (i = 0; i < talsz; i++) {
63 if (fprintf(out,
64 "\t\t\t\"%s\"%s\n",
65 tals[i], i == talsz - 1 ? "" : ",") < 0)
66 return -1;
67 }
68
69 if (fprintf(out,
70 "\t\t],\n"
5571 "\t\t\"manifests\": %zu,\n"
5672 "\t\t\"failedmanifests\": %zu,\n"
5773 "\t\t\"stalemanifests\": %zu,\n"
6379 "\t\t\"cachedir_del_files\": %zu,\n"
6480 "\t\t\"cachedir_del_dirs\": %zu\n"
6581 "\t},\n\n",
66 hn, tbuf, (long long)st->elapsed_time.tv_sec,
67 (long long)st->user_time.tv_sec, (long long)st->system_time.tv_sec,
68 st->roas, st->roas_fail, st->roas_invalid,
69 st->brks, st->brks_invalids,
70 st->certs, st->certs_fail, st->certs_invalid,
71 st->tals, st->talnames,
7282 st->mfts, st->mfts_fail, st->mfts_stale,
7383 st->crls,
7484 st->gbrs,
105115
106116 if (fprintf(out, "\t\t{ \"asn\": %u, \"prefix\": \"%s\", "
107117 "\"maxLength\": %u, \"ta\": \"%s\", \"expires\": %lld }",
108 v->asid, buf, v->maxlength, v->tal, (long long)v->expires)
118 v->asid, buf, v->maxlength, taldescs[v->talid],
119 (long long)v->expires)
109120 < 0)
110121 return -1;
111122 }
123134
124135 if (fprintf(out, "\t\t{ \"asn\": %u, \"ski\": \"%s\", "
125136 "\"pubkey\": \"%s\", \"ta\": \"%s\", \"expires\": %lld }",
126 b->asid, b->ski, b->pubkey, b->tal,
137 b->asid, b->ski, b->pubkey, taldescs[b->talid],
127138 (long long)b->expires) < 0)
128139 return -1;
129140 }
0 /* $OpenBSD: output.c,v 1.22 2021/10/11 16:50:03 job Exp $ */
0 /* $OpenBSD: output.c,v 1.24 2021/11/04 11:32:55 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org>
33 *
200200 char hn[NI_MAXHOST], tbuf[80];
201201 struct tm *tp;
202202 time_t t;
203 size_t i;
203204
204205 time(&t);
205206 setenv("TZ", "UTC", 1);
210211
211212 if (fprintf(out,
212213 "# Generated on host %s at %s\n"
213 "# Processing time %lld seconds (%lld seconds user, %lld seconds system)\n"
214 "# Processing time %lld seconds (%llds user, %llds system)\n"
214215 "# Route Origin Authorizations: %zu (%zu failed parse, %zu invalid)\n"
215 "# BGPsec Router Certificates: %zu (%zu invalid)\n"
216 "# Certificates: %zu (%zu failed parse, %zu invalid)\n"
217 "# Trust Anchor Locators: %zu (%s)\n"
216 "# BGPsec Router Certificates: %zu\n"
217 "# Certificates: %zu (%zu invalid)\n",
218 hn, tbuf, (long long)st->elapsed_time.tv_sec,
219 (long long)st->user_time.tv_sec, (long long)st->system_time.tv_sec,
220 st->roas, st->roas_fail, st->roas_invalid,
221 st->brks, st->certs, st->certs_fail) < 0)
222 return -1;
223
224 if (fprintf(out,
225 "# Trust Anchor Locators: %zu (%zu invalid) [", st->tals,
226 talsz - st->tals) < 0)
227 return -1;
228 for (i = 0; i < talsz; i++)
229 if (fprintf(out, " %s", tals[i]) < 0)
230 return -1;
231
232 if (fprintf(out,
233 " ]\n"
218234 "# Manifests: %zu (%zu failed parse, %zu stale)\n"
219235 "# Certificate revocation lists: %zu\n"
220236 "# Ghostbuster records: %zu\n"
221237 "# Repositories: %zu\n"
222238 "# VRP Entries: %zu (%zu unique)\n",
223 hn, tbuf, (long long)st->elapsed_time.tv_sec,
224 (long long)st->user_time.tv_sec, (long long)st->system_time.tv_sec,
225 st->roas, st->roas_fail, st->roas_invalid,
226 st->brks, st->brks_invalids,
227 st->certs, st->certs_fail, st->certs_invalid,
228 st->tals, st->talnames,
229239 st->mfts, st->mfts_fail, st->mfts_stale,
230240 st->crls,
231241 st->gbrs,
0 /* $OpenBSD: parser.c,v 1.21 2021/10/28 09:02:19 beck Exp $ */
0 /* $OpenBSD: parser.c,v 1.28 2021/11/04 18:26:48 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
33 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
4040 static struct crl *get_crl(const struct auth *);
4141 static void build_crls(const struct crl *, STACK_OF(X509_CRL) **);
4242
43 /* Limit how deep the RPKI tree can be. */
44 #define MAX_CERT_DEPTH 12
45
4643 static X509_STORE_CTX *ctx;
4744 static struct auth_tree auths = RB_INITIALIZER(&auths);
4845 static struct crl_tree crlt = RB_INITIALIZER(&crlt);
6764 return NULL;
6865
6966 a = valid_ski_aki(entp->file, &auths, roa->ski, roa->aki);
70
7167 build_chain(a, &chain);
7268 crl = get_crl(a);
7369 build_crls(crl, &crls);
9894 /*
9995 * Check CRL to figure out the soonest transitive expiry moment
10096 */
101 if (roa->expires > crl->expires)
97 if (crl != NULL && roa->expires > crl->expires)
10298 roa->expires = crl->expires;
10399
104100 /*
105101 * Scan the cert tree to figure out the soonest transitive
106102 * expiry moment
107103 */
108 for (; a->parent != NULL; a = a->parent) {
104 for (; a != NULL; a = a->parent) {
109105 if (roa->expires > a->cert->expires)
110106 roa->expires = a->cert->expires;
111107 }
194190 struct cert *cert;
195191 X509 *x509;
196192 int c;
197 struct auth *a = NULL, *na;
193 struct auth *a = NULL;
198194 STACK_OF(X509) *chain;
199195 STACK_OF(X509_CRL) *crls;
200196
235231 X509_STORE_CTX_cleanup(ctx);
236232 sk_X509_free(chain);
237233 sk_X509_CRL_free(crls);
234 X509_free(x509);
235
236 cert->talid = a->cert->talid;
238237
239238 /* Validate the cert to get the parent */
240239 if (!valid_cert(entp->file, &auths, cert)) {
241 X509_free(x509); // needed? XXX
242 return cert;
240 cert_free(cert);
241 return NULL;
243242 }
244243
245244 /*
246 * Add validated certs to the RPKI auth tree.
245 * Add validated CA certs to the RPKI auth tree.
247246 */
248
249 cert->valid = 1;
250
251 na = malloc(sizeof(*na));
252 if (na == NULL)
253 err(1, NULL);
254
255 cert->tal = strdup(a->tal);
256 if (cert->tal == NULL)
257 err(1, NULL);
258
259 na->parent = a;
260 na->cert = cert;
261 na->tal = a->tal;
262 na->fn = strdup(entp->file);
263 if (na->fn == NULL)
264 err(1, NULL);
265
266 if (RB_INSERT(auth_tree, &auths, na) != NULL)
267 err(1, "auth tree corrupted");
247 if (cert->purpose == CERT_PURPOSE_CA) {
248 if (!auth_insert(&auths, cert, a)) {
249 cert_free(cert);
250 return NULL;
251 }
252 }
268253
269254 return cert;
270255 }
271
272256
273257 /*
274258 * Root certificates come from TALs (has a pkey and is self-signed).
288272 X509_NAME *name;
289273 struct cert *cert;
290274 X509 *x509;
291 struct auth *na;
292 char *tal;
293275
294276 assert(entp->has_data);
295277
334316 goto badcert;
335317 }
336318
319 X509_free(x509);
320
321 cert->talid = entp->talid;
322
337323 /*
338324 * Add valid roots to the RPKI auth tree.
339325 */
340
341 cert->valid = 1;
342
343 na = malloc(sizeof(*na));
344 if (na == NULL)
345 err(1, NULL);
346
347 if ((tal = strdup(entp->descr)) == NULL)
348 err(1, NULL);
349
350 na->parent = NULL;
351 na->cert = cert;
352 na->tal = tal;
353 na->fn = strdup(entp->file);
354 if (na->fn == NULL)
355 err(1, NULL);
356
357 if (RB_INSERT(auth_tree, &auths, na) != NULL)
358 err(1, "auth tree corrupted");
326 if (!auth_insert(&auths, cert, NULL)) {
327 cert_free(cert);
328 return NULL;
329 }
359330
360331 return cert;
332
361333 badcert:
362 X509_free(x509); // needed? XXX
363 return cert;
334 X509_free(x509);
335 cert_free(cert);
336 return NULL;
364337 }
365338
366339 /*
546519 entp->datasz)) == NULL)
547520 errx(1, "%s: could not parse tal file",
548521 entp->file);
522 tal->id = entp->talid;
549523 tal_buffer(b, tal);
550524 tal_free(tal);
551525 break;
0 /* $OpenBSD: repo.c,v 1.9 2021/08/12 15:27:15 claudio Exp $ */
0 /* $OpenBSD: repo.c,v 1.11 2021/11/09 11:03:39 claudio Exp $ */
11 /*
22 * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
33 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
2626 #include <fcntl.h>
2727 #include <fts.h>
2828 #include <limits.h>
29 #include <poll.h>
2930 #include <stdio.h>
3031 #include <stdlib.h>
3132 #include <string.h>
8788
8889 struct repo {
8990 SLIST_ENTRY(repo) entry;
90 char *repouri; /* CA repository base URI */
91 char *repouri;
92 char *notifyuri;
9193 const struct rrdprepo *rrdp;
9294 const struct rsyncrepo *rsync;
9395 const struct tarepo *ta;
9496 struct entityq queue; /* files waiting for repo */
97 time_t alarm; /* sync timeout */
98 int talid;
9599 size_t id; /* identifier */
96100 };
97101 SLIST_HEAD(, repo) repos = SLIST_HEAD_INITIALIZER(repos);
606610 * Allocate and insert a new repository.
607611 */
608612 static struct repo *
609 repo_alloc(void)
613 repo_alloc(int talid)
610614 {
611615 struct repo *rp;
612616
617 if (++talrepocnt[talid] >= MAX_REPO_PER_TAL) {
618 if (talrepocnt[talid] == MAX_REPO_PER_TAL)
619 warnx("too many repositories under %s", tals[talid]);
620 return NULL;
621 }
622
613623 if ((rp = calloc(1, sizeof(*rp))) == NULL)
614624 err(1, NULL);
615625
616626 rp->id = ++repoid;
627 rp->talid = talid;
628 rp->alarm = getmonotime() + MAX_REPO_TIMEOUT;
617629 TAILQ_INIT(&rp->queue);
618630 SLIST_INSERT_HEAD(&repos, rp, entry);
619631
930942
931943 tr = ta_find(id);
932944 if (tr != NULL) {
945 /* repository changed state already, ignore request */
946 if (tr->state != REPO_LOADING)
947 return;
933948 if (ok) {
934949 logx("ta/%s: loaded from network", tr->descr);
935950 stats.rsync_repos++;
952967 if (rr == NULL)
953968 errx(1, "unknown rsync repo %zu", id);
954969
970 /* repository changed state already, ignore request */
971 if (rr->state != REPO_LOADING)
972 return;
955973 if (ok) {
956974 logx("%s: loaded from network", rr->basedir);
957975 stats.rsync_repos++;
980998 rr = rrdp_find(id);
981999 if (rr == NULL)
9821000 errx(1, "unknown RRDP repo %zu", id);
1001 /* repository changed state already, ignore request */
1002 if (rr->state != REPO_LOADING)
1003 return;
9831004
9841005 if (ok && rrdp_merge_repo(rr)) {
9851006 logx("%s: loaded from network", rr->notifyuri);
10311052 return;
10321053 }
10331054
1055 /* repository changed state already, ignore request */
1056 if (tr->state != REPO_LOADING)
1057 return;
1058
10341059 /* Move downloaded TA file into place, or unlink on failure. */
10351060 if (res == HTTP_OK) {
10361061 char *file;
10641089 * Look up a trust anchor, queueing it for download if not found.
10651090 */
10661091 struct repo *
1067 ta_lookup(struct tal *tal)
1092 ta_lookup(int id, struct tal *tal)
10681093 {
10691094 struct repo *rp;
10701095
10741099 return rp;
10751100 }
10761101
1077 rp = repo_alloc();
1102 rp = repo_alloc(id);
1103 if (rp == NULL)
1104 return NULL;
1105
10781106 if ((rp->repouri = strdup(tal->descr)) == NULL)
10791107 err(1, NULL);
10801108 rp->ta = ta_get(tal);
10861114 * Look up a repository, queueing it for discovery if not found.
10871115 */
10881116 struct repo *
1089 repo_lookup(const char *uri, const char *notify)
1090 {
1091 struct repo *rp;
1117 repo_lookup(int id, const char *uri, const char *notify)
1118 {
1119 struct repo *rp;
1120 char *repouri;
1121
1122 if ((repouri = rsync_base_uri(uri)) == NULL)
1123 errx(1, "bad caRepository URI: %s", uri);
10921124
10931125 /* Look up in repository table. */
10941126 SLIST_FOREACH(rp, &repos, entry) {
1095 if (strcmp(rp->repouri, uri) != 0)
1127 if (strcmp(rp->repouri, repouri) != 0)
10961128 continue;
1129 if (rp->notifyuri != NULL) {
1130 if (notify == NULL)
1131 continue;
1132 if (strcmp(rp->notifyuri, notify) != 0)
1133 continue;
1134 } else if (notify != NULL)
1135 continue;
1136 /* found matching repo */
1137 free(repouri);
10971138 return rp;
10981139 }
10991140
1100 rp = repo_alloc();
1101 if ((rp->repouri = strdup(uri)) == NULL)
1102 err(1, NULL);
1141 rp = repo_alloc(id);
1142 if (rp == NULL) {
1143 free(repouri);
1144 return NULL;
1145 }
1146
1147 rp->repouri = repouri;
1148 if (notify != NULL)
1149 if ((rp->notifyuri = strdup(notify)) == NULL)
1150 err(1, NULL);
11031151
11041152 /* try RRDP first if available */
11051153 if (notify != NULL)
11501198 return 1;
11511199 }
11521200 return 0;
1201 }
1202
1203 int
1204 repo_next_timeout(int timeout)
1205 {
1206 struct repo *rp;
1207 time_t now;
1208
1209 now = getmonotime();
1210 /* Look up in repository table. (Lookup should actually fail here) */
1211 SLIST_FOREACH(rp, &repos, entry) {
1212 if (repo_state(rp) == REPO_LOADING) {
1213 int diff = rp->alarm - now;
1214 diff *= 1000;
1215 if (timeout == INFTIM || diff < timeout)
1216 timeout = diff;
1217 }
1218 }
1219 return timeout;
1220 }
1221
1222 static void
1223 repo_fail(struct repo *rp)
1224 {
1225 /* reset the alarm since code may fallback to rsync */
1226 rp->alarm = getmonotime() + MAX_REPO_TIMEOUT;
1227
1228 if (rp->ta)
1229 http_finish(rp->ta->id, HTTP_FAILED, NULL);
1230 else if (rp->rrdp)
1231 rrdp_finish(rp->rrdp->id, 0);
1232 else if (rp->rsync)
1233 rsync_finish(rp->rsync->id, 0);
1234 else
1235 errx(1, "%s: bad repo", rp->repouri);
1236 }
1237
1238 void
1239 repo_check_timeout(void)
1240 {
1241 struct repo *rp;
1242 time_t now;
1243
1244 now = getmonotime();
1245 /* Look up in repository table. (Lookup should actually fail here) */
1246 SLIST_FOREACH(rp, &repos, entry) {
1247 if (repo_state(rp) == REPO_LOADING) {
1248 if (rp->alarm <= now) {
1249 warnx("%s: synchronisation timeout",
1250 rp->repouri);
1251 repo_fail(rp);
1252 }
1253 }
1254 }
11531255 }
11541256
11551257 static char **
0 /* $OpenBSD: roa.c,v 1.30 2021/10/28 09:02:19 beck Exp $ */
0 /* $OpenBSD: roa.c,v 1.32 2021/11/05 10:50:41 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
408408 free(p->aki);
409409 free(p->ski);
410410 free(p->ips);
411 free(p->tal);
412411 free(p);
413412 }
414413
419418 void
420419 roa_buffer(struct ibuf *b, const struct roa *p)
421420 {
422 size_t i;
423
424 io_simple_buffer(b, &p->valid, sizeof(int));
425 io_simple_buffer(b, &p->asid, sizeof(uint32_t));
426 io_simple_buffer(b, &p->ipsz, sizeof(size_t));
427 io_simple_buffer(b, &p->expires, sizeof(time_t));
428
429 for (i = 0; i < p->ipsz; i++) {
430 io_simple_buffer(b, &p->ips[i].afi, sizeof(enum afi));
431 io_simple_buffer(b, &p->ips[i].maxlength, sizeof(size_t));
432 io_simple_buffer(b, p->ips[i].min, sizeof(p->ips[i].min));
433 io_simple_buffer(b, p->ips[i].max, sizeof(p->ips[i].max));
434 ip_addr_buffer(b, &p->ips[i].addr);
435 }
421 io_simple_buffer(b, &p->valid, sizeof(p->valid));
422 io_simple_buffer(b, &p->asid, sizeof(p->asid));
423 io_simple_buffer(b, &p->talid, sizeof(p->talid));
424 io_simple_buffer(b, &p->ipsz, sizeof(p->ipsz));
425 io_simple_buffer(b, &p->expires, sizeof(p->expires));
426
427 io_simple_buffer(b, p->ips, p->ipsz * sizeof(p->ips[0]));
436428
437429 io_str_buffer(b, p->aia);
438430 io_str_buffer(b, p->aki);
439431 io_str_buffer(b, p->ski);
440 io_str_buffer(b, p->tal);
441432 }
442433
443434 /*
449440 roa_read(struct ibuf *b)
450441 {
451442 struct roa *p;
452 size_t i;
453443
454444 if ((p = calloc(1, sizeof(struct roa))) == NULL)
455445 err(1, NULL);
456446
457 io_read_buf(b, &p->valid, sizeof(int));
458 io_read_buf(b, &p->asid, sizeof(uint32_t));
459 io_read_buf(b, &p->ipsz, sizeof(size_t));
460 io_read_buf(b, &p->expires, sizeof(time_t));
447 io_read_buf(b, &p->valid, sizeof(p->valid));
448 io_read_buf(b, &p->asid, sizeof(p->asid));
449 io_read_buf(b, &p->talid, sizeof(p->talid));
450 io_read_buf(b, &p->ipsz, sizeof(p->ipsz));
451 io_read_buf(b, &p->expires, sizeof(p->expires));
461452
462453 if ((p->ips = calloc(p->ipsz, sizeof(struct roa_ip))) == NULL)
463454 err(1, NULL);
464
465 for (i = 0; i < p->ipsz; i++) {
466 io_read_buf(b, &p->ips[i].afi, sizeof(enum afi));
467 io_read_buf(b, &p->ips[i].maxlength, sizeof(size_t));
468 io_read_buf(b, &p->ips[i].min, sizeof(p->ips[i].min));
469 io_read_buf(b, &p->ips[i].max, sizeof(p->ips[i].max));
470 ip_addr_read(b, &p->ips[i].addr);
471 }
455 io_read_buf(b, p->ips, p->ipsz * sizeof(p->ips[0]));
472456
473457 io_read_str(b, &p->aia);
474458 io_read_str(b, &p->aki);
475459 io_read_str(b, &p->ski);
476 io_read_str(b, &p->tal);
477 assert(p->aia && p->aki && p->ski && p->tal);
460 assert(p->aia && p->aki && p->ski);
478461
479462 return p;
480463 }
498481 v->addr = roa->ips[i].addr;
499482 v->maxlength = roa->ips[i].maxlength;
500483 v->asid = roa->asid;
501 if ((v->tal = strdup(roa->tal)) == NULL)
502 err(1, NULL);
484 v->talid = roa->talid;
503485 v->expires = roa->expires;
504486
505487 /*
511493 /* already exists */
512494 if (found->expires < v->expires) {
513495 /* update found with preferred data */
514 found->expires = roa->expires;
515 free(found->tal);
516 found->tal = v->tal;
517 v->tal = NULL;
496 found->talid = v->talid;
497 found->expires = v->expires;
518498 }
519 free(v->tal);
520499 free(v);
521500 } else
522501 (*uniqs)++;
0 /* $OpenBSD: rrdp_delta.c,v 1.4 2021/10/28 11:57:00 claudio Exp $ */
0 /* $OpenBSD: rrdp_delta.c,v 1.6 2021/11/09 11:01:04 claudio Exp $ */
11 /*
22 * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
33 * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
8686 continue;
8787 }
8888 PARSE_FAIL(p, "parse failed - non conforming "
89 "attribute found in delta elem");
89 "attribute '%s' found in delta elem", attr[i]);
9090 }
9191 if (!(has_xmlns && dxml->version && dxml->session_id && dxml->serial))
9292 PARSE_FAIL(p, "parse failed - incomplete delta attributes");
135135 continue;
136136 }
137137 PARSE_FAIL(p, "parse failed - non conforming "
138 "attribute found in publish/withdraw elem");
138 "attribute '%s' found in publish/withdraw elem", attr[i]);
139139 }
140140 if (hasUri != 1)
141141 PARSE_FAIL(p,
224224 PARSE_FAIL(p, "parse failed - content too big");
225225 }
226226
227 static void
228 delta_doctype_handler(void *data, const char *doctypeName,
229 const char *sysid, const char *pubid, int subset)
230 {
231 struct delta_xml *dxml = data;
232 XML_Parser p = dxml->parser;
233
234 PARSE_FAIL(p, "parse failed - DOCTYPE not allowed");
235 }
236
227237 struct delta_xml *
228238 new_delta_xml(XML_Parser p, struct rrdp_session *rs, struct rrdp *r)
229239 {
242252 delta_xml_elem_end);
243253 XML_SetCharacterDataHandler(dxml->parser, delta_content_handler);
244254 XML_SetUserData(dxml->parser, dxml);
255 XML_SetDoctypeDeclHandler(dxml->parser, delta_doctype_handler, NULL);
245256
246257 return dxml;
247258 }
0 /* $OpenBSD: rrdp_notification.c,v 1.9 2021/10/29 09:27:36 claudio Exp $ */
0 /* $OpenBSD: rrdp_notification.c,v 1.11 2021/11/09 11:01:04 claudio Exp $ */
11 /*
22 * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
33 * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
140140 continue;
141141 }
142142 PARSE_FAIL(p, "parse failed - non conforming "
143 "attribute found in notification elem");
143 "attribute '%s' found in notification elem", attr[i]);
144144 }
145145 if (!(has_xmlns && nxml->version && nxml->session_id && nxml->serial))
146146 PARSE_FAIL(p, "parse failed - incomplete "
184184 continue;
185185 }
186186 PARSE_FAIL(p, "parse failed - non conforming "
187 "attribute found in snapshot elem");
187 "attribute '%s' found in snapshot elem", attr[i]);
188188 }
189189 if (hasUri != 1 || hasHash != 1)
190190 PARSE_FAIL(p, "parse failed - incomplete snapshot attributes");
238238 continue;
239239 }
240240 PARSE_FAIL(p, "parse failed - non conforming "
241 "attribute found in snapshot elem");
241 "attribute '%s' found in snapshot elem", attr[i]);
242242 }
243243 /* Only add to the list if we are relevant */
244244 if (hasUri != 1 || hasHash != 1 || delta_serial == 0)
307307 PARSE_FAIL(p, "parse failed - unexpected elem exit found");
308308 }
309309
310 static void
311 notification_doctype_handler(void *data, const char *doctypeName,
312 const char *sysid, const char *pubid, int subset)
313 {
314 struct notification_xml *nxml = data;
315 XML_Parser p = nxml->parser;
316
317 PARSE_FAIL(p, "parse failed - DOCTYPE not allowed");
318 }
319
310320 struct notification_xml *
311321 new_notification_xml(XML_Parser p, struct rrdp_session *repository,
312322 struct rrdp_session *current, const char *notifyuri)
324334 XML_SetElementHandler(nxml->parser, notification_xml_elem_start,
325335 notification_xml_elem_end);
326336 XML_SetUserData(nxml->parser, nxml);
337 XML_SetDoctypeDeclHandler(nxml->parser, notification_doctype_handler,
338 NULL);
327339
328340 return nxml;
329341 }
0 /* $OpenBSD: rrdp_snapshot.c,v 1.3 2021/10/28 11:57:00 claudio Exp $ */
0 /* $OpenBSD: rrdp_snapshot.c,v 1.5 2021/11/09 11:01:04 claudio Exp $ */
11 /*
22 * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
33 * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
7979 }
8080 PARSE_FAIL(p,
8181 "parse failed - non conforming "
82 "attribute found in snapshot elem");
82 "attribute '%s' found in snapshot elem", attr[i]);
8383 }
8484 if (!(has_xmlns && sxml->version && sxml->session_id && sxml->serial))
8585 PARSE_FAIL(p,
200200 PARSE_FAIL(p, "parse failed - content too big");
201201 }
202202
203 static void
204 snapshot_doctype_handler(void *data, const char *doctypeName,
205 const char *sysid, const char *pubid, int subset)
206 {
207 struct snapshot_xml *sxml = data;
208 XML_Parser p = sxml->parser;
209
210 PARSE_FAIL(p, "parse failed - DOCTYPE not allowed");
211 }
212
203213 struct snapshot_xml *
204214 new_snapshot_xml(XML_Parser p, struct rrdp_session *rs, struct rrdp *r)
205215 {
218228 snapshot_xml_elem_end);
219229 XML_SetCharacterDataHandler(sxml->parser, snapshot_content_handler);
220230 XML_SetUserData(sxml->parser, sxml);
231 XML_SetDoctypeDeclHandler(sxml->parser, snapshot_doctype_handler,
232 NULL);
221233
222234 return sxml;
223235 }
0 /* $OpenBSD: rsync.c,v 1.29 2021/10/28 13:50:29 job Exp $ */
0 /* $OpenBSD: rsync.c,v 1.30 2021/11/03 14:59:37 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
118118 void
119119 proc_rsync(char *prog, char *bind_addr, int fd)
120120 {
121 size_t i, idsz = 0;
121 size_t i, idsz = 0, nprocs = 0;
122122 int rc = 0;
123123 struct pollfd pfd;
124124 struct msgbuf msgq;
185185 pid_t pid;
186186 int st;
187187
188 pfd.events = POLLIN;
188 pfd.events = 0;
189 if (nprocs < MAX_RSYNC_PROCESSES)
190 pfd.events |= POLLIN;
189191 if (msgq.queued)
190192 pfd.events |= POLLOUT;
191193
227229 ids[i].uri = NULL;
228230 ids[i].pid = 0;
229231 ids[i].id = 0;
232 nprocs--;
230233 }
231234 if (pid == -1 && errno != ECHILD)
232235 err(1, "waitpid");
313316 ids[i].id = id;
314317 ids[i].pid = pid;
315318 ids[i].uri = uri;
319 nprocs++;
316320
317321 /* Clean up temporary values. */
318322
0 /* $OpenBSD: tal.c,v 1.32 2021/10/26 16:12:54 claudio Exp $ */
0 /* $OpenBSD: tal.c,v 1.34 2021/11/04 11:32:55 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
5757 while ((nl = memchr(buf, '\n', len)) != NULL) {
5858 line = buf;
5959
60 /* replace LF and optional CR with NUL */
61 *nl = '\0';
62 if (nl > line && nl[-1] == '\r')
63 nl[-1] = '\0';
64
6560 /* advance buffer to next line */
6661 len -= nl + 1 - buf;
6762 buf = nl + 1;
63
64 /* replace LF and optional CR with NUL, point nl at first NUL */
65 *nl = '\0';
66 if (nl > line && nl[-1] == '\r') {
67 nl[-1] = '\0';
68 nl--;
69 }
6870
6971 if (optcomment) {
7072 /* if this is a comment, just eat the line */
212214 {
213215 size_t i;
214216
217 io_simple_buffer(b, &p->id, sizeof(p->id));
215218 io_buf_buffer(b, p->pkey, p->pkeysz);
216219 io_str_buffer(b, p->descr);
217 io_simple_buffer(b, &p->urisz, sizeof(size_t));
220 io_simple_buffer(b, &p->urisz, sizeof(p->urisz));
218221
219222 for (i = 0; i < p->urisz; i++)
220223 io_str_buffer(b, p->uri[i]);
234237 if ((p = calloc(1, sizeof(struct tal))) == NULL)
235238 err(1, NULL);
236239
240 io_read_buf(b, &p->id, sizeof(p->id));
237241 io_read_buf_alloc(b, (void **)&p->pkey, &p->pkeysz);
238242 io_read_str(b, &p->descr);
239 io_read_buf(b, &p->urisz, sizeof(size_t));
243 io_read_buf(b, &p->urisz, sizeof(p->urisz));
240244 assert(p->pkeysz > 0);
241245 assert(p->descr);
242246 assert(p->urisz > 0);
0 /* $OpenBSD: validate.c,v 1.20 2021/10/29 09:27:36 claudio Exp $ */
0 /* $OpenBSD: validate.c,v 1.22 2021/11/04 11:32:55 claudio Exp $ */
11 /*
22 * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
33 *
2828 #include <unistd.h>
2929
3030 #include "extern.h"
31
32 static void
33 tracewarn(const struct auth *a)
34 {
35
36 for (; a != NULL; a = a->parent)
37 warnx(" ...inheriting from: %s", a->fn);
38 }
3931
4032 /*
4133 * Walk up the chain of certificates trying to match our AS number to
175167 continue;
176168 warnx("%s: RFC 6487: uncovered AS: "
177169 "%u--%u", fn, min, max);
178 tracewarn(a);
179170 return 0;
180171 }
181172
203194 "(inherit)", fn);
204195 break;
205196 }
206 tracewarn(a);
207197 return 0;
208198 }
209199
226216 if (a == NULL)
227217 return 0;
228218
229 if ((roa->tal = strdup(a->tal)) == NULL)
230 err(1, NULL);
219 roa->talid = a->cert->talid;
231220
232221 for (i = 0; i < roa->ipsz; i++) {
233222 if (valid_ip(a, roa->ips[i].afi, roa->ips[i].min,
237226 roa->ips[i].afi, buf, sizeof(buf));
238227 warnx("%s: RFC 6482: uncovered IP: "
239228 "%s", fn, buf);
240 tracewarn(a);
241229 return 0;
242230 }
243231
0 /* $OpenBSD: version.h,v 1.6 2021/10/29 10:36:55 claudio Exp $ */
0 /* $OpenBSD: version.h,v 1.7 2021/11/07 20:57:27 benno Exp $ */
11
2 #define RPKI_VERSION "7.4"
2 #define RPKI_VERSION "7.5"