From: Claudio Jeker Subject: add filtered support to bgplgd(8) To: tech@openbsd.org Date: Thu, 15 Aug 2024 10:58:29 +0200 This adds filtered support to bgplgd(8). -- :wq Claudio Index: bgplgd.8 =================================================================== RCS file: /cvs/src/usr.sbin/bgplgd/bgplgd.8,v diff -u -p -r1.8 bgplgd.8 --- bgplgd.8 26 Jan 2024 18:11:49 -0000 1.8 +++ bgplgd.8 15 Aug 2024 08:56:12 -0000 @@ -148,6 +148,8 @@ Show only prefixes that match the specif 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 Index: bgplgd.h =================================================================== RCS file: /cvs/src/usr.sbin/bgplgd/bgplgd.h,v diff -u -p -r1.3 bgplgd.h --- bgplgd.h 13 Mar 2023 17:31:28 -0000 1.3 +++ bgplgd.h 15 Aug 2024 08:38:24 -0000 @@ -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 { Index: qs.c =================================================================== RCS file: /cvs/src/usr.sbin/bgplgd/qs.c,v diff -u -p -r1.5 qs.c --- qs.c 9 May 2023 14:35:45 -0000 1.5 +++ qs.c 15 Aug 2024 08:38:24 -0000 @@ -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 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";