]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: When issuing `no ... ebgp-multihop` always resets
authorDonald Sharp <sharpd@nvidia.com>
Sun, 24 Oct 2021 19:02:11 +0000 (15:02 -0400)
committermergify-bot <noreply@mergify.io>
Tue, 26 Oct 2021 06:11:16 +0000 (06:11 +0000)
When removing the command `no neighbor <X> ebgp-multihop <Y>`
the bgp code was always resetting the connection even if
the command would do nothing.

Fixes: #6464
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6e26b2e21f1f742bd0b4f40b4535c75b03b49a89)

bgpd/bgpd.c

index 03ab5954245c68c76647cdaaf88aab1d61b7076a..80191c739dea3f53cd7242b1b2dd55438d0175db 100644 (file)
@@ -4757,6 +4757,7 @@ int peer_ebgp_multihop_unset(struct peer *peer)
 {
        struct peer_group *group;
        struct listnode *node, *nnode;
+       int ttl;
 
        if (peer->sort == BGP_PEER_IBGP)
                return 0;
@@ -4765,9 +4766,14 @@ int peer_ebgp_multihop_unset(struct peer *peer)
                return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK;
 
        if (peer_group_active(peer))
-               peer->ttl = peer->group->conf->ttl;
+               ttl = peer->group->conf->ttl;
        else
-               peer->ttl = BGP_DEFAULT_TTL;
+               ttl = BGP_DEFAULT_TTL;
+
+       if (ttl == peer->ttl)
+               return 0;
+
+       peer->ttl = ttl;
 
        if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
                if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))