summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJob Snijders <job@cvs.openbsd.org>2023-02-03 10:10:37 +0000
committerJob Snijders <job@cvs.openbsd.org>2023-02-03 10:10:37 +0000
commit2f69f9ca37cf8dcf2eb01af3467e7878102863dc (patch)
treefafe3bae58fb15e3ea14aef66056655ca4c9c053 /usr.sbin
parentc26308cd25bb116e8de4f2cfe74e630652584932 (diff)
Add ASPA support to bgpctl FastCGI server
OK tb@ claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgplgd/bgplgd.88
-rw-r--r--usr.sbin/bgplgd/bgplgd.h7
-rw-r--r--usr.sbin/bgplgd/qs.c27
3 files changed, 35 insertions, 7 deletions
diff --git a/usr.sbin/bgplgd/bgplgd.8 b/usr.sbin/bgplgd/bgplgd.8
index 5b493045479..0d954ff96a4 100644
--- a/usr.sbin/bgplgd/bgplgd.8
+++ b/usr.sbin/bgplgd/bgplgd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgplgd.8,v 1.4 2022/10/17 15:42:19 claudio Exp $
+.\" $OpenBSD: bgplgd.8,v 1.5 2023/02/03 10:10:36 job Exp $
.\"
.\" Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
.\"
@@ -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: October 17 2022 $
+.Dd $Mdocdate: February 3 2023 $
.Dt BGPLGD 8
.Os
.Sh NAME
@@ -136,6 +136,10 @@ Show only entries from the RIB with name
.Pq Ic valid | not-found | invalid
.Xc
Show only prefixes that match the specified Origin Validation State.
+.Ic avs Ns = Ns
+.Pq Ic valid | invalid | unknown
+.Xc
+Show only prefixes that match the specified ASPA Validation State.
.It Cm best Ns = Ns 1
Show only selected routes.
.It Cm error Ns = Ns 1
diff --git a/usr.sbin/bgplgd/bgplgd.h b/usr.sbin/bgplgd/bgplgd.h
index 3856b8a2f01..4b3726151b4 100644
--- a/usr.sbin/bgplgd/bgplgd.h
+++ b/usr.sbin/bgplgd/bgplgd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgplgd.h,v 1.1 2022/06/28 16:11:30 claudio Exp $ */
+/* $OpenBSD: bgplgd.h,v 1.2 2023/02/03 10:10:36 job Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
*
@@ -29,7 +29,8 @@
#define QS_ALL 12
#define QS_SHORTER 13
#define QS_ERROR 14
-#define QS_MAX 15
+#define QS_AVS 15
+#define QS_MAX 16
/* too add: empty-as, in, out, peer-as, source-as, transit-as */
@@ -40,7 +41,7 @@
(1 << QS_EXTCOMMUNITY) | (1 << QS_LARGECOMMUNITY) | \
(1 << QS_AF) | (1 << QS_RIB) | (1 << QS_OVS) | \
(1 << QS_BEST) | (1 << QS_ALL) | (1 << QS_SHORTER) | \
- (1 << QS_ERROR))
+ (1 << QS_ERROR) | (1 << QS_AVS))
struct cmd;
struct lg_ctx {
diff --git a/usr.sbin/bgplgd/qs.c b/usr.sbin/bgplgd/qs.c
index 2356a889653..98d2664eef9 100644
--- a/usr.sbin/bgplgd/qs.c
+++ b/usr.sbin/bgplgd/qs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qs.c,v 1.2 2022/08/25 16:49:18 claudio Exp $ */
+/* $OpenBSD: qs.c,v 1.3 2023/02/03 10:10:36 job Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
*
@@ -31,7 +31,8 @@ enum qs_type {
PREFIX,
NUMBER,
FAMILY,
- OVS
+ OVS,
+ AVS,
};
const struct qs {
@@ -53,6 +54,7 @@ const struct qs {
{ QS_ALL, "all", ONE },
{ QS_SHORTER, "or-shorter", ONE },
{ QS_ERROR, "error", ONE },
+ { QS_AVS, "avs", AVS },
{ 0, NULL }
};
@@ -246,7 +248,22 @@ parse_value(struct lg_ctx *ctx, unsigned int qs, enum qs_type type, char *val)
return 400;
}
break;
+ case AVS:
+ if (strcmp("unknown", val) == 0 ||
+ strcmp("valid", val) == 0 ||
+ strcmp("invalid", val) == 0) {
+ ctx->qs_args[qs].string = strdup(val);
+ if (ctx->qs_args[qs].string == NULL) {
+ lwarn("parse_value");
+ return 500;
+ }
+ } else {
+ lwarnx("%s: bad AVS value %s", qs2str(qs), val);
+ return 400;
+ }
+ break;
}
+
return 0;
}
@@ -357,6 +374,12 @@ 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_OVS].string;
}
+ if (ctx->qs_set & (1 << QS_AVS)) {
+ if (argc < len)
+ argv[argc++] = "avs";
+ if (argc < len)
+ argv[argc++] = ctx->qs_args[QS_AVS].string;
+ }
/* BEST and ERROR are exclusive */
if (ctx->qs_args[QS_BEST].one) {
if (argc < len)