summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-04-08 22:55:00 +0300
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-04-11 21:42:18 +0300
commit9119ef3a8bd571a0892f4627808ef5ebc5290fe2 (patch)
treefd0b22f3b97066d6c603c1e5267c819316e6e931
parent8435eae7bb059df82a886ef03a30c5dd620a21df (diff)
bgpd: Show BGP table version which was used for a particular prefix
This is useful to go back in the past and check when was that prefix appeared, changed, etc. ``` exit1-debian-9# show ip bgp 172.16.16.1/32 BGP routing table entry for 172.16.16.1/32, version 6 Paths: (2 available, best #2, table default) Advertised to non peer-group peers: home-spine1.donatas.net(192.168.0.2) home-spine1.donatas.net(2a02:bbd::2) 65030 192.168.0.2 from home-spine1.donatas.net(2a02:bbd::2) (172.16.16.1) Origin incomplete, metric 0, valid, external Last update: Thu Apr 8 20:15:25 2021 65030 192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (172.16.16.1) Origin incomplete, metric 0, valid, external, best (Neighbor IP) Last update: Thu Apr 8 20:15:25 2021 exit1-debian-9# ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
-rw-r--r--bgpd/bgp_route.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 35a9316221..0f0d0590bf 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -11086,16 +11086,22 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
}
} else {
if (!json) {
- vty_out(vty, "BGP routing table entry for %s%s%pFX\n",
+ vty_out(vty,
+ "BGP routing table entry for %s%s%pFX, version %" PRIu64
+ "\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
? prefix_rd2str(prd, buf1,
sizeof(buf1))
: ""),
- safi == SAFI_MPLS_VPN ? ":" : "", p);
+ safi == SAFI_MPLS_VPN ? ":" : "", p,
+ dest->version);
- } else
+ } else {
json_object_string_add(json, "prefix",
prefix2str(p, prefix_str, sizeof(prefix_str)));
+ json_object_int_add(json, "version", dest->version);
+
+ }
}
if (has_valid_label) {