]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Show BGP table version which was used for a particular prefix
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 8 Apr 2021 19:55:00 +0000 (22:55 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Sun, 11 Apr 2021 18:42:18 +0000 (21:42 +0300)
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>
bgpd/bgp_route.c

index 35a93162216884a061bd58564892b4eb480d5cd2..0f0d0590bf61c9d5a1f7deaa3637422b197d7b3b 100644 (file)
@@ -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) {