From 548f916a9f11c0bae18b5992f3f45404662d4aff Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 24 Oct 2021 15:02:11 -0400 Subject: [PATCH] bgpd: When issuing `no ... ebgp-multihop` always resets When removing the command `no neighbor ebgp-multihop ` the bgp code was always resetting the connection even if the command would do nothing. Fixes: #6464 Signed-off-by: Donald Sharp (cherry picked from commit 6e26b2e21f1f742bd0b4f40b4535c75b03b49a89) --- bgpd/bgpd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 57083440b1..a823009179 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4774,6 +4774,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; @@ -4782,9 +4783,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)) -- 2.39.5