]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_vty.c
Merge pull request #5785 from ton31337/fix/replace_gtsm_hops_to_readable_macros
[mirror_frr.git] / bgpd / bgp_vty.c
index e55548f713bcf240e22976245dfd8c71076dcf78..5e2c5d07db5a76bcb887df1f339f7693985af610 100644 (file)
@@ -6901,7 +6901,7 @@ DEFUN (neighbor_ttl_security,
         * If 'neighbor swpX', then this is for directly connected peers,
         * we should not accept a ttl-security hops value greater than 1.
         */
-       if (peer->conf_if && (gtsm_hops > 1)) {
+       if (peer->conf_if && (gtsm_hops > BGP_GTSM_HOPS_CONNECTED)) {
                vty_out(vty,
                        "%s is directly connected peer, hops cannot exceed 1\n",
                        argv[idx_peer]->arg);
@@ -11939,7 +11939,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
        /* EBGP Multihop and GTSM */
        if (p->sort != BGP_PEER_IBGP) {
                if (use_json) {
-                       if (p->gtsm_hops > 0)
+                       if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED)
                                json_object_int_add(json_neigh,
                                                    "externalBgpNbrMaxHopsAway",
                                                    p->gtsm_hops);
@@ -11948,7 +11948,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
                                                    "externalBgpNbrMaxHopsAway",
                                                    p->ttl);
                } else {
-                       if (p->gtsm_hops > 0)
+                       if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED)
                                vty_out(vty,
                                        "  External BGP neighbor may be up to %d hops away.\n",
                                        p->gtsm_hops);
@@ -11958,7 +11958,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
                                        p->ttl);
                }
        } else {
-               if (p->gtsm_hops > 0) {
+               if (p->gtsm_hops > BGP_GTSM_HOPS_DISABLED) {
                        if (use_json)
                                json_object_int_add(json_neigh,
                                                    "internalBgpNbrMaxHopsAway",
@@ -14450,7 +14450,8 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
 
        /* ebgp-multihop */
        if (peer->sort != BGP_PEER_IBGP && peer->ttl != BGP_DEFAULT_TTL
-           && !(peer->gtsm_hops != 0 && peer->ttl == MAXTTL)) {
+           && !(peer->gtsm_hops != BGP_GTSM_HOPS_DISABLED
+                && peer->ttl == MAXTTL)) {
                if (!peer_group_active(peer) || g_peer->ttl != peer->ttl) {
                        vty_out(vty, " neighbor %s ebgp-multihop %d\n", addr,
                                peer->ttl);
@@ -14458,7 +14459,7 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
        }
 
        /* ttl-security hops */
-       if (peer->gtsm_hops != 0) {
+       if (peer->gtsm_hops != BGP_GTSM_HOPS_DISABLED) {
                if (!peer_group_active(peer)
                    || g_peer->gtsm_hops != peer->gtsm_hops) {
                        vty_out(vty, " neighbor %s ttl-security hops %d\n",