From aa1a13677d071184abd254be5e63f227a053b713 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 6 Nov 2019 11:57:23 -0800 Subject: [PATCH] [frr]: Move to version 7.2 (#3704) * Use 7.2 tree to generate frr packages * Adapt patches for frr/7.2 * Use vrf_id --- rules/frr.mk | 2 +- src/sonic-frr/frr | 2 +- ...01-Add-support-of-bgp-tcp-DSCP-value.patch | 26 +- ...verity-of-Vty-connected-from-message.patch | 8 +- ...003-Use-vrf_id-for-vrf-not-tabled_id.patch | 35 +++ ...EXT_HOP-to-be-0.0.0.0-due-to-allevia.patch | 8 +- src/sonic-frr/patch/0005-Support-VRF.patch | 30 --- ...-dead-fd-poll-data-port-fix-from-frr.patch | 107 --------- ...-zebra-kernel-level-graceful-restart.patch | 227 ------------------ src/sonic-frr/patch/series | 4 +- 10 files changed, 59 insertions(+), 390 deletions(-) create mode 100644 src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch delete mode 100644 src/sonic-frr/patch/0005-Support-VRF.patch delete mode 100644 src/sonic-frr/patch/0007-prevent-dead-fd-poll-data-port-fix-from-frr.patch delete mode 100644 src/sonic-frr/patch/0008-zebra-kernel-level-graceful-restart.patch diff --git a/rules/frr.mk b/rules/frr.mk index 83c359992a..27391ce0cf 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -1,6 +1,6 @@ # FRRouting (frr) package -FRR_VERSION = 7.1 +FRR_VERSION = 7.2 FRR_SUBVERSION = 0 export FRR_VERSION FRR_SUBVERSION diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index 8c5e037c49..514f508fc6 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit 8c5e037c496025597406f496010d6ef6b1d2e73d +Subproject commit 514f508fc60e0573d9863beaad8924927d373954 diff --git a/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch b/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch index c7676fd65c..9587231d88 100644 --- a/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch +++ b/src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch @@ -1,6 +1,6 @@ -From ab8ae984def8ee5cea22f802b2a60a05214c11d2 Mon Sep 17 00:00:00 2001 +From 3ec4fa4c8377330d4e3bdbdfc453a79a7827d84d Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Mon, 7 Oct 2019 17:00:15 -0700 +Date: Mon, 4 Nov 2019 18:09:51 -0800 Subject: [PATCH 1/1] Add support of bgp tcp DSCP value --- @@ -11,12 +11,12 @@ Subject: [PATCH 1/1] Add support of bgp tcp DSCP value 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c -index 6a5c2c4b3..9ec162aa4 100644 +index 1394c60b2..a70268b05 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c -@@ -627,11 +627,9 @@ int bgp_connect(struct peer *peer) +@@ -633,11 +633,9 @@ int bgp_connect(struct peer *peer) #ifdef IPTOS_PREC_INTERNETCONTROL - frr_elevate_privs(&bgpd_privs) { + frr_with_privs(&bgpd_privs) { if (sockunion_family(&peer->su) == AF_INET) - setsockopt_ipv4_tos(peer->fd, - IPTOS_PREC_INTERNETCONTROL); @@ -28,7 +28,7 @@ index 6a5c2c4b3..9ec162aa4 100644 } #endif -@@ -707,10 +705,9 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, +@@ -713,10 +711,9 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, #ifdef IPTOS_PREC_INTERNETCONTROL if (sa->sa_family == AF_INET) @@ -42,10 +42,10 @@ index 6a5c2c4b3..9ec162aa4 100644 sockopt_v6only(sa->sa_family, sock); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c -index d05432327..a15a0f526 100644 +index 141d5cf30..8faa918d0 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c -@@ -1139,6 +1139,42 @@ DEFUN (no_router_bgp, +@@ -1182,6 +1182,42 @@ DEFUN (no_router_bgp, return CMD_SUCCESS; } @@ -88,7 +88,7 @@ index d05432327..a15a0f526 100644 /* BGP router-id. */ -@@ -12929,6 +12965,10 @@ void bgp_vty_init(void) +@@ -13035,6 +13071,10 @@ void bgp_vty_init(void) /* "no router bgp" commands. */ install_element(CONFIG_NODE, &no_router_bgp_cmd); @@ -100,10 +100,10 @@ index d05432327..a15a0f526 100644 install_element(BGP_NODE, &bgp_router_id_cmd); install_element(BGP_NODE, &no_bgp_router_id_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c -index 8c0b5336e..55aeb2dd8 100644 +index 80c6dd613..87a8ef34f 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c -@@ -3040,7 +3040,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, +@@ -3050,7 +3050,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, bgp->evpn_info = XCALLOC(MTYPE_BGP_EVPN_INFO, sizeof(struct bgp_evpn_info)); @@ -112,7 +112,7 @@ index 8c0b5336e..55aeb2dd8 100644 bgp_evpn_init(bgp); bgp_pbr_init(bgp); return bgp; -@@ -7629,6 +7629,9 @@ int bgp_config_write(struct vty *vty) +@@ -7564,6 +7564,9 @@ int bgp_config_write(struct vty *vty) if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) vty_out(vty, " no bgp fast-external-failover\n"); @@ -123,7 +123,7 @@ index 8c0b5336e..55aeb2dd8 100644 if (bgp->router_id_static.s_addr != 0) vty_out(vty, " bgp router-id %s\n", diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index b0f656753..32983a0a9 100644 +index e4f4dc0b5..4d372c562 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -569,6 +569,9 @@ struct bgp { diff --git a/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch b/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch index 9ec7b980ae..e47544f793 100644 --- a/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch +++ b/src/sonic-frr/patch/0002-Reduce-severity-of-Vty-connected-from-message.patch @@ -1,6 +1,6 @@ -From 5a30a4e91a91f8e19c69ef219cd6d8b19e9b6fae Mon Sep 17 00:00:00 2001 +From 63b5b14ad289f18928beac65754e7bb13183b5dc Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Mon, 7 Oct 2019 17:06:27 -0700 +Date: Mon, 4 Nov 2019 18:12:54 -0800 Subject: [PATCH 1/1] Reduce severity of 'Vty connected from' message --- @@ -8,10 +8,10 @@ Subject: [PATCH 1/1] Reduce severity of 'Vty connected from' message 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vty.c b/lib/vty.c -index b1ed3d63c..5aa4b56cb 100644 +index deb9391bd..743ff1c17 100644 --- a/lib/vty.c +++ b/lib/vty.c -@@ -1870,7 +1870,7 @@ static int vty_accept(struct thread *thread) +@@ -1853,7 +1853,7 @@ static int vty_accept(struct thread *thread) zlog_info("can't set sockopt to vty_sock : %s", safe_strerror(errno)); diff --git a/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch new file mode 100644 index 0000000000..c9a8c00819 --- /dev/null +++ b/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch @@ -0,0 +1,35 @@ +From 9e7f1de3b79ca6ada8a3124f4cdc35530284832e Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Tue, 5 Nov 2019 06:16:51 -0800 +Subject: [PATCH 1/1] Use vrf_id for vrf, not tabled_id + +--- + zebra/zebra_fpm_netlink.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c +index f347d3955..74aab8228 100644 +--- a/zebra/zebra_fpm_netlink.c ++++ b/zebra/zebra_fpm_netlink.c +@@ -284,7 +284,6 @@ static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd, + rib_dest_t *dest, struct route_entry *re) + { + struct nexthop *nexthop; +- struct zebra_vrf *zvrf; + + memset(ri, 0, sizeof(*ri)); + +@@ -292,9 +291,7 @@ static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd, + ri->af = rib_dest_af(dest); + + ri->nlmsg_type = cmd; +- zvrf = rib_dest_vrf(dest); +- if (zvrf) +- ri->rtm_table = zvrf->table_id; ++ ri->rtm_table = zvrf_id(rib_dest_vrf(dest)); + ri->rtm_protocol = RTPROT_UNSPEC; + + /* +-- +2.17.1.windows.2 + diff --git a/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch b/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch index cb3c30c781..b31da0651a 100644 --- a/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch +++ b/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch @@ -1,6 +1,6 @@ -From 9fa0ffcc8f9ec987af527e911cd748014aeacffe Mon Sep 17 00:00:00 2001 +From fe1e544d46d721798594fcec175665e3754500a6 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Mon, 7 Oct 2019 17:15:15 -0700 +Date: Mon, 4 Nov 2019 18:14:12 -0800 Subject: [PATCH 1/1] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate the vendor bug @@ -9,10 +9,10 @@ Subject: [PATCH 1/1] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c -index f8eae135e..732115756 100644 +index c122df498..3c7aa3075 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -2904,8 +2904,7 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, +@@ -2983,8 +2983,7 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, /* If NEXT_HOP is present, validate it. */ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { diff --git a/src/sonic-frr/patch/0005-Support-VRF.patch b/src/sonic-frr/patch/0005-Support-VRF.patch deleted file mode 100644 index 8d6689e524..0000000000 --- a/src/sonic-frr/patch/0005-Support-VRF.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b7ae4e11c2dc14f9208b62ea060bb5ecbf4cddb2 Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Mon, 7 Oct 2019 17:17:54 -0700 -Subject: [PATCH 1/1] Support VRF - ---- - zebra/zebra_fpm_netlink.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index 88f0c3250..29f07f801 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -327,7 +327,12 @@ static int netlink_route_info_encode(netlink_route_info_t *ri, char *in_buf, - req->n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST; - req->n.nlmsg_type = ri->nlmsg_type; - req->r.rtm_family = ri->af; -- req->r.rtm_table = ri->rtm_table; -+ if (ri->rtm_table < 256) -+ req->r.rtm_table = ri->rtm_table; -+ else { -+ req->r.rtm_table = RT_TABLE_COMPAT; -+ addattr32(&req->n, in_buf_len, RTA_TABLE, ri->rtm_table); -+ } - req->r.rtm_dst_len = ri->prefix->prefixlen; - req->r.rtm_protocol = ri->rtm_protocol; - req->r.rtm_scope = RT_SCOPE_UNIVERSE; --- -2.17.1.windows.2 - diff --git a/src/sonic-frr/patch/0007-prevent-dead-fd-poll-data-port-fix-from-frr.patch b/src/sonic-frr/patch/0007-prevent-dead-fd-poll-data-port-fix-from-frr.patch deleted file mode 100644 index 5954e5c7c5..0000000000 --- a/src/sonic-frr/patch/0007-prevent-dead-fd-poll-data-port-fix-from-frr.patch +++ /dev/null @@ -1,107 +0,0 @@ -From e4225086634fb7ae7fa762f3a45af6ad39e78641 Mon Sep 17 00:00:00 2001 -From: sudhanshukumar22 -Date: Tue, 15 Oct 2019 02:17:00 -0700 -Subject: [PATCH] Port a fix from FRR community - https://github.com/donaldsharp/frr/commit/39c93f379a5b57c56739a339ad75ec06e30daef3 - If we have a case where have created a fd for i/o and we have removed the - handling thread but still have the fd in the poll data structure, there - existed a case where we would get the handle this fd return from poll but we - would immediately do nothing with it because we didn't have a thread to hand - the event to. - -This leads to an infinite loop. Prevent the infinite loop -from happening and log the problem. ---- - lib/lib_errors.c | 6 ++++++ - lib/lib_errors.h | 1 + - lib/thread.c | 25 ++++++++++++++++++------- - 3 files changed, 25 insertions(+), 7 deletions(-) - -diff --git a/lib/lib_errors.c b/lib/lib_errors.c -index b6c764d87..033f27e58 100644 ---- a/lib/lib_errors.c -+++ b/lib/lib_errors.c -@@ -50,6 +50,12 @@ static struct log_ref ferr_lib_warn[] = { - .description = "The Event subsystem has detected a slow process, this typically indicates that FRR is having trouble completing work in a timely manner. This can be either a misconfiguration, bug, or some combination therof.", - .suggestion = "Gather log data and open an Issue", - }, -+ { -+ .code = EC_LIB_NO_THREAD, -+ .title = "The Event subsystem has detected an internal FD problem", -+ .description = "The Event subsystem has detected a file descriptor read/write event without an associated handling function. This is a bug, please collect log data and open an issue.", -+ .suggestion = "Gather log data and open an Issue", -+ }, - { - .code = EC_LIB_RMAP_RECURSION_LIMIT, - .title = "Reached the Route-Map Recursion Limit", -diff --git a/lib/lib_errors.h b/lib/lib_errors.h -index 39b39fb06..996a16ba9 100644 ---- a/lib/lib_errors.h -+++ b/lib/lib_errors.h -@@ -45,6 +45,7 @@ enum lib_log_refs { - EC_LIB_STREAM, - EC_LIB_LINUX_NS, - EC_LIB_SLOW_THREAD, -+ EC_LIB_NO_THREAD, - EC_LIB_RMAP_RECURSION_LIMIT, - EC_LIB_BACKUP_CONFIG, - EC_LIB_VRF_LENGTH, -diff --git a/lib/thread.c b/lib/thread.c -index 5ca859a74..82708557d 100644 ---- a/lib/thread.c -+++ b/lib/thread.c -@@ -1235,12 +1235,26 @@ static struct thread *thread_run(struct thread_master *m, struct thread *thread, - } - - static int thread_process_io_helper(struct thread_master *m, -- struct thread *thread, short state, int pos) -+ struct thread *thread, short state, short actual_state, int pos) - { - struct thread **thread_array; - -- if (!thread) -+ /* -+ * If another pthread scheduled this file descriptor for this event -+ * we're responding to, no problem, we're getting to it now. -+ * Additionally if !thread if we don't clear this now we'll -+ * infinaloop( which sucks ) -+ */ -+ m->handler.pfds[pos].events &= ~(state); -+ -+ if (!thread) { -+ if ((actual_state & (POLLHUP | POLLIN)) != POLLHUP) -+ flog_err( EC_LIB_NO_THREAD, -+ "Attempting to process an I/O event but for fd: %d(%d) no thread to handle this!\n", -+ m->handler.pfds[pos].fd, actual_state); - return 0; -+ } -+ - - if (thread->type == THREAD_READ) - thread_array = m->read; -@@ -1250,9 +1264,6 @@ static int thread_process_io_helper(struct thread_master *m, - thread_array[thread->u.fd] = NULL; - thread_list_add_tail(&m->ready, thread); - thread->type = THREAD_READY; -- /* if another pthread scheduled this file descriptor for the event we're -- * responding to, no problem; we're getting to it now */ -- thread->master->handler.pfds[pos].events &= ~(state); - return 1; - } - -@@ -1290,10 +1301,10 @@ static void thread_process_io(struct thread_master *m, unsigned int num) - * should still be a valid index into the master's pfds. */ - if (pfds[i].revents & (POLLIN | POLLHUP)) - thread_process_io_helper(m, m->read[pfds[i].fd], POLLIN, -- i); -+ pfds[i].revents,i); - if (pfds[i].revents & POLLOUT) - thread_process_io_helper(m, m->write[pfds[i].fd], -- POLLOUT, i); -+ POLLOUT, pfds[i].revents, i); - - /* if one of our file descriptors is garbage, remove the same - * from --- -2.18.0 - diff --git a/src/sonic-frr/patch/0008-zebra-kernel-level-graceful-restart.patch b/src/sonic-frr/patch/0008-zebra-kernel-level-graceful-restart.patch deleted file mode 100644 index e2a68a3507..0000000000 --- a/src/sonic-frr/patch/0008-zebra-kernel-level-graceful-restart.patch +++ /dev/null @@ -1,227 +0,0 @@ - - zebra: Add kernel level graceful restart - - - - Add the a `--graceful_restart X` flag to zebra start that - now creates a timer that pops in X seconds and will go - through and remove all routes that are older than startup. - - If graceful_restart is not specified then we will just pop - a timer that cleans everything up immediately. - - Signed-off-by: Praveen Chaudhary - Signed-off-by: Donald Sharp - -diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst -index f38db9d24..40d894929 100644 ---- a/doc/user/zebra.rst -+++ b/doc/user/zebra.rst -@@ -23,9 +23,12 @@ Besides the common invocation options (:ref:`common-invocation-options`), the - Runs in batch mode. *zebra* parses configuration file and terminates - immediately. - --.. option:: -k, --keep_kernel -+.. option:: -K TIME, --graceful_restart TIME - -- When zebra starts up, don't delete old self inserted routes. -+ If this option is specified, the graceful restart time is TIME seconds. -+ Zebra, when started, will read in routes. Those routes that Zebra -+ identifies that it was the originator of will be swept in TIME seconds. -+ If no time is specified then we will sweep those routes immediately. - - .. option:: -r, --retain - -diff --git a/zebra/main.c b/zebra/main.c -index 184e798bd..3d1d156ad 100644 ---- a/zebra/main.c -+++ b/zebra/main.c -@@ -74,8 +74,7 @@ int retain_mode = 0; - /* Allow non-quagga entities to delete quagga routes */ - int allow_delete = 0; - --/* Don't delete kernel route. */ --int keep_kernel_mode = 0; -+int graceful_restart; - - bool v6_rr_semantics = false; - -@@ -89,12 +88,12 @@ uint32_t nl_rcvbufsize = 4194304; - struct option longopts[] = { - {"batch", no_argument, NULL, 'b'}, - {"allow_delete", no_argument, NULL, 'a'}, -- {"keep_kernel", no_argument, NULL, 'k'}, - {"socket", required_argument, NULL, 'z'}, - {"ecmp", required_argument, NULL, 'e'}, - {"label_socket", no_argument, NULL, 'l'}, - {"retain", no_argument, NULL, 'r'}, - {"vrfdefaultname", required_argument, NULL, 'o'}, -+ {"graceful_restart", required_argument, NULL, 'K'}, - #ifdef HAVE_NETLINK - {"vrfwnetns", no_argument, NULL, 'n'}, - {"nl-bufsize", required_argument, NULL, 's'}, -@@ -264,13 +263,14 @@ int main(int argc, char **argv) - char *netlink_fuzzing = NULL; - #endif /* HANDLE_NETLINK_FUZZING */ - -+ graceful_restart = 0; - vrf_configure_backend(VRF_BACKEND_VRF_LITE); - logicalrouter_configure_backend(LOGICALROUTER_BACKEND_NETNS); - - frr_preinit(&zebra_di, argc, argv); - - frr_opt_add( -- "bakz:e:l:o:r" -+ "baz:e:l:o:rK:" - #ifdef HAVE_NETLINK - "s:n" - #endif -@@ -282,24 +282,24 @@ int main(int argc, char **argv) - #endif /* HANDLE_NETLINK_FUZZING */ - , - longopts, -- " -b, --batch Runs in batch mode\n" -- " -a, --allow_delete Allow other processes to delete zebra routes\n" -- " -z, --socket Set path of zebra socket\n" -- " -e, --ecmp Specify ECMP to use.\n" -- " -l, --label_socket Socket to external label manager\n" -- " -k, --keep_kernel Don't delete old routes which were installed by zebra.\n" -- " -r, --retain When program terminates, retain added route by zebra.\n" -- " -o, --vrfdefaultname Set default VRF name.\n" -+ " -b, --batch Runs in batch mode\n" -+ " -a, --allow_delete Allow other processes to delete zebra routes\n" -+ " -z, --socket Set path of zebra socket\n" -+ " -e, --ecmp Specify ECMP to use.\n" -+ " -l, --label_socket Socket to external label manager\n" -+ " -r, --retain When program terminates, retain added route by zebra.\n" -+ " -o, --vrfdefaultname Set default VRF name.\n" -+ " -K, --graceful_restart Graceful restart at the kernel level, timer in seconds for expiration\n" - #ifdef HAVE_NETLINK -- " -n, --vrfwnetns Use NetNS as VRF backend\n" -- " -s, --nl-bufsize Set netlink receive buffer size\n" -- " --v6-rr-semantics Use v6 RR semantics\n" -+ " -n, --vrfwnetns Use NetNS as VRF backend\n" -+ " -s, --nl-bufsize Set netlink receive buffer size\n" -+ " --v6-rr-semantics Use v6 RR semantics\n" - #endif /* HAVE_NETLINK */ - #if defined(HANDLE_ZAPI_FUZZING) -- " -c Bypass normal startup and use this file for testing of zapi\n" -+ " -c Bypass normal startup and use this file for testing of zapi\n" - #endif /* HANDLE_ZAPI_FUZZING */ - #if defined(HANDLE_NETLINK_FUZZING) -- " -w Bypass normal startup and use this file for testing of netlink input\n" -+ " -w Bypass normal startup and use this file for testing of netlink input\n" - #endif /* HANDLE_NETLINK_FUZZING */ - ); - -@@ -318,9 +318,6 @@ int main(int argc, char **argv) - case 'a': - allow_delete = 1; - break; -- case 'k': -- keep_kernel_mode = 1; -- break; - case 'e': - multipath_num = atoi(optarg); - if (multipath_num > MULTIPATH_NUM -@@ -350,6 +347,9 @@ int main(int argc, char **argv) - case 'r': - retain_mode = 1; - break; -+ case 'K': -+ graceful_restart = atoi(optarg); -+ break; - #ifdef HAVE_NETLINK - case 's': - nl_rcvbufsize = atoi(optarg); -@@ -437,9 +437,9 @@ int main(int argc, char **argv) - * will be equal to the current getpid(). To know about such routes, - * we have to have route_read() called before. - */ -- if (!keep_kernel_mode) -- rib_sweep_route(); -- -+ zrouter.startup_time = monotime(NULL); -+ thread_add_timer(zrouter.master, rib_sweep_route, -+ NULL, graceful_restart, NULL); - /* Needed for BSD routing socket. */ - pid = getpid(); - -diff --git a/zebra/rib.h b/zebra/rib.h -index 9fe42aef3..69850f3a0 100644 ---- a/zebra/rib.h -+++ b/zebra/rib.h -@@ -351,7 +351,7 @@ extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, - extern void rib_update(vrf_id_t vrf_id, rib_update_event_t event); - extern void rib_update_table(struct route_table *table, - rib_update_event_t event); --extern void rib_sweep_route(void); -+extern int rib_sweep_route(struct thread *t); - extern void rib_sweep_table(struct route_table *table); - extern void rib_close_table(struct route_table *table); - extern void rib_init(void); -diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c -index 555127b09..b6afcdc8c 100644 ---- a/zebra/zebra_rib.c -+++ b/zebra/zebra_rib.c -@@ -3145,6 +3145,7 @@ void rib_sweep_table(struct route_table *table) - - for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) { - RNODE_FOREACH_RE_SAFE (rn, re, next) { -+ - if (IS_ZEBRA_DEBUG_RIB) - route_entry_dump(&rn->p, NULL, re); - -@@ -3154,6 +3155,14 @@ void rib_sweep_table(struct route_table *table) - if (!CHECK_FLAG(re->flags, ZEBRA_FLAG_SELFROUTE)) - continue; - -+ /* -+ * If routes are older than startup_time then -+ * we know we read them in from the kernel. -+ * As such we can safely remove them. -+ */ -+ if (zrouter.startup_time < re->uptime) -+ continue; -+ - /* - * So we are starting up and have received - * routes from the kernel that we have installed -@@ -3183,7 +3192,7 @@ void rib_sweep_table(struct route_table *table) - } - - /* Sweep all RIB tables. */ --void rib_sweep_route(void) -+int rib_sweep_route(struct thread *t) - { - struct vrf *vrf; - struct zebra_vrf *zvrf; -@@ -3197,6 +3206,8 @@ void rib_sweep_route(void) - } - - zebra_router_sweep_route(); -+ -+ return 0; - } - - /* Remove specific by protocol routes from 'table'. */ -diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h -index b316b91d0..b2e92bad0 100644 ---- a/zebra/zebra_router.h -+++ b/zebra/zebra_router.h -@@ -110,8 +110,15 @@ struct zebra_router { - * The EVPN instance, if any - */ - struct zebra_vrf *evpn_vrf; -+ -+ /* -+ * Time for when we sweep the rib from old routes -+ */ -+ time_t startup_time; - }; - -+#define GRACEFUL_RESTART_TIME 60 -+ - extern struct zebra_router zrouter; - - extern void zebra_router_init(void); diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index da0ab7ba47..233021ace5 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -1,7 +1,5 @@ 0001-Add-support-of-bgp-tcp-DSCP-value.patch 0002-Reduce-severity-of-Vty-connected-from-message.patch +0003-Use-vrf_id-for-vrf-not-tabled_id.patch 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch -0005-Support-VRF.patch 0006-changes-for-making-snmp-socket-non-blocking.patch -0007-prevent-dead-fd-poll-data-port-fix-from-frr.patch -0008-zebra-kernel-level-graceful-restart.patch \ No newline at end of file