summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2023-04-21 12:04:08 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2023-09-18 15:05:54 +0200
commit7e0d9ff8ba984966689562553afe2734b04c8539 (patch)
tree58bfb62539c08fc8a0e159d1827c49b300f6c4f6 /bgpd/bgp_route.c
parentbgpd: do not display vty output headers for link-state prefixes (diff)
downloadfrr-7e0d9ff8ba984966689562553afe2734b04c8539.tar.xz
frr-7e0d9ff8ba984966689562553afe2734b04c8539.zip
bgpd: display link-state prefixes detail
BGP link-state prefixes are displayed in the form of NLRI-TYPE / Prefix-Length. > r2# show bgp all > > For address family: Link State > BGP table version is 8, local router ID is 192.0.2.2, vrf id 0 > Default local pref 100, local AS 65002 > Network Next Hop Metric LocPrf Weight Path > *> Link/153 0 65001 i > *> IPv6-Prefix/77 0 65001 i > *> IPv4-Prefix/57 0 65001 i > *> Node/49 0 65001 i > *> Node/45 0 65001 i Add a lib prefix display hook in bgpd to display properly all the details. > r2# show bgp all > > For address family: Link State > BGP table version is 8, local router ID is 192.0.2.2, vrf id 0 > Default local pref 100, local AS 65002 > Network Next Hop Metric LocPrf Weight Path > *> Link OSPFv3 ID:0xffffffffffffffff {Local {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.11:2.2.2.2} Remote {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.10:1.1.1.1} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/153 > 0 65001 i > *> IPv6-Prefix OSPFv3 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10} MT:2 OSPF-Route-Type:1 IPv6:12:12::12:12/128}/77 > 0 65001 i > *> IPv4-Prefix OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1} IPv4:89.10.11.0/24}/57 > 0 65001 i > *> Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1}}/49 > 0 65001 i > *> Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10}}/45 > 0 65001 i Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 8bfb19a64..5364853d4 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -73,6 +73,7 @@
#include "bgpd/bgp_flowspec.h"
#include "bgpd/bgp_flowspec_util.h"
#include "bgpd/bgp_pbr.h"
+#include "bgpd/bgp_linkstate_tlv.h"
#include "bgpd/bgp_route_clippy.c"
@@ -8799,6 +8800,14 @@ static void route_vty_out_route(struct bgp_dest *dest, const struct prefix *p,
json ?
NLRI_STRING_FORMAT_JSON_SIMPLE :
NLRI_STRING_FORMAT_MIN, json);
+ } else if (p->family == AF_LINKSTATE) {
+ if (json) {
+ json_object_int_add(json, "version", dest->version);
+ bgp_linkstate_nlri_prefix_json(
+ json, p->u.prefix_linkstate.nlri_type,
+ p->u.prefix_linkstate.ptr, p->prefixlen);
+ } else
+ len = vty_out(vty, "%pFX", p);
} else {
if (!json)
len = vty_out(vty, "%pFX", p);
@@ -11036,6 +11045,10 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
" Time until Long-lived stale route deleted: %lu\n",
llgr_remaining);
}
+ if (safi == SAFI_LINKSTATE && json_paths)
+ bgp_linkstate_nlri_prefix_json(
+ json_path, bn->rn->p.u.prefix_linkstate.nlri_type,
+ bn->rn->p.u.prefix_linkstate.ptr, bn->rn->p.prefixlen);
/* Output some debug about internal state of the dest flags */
if (json_paths) {