rpki-client: fix vap_pas stats
authortb <tb@openbsd.org>
Thu, 29 Jun 2023 14:33:35 +0000 (14:33 +0000)
committertb <tb@openbsd.org>
Thu, 29 Jun 2023 14:33:35 +0000 (14:33 +0000)
A small mistake in a diff broke the counters. Make them AFI agnostic and
adjust ometric output.

guidance & ok claudio

usr.sbin/rpki-client/aspa.c
usr.sbin/rpki-client/extern.h
usr.sbin/rpki-client/main.c
usr.sbin/rpki-client/output-ometric.c
usr.sbin/rpki-client/repo.c

index 35c8ffa..ead8cc9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: aspa.c,v 1.20 2023/06/28 17:24:20 tb Exp $ */
+/*     $OpenBSD: aspa.c,v 1.21 2023/06/29 14:33:35 tb Exp $ */
 /*
  * Copyright (c) 2022 Job Snijders <job@fastly.com>
  * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -369,7 +369,7 @@ aspa_insert_vaps(struct vap_tree *tree, struct aspa *aspa, struct repo *rp)
                    aspa->providers[i] < v->providers[j]) {
                        /* merge provider from aspa into v */
                        repo_stat_inc(rp, v->talid, RTYPE_ASPA,
-                           STYPE_BOTH + aspa->providers[i]);
+                           STYPE_PROVIDERS);
                        insert_vap(v, j, &aspa->providers[i]);
                        i++;
                } else if (aspa->providers[i] == v->providers[j])
index d32c131..e41baff 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: extern.h,v 1.187 2023/06/29 10:28:25 tb Exp $ */
+/*     $OpenBSD: extern.h,v 1.188 2023/06/29 14:33:35 tb Exp $ */
 /*
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -530,9 +530,7 @@ enum stype {
        STYPE_TOTAL,
        STYPE_UNIQUE,
        STYPE_DEC_UNIQUE,
-       STYPE_BOTH,
-       STYPE_ONLY_IPV4,
-       STYPE_ONLY_IPV6,
+       STYPE_PROVIDERS,
 };
 
 struct repo;
@@ -562,8 +560,6 @@ struct repotalstats {
        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 */
 };
index 771b8cf..e708666 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: main.c,v 1.243 2023/06/23 11:36:24 claudio Exp $ */
+/*     $OpenBSD: main.c,v 1.244 2023/06/29 14:33:35 tb Exp $ */
 /*
  * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -750,8 +750,6 @@ sum_stats(const struct repo *rp, const struct repotalstats *in, void *arg)
        out->vaps += in->vaps;
        out->vaps_uniqs += in->vaps_uniqs;
        out->vaps_pas += in->vaps_pas;
-       out->vaps_pas4 += in->vaps_pas4;
-       out->vaps_pas6 += in->vaps_pas6;
 }
 
 static void
index 53ab900..350cf02 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: output-ometric.c,v 1.4 2023/06/05 14:19:13 claudio Exp $ */
+/*     $OpenBSD: output-ometric.c,v 1.5 2023/06/29 14:33:35 tb Exp $ */
 /*
  * Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
  *
@@ -83,11 +83,7 @@ set_common_stats(const struct repotalstats *in, struct ometric *metric,
        ometric_set_int_with_labels(metric, in->vaps_uniqs,
            OKV("type", "state"), OKV("vap", "unique"), ol);
        ometric_set_int_with_labels(metric, in->vaps_pas,
-           OKV("type", "state"), OKV("vap providers", "both"), ol);
-       ometric_set_int_with_labels(metric, in->vaps_pas4,
-           OKV("type", "state"), OKV("vap providers", "IPv4 only"), ol);
-       ometric_set_int_with_labels(metric, in->vaps_pas6,
-           OKV("type", "state"), OKV("vap providers", "IPv6 only"), ol);
+           OKV("type", "state"), OKV("vap providers", "total"), ol);
 }
 
 static void
index e3d684f..1a1bb49 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: repo.c,v 1.49 2023/06/29 14:09:42 claudio Exp $ */
+/*     $OpenBSD: repo.c,v 1.50 2023/06/29 14:33:35 tb Exp $ */
 /*
  * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1473,15 +1473,9 @@ repo_stat_inc(struct repo *rp, int talid, enum rtype type, enum stype subtype)
                case STYPE_DEC_UNIQUE:
                        rp->stats[talid].vaps_uniqs--;
                        break;
-               case STYPE_BOTH:
+               case STYPE_PROVIDERS:
                        rp->stats[talid].vaps_pas++;
                        break;
-               case STYPE_ONLY_IPV4:
-                       rp->stats[talid].vaps_pas4++;
-                       break;
-               case STYPE_ONLY_IPV6:
-                       rp->stats[talid].vaps_pas6++;
-                       break;
                default:
                        break;
                }