From: claudio Date: Thu, 15 Aug 2024 09:13:13 +0000 (+0000) Subject: Add filtered support to bgplgd. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fac3be8e1adc5391f33843d46be8d8dbe4beac5d;p=openbsd Add filtered support to bgplgd. OK tb@ --- diff --git a/usr.sbin/bgplgd/bgplgd.8 b/usr.sbin/bgplgd/bgplgd.8 index 2b62b77853f..fb3d0db1280 100644 --- a/usr.sbin/bgplgd/bgplgd.8 +++ b/usr.sbin/bgplgd/bgplgd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgplgd.8,v 1.8 2024/01/26 18:11:49 job Exp $ +.\" $OpenBSD: bgplgd.8,v 1.9 2024/08/15 09:13:13 claudio Exp $ .\" .\" Copyright (c) 2021 Claudio Jeker .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 26 2024 $ +.Dd $Mdocdate: August 15 2024 $ .Dt BGPLGD 8 .Os .Sh NAME @@ -148,6 +148,8 @@ Show only prefixes that match the specified ASPA Validation State. Show only selected routes. .It Cm error Ns = Ns 1 Show only prefixes which are marked invalid and were treated as withdrawn. +.It Cm filtered Ns = Ns 1 +Show only prefixes which are marked filtered by the input filter. .It Cm invalid Ns = Ns 1 Show only prefixes which are not eligible. .It Cm leaked Ns = Ns 1 diff --git a/usr.sbin/bgplgd/bgplgd.h b/usr.sbin/bgplgd/bgplgd.h index 1a660378683..4cf62b73af4 100644 --- a/usr.sbin/bgplgd/bgplgd.h +++ b/usr.sbin/bgplgd/bgplgd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgplgd.h,v 1.3 2023/03/13 17:31:28 claudio Exp $ */ +/* $OpenBSD: bgplgd.h,v 1.4 2024/08/15 09:13:13 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker * @@ -32,7 +32,8 @@ #define QS_AVS 15 #define QS_INVALID 16 #define QS_LEAKED 17 -#define QS_MAX 18 +#define QS_FILTERED 18 +#define QS_MAX 19 /* too add: empty-as, in, out, peer-as, source-as, transit-as */ @@ -44,7 +45,7 @@ (1 << QS_AF) | (1 << QS_RIB) | (1 << QS_OVS) | \ (1 << QS_BEST) | (1 << QS_ALL) | (1 << QS_SHORTER) | \ (1 << QS_ERROR) | (1 << QS_AVS) | (1 << QS_INVALID) | \ - (1 << QS_LEAKED)) + (1 << QS_LEAKED) | (1 << QS_FILTERED)) struct cmd; struct lg_ctx { diff --git a/usr.sbin/bgplgd/qs.c b/usr.sbin/bgplgd/qs.c index 0aa10f6d4f2..ee865810fbb 100644 --- a/usr.sbin/bgplgd/qs.c +++ b/usr.sbin/bgplgd/qs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qs.c,v 1.5 2023/05/09 14:35:45 claudio Exp $ */ +/* $OpenBSD: qs.c,v 1.6 2024/08/15 09:13:13 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker * @@ -57,6 +57,7 @@ const struct qs { { QS_AVS, "avs", AVS }, { QS_INVALID, "invalid", ONE }, { QS_LEAKED, "leaked", ONE }, + { QS_FILTERED, "filtered", ONE }, { 0, NULL } }; @@ -382,13 +383,16 @@ qs_argv(char **argv, size_t argc, size_t len, struct lg_ctx *ctx, int barenbr) if (argc < len) argv[argc++] = ctx->qs_args[QS_AVS].string; } - /* BEST, ERROR, INVALID and LEAKED are exclusive */ + /* BEST, ERROR, FILTERED, INVALID and LEAKED are exclusive */ if (ctx->qs_args[QS_BEST].one) { if (argc < len) argv[argc++] = "best"; } else if (ctx->qs_args[QS_ERROR].one) { if (argc < len) argv[argc++] = "error"; + } else if (ctx->qs_args[QS_FILTERED].one) { + if (argc < len) + argv[argc++] = "filtered"; } else if (ctx->qs_args[QS_INVALID].one) { if (argc < len) argv[argc++] = "disqualified";