mirror of
https://github.com/openbsd/src.git
synced 2024-12-21 23:18:00 -08:00
Add /rib/in and /rib/out as endpoints to query the Adj-RIB-In and Adj-RIB-Out
respectively. Also fix the rib query parameter to properly work. bgpctl calls this table. OK sthen@
This commit is contained in:
parent
71e7e71144
commit
5ffbcedbb1
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: bgplgd.8,v 1.11 2024/09/19 08:55:22 claudio Exp $
|
||||
.\" $OpenBSD: bgplgd.8,v 1.12 2024/12/03 10:38:06 claudio 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: September 19 2024 $
|
||||
.Dd $Mdocdate: December 3 2024 $
|
||||
.Dt BGPLGD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -88,7 +88,8 @@ Show the version and exit.
|
||||
.Nm
|
||||
provides the following API endpoints.
|
||||
Unless further specified the endpoints do not take any parameters:
|
||||
.Bl -tag -width Ds
|
||||
.Pp
|
||||
.Bl -tag -width "/interfaces" -compact
|
||||
.It Pa /interfaces
|
||||
Show the interface states.
|
||||
.It Pa /memory
|
||||
@ -110,7 +111,17 @@ Show only entries from the specified peer group.
|
||||
.It Pa /nexthops
|
||||
Show the list of BGP nexthops and the result of their validity check.
|
||||
.It Pa /rib
|
||||
.It Pa /rib/in
|
||||
.It Pa /rib/out
|
||||
Show routes from the bgpd(8) Routing Information Base.
|
||||
For
|
||||
.Pa /rib/in
|
||||
the
|
||||
.Ar Adj-RIB-In
|
||||
will be queried and for
|
||||
.Pa /rib/out
|
||||
the
|
||||
.Ar Adj-RIB-out .
|
||||
The following parameters can be used to filter the output:
|
||||
.Pp
|
||||
.Bl -tag -width "neighbor=peer" -compact
|
||||
@ -134,6 +145,9 @@ Show only entries that match the specified address family.
|
||||
.It Cm rib Ns = Ns Ar name
|
||||
Show only entries from the RIB with name
|
||||
.Ar name .
|
||||
Can only be used with the
|
||||
.Pa /rib
|
||||
endpoint.
|
||||
.It Xo
|
||||
.Ic ovs Ns = Ns
|
||||
.Pq Ic valid | not-found | invalid
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bgplgd.c,v 1.3 2022/10/17 15:42:19 claudio Exp $ */
|
||||
/* $OpenBSD: bgplgd.c,v 1.4 2024/12/03 10:38:06 claudio Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
*
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
#include "bgplgd.h"
|
||||
|
||||
#define NCMDARGS 4
|
||||
#define NCMDARGS 5
|
||||
#define OMETRIC_TYPE \
|
||||
"application/openmetrics-text; version=1.0.0; charset=utf-8"
|
||||
|
||||
@ -41,6 +41,8 @@ const struct cmd {
|
||||
{ "/neighbors", { "show", "neighbor", NULL }, QS_MASK_NEIGHBOR, 1 },
|
||||
{ "/nexthops", { "show", "nexthop", NULL }, 0 },
|
||||
{ "/rib", { "show", "rib", "detail", NULL }, QS_MASK_RIB },
|
||||
{ "/rib/in", { "show", "rib", "in", "detail", NULL }, QS_MASK_ADJRIB },
|
||||
{ "/rib/out", { "show", "rib", "out", "detail", NULL }, QS_MASK_ADJRIB },
|
||||
{ "/rtr", { "show", "rtr", NULL }, 0 },
|
||||
{ "/sets", { "show", "sets", NULL }, 0 },
|
||||
{ "/summary", { "show", NULL }, 0 },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bgplgd.h,v 1.4 2024/08/15 09:13:13 claudio Exp $ */
|
||||
/* $OpenBSD: bgplgd.h,v 1.5 2024/12/03 10:38:06 claudio Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
*
|
||||
@ -35,17 +35,19 @@
|
||||
#define QS_FILTERED 18
|
||||
#define QS_MAX 19
|
||||
|
||||
/* too add: empty-as, in, out, peer-as, source-as, transit-as */
|
||||
/* too add: empty-as, peer-as, source-as, transit-as */
|
||||
|
||||
#define QS_MASK_NEIGHBOR ((1 << QS_NEIGHBOR) | (1 << QS_GROUP))
|
||||
#define QS_MASK_RIB \
|
||||
#define QS_MASK_ADJRIB \
|
||||
((1 << QS_NEIGHBOR) | (1 << QS_GROUP) | (1 << QS_AS) | \
|
||||
(1 << QS_PREFIX) | (1 << QS_COMMUNITY) | \
|
||||
(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_AVS) | (1 << QS_INVALID) | \
|
||||
(1 << QS_LEAKED) | (1 << QS_FILTERED))
|
||||
(1 << QS_AF) | (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_FILTERED))
|
||||
|
||||
#define QS_MASK_RIB (QS_MASK_ADJRIB | (1 << QS_RIB))
|
||||
|
||||
struct cmd;
|
||||
struct lg_ctx {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: qs.c,v 1.6 2024/08/15 09:13:13 claudio Exp $ */
|
||||
/* $OpenBSD: qs.c,v 1.7 2024/12/03 10:38:06 claudio Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
*
|
||||
@ -367,7 +367,7 @@ qs_argv(char **argv, size_t argc, size_t len, struct lg_ctx *ctx, int barenbr)
|
||||
}
|
||||
if (ctx->qs_set & (1 << QS_RIB)) {
|
||||
if (argc < len)
|
||||
argv[argc++] = "rib";
|
||||
argv[argc++] = "table";
|
||||
if (argc < len)
|
||||
argv[argc++] = ctx->qs_args[QS_RIB].string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user