]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Show the real table version for a decent peer subgroup
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 15 May 2023 11:43:32 +0000 (14:43 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 15 May 2023 18:46:41 +0000 (21:46 +0300)
Without the patch:

```
Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.1.2     4      65002         4         5        2    0    0 00:00:45            1        1 N/A
192.168.1.3     4      65003         5         5        2    0    0 00:00:45            0        2 N/A
192.168.1.4     4      65004         5         5        2    0    0 00:00:45            0        2 N/A
```

With the patch:

```
Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.1.2     4      65002         6         6        2    0    0 00:01:05            0        1 N/A
192.168.1.3     4      65003         7         7        3    0    0 00:01:05            0        1 N/A
192.168.1.4     4      65004         7         7        3    0    0 00:01:05            0        1 N/A
```

JSON output is also fixed:

```
munet> r1 shi vtysh -c 'sh ip bgp sum json' | grep version -i
  "tableVersion":3,
      "version":4,
      "tableVersion":2,
      "version":4,
      "tableVersion":3,
      "version":4,
      "tableVersion":3,

munet>
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_vty.c
bgpd/bgpd.h

index 1be44adde8034e4acc718463ec25eb45d36c0c56..7ef9db9f0dd8e60040399fd386f1316d2cdc91d7 100644 (file)
@@ -11620,8 +11620,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                        &peer->ibuf->count,
                                        memory_order_relaxed);
 
-                               json_object_int_add(json_peer, "tableVersion",
-                                                   peer->version[afi][safi]);
+                               json_object_int_add(
+                                       json_peer, "tableVersion",
+                                       (paf && PAF_SUBGRP(paf))
+                                               ? paf->subgroup->version
+                                               : 0);
                                json_object_int_add(json_peer, "outq",
                                                    outq_count);
                                json_object_int_add(json_peer, "inq",
@@ -11799,8 +11802,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                        " %9u %9u %8" PRIu64 " %4zu %4zu %8s",
                                        PEER_TOTAL_RX(peer),
                                        PEER_TOTAL_TX(peer),
-                                       peer->version[afi][safi], inq_count,
-                                       outq_count,
+                                       (paf && PAF_SUBGRP(paf))
+                                               ? paf->subgroup->version
+                                               : 0,
+                                       inq_count, outq_count,
                                        peer_uptime(peer->uptime, timebuf,
                                                    BGP_UPTIME_LEN, 0, NULL));
 
index 68b32b59458fb9f8913a32a729e29a1e44213204..9cb1d51088cfc456f344b17b8068f84d382e3751 100644 (file)
@@ -1119,7 +1119,6 @@ struct peer {
 
        /* BGP peer group.  */
        struct peer_group *group;
-       uint64_t version[AFI_MAX][SAFI_MAX];
 
        /* BGP peer_af structures, per configured AF on this peer */
        struct peer_af *peer_af_array[BGP_AF_MAX];