]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Show TTL value unconditionally for neighbors
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 10 Jun 2022 13:50:24 +0000 (16:50 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 10 Jun 2022 13:55:02 +0000 (16:55 +0300)
If GTSM configured - show this value, otherwise TTL.

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

index 0a4083e5f62a5d8dfb4869e3c9ec88db646d975b..17ea915c27860489386c72b32dfc2034642d1c7d 100644 (file)
@@ -13950,7 +13950,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
                                json_object_int_add(json_neigh,
                                                    "externalBgpNbrMaxHopsAway",
                                                    p->gtsm_hops);
-                       else if (p->ttl > BGP_DEFAULT_TTL)
+                       else
                                json_object_int_add(json_neigh,
                                                    "externalBgpNbrMaxHopsAway",
                                                    p->ttl);
@@ -13959,21 +13959,30 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
                                vty_out(vty,
                                        "  External BGP neighbor may be up to %d hops away.\n",
                                        p->gtsm_hops);
-                       else if (p->ttl > BGP_DEFAULT_TTL)
+                       else
                                vty_out(vty,
                                        "  External BGP neighbor may be up to %d hops away.\n",
                                        p->ttl);
                }
        } else {
-               if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED) {
-                       if (use_json)
+               if (use_json) {
+                       if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED)
                                json_object_int_add(json_neigh,
                                                    "internalBgpNbrMaxHopsAway",
                                                    p->gtsm_hops);
                        else
+                               json_object_int_add(json_neigh,
+                                                   "internalBgpNbrMaxHopsAway",
+                                                   p->ttl);
+               } else {
+                       if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED)
                                vty_out(vty,
                                        "  Internal BGP neighbor may be up to %d hops away.\n",
                                        p->gtsm_hops);
+                       else
+                               vty_out(vty,
+                                       "  Internal BGP neighbor may be up to %d hops away.\n",
+                                       p->ttl);
                }
        }