From: claudio Date: Mon, 13 Mar 2023 16:59:22 +0000 (+0000) Subject: Extend bgpctl show rib with two new options: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=12abdda6e47470b4e10a15c143c1e02bae163baa;p=openbsd Extend bgpctl show rib with two new options: - invalid: show only routes that are not valid - leaked: show only routes where a route leak was detected OK tb@ --- diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8 index 14df5974486..ed570515f07 100644 --- a/usr.sbin/bgpctl/bgpctl.8 +++ b/usr.sbin/bgpctl/bgpctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpctl.8,v 1.105 2023/03/02 17:09:52 jmc Exp $ +.\" $OpenBSD: bgpctl.8,v 1.106 2023/03/13 16:59:22 claudio Exp $ .\" .\" Copyright (c) 2003 Henning Brauer .\" @@ -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: March 2 2023 $ +.Dd $Mdocdate: March 13 2023 $ .Dt BGPCTL 8 .Os .Sh NAME @@ -387,17 +387,10 @@ are defined: .It Cm best Alias for .Ic selected . -.It Cm error -Show only prefixes which are marked invalid and were treated as withdrawn. -.It Cm selected -Show only selected routes. -.It Cm ssv -Show each RIB entry as a single line, with fields separated by semicolons. -Only works if -.Cm detail -is specified. .It Cm detail Show more detailed output for matching routes. +.It Cm error +Show only prefixes which are marked invalid and were treated as withdrawn. .It Ar family Limit the output to the given address family. .It Cm in @@ -405,11 +398,22 @@ Show routes from the unfiltered Adj-RIB-In. The .Cm neighbor needs to be specified. +.It Cm invalid +Show only routes which are not eligible. +.It Cm leaked +Show only routes where a route leak was detected. .It Cm out Show the filtered routes sent to a neighbor. The .Cm neighbor needs to be specified. +.It Cm selected +Show only selected routes. +.It Cm ssv +Show each RIB entry as a single line, with fields separated by semicolons. +Only works if +.Cm detail +is specified. .El .Pp Options are silently ignored when used together with diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index e8de3bec594..6f2a79f91b8 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.289 2023/01/24 11:29:34 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.290 2023/03/13 16:59:22 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -711,7 +711,7 @@ fmt_flags(uint32_t flags, int sum) if (sum) { if (flags & F_PREF_INVALID) *p++ = 'E'; - if (flags & F_PREF_OTC_LOOP) + if (flags & F_PREF_OTC_LEAK) *p++ = 'L'; if (flags & F_PREF_ANNOUNCE) *p++ = 'A'; @@ -737,8 +737,8 @@ fmt_flags(uint32_t flags, int sum) if (flags & F_PREF_INVALID) strlcat(buf, ", invalid", sizeof(buf)); - if (flags & F_PREF_OTC_LOOP) - strlcat(buf, ", otc loop", sizeof(buf)); + if (flags & F_PREF_OTC_LEAK) + strlcat(buf, ", otc leak", sizeof(buf)); if (flags & F_PREF_STALE) strlcat(buf, ", stale", sizeof(buf)); if (flags & F_PREF_ELIGIBLE) diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index 6053cfd8547..65aac80f00e 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.121 2023/02/02 19:23:01 job Exp $ */ +/* $OpenBSD: parser.c,v 1.122 2023/03/13 16:59:22 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -178,9 +178,11 @@ static const struct token t_show_rib[] = { { FLAG, "selected", F_CTL_BEST, t_show_rib}, { FLAG, "detail", F_CTL_DETAIL, t_show_rib}, { FLAG, "error", F_CTL_INVALID, t_show_rib}, - { FLAG, "ssv" , F_CTL_SSV, t_show_rib}, + { FLAG, "invalid", F_CTL_INELIGIBLE, t_show_rib}, + { FLAG, "leaked", F_CTL_LEAKED, t_show_rib}, { FLAG, "in", F_CTL_ADJ_IN, t_show_rib}, { FLAG, "out", F_CTL_ADJ_OUT, t_show_rib}, + { FLAG, "ssv" , F_CTL_SSV, t_show_rib}, { KEYWORD, "neighbor", NONE, t_show_rib_neigh}, { KEYWORD, "avs", NONE, t_show_avs}, { KEYWORD, "ovs", NONE, t_show_ovs},