Merge pull request #15951 from FRRouting/mergify/bp/stable/10.0/pr-15883

bgpd: Apply NOOP when doing negative commands for GR operations (backport #15883)
This commit is contained in:
Donatas Abraitis 2024-05-08 06:56:24 +03:00 committed by GitHub
commit 7472bc5bca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View File

@ -2895,19 +2895,22 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
peer_old_state = bgp_peer_gr_mode_get(peer); peer_old_state = bgp_peer_gr_mode_get(peer);
if (peer_old_state == PEER_INVALID) { if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
zlog_debug("[BGP_GR] peer_old_state == Invalid state !"); zlog_debug("%s [BGP_GR] peer_old_state: %d", __func__,
peer_old_state);
if (peer_old_state == PEER_INVALID)
return BGP_ERR_GR_OPERATION_FAILED; return BGP_ERR_GR_OPERATION_FAILED;
}
peer_state = peer->PEER_GR_FSM[peer_old_state][peer_gr_cmd]; peer_state = peer->PEER_GR_FSM[peer_old_state][peer_gr_cmd];
peer_new_state = peer_state.next_state; peer_new_state = peer_state.next_state;
if (peer_new_state == PEER_INVALID) { if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
zlog_debug( zlog_debug("%s [BGP_GR] peer_new_state: %d", __func__,
"[BGP_GR] Invalid bgp graceful restart command used !"); peer_new_state);
if (peer_new_state == PEER_INVALID)
return BGP_ERR_GR_INVALID_CMD; return BGP_ERR_GR_INVALID_CMD;
}
if (peer_new_state != peer_old_state) { if (peer_new_state != peer_old_state) {
result = peer_state.action_fun(peer, peer_old_state, result = peer_state.action_fun(peer, peer_old_state,

View File

@ -1446,11 +1446,11 @@ int bgp_peer_gr_init(struct peer *peer)
{ {
/* PEER_GLOBAL_INHERIT Mode */ /* PEER_GLOBAL_INHERIT Mode */
/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */ /* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
{ PEER_GR, bgp_peer_gr_action }, { PEER_INVALID, NULL }, { PEER_GR, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */ /* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
{ PEER_DISABLE, bgp_peer_gr_action}, { PEER_INVALID, NULL }, { PEER_DISABLE, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */ /* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */
{ PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL } { PEER_HELPER, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL }
} }
}; };
memcpy(&peer->PEER_GR_FSM, local_Peer_GR_FSM, memcpy(&peer->PEER_GR_FSM, local_Peer_GR_FSM,