-/* $OpenBSD: aspa.c,v 1.29 2024/04/05 16:05:15 job Exp $ */
+/* $OpenBSD: aspa.c,v 1.30 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2022 Job Snijders <job@fastly.com>
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
v->expires = aspa->expires;
if ((found = RB_INSERT(vap_tree, tree, v)) != NULL) {
- if (found->invalid) {
+ if (found->overflowed) {
free(v);
return;
}
} else
repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_UNIQUE);
- if (v->providersz >= MAX_ASPA_PROVIDERS) {
- v->invalid = 1;
- repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_INVALID);
- warnx("%s: too many providers for ASPA Customer ASID "
- "(more than %d)", fn, MAX_ASPA_PROVIDERS);
- return;
- }
-
repo_stat_inc(rp, aspa->talid, RTYPE_ASPA, STYPE_TOTAL);
v->providers = reallocarray(v->providers,
if (j < v->providersz)
j++;
}
+
+ if (v->providersz >= MAX_ASPA_PROVIDERS) {
+ v->overflowed = 1;
+ free(v->providers);
+ v->providers = NULL;
+ v->providersz = 0;
+ repo_stat_inc(rp, v->talid, RTYPE_ASPA, STYPE_OVERFLOW);
+ warnx("%s: too many providers for ASPA Customer ASID %u "
+ "(more than %d)", fn, v->custasid, MAX_ASPA_PROVIDERS);
+ return;
+ }
}
static inline int
-/* $OpenBSD: extern.h,v 1.214 2024/04/05 16:05:15 job Exp $ */
+/* $OpenBSD: extern.h,v 1.215 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
time_t expires;
int talid;
unsigned int repoid;
- int invalid;
+ int overflowed;
};
/*
STYPE_UNIQUE,
STYPE_DEC_UNIQUE,
STYPE_PROVIDERS,
+ STYPE_OVERFLOW,
};
struct repo;
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_overflowed; /* VAPs with too many providers */
uint32_t vrps; /* total number of Validated ROA Payloads */
uint32_t vrps_uniqs; /* number of unique vrps */
uint32_t spls; /* signed prefix list */
-/* $OpenBSD: main.c,v 1.256 2024/04/05 16:05:15 job Exp $ */
+/* $OpenBSD: main.c,v 1.257 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
out->vaps += in->vaps;
out->vaps_uniqs += in->vaps_uniqs;
out->vaps_pas += in->vaps_pas;
+ out->vaps_overflowed += in->vaps_overflowed;
out->spls += in->spls;
out->spls_fail += in->spls_fail;
out->spls_invalid += in->spls_invalid;
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,
- stats.repo_tal_stats.vaps_uniqs);
+ printf("VAP Entries: %u (%u unique, %u overflowed)\n",
+ stats.repo_tal_stats.vaps, stats.repo_tal_stats.vaps_uniqs,
+ stats.repo_tal_stats.vaps_overflowed);
printf("VSP Entries: %u (%u unique)\n", stats.repo_tal_stats.vsps,
stats.repo_tal_stats.vsps_uniqs);
-/* $OpenBSD: output-bgpd.c,v 1.30 2024/04/05 16:05:15 job Exp $ */
+/* $OpenBSD: output-bgpd.c,v 1.31 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
if (fprintf(out, "\naspa-set {\n") < 0)
return -1;
RB_FOREACH(vap, vap_tree, vaps) {
- if (vap->invalid)
+ if (vap->overflowed)
continue;
if (fprintf(out, "\tcustomer-as %d expires %lld "
"provider-as { ", vap->custasid,
-/* $OpenBSD: output-json.c,v 1.47 2024/04/05 16:05:15 job Exp $ */
+/* $OpenBSD: output-json.c,v 1.48 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
*
{
size_t i;
- if (v->invalid)
+ if (v->overflowed)
return;
json_do_object("aspa", 1);
-/* $OpenBSD: output-ometric.c,v 1.9 2024/02/26 15:40:33 job Exp $ */
+/* $OpenBSD: output-ometric.c,v 1.10 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
*
OKV("type", "state"), OKV("vap", "unique"), ol);
ometric_set_int_with_labels(metric, in->vaps_pas,
OKV("type", "state"), OKV("vap providers", "total"), ol);
+ 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);
-/* $OpenBSD: repo.c,v 1.55 2024/03/22 03:38:12 job Exp $ */
+/* $OpenBSD: repo.c,v 1.56 2024/04/08 14:02:13 tb Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
case STYPE_PROVIDERS:
rp->stats[talid].vaps_pas++;
break;
+ case STYPE_OVERFLOW:
+ rp->stats[talid].vaps_overflowed++;
+ break;
default:
break;
}