diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 599723ee2a1c..d91ff1db5df0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2617,7 +2617,8 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, if (aspath_check_as_zero(attr->aspath)) return false; - if (bgp_in_graceful_shutdown(bgp)) { + if ((bgp_in_graceful_shutdown(bgp)) || + (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_SHUTDOWN))) { if (peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED || peer->sub_sort == BGP_PEER_EBGP_OAD) { diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 063c99ccebde..ea32fa66e47c 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -334,6 +334,7 @@ static unsigned int updgrp_hash_key_make(const void *p) */ #define SEED1 999331 #define SEED2 2147483647 +#define SEED3 4258594758 updgrp = p; peer = updgrp->conf; @@ -429,6 +430,10 @@ static unsigned int updgrp_hash_key_make(const void *p) || CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT)) key = jhash_1word(jhash(peer->host, strlen(peer->host), SEED2), key); + + if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_SHUTDOWN)) + key = jhash_1word(jhash(peer->host, strlen(peer->host), SEED3), key); + /* * Multiple sessions with the same neighbor should get their own * update-group if they have different roles. diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 573ba52cd50c..7b12923b7b12 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -1023,7 +1023,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, bool withdraw) } /* Advertise the default route */ - if (bgp_in_graceful_shutdown(bgp)) + if (bgp_in_graceful_shutdown(bgp) || + (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_SHUTDOWN))) bgp_attr_add_gshut_community(new_attr); SET_FLAG(subgrp->sflags, diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5983e9a4b057..646e3202244e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3732,6 +3732,7 @@ DEFPY (neighbor_graceful_shutdown, safi_t safi; struct peer *peer; int ret; + struct peer_af *paf; VTY_DECLVAR_CONTEXT(bgp, bgp); @@ -3752,6 +3753,11 @@ DEFPY (neighbor_graceful_shutdown, bgp_clear(vty, bgp, afi, safi, clear_peer, BGP_CLEAR_SOFT_IN, neighbor); + paf = peer_af_find(peer, afi, safi); + if (paf) { + update_group_adjust_peer(paf); + bgp_announce_route(peer, afi, safi, false); + } } return ret;