diff options
Diffstat (limited to 'usr.sbin/rpki-client/extern.h')
-rw-r--r-- | usr.sbin/rpki-client/extern.h | 115 |
1 files changed, 75 insertions, 40 deletions
diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index 9143c457766..d6c3b93de79 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.163 2022/12/14 10:34:49 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.164 2022/12/15 12:02:29 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -376,6 +376,7 @@ struct vrp { RB_ENTRY(vrp) entry; struct ip_addr addr; int talid; /* covered by which TAL */ + unsigned int repoid; uint32_t asid; enum afi afi; unsigned char maxlength; @@ -493,6 +494,20 @@ struct entity { }; TAILQ_HEAD(entityq, entity); +enum stype { + STYPE_OK, + STYPE_FAIL, + STYPE_INVALID, + STYPE_STALE, + STYPE_BGPSEC, + STYPE_TOTAL, + STYPE_UNIQUE, + STYPE_DEC_UNIQUE, + STYPE_ONLY_IPV4, + STYPE_ONLY_IPV6, + STYPE_BOTH, +}; + struct repo; struct filepath; RB_HEAD(filepath_tree, filepath); @@ -501,41 +516,50 @@ RB_HEAD(filepath_tree, filepath); /* * Statistics collected during run-time. */ +struct repostats { + uint32_t certs; /* certificates */ + uint32_t certs_fail; /* invalid certificate */ + uint32_t mfts; /* total number of manifests */ + uint32_t mfts_fail; /* failing syntactic parse */ + uint32_t mfts_stale; /* stale manifests */ + uint32_t roas; /* route origin authorizations */ + uint32_t roas_fail; /* failing syntactic parse */ + uint32_t roas_invalid; /* invalid resources */ + uint32_t aspas; /* ASPA objects */ + uint32_t aspas_fail; /* ASPA objects failing syntactic parse */ + uint32_t aspas_invalid; /* ASPAs with invalid customerASID */ + uint32_t brks; /* number of BGPsec Router Key (BRK) certs */ + uint32_t crls; /* revocation lists */ + uint32_t gbrs; /* ghostbuster records */ + uint32_t taks; /* signed TAL objects */ + uint32_t vaps; /* total number of Validated ASPA Payloads */ + uint32_t vaps_uniqs; /* total number of unique VAPs */ + uint32_t vaps_pas; /* total number of providers */ + uint32_t vaps_pas4; /* total number of IPv4 only providers */ + uint32_t vaps_pas6; /* total number of IPv6 only providers */ + uint32_t vrps; /* total number of Validated ROA Payloads */ + uint32_t vrps_uniqs; /* number of unique vrps */ + struct timespec sync_time; /* time to sync repo */ +}; + struct stats { - size_t tals; /* total number of locators */ - size_t mfts; /* total number of manifests */ - size_t mfts_fail; /* failing syntactic parse */ - size_t mfts_stale; /* stale manifests */ - size_t certs; /* certificates */ - size_t certs_fail; /* invalid certificate */ - size_t roas; /* route origin authorizations */ - size_t roas_fail; /* failing syntactic parse */ - size_t roas_invalid; /* invalid resources */ - size_t repos; /* repositories */ - size_t rsync_repos; /* synced rsync repositories */ - size_t rsync_fails; /* failed rsync repositories */ - size_t http_repos; /* synced http repositories */ - size_t http_fails; /* failed http repositories */ - size_t rrdp_repos; /* synced rrdp repositories */ - size_t rrdp_fails; /* failed rrdp repositories */ - size_t crls; /* revocation lists */ - size_t gbrs; /* ghostbuster records */ - size_t taks; /* signed TAL objects */ - size_t aspas; /* ASPA objects */ - size_t aspas_fail; /* ASPA objects failing syntactic parse */ - size_t aspas_invalid; /* ASPAs with invalid customerASID */ - size_t vaps; /* total number of Validated ASPA Payloads */ - size_t vaps_uniqs; /* total number of unique VAPs */ - size_t vrps; /* total number of vrps */ - size_t uniqs; /* number of unique vrps */ - size_t del_files; /* number of files removed in cleanup */ - size_t extra_files; /* number of superfluous files */ - size_t del_dirs; /* number of directories removed in cleanup */ - size_t brks; /* number of BGPsec Router Key (BRK) certificates */ - size_t skiplistentries; /* number of skiplist entries */ - struct timespec elapsed_time; - struct timespec user_time; - struct timespec system_time; + uint32_t tals; /* total number of locators */ + uint32_t repos; /* repositories */ + uint32_t rsync_repos; /* synced rsync repositories */ + uint32_t rsync_fails; /* failed rsync repositories */ + uint32_t http_repos; /* synced http repositories */ + uint32_t http_fails; /* failed http repositories */ + uint32_t rrdp_repos; /* synced rrdp repositories */ + uint32_t rrdp_fails; /* failed rrdp repositories */ + uint32_t del_files; /* number of files removed in cleanup */ + uint32_t extra_files; /* number of superfluous files */ + uint32_t del_dirs; /* number of dirs removed in cleanup */ + uint32_t skiplistentries; /* number of skiplist entries */ + + struct repostats repo_stats; + struct timespec elapsed_time; + struct timespec user_time; + struct timespec system_time; }; struct ibuf; @@ -547,6 +571,7 @@ extern int filemode; extern const char *tals[]; extern const char *taldescs[]; extern unsigned int talrepocnt[]; +extern struct repostats talstats[]; extern int talsz; /* Routines for RPKI entities. */ @@ -580,8 +605,8 @@ void roa_free(struct roa *); struct roa *roa_parse(X509 **, const char *, const unsigned char *, size_t); struct roa *roa_read(struct ibuf *); -void roa_insert_vrps(struct vrp_tree *, struct roa *, size_t *, - size_t *); +void roa_insert_vrps(struct vrp_tree *, struct roa *, + struct repo *); void gbr_free(struct gbr *); struct gbr *gbr_parse(X509 **, const char *, const unsigned char *, @@ -602,8 +627,8 @@ struct tak *tak_read(struct ibuf *); void aspa_buffer(struct ibuf *, const struct aspa *); void aspa_free(struct aspa *); -void aspa_insert_vaps(struct vap_tree *, struct aspa *, size_t *, - size_t *); +void aspa_insert_vaps(struct vap_tree *, struct aspa *, + struct repo *); struct aspa *aspa_parse(X509 **, const char *, const unsigned char *, size_t); struct aspa *aspa_read(struct ibuf *); @@ -703,11 +728,19 @@ int rrdp_handle_file(unsigned int, enum publish_type, char *, char *repo_basedir(const struct repo *, int); unsigned int repo_id(const struct repo *); const char *repo_uri(const struct repo *); +void repo_fetch_uris(const struct repo *, const char **, + const char **); +int repo_synced(const struct repo *); +int repo_talid(const struct repo *); struct repo *ta_lookup(int, struct tal *); struct repo *repo_lookup(int, const char *, const char *); struct repo *repo_byid(unsigned int); int repo_queued(struct repo *, struct entity *); void repo_cleanup(struct filepath_tree *, int); +int repo_check_timeout(int); +void repo_stat_inc(struct repo *, enum rtype, enum stype); +void repo_stats_collect(void (*)(const struct repo *, + const struct repostats *, void *), void *); void repo_free(void); void rsync_finish(unsigned int, int); @@ -722,7 +755,6 @@ void rrdp_fetch(unsigned int, const char *, const char *, struct rrdp_session *); void rrdp_abort(unsigned int); void rrdp_http_done(unsigned int, enum http_result, const char *); -int repo_check_timeout(int); /* Logging (though really used for OpenSSL errors). */ @@ -797,6 +829,7 @@ extern int outformats; #define FORMAT_BIRD 0x02 #define FORMAT_CSV 0x04 #define FORMAT_JSON 0x08 +#define FORMAT_OMETRIC 0x10 int outputfiles(struct vrp_tree *v, struct brk_tree *b, struct vap_tree *, struct stats *); @@ -813,6 +846,8 @@ int output_csv(FILE *, struct vrp_tree *, struct brk_tree *, struct vap_tree *, struct stats *); int output_json(FILE *, struct vrp_tree *, struct brk_tree *, struct vap_tree *, struct stats *); +int output_ometric(FILE *, struct vrp_tree *, struct brk_tree *, + struct vap_tree *, struct stats *); void logx(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |