forked from Mirror/frr
bgpd: Adding BGP GR change mode config apply on notification sent & received.
* Changing GR mode on a router needs a session reset from the SAME router to negotiate new GR capability. * The present GR implementation needs a session reset after every new BGP GR mode change. * When BGP session reset happens due to sending or receiving BGP notification after changing BGP GR mode, there is no need of explicit session reset. Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
This commit is contained in:
parent
3a75afa4b9
commit
5cce3f0544
|
@ -1308,7 +1308,6 @@ int bgp_stop(struct peer *peer)
|
||||||
} else {
|
} else {
|
||||||
bgp_peer_conf_if_to_su_update(peer);
|
bgp_peer_conf_if_to_su_update(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -759,6 +759,8 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
|
||||||
/* Add packet to peer's output queue */
|
/* Add packet to peer's output queue */
|
||||||
stream_fifo_push(peer->obuf, s);
|
stream_fifo_push(peer->obuf, s);
|
||||||
|
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
|
||||||
bgp_write_notify(peer);
|
bgp_write_notify(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,6 +1798,8 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
|
||||||
&& bgp_notify.subcode == BGP_NOTIFY_OPEN_UNSUP_PARAM)
|
&& bgp_notify.subcode == BGP_NOTIFY_OPEN_UNSUP_PARAM)
|
||||||
UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
|
UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
|
||||||
|
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
|
||||||
return Receive_NOTIFICATION_message;
|
return Receive_NOTIFICATION_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -843,6 +843,8 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
bgp_clear_vty_error(vty, peer, afi, safi, ret);
|
bgp_clear_vty_error(vty, peer, afi, safi, ret);
|
||||||
|
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is to apply read-only mode on this clear. */
|
/* This is to apply read-only mode on this clear. */
|
||||||
|
@ -2145,6 +2147,9 @@ DEFUN (bgp_graceful_restart,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int ret = BGP_GR_FAILURE;
|
int ret = BGP_GR_FAILURE;
|
||||||
|
struct peer *peer;
|
||||||
|
struct listnode *node = {0};
|
||||||
|
struct listnode *nnode = {0};
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug("BGP_GR:: bgp_graceful_restart_cmd : START ");
|
zlog_debug("BGP_GR:: bgp_graceful_restart_cmd : START ");
|
||||||
|
@ -2152,6 +2157,11 @@ DEFUN (bgp_graceful_restart,
|
||||||
|
|
||||||
ret = bgp_gr_update_all(bgp, GLOBAL_GR_CMD);
|
ret = bgp_gr_update_all(bgp, GLOBAL_GR_CMD);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
||||||
|
if (peer->bgp->t_startup)
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
}
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug("BGP_GR:: bgp_graceful_restart_cmd : END ");
|
zlog_debug("BGP_GR:: bgp_graceful_restart_cmd : END ");
|
||||||
return bgp_vty_return(vty, ret);
|
return bgp_vty_return(vty, ret);
|
||||||
|
@ -2166,6 +2176,9 @@ DEFUN (no_bgp_graceful_restart,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
struct peer *peer;
|
||||||
|
struct listnode *node = {0};
|
||||||
|
struct listnode *nnode = {0};
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug("BGP_GR:: no_bgp_graceful_restart_cmd : START ");
|
zlog_debug("BGP_GR:: no_bgp_graceful_restart_cmd : START ");
|
||||||
|
@ -2174,6 +2187,11 @@ DEFUN (no_bgp_graceful_restart,
|
||||||
|
|
||||||
ret = bgp_gr_update_all(bgp, NO_GLOBAL_GR_CMD);
|
ret = bgp_gr_update_all(bgp, NO_GLOBAL_GR_CMD);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
||||||
|
if (peer->bgp->t_startup)
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
}
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug("BGP_GR:: no_bgp_graceful_restart_cmd : END ");
|
zlog_debug("BGP_GR:: no_bgp_graceful_restart_cmd : END ");
|
||||||
|
|
||||||
|
@ -2315,6 +2333,9 @@ DEFUN (bgp_graceful_restart_disable,
|
||||||
GR_DISABLE)
|
GR_DISABLE)
|
||||||
{
|
{
|
||||||
int ret = BGP_GR_FAILURE;
|
int ret = BGP_GR_FAILURE;
|
||||||
|
struct peer *peer;
|
||||||
|
struct listnode *node = {0};
|
||||||
|
struct listnode *nnode = {0};
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
|
@ -2323,6 +2344,11 @@ DEFUN (bgp_graceful_restart_disable,
|
||||||
|
|
||||||
ret = bgp_gr_update_all(bgp, GLOBAL_DISABLE_CMD);
|
ret = bgp_gr_update_all(bgp, GLOBAL_DISABLE_CMD);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
||||||
|
if (peer->bgp->t_startup)
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
}
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: bgp_graceful_restart_disable_cmd : END ");
|
"BGP_GR:: bgp_graceful_restart_disable_cmd : END ");
|
||||||
|
@ -2338,6 +2364,9 @@ DEFUN (no_bgp_graceful_restart_disable,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
struct peer *peer;
|
||||||
|
struct listnode *node = {0};
|
||||||
|
struct listnode *nnode = {0};
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
|
@ -2347,6 +2376,11 @@ DEFUN (no_bgp_graceful_restart_disable,
|
||||||
|
|
||||||
ret = bgp_gr_update_all(bgp, NO_GLOBAL_DISABLE_CMD);
|
ret = bgp_gr_update_all(bgp, NO_GLOBAL_DISABLE_CMD);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
||||||
|
if (peer->bgp->t_startup)
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
}
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: no_bgp_graceful_restart_disable_cmd : END ");
|
"BGP_GR:: no_bgp_graceful_restart_disable_cmd : END ");
|
||||||
|
@ -2413,7 +2447,7 @@ DEFUN (no_bgp_neighbor_graceful_restart,
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: no_bgp_neighbor_graceful_restart_set_cmd : END ");
|
"BGP_GR:: no_bgp_neighbor_graceful_restart_helper_set_cmd : END ");
|
||||||
|
|
||||||
return bgp_vty_return(vty, ret);
|
return bgp_vty_return(vty, ret);
|
||||||
}
|
}
|
||||||
|
@ -2432,17 +2466,18 @@ DEFUN (bgp_neighbor_graceful_restart_helper_set,
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: bgp_neighbor_graceful_restart_set_helper_cmd : START ");
|
"BGP_GR:: bgp_neighbor_graceful_restart_helper_set_cmd : START ");
|
||||||
peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg);
|
peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg);
|
||||||
|
|
||||||
if (peer->bgp->t_startup)
|
|
||||||
bgp_peer_gr_flags_update(peer);
|
|
||||||
|
|
||||||
if (!peer)
|
if (!peer)
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
|
||||||
ret = bgp_neighbor_graceful_restart(peer, PEER_HELPER_CMD);
|
ret = bgp_neighbor_graceful_restart(peer, PEER_HELPER_CMD);
|
||||||
|
|
||||||
|
if (peer->bgp->t_startup)
|
||||||
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: bgp_neighbor_graceful_restart_helper_set_cmd : END ");
|
"BGP_GR:: bgp_neighbor_graceful_restart_helper_set_cmd : END ");
|
||||||
|
@ -2479,7 +2514,7 @@ DEFUN (no_bgp_neighbor_graceful_restart_helper,
|
||||||
|
|
||||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"BGP_GR:: no_bgp_neighbor_graceful_restart_set_cmd : END ");
|
"BGP_GR:: no_bgp_neighbor_graceful_restart_disable_set_cmd : END ");
|
||||||
|
|
||||||
return bgp_vty_return(vty, ret);
|
return bgp_vty_return(vty, ret);
|
||||||
}
|
}
|
||||||
|
@ -2506,7 +2541,7 @@ DEFUN (bgp_neighbor_graceful_restart_disable_set,
|
||||||
|
|
||||||
|
|
||||||
ret = bgp_neighbor_graceful_restart(peer,
|
ret = bgp_neighbor_graceful_restart(peer,
|
||||||
PEER_DISABLE_cmd);
|
PEER_DISABLE_cmd);
|
||||||
|
|
||||||
if (peer->bgp->t_startup)
|
if (peer->bgp->t_startup)
|
||||||
bgp_peer_gr_flags_update(peer);
|
bgp_peer_gr_flags_update(peer);
|
||||||
|
|
Loading…
Reference in a new issue