From d3217a1bd1b90f084bdb6936febeb3376d40a6e1 Mon Sep 17 00:00:00 2001 From: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com> Date: Fri, 14 Jul 2023 09:36:35 +0800 Subject: [PATCH] [sonic-frr] enable info log for graceful restart events (#15623) #### Why I did it cherry pick, #15535 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. --- ...l-of-graceful-restart-events-to-info.patch | 123 ++++++++++++++++++ src/sonic-frr/patch/series | 3 +- 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 src/sonic-frr/patch/0010-bgpd-change-log-level-of-graceful-restart-events-to-info.patch diff --git a/src/sonic-frr/patch/0010-bgpd-change-log-level-of-graceful-restart-events-to-info.patch b/src/sonic-frr/patch/0010-bgpd-change-log-level-of-graceful-restart-events-to-info.patch new file mode 100644 index 000000000000..99a79e21797c --- /dev/null +++ b/src/sonic-frr/patch/0010-bgpd-change-log-level-of-graceful-restart-events-to-info.patch @@ -0,0 +1,123 @@ +From 04552a73fa0fedf46e550c038614a568856afbc1 Mon Sep 17 00:00:00 2001 +From: stormliang +Date: Mon, 26 Jun 2023 01:29:57 +0000 +Subject: [PATCH] change log level of graceful restart events to info + +--- + bgpd/bgp_fsm.c | 45 +++++++++++++++++++-------------------------- + bgpd/bgpd.c | 12 +++++------- + 2 files changed, 24 insertions(+), 33 deletions(-) + +diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c +index 14dcf2b59..e0aedcc5f 100644 +--- a/bgpd/bgp_fsm.c ++++ b/bgpd/bgp_fsm.c +@@ -617,11 +617,9 @@ static int bgp_graceful_restart_timer_expire(struct thread *thread) + UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT); + BGP_TIMER_OFF(peer->t_gr_stale); + +- if (bgp_debug_neighbor_events(peer)) { +- zlog_debug("%s graceful restart timer expired", peer->host); +- zlog_debug("%s graceful restart stalepath timer stopped", +- peer->host); +- } ++ zlog_info("%s graceful restart timer expired", peer->host); ++ zlog_info("%s graceful restart stalepath timer stopped", ++ peer->host); + + bgp_timer_set(peer); + +@@ -636,8 +634,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 */ +@@ -1206,20 +1204,17 @@ 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); +@@ -1909,18 +1904,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 4d3812bf6..dac0e7606 100644 +--- a/bgpd/bgpd.c ++++ b/bgpd/bgpd.c +@@ -2212,16 +2212,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 34a323782c8e..5c5cd48ba5c2 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -5,4 +5,5 @@ 0005-nexthops-compare-vrf-only-if-ip-type.patch 0007-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch 0008-Add-support-of-bgp-l3vni-evpn.patch -0009-ignore-route-from-default-table.patch \ No newline at end of file +0009-ignore-route-from-default-table.patch +0010-bgpd-change-log-level-of-graceful-restart-events-to-info.patch \ No newline at end of file