Skip to content

Commit

Permalink
bgpd: display link-state prefixes detail
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
louis-6wind committed Sep 18, 2023
1 parent 3098772 commit 7e0d9ff
Show file tree
Hide file tree
Showing 7 changed files with 753 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bgpd/bgp_linkstate.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State
* Copyright 2023 6WIND S.A.
*/

#include <zebra.h>

#include "prefix.h"
#include "lib_errors.h"

#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_errors.h"
#include "bgpd/bgp_linkstate.h"
#include "bgpd/bgp_linkstate_tlv.h"

void bgp_linkstate_init(void)
{
prefix_set_linkstate_display_hook(bgp_linkstate_nlri_prefix_display);
}
10 changes: 10 additions & 0 deletions bgpd/bgp_linkstate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP Link-State header
* Copyright 2023 6WIND S.A.
*/

#ifndef _FRR_BGP_LINKSTATE_H
#define _FRR_BGP_LINKSTATE_H

void bgp_linkstate_init(void);
#endif /* _FRR_BGP_LINKSTATE_H */
Loading

0 comments on commit 7e0d9ff

Please sign in to comment.