diff --git a/dockers/docker-fpm-frr/docker_init.sh b/dockers/docker-fpm-frr/docker_init.sh index 1f1bc511dc8..d8058e9b5d8 100755 --- a/dockers/docker-fpm-frr/docker_init.sh +++ b/dockers/docker-fpm-frr/docker_init.sh @@ -41,6 +41,15 @@ update_default_gw() fi } +write_default_zebra_config() +{ + FILE_NAME=${1} + + grep -q '^no fpm use-next-hop-groups' $FILE_NAME || { + sed -i '1i no fpm use-next-hop-groups\nfpm address 127.0.0.1' $FILE_NAME + } +} + if [[ ! -z "$NAMESPACE_ID" ]]; then update_default_gw 4 update_default_gw 6 @@ -69,9 +78,11 @@ if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then elif [ "$CONFIG_TYPE" == "split" ]; then echo "no service integrated-vtysh-config" > /etc/frr/vtysh.conf rm -f /etc/frr/frr.conf + write_default_zebra_config /etc/frr/zebra.conf elif [ "$CONFIG_TYPE" == "split-unified" ]; then echo "service integrated-vtysh-config" > /etc/frr/vtysh.conf rm -f /etc/frr/bgpd.conf /etc/frr/zebra.conf /etc/frr/staticd.conf + write_default_zebra_config /etc/frr/frr.conf elif [ "$CONFIG_TYPE" == "unified" ]; then CFGGEN_PARAMS=" \ -d \ diff --git a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 index 105c03345b4..e7312466051 100644 --- a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 +++ b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 @@ -30,7 +30,7 @@ stderr_logfile=syslog dependent_startup=true [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl -M snmp priority=4 autostart=false autorestart=false diff --git a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 index 51d998e90d3..f5a56c316d4 100644 --- a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 @@ -6,6 +6,13 @@ ! {% endblock banner %} ! +{% block fpm %} +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +{% endblock fpm %} +! {% include "common/daemons.common.conf.j2" %} ! {% include "zebra.interfaces.conf.j2" %} diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 56180b51b1c..3c89327cb88 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -205,6 +205,8 @@ RUN touch /etc/quagga/zebra.conf # disable integrated vtysh config RUN rm /etc/frr/frr.conf +COPY ["frr/zebra.conf", "/etc/frr/"] + # Create /var/warmboot/teamd folder for teammgrd RUN mkdir -p /var/warmboot/teamd diff --git a/platform/vs/docker-sonic-vs/frr/zebra.conf b/platform/vs/docker-sonic-vs/frr/zebra.conf new file mode 100644 index 00000000000..4c994e60def --- /dev/null +++ b/platform/vs/docker-sonic-vs/frr/zebra.conf @@ -0,0 +1,4 @@ +no fpm use-next-hop-groups + +fpm address 127.0.0.1 + diff --git a/platform/vs/docker-sonic-vs/supervisord.conf.j2 b/platform/vs/docker-sonic-vs/supervisord.conf.j2 index ba63d2b77dd..bfaac71d630 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf.j2 +++ b/platform/vs/docker-sonic-vs/supervisord.conf.j2 @@ -164,7 +164,7 @@ environment=ASAN_OPTIONS="log_path=/var/log/asan/teammgrd-asan.log{{ asan_extra_ {% endif %} [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl priority=13 autostart=false autorestart=false diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf index ac2d8dac88f..797b9c29826 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf @@ -3,6 +3,12 @@ ! generated by templates/zebra/zebra.conf.j2 using config DB data ! file: zebra.conf ! +! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname new_hostname diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf index fb441f69f6f..b806cf44bb6 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf index 908280e2ddf..5952bc836a7 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf index 4024f4b340e..3643bcb8b1c 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname switch-t0 diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf index 7b7987650d6..1b1aa992e2d 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf index fc8a8a2fb3b..65c43fd706b 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname SpineFront01 diff --git a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf index f596c5579d3..5661b25dac9 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf @@ -4,6 +4,11 @@ ! file: zebra.conf ! ! +! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages +no fpm use-next-hop-groups +! +fpm address 127.0.0.1 +! ! template: common/daemons.common.conf.j2 ! hostname switch-t0 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 index f815cf38455..68d4fd0d34d 100644 --- 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 @@ -1,25 +1,48 @@ -From 39bb40dc4bad4462e4ae9c98580d75fa2c92e032 Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Mon, 16 Nov 2020 18:29:46 -0800 -Subject: [PATCH 3/8] Use vrf_id for vrf, not tabled_id +From 5dba497fb3810f9e5cb4b23bec151ec44d8dcec4 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Mon, 16 Jan 2023 11:24:16 +0000 +Subject: [PATCH] Use vrf_id for vrf, not tabled_id +Signed-off-by: Stepan Blyschak --- - zebra/zebra_fpm_netlink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + zebra/rt_netlink.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index ec22c5dd4..aad0156b3 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -287,7 +287,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, - ri->nlmsg_pid = zvrf->zns->netlink_dplane_out.snl.nl_pid; +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 24c01b7f5..d4567990e 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -1969,12 +1969,24 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, + #endif + /* Table corresponding to this route. */ + table_id = dplane_ctx_get_table(ctx); +- if (table_id < 256) +- req->r.rtm_table = table_id; +- else { +- req->r.rtm_table = RT_TABLE_UNSPEC; +- if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) +- return 0; ++ if (!fpm) { ++ if (table_id < 256) ++ req->r.rtm_table = table_id; ++ else { ++ req->r.rtm_table = RT_TABLE_UNSPEC; ++ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) ++ return 0; ++ } ++ } else { ++ /* Put vrf if_index instead of table id */ ++ vrf_id_t vrf = dplane_ctx_get_vrf(ctx); ++ if (vrf < 256) ++ req->r.rtm_table = vrf; ++ else { ++ req->r.rtm_table = RT_TABLE_UNSPEC; ++ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, vrf)) ++ return 0; ++ } + } - ri->nlmsg_type = cmd; -- ri->rtm_table = table_info->table_id; -+ ri->rtm_table = zvrf_id(rib_dest_vrf(dest)); - ri->rtm_protocol = RTPROT_UNSPEC; - - /* + if (IS_ZEBRA_DEBUG_KERNEL) -- -2.12.2 +2.30.2 diff --git a/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch index 5097ad513ef..5efd29fdcf0 100644 --- a/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch +++ b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch @@ -1,39 +1,40 @@ -From 74ee34e4990dbd168b7b8072894eb0cf8927f9d1 Mon Sep 17 00:00:00 2001 -From: Kishore Kunal -Date: Fri, 15 Jan 2021 15:52:13 -0800 -Subject: [PATCH 7/8] This is temp patch till Prefix to ARP indirection is - add in neighorch +From 369bbb4d62aa47d5a6d5157ca6ea819c4cb80f15 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:19:31 +0000 +Subject: [PATCH 07/13] Added support of L3VNI EVPN +This is temp patch till Prefix to ARP indirection is add in neighorch + +Signed-off-by: Kishore Kunal +Signed-off-by: Stepan Blyschak --- - lib/nexthop.c | 2 ++ - lib/nexthop.h | 6 ++++++ - zebra/rt_netlink.c | 2 +- - zebra/zapi_msg.c | 4 ++++ - zebra/zebra_dplane.c | 1 + - zebra/zebra_fpm_netlink.c | 20 ++++++++++++++++++++ - 6 files changed, 34 insertions(+), 1 deletion(-) + lib/nexthop.c | 1 + + lib/nexthop.h | 7 ++++++- + zebra/rt_netlink.c | 15 ++++++++++++++- + zebra/zapi_msg.c | 4 ++++ + zebra/zebra_dplane.c | 2 +- + 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c -index a1ce22e3b..6f3fe2a5f 100644 +index a1ce22e3b..10a87f072 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c -@@ -813,6 +813,8 @@ void nexthop_copy_no_recurse(struct nexthop *copy, +@@ -813,6 +813,7 @@ void nexthop_copy_no_recurse(struct nexthop *copy, memcpy(©->src, &nexthop->src, sizeof(nexthop->src)); memcpy(©->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src)); copy->rparent = rparent; + memcpy(©->nh_encap.encap_data.rmac, &nexthop->nh_encap.encap_data.rmac, ETH_ALEN); -+ if (nexthop->nh_label) nexthop_add_labels(copy, nexthop->nh_label_type, nexthop->nh_label->num_labels, diff --git a/lib/nexthop.h b/lib/nexthop.h -index 320b46315..0f98dc3c2 100644 +index 320b46315..77eea3674 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -66,6 +66,11 @@ enum nh_encap_type { /* Backup index value is limited */ #define NEXTHOP_BACKUP_IDX_MAX 255 - + +struct vxlan_nh_encap { + vni_t vni; + struct ethaddr rmac; @@ -42,27 +43,50 @@ index 320b46315..0f98dc3c2 100644 /* Nexthop structure. */ struct nexthop { struct nexthop *next; -@@ -136,6 +141,7 @@ struct nexthop { +@@ -135,7 +140,7 @@ struct nexthop { + /* Encapsulation information. */ enum nh_encap_type nh_encap_type; union { - vni_t vni; +- vni_t vni; + struct vxlan_nh_encap encap_data; } nh_encap; - + /* SR-TE color used for matching SR-TE policies */ diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c -index 24c01b7f5..5e0f4cd8f 100644 +index 03c84d6dc..a56a95276 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -1856,7 +1856,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, +@@ -1869,6 +1869,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, + struct nexthop *nh) + { + struct rtattr *nest; ++ struct vxlan_nh_encap* encap_data; + + switch (nh->nh_encap_type) { + case NET_VXLAN: +@@ -1879,9 +1880,21 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, + if (!nest) return false; - + ++ encap_data = &nh->nh_encap.encap_data; ++ if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, - nh->nh_encap.vni)) -+ nh->nh_encap.encap_data.vni)) ++ encap_data->vni)) ++ return false; ++ ++ if (ZEBRA_DEBUG_KERNEL) ++ zlog_debug( ++ "%s: VNI:%d RMAC:%pEA", __func__, encap_data->vni, ++ &encap_data->rmac); ++ ++ if (!nl_attr_put(n, nlen, 1 /* VXLAN_RMAC */, ++ &encap_data->rmac, sizeof(encap_data->rmac))) return false; ++ nl_attr_nest_end(n, nest); break; + } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 5cf7d815d..529cbb44b 100644 --- a/zebra/zapi_msg.c @@ -86,80 +110,18 @@ index 5cf7d815d..529cbb44b 100644 api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); } diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c -index 656ebcf3b..8d125d77e 100644 +index 656ebcf3b..bd59df189 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c -@@ -2421,6 +2421,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, +@@ -2420,7 +2420,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + zl3vni = zl3vni_from_vrf(nexthop->vrf_id); if (zl3vni && is_l3vni_oper_up(zl3vni)) { nexthop->nh_encap_type = NET_VXLAN; - nexthop->nh_encap.vni = zl3vni->vni; +- nexthop->nh_encap.vni = zl3vni->vni; + nexthop->nh_encap.encap_data.vni = zl3vni->vni; } } - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index aad0156b3..34be9fb39 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -95,10 +95,12 @@ static const char *fpm_nh_encap_type_to_str(enum fpm_nh_encap_type_t encap_type) - - struct vxlan_encap_info_t { - vni_t vni; -+ struct ethaddr rmac; - }; - - enum vxlan_encap_info_type_t { - VXLAN_VNI = 0, -+ VXLAN_RMAC = 1, - }; - - struct fpm_nh_encap_info_t { -@@ -234,6 +236,9 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, - } - - nhi.encap_info.vxlan_encap.vni = vni; -+ memcpy(&nhi.encap_info.vxlan_encap.rmac, -+ &(nexthop->nh_encap.encap_data.rmac), -+ ETH_ALEN); - } - - /* -@@ -456,9 +461,16 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, - nl_attr_put16(&req->n, in_buf_len, RTA_ENCAP_TYPE, - encap); - vxlan = &nhi->encap_info.vxlan_encap; -+ char buf[ETHER_ADDR_STRLEN]; -+ -+ zfpm_debug( -+ "%s: VNI:%d RMAC:%s", __func__, vxlan->vni, -+ prefix_mac2str(&vxlan->rmac, buf, sizeof(buf))); - nest = nl_attr_nest(&req->n, in_buf_len, RTA_ENCAP); - nl_attr_put32(&req->n, in_buf_len, VXLAN_VNI, - vxlan->vni); -+ nl_attr_put(&req->n, in_buf_len, VXLAN_RMAC, -+ &vxlan->rmac, sizeof(vxlan->rmac)); - nl_attr_nest_end(&req->n, nest); - break; - } -@@ -494,10 +506,18 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, - nl_attr_put16(&req->n, in_buf_len, RTA_ENCAP_TYPE, - encap); - vxlan = &nhi->encap_info.vxlan_encap; -+ char rmac_buf[ETHER_ADDR_STRLEN]; -+ -+ zfpm_debug("%s: Multi VNI:%d RMAC:%s", __func__, -+ vxlan->vni, -+ prefix_mac2str(&vxlan->rmac, rmac_buf, -+ sizeof(rmac_buf))); - inner_nest = - nl_attr_nest(&req->n, in_buf_len, RTA_ENCAP); - nl_attr_put32(&req->n, in_buf_len, VXLAN_VNI, - vxlan->vni); -+ nl_attr_put(&req->n, in_buf_len, VXLAN_RMAC, -+ &vxlan->rmac, sizeof(vxlan->rmac)); - nl_attr_nest_end(&req->n, inner_nest); - break; - } --- -2.12.2 + +-- +2.30.2 diff --git a/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch b/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch index b90092446fe..6af5bfc4578 100644 --- a/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch +++ b/src/sonic-frr/patch/0009-ignore-route-from-default-table.patch @@ -1,54 +1,32 @@ -commit 8b78a43ba243df281f2096a84893ad87cb2a79ff -Author: Stephen Xu -Date: Wed Nov 16 16:07:37 2022 -0500 +From ca66350aecf7db3354019480d11754fabae3a97c Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:07:18 +0000 +Subject: [PATCH 09/13] ignore route from default table - [PATCH] ignore route from default table +Signed-off-by: Stepan Blyschak +--- + zebra/dplane_fpm_nl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) - Signed-off-by: Stephen Xu +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 3b02128c9..da8504adf 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -699,6 +699,15 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx) + || op == DPLANE_OP_NH_UPDATE)) + return 0; -diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c -index 43958fdfd..de7e246d4 100644 ---- a/zebra/zebra_fpm.c -+++ b/zebra/zebra_fpm.c -@@ -25,6 +25,7 @@ - - #include "log.h" - #include "libfrr.h" -+#include "rib.h" - #include "stream.h" - #include "thread.h" - #include "network.h" -@@ -1016,8 +1017,15 @@ static int zfpm_build_route_updates(void) - else - zfpm_g->stats.route_dels++; - } else { -- zlog_err("%s: Encoding Prefix: %pRN No valid nexthops", -- __func__, dest->rnode); -+ struct rib_table_info *table_info = -+ rib_table_info(rib_dest_table(dest)); -+ if (table_info && table_info->table_id == RT_TABLE_DEFAULT) { -+ zfpm_debug("%s: Skip encoding default table prefix: %pRN", -+ __func__, dest->rnode); -+ } else { -+ zlog_err("%s: Encoding Prefix: %pRN No valid nexthops", -+ __func__, dest->rnode); -+ } - } - } - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index ec22c5dd4..53e5f59fb 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -278,6 +278,11 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, - rib_table_info(rib_dest_table(dest)); - struct zebra_vrf *zvrf = table_info->zvrf; - -+ if (table_info->table_id == RT_TABLE_DEFAULT) { -+ zfpm_debug("%s: Discard default table route", __func__); -+ return 0; -+ } ++ /* ++ * Ignore route from default table, because when mgmt port goes down, ++ * zebra will remove the default route and causing ASIC to blackhole IO. ++ */ ++ if (dplane_ctx_get_table(ctx) == RT_TABLE_DEFAULT) { ++ zlog_debug("%s: discard default table route", __func__); ++ return 0; ++ } + - memset(ri, 0, sizeof(*ri)); - - ri->prefix = rib_dest_prefix(dest); + nl_buf_len = 0; + + frr_mutex_lock_autounlock(&fnc->obuf_mutex); +-- +2.30.2 diff --git a/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch b/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch new file mode 100644 index 00000000000..9a412d24ee8 --- /dev/null +++ b/src/sonic-frr/patch/0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch @@ -0,0 +1,62 @@ +From 551fa8c3549e24020dfce33d06ade4a14f72abfe Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Mon, 14 Nov 2022 08:28:45 -0500 +Subject: [PATCH] zebra: Fix dplane_fpm_nl to allow for fast configuration + +If you have this order in your configuration file: + +no fpm use-next-hop-groups +fpm address 127.0.0.1 + +the dplane code was using the same event thread t_event and the second +add event in the code was going, you already have an event scheduled +and as such the second event does not overwrite it. Leaving +no code to actually start the whole processing. There are probably +other cli iterations that will cause this fun as well, but I'm +not going to spend the time sussing them out at the moment. + +Fixes: #12314 +Signed-off-by: Donald Sharp +--- + zebra/dplane_fpm_nl.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 7383c982baa..c5e1c113cb0 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -98,6 +98,7 @@ struct fpm_nl_ctx { + struct thread *t_read; + struct thread *t_write; + struct thread *t_event; ++ struct thread *t_nhg; + struct thread *t_dequeue; + + /* zebra events. */ +@@ -271,7 +272,7 @@ DEFUN(fpm_use_nhg, fpm_use_nhg_cmd, + return CMD_SUCCESS; + + thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, +- FNE_TOGGLE_NHG, &gfnc->t_event); ++ FNE_TOGGLE_NHG, &gfnc->t_nhg); + + return CMD_SUCCESS; + } +@@ -287,7 +288,7 @@ DEFUN(no_fpm_use_nhg, no_fpm_use_nhg_cmd, + return CMD_SUCCESS; + + thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, +- FNE_TOGGLE_NHG, &gfnc->t_event); ++ FNE_TOGGLE_NHG, &gfnc->t_nhg); + + return CMD_SUCCESS; + } +@@ -1367,6 +1368,8 @@ static int fpm_nl_finish_early(struct fpm_nl_ctx *fnc) + THREAD_OFF(fnc->t_ribwalk); + THREAD_OFF(fnc->t_rmacreset); + THREAD_OFF(fnc->t_rmacwalk); ++ THREAD_OFF(fnc->t_event); ++ THREAD_OFF(fnc->t_nhg); + thread_cancel_async(fnc->fthread->master, &fnc->t_read, NULL); + thread_cancel_async(fnc->fthread->master, &fnc->t_write, NULL); + thread_cancel_async(fnc->fthread->master, &fnc->t_connect, NULL); diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index d7d7046ee6f..01197120ef2 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -12,3 +12,4 @@ cross-compile-changes.patch 0010-zebra-Note-when-the-netlink-DUMP-command-is-interrup.patch 0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch 0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch +0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch