Merge pull request #15458 from opensourcerouting/fix/bgpd_send_hold_timer_expired_notification_code

bgpd: Send "Send Hold Timer Expired" on such events notification
This commit is contained in:
Donald Sharp 2024-03-02 21:21:08 -05:00 committed by GitHub
commit 0186c94ce6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 2 deletions

View File

@ -116,6 +116,7 @@ static const struct message bgp_notify_msg[] = {
{BGP_NOTIFY_FSM_ERR, "Neighbor Events Error"},
{BGP_NOTIFY_CEASE, "Cease"},
{BGP_NOTIFY_ROUTE_REFRESH_ERR, "ROUTE-REFRESH Message Error"},
{BGP_NOTIFY_SEND_HOLD_ERR, "Send Hold Timer Expired"},
{0}};
static const struct message bgp_notify_head_msg[] = {
@ -515,6 +516,7 @@ const char *bgp_notify_subcode_str(char code, char subcode)
return lookup_msg(bgp_notify_update_msg, subcode,
"Unrecognized Error Subcode");
case BGP_NOTIFY_HOLD_ERR:
case BGP_NOTIFY_SEND_HOLD_ERR:
break;
case BGP_NOTIFY_FSM_ERR:
return lookup_msg(bgp_notify_fsm_msg, subcode,

View File

@ -1589,7 +1589,7 @@ bgp_stop_with_error(struct peer_connection *connection)
/* something went wrong, send notify and tear down */
static enum bgp_fsm_state_progress
enum bgp_fsm_state_progress
bgp_stop_with_notify(struct peer_connection *connection, uint8_t code,
uint8_t sub_code)
{

View File

@ -122,6 +122,9 @@ extern void bgp_maxmed_update(struct bgp *);
extern bool bgp_maxmed_onstartup_configured(struct bgp *);
extern bool bgp_maxmed_onstartup_active(struct bgp *);
extern int bgp_fsm_error_subcode(int status);
extern enum bgp_fsm_state_progress
bgp_stop_with_notify(struct peer_connection *connection, uint8_t code,
uint8_t sub_code);
/**
* Start the route advertisement timer (that honors MRAI) for all the

View File

@ -148,7 +148,8 @@ static void bgp_packet_add(struct peer_connection *connection,
EC_BGP_SENDQ_STUCK_PROPER,
"%pBP has not made any SendQ progress for 2 holdtimes (%jds), terminating session",
peer, sendholdtime);
BGP_EVENT_ADD(connection, TCP_fatal_error);
bgp_stop_with_notify(connection,
BGP_NOTIFY_SEND_HOLD_ERR, 0);
} else if (delta > (intmax_t)holdtime &&
monotime(NULL) - peer->last_sendq_warn > 5) {
flog_warn(

View File

@ -1983,6 +1983,7 @@ struct bgp_nlri {
#define BGP_NOTIFY_FSM_ERR 5
#define BGP_NOTIFY_CEASE 6
#define BGP_NOTIFY_ROUTE_REFRESH_ERR 7
#define BGP_NOTIFY_SEND_HOLD_ERR 8
/* Subcodes for BGP Finite State Machine Error */
#define BGP_NOTIFY_FSM_ERR_SUBCODE_UNSPECIFIC 0