From 20c31060e07aa5f13a04ecf8d9b2a95b7bd05e89 Mon Sep 17 00:00:00 2001 From: job Date: Tue, 3 Sep 2024 15:04:48 +0000 Subject: [PATCH] Also gate SPL statistics behind 'experimental' command line option This changes the JSON output, without -x some keys are missing from 'metadata' OK tb@ --- usr.sbin/rpki-client/main.c | 11 +++++++---- usr.sbin/rpki-client/output-json.c | 10 ++++++---- usr.sbin/rpki-client/output-ometric.c | 16 +++++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 7ff894915fa..88b30455667 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.264 2024/08/20 13:31:49 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.265 2024/09/03 15:04:48 job Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1489,9 +1489,12 @@ main(int argc, char *argv[]) "invalid)\n", stats.repo_tal_stats.aspas, stats.repo_tal_stats.aspas_fail, stats.repo_tal_stats.aspas_invalid); - printf("Signed Prefix Lists: %u (%u failed parse, %u invalid)\n", - stats.repo_tal_stats.spls, stats.repo_tal_stats.spls_fail, - stats.repo_tal_stats.spls_invalid); + if (experimental) { + printf("Signed Prefix Lists: %u " + "(%u failed parse, %u invalid)\n", + stats.repo_tal_stats.spls, stats.repo_tal_stats.spls_fail, + stats.repo_tal_stats.spls_invalid); + } printf("BGPsec Router Certificates: %u\n", stats.repo_tal_stats.brks); printf("Certificates: %u (%u invalid)\n", stats.repo_tal_stats.certs, stats.repo_tal_stats.certs_fail); diff --git a/usr.sbin/rpki-client/output-json.c b/usr.sbin/rpki-client/output-json.c index bc0695ef89f..d69d95f4c03 100644 --- a/usr.sbin/rpki-client/output-json.c +++ b/usr.sbin/rpki-client/output-json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output-json.c,v 1.49 2024/04/21 19:27:44 claudio Exp $ */ +/* $OpenBSD: output-json.c,v 1.50 2024/09/03 15:04:48 job Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * @@ -47,9 +47,11 @@ outputheader_json(struct stats *st) json_do_int("roas", st->repo_tal_stats.roas); json_do_int("failedroas", st->repo_tal_stats.roas_fail); json_do_int("invalidroas", st->repo_tal_stats.roas_invalid); - json_do_int("spls", st->repo_tal_stats.spls); - json_do_int("failedspls", st->repo_tal_stats.spls_fail); - json_do_int("invalidspls", st->repo_tal_stats.spls_invalid); + if (experimental) { + json_do_int("spls", st->repo_tal_stats.spls); + json_do_int("failedspls", st->repo_tal_stats.spls_fail); + json_do_int("invalidspls", st->repo_tal_stats.spls_invalid); + } json_do_int("aspas", st->repo_tal_stats.aspas); json_do_int("failedaspas", st->repo_tal_stats.aspas_fail); json_do_int("invalidaspas", st->repo_tal_stats.aspas_invalid); diff --git a/usr.sbin/rpki-client/output-ometric.c b/usr.sbin/rpki-client/output-ometric.c index a2795f12578..8eb6736898f 100644 --- a/usr.sbin/rpki-client/output-ometric.c +++ b/usr.sbin/rpki-client/output-ometric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output-ometric.c,v 1.10 2024/04/08 14:02:13 tb Exp $ */ +/* $OpenBSD: output-ometric.c,v 1.11 2024/09/03 15:04:48 job Exp $ */ /* * Copyright (c) 2022 Claudio Jeker * @@ -85,12 +85,14 @@ set_common_stats(const struct repotalstats *in, struct ometric *metric, ometric_set_int_with_labels(metric, in->vaps_overflowed, OKV("type", "state"), OKV("vap overflowed"), ol); - ometric_set_int_with_labels(metric, in->spls, - OKV("type", "state"), OKV("spl", "valid"), ol); - ometric_set_int_with_labels(metric, in->spls_fail, - OKV("type", "state"), OKV("spl", "failed parse"), ol); - ometric_set_int_with_labels(metric, in->spls_invalid, - OKV("type", "state"), OKV("spl", "invalid"), ol); + if (experimental) { + ometric_set_int_with_labels(metric, in->spls, + OKV("type", "state"), OKV("spl", "valid"), ol); + ometric_set_int_with_labels(metric, in->spls_fail, + OKV("type", "state"), OKV("spl", "failed parse"), ol); + ometric_set_int_with_labels(metric, in->spls_invalid, + OKV("type", "state"), OKV("spl", "invalid"), ol); + } ometric_set_int_with_labels(metric, in->vsps, OKV("type", "state"), OKV("vsp", "total"), ol); -- 2.20.1