From a67bffab8efb4e47d061fba24f6d11c1ecf51ef0 Mon Sep 17 00:00:00 2001 From: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com> Date: Wed, 21 Jun 2023 15:20:00 +0800 Subject: [PATCH] enable info log for graceful restart events (#15535) Why I did it Graceful restart is a key event for bgpd, related log print is debug level. To change it to info level to get more visibilities when this kind of event is triggered. Work item tracking Microsoft ADO (13875291): How I did it To create patch file to change from debug level to info level. How to verify it To run PR test and capture the print. --- ...og-level-for-graceful-restart-events.patch | 122 ++++++++++++++++++ src/sonic-frr/patch/series | 1 + 2 files changed, 123 insertions(+) create mode 100644 src/sonic-frr/patch/0029-bgpd-Change-log-level-for-graceful-restart-events.patch diff --git a/src/sonic-frr/patch/0029-bgpd-Change-log-level-for-graceful-restart-events.patch b/src/sonic-frr/patch/0029-bgpd-Change-log-level-for-graceful-restart-events.patch new file mode 100644 index 0000000000..a3474ae64f --- /dev/null +++ b/src/sonic-frr/patch/0029-bgpd-Change-log-level-for-graceful-restart-events.patch @@ -0,0 +1,122 @@ +From c423bce4db804c1d07d65ce3d06a9e62c4eceb2b Mon Sep 17 00:00:00 2001 +From: stormliang +Date: Mon, 19 Jun 2023 13:57:01 +0000 +Subject: [PATCH] change log level for graceful restart events + +--- + bgpd/bgp_fsm.c | 44 ++++++++++++++++++++------------------------ + bgpd/bgpd.c | 12 +++++------- + 2 files changed, 25 insertions(+), 31 deletions(-) + +diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c +index 672fa4512..e392cd6e1 100644 +--- a/bgpd/bgp_fsm.c ++++ b/bgpd/bgp_fsm.c +@@ -786,9 +786,9 @@ static int bgp_graceful_restart_timer_expire(struct thread *thread) + + peer = THREAD_ARG(thread); + +- if (bgp_debug_neighbor_events(peer)) { +- zlog_debug("%s graceful restart timer expired", peer->host); +- zlog_debug("%s graceful restart stalepath timer stopped", ++ if (peer) { ++ zlog_info("%s graceful restart timer expired", peer->host); ++ zlog_info("%s graceful restart stalepath timer stopped", + peer->host); + } + +@@ -852,8 +852,8 @@ static int bgp_graceful_stale_timer_expire(struct thread *thread) + + peer = THREAD_ARG(thread); + +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug("%s graceful restart stalepath timer expired", ++ if (peer) ++ zlog_info("%s graceful restart stalepath timer expired", + peer->host); + + /* NSF delete stale route */ +@@ -1427,20 +1427,18 @@ int bgp_stop(struct peer *peer) + /* graceful restart */ + if (peer->t_gr_stale) { + BGP_TIMER_OFF(peer->t_gr_stale); +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug( +- "%s graceful restart stalepath timer stopped", +- peer->host); ++ zlog_info( ++ "%s graceful restart stalepath timer stopped", ++ peer->host); + } + if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) { +- if (bgp_debug_neighbor_events(peer)) { +- zlog_debug( +- "%s graceful restart timer started for %d sec", +- peer->host, peer->v_gr_restart); +- zlog_debug( +- "%s graceful restart stalepath timer started for %d sec", +- peer->host, peer->bgp->stalepath_time); +- } ++ zlog_info( ++ "%s graceful restart timer started for %d sec", ++ peer->host, peer->v_gr_restart); ++ zlog_info( ++ "%s graceful restart stalepath timer started for %d sec", ++ peer->host, peer->bgp->stalepath_time); ++ + BGP_TIMER_ON(peer->t_gr_restart, + bgp_graceful_restart_timer_expire, + peer->v_gr_restart); +@@ -2205,18 +2203,16 @@ static int bgp_establish(struct peer *peer) + UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE); + if (peer->t_gr_stale) { + BGP_TIMER_OFF(peer->t_gr_stale); +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug( +- "%s graceful restart stalepath timer stopped", +- peer->host); ++ zlog_info( ++ "%s graceful restart stalepath timer stopped", ++ peer->host); + } + } + + if (peer->t_gr_restart) { + BGP_TIMER_OFF(peer->t_gr_restart); +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug("%s graceful restart timer stopped", +- peer->host); ++ zlog_info("%s graceful restart timer stopped", ++ peer->host); + } + + /* Reset uptime, turn on keepalives, send current table. */ +diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c +index 7e528b219..2fc471555 100644 +--- a/bgpd/bgpd.c ++++ b/bgpd/bgpd.c +@@ -2346,16 +2346,14 @@ void peer_nsf_stop(struct peer *peer) + + if (peer->t_gr_restart) { + BGP_TIMER_OFF(peer->t_gr_restart); +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug("%s graceful restart timer stopped", +- peer->host); ++ zlog_info("%s graceful restart timer stopped", ++ peer->host); + } + if (peer->t_gr_stale) { + BGP_TIMER_OFF(peer->t_gr_stale); +- if (bgp_debug_neighbor_events(peer)) +- zlog_debug( +- "%s graceful restart stalepath timer stopped", +- peer->host); ++ zlog_info( ++ "%s graceful restart stalepath timer stopped", ++ peer->host); + } + bgp_clear_route_all(peer); + } +-- +2.25.1 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index da96dc27be..db97b2ea82 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -27,4 +27,5 @@ cross-compile-changes.patch 0026-bgpd-Ensure-suppress-fib-pending-works-with-network-.patch 0027-bgpd-Ensure-FRR-has-enough-data-to-read-in-peek_for_as4_capability-and-bgp_open_option_parse.patch 0028-bgpd-Ensure-that-bgp-open-message-stream-has-enough-data-to-read.patch +0029-bgpd-Change-log-level-for-graceful-restart-events.patch