From 1ccee478e226844f3098ebc48d1e7bbfe1cba589 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 23 Jan 2024 08:43:43 -0800 Subject: [PATCH] Revert "[202311] Revert bgp suppress fib pending" (#17882) --- .../docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 1 + .../frr/supervisord/supervisord.conf.j2 | 2 +- .../vs/docker-sonic-vs/supervisord.conf.j2 | 2 +- src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py | 5 +- .../data/sonic-cfggen/bgpd.conf.j2/all.conf | 1 + .../sonic-cfggen/bgpd.main.conf.j2/all.conf | 1 + .../sonic-cfggen/bgpd.main.conf.j2/base.conf | 1 + .../bgpd.main.conf.j2/defaults.conf | 1 + .../bgpd.main.conf.j2/ipv6_lo.conf | 1 + .../bgpd.main.conf.j2/packet_chassis.conf | 1 + .../bgpd.main.conf.j2/voq_chassis.conf | 1 + .../data/sonic-cfggen/frr.conf.j2/all.conf | 1 + src/sonic-config-engine/minigraph.py | 6 +- .../tests/sample_output/py2/bgpd_frr.conf | 1 + .../py2/bgpd_frr_backend_asic.conf | 1 + .../sample_output/py2/bgpd_frr_dualtor.conf | 1 + .../py2/bgpd_frr_frontend_asic.conf | 1 + .../tests/sample_output/py2/frr.conf | 1 + .../sample_output/py2/t2-chassis-fe-bgpd.conf | 1 + .../tests/sample_output/py3/bgpd_frr.conf | 1 + .../py3/bgpd_frr_backend_asic.conf | 1 + .../sample_output/py3/bgpd_frr_dualtor.conf | 1 + .../py3/bgpd_frr_frontend_asic.conf | 1 + .../tests/sample_output/py3/frr.conf | 1 + .../sample_output/py3/t2-chassis-fe-bgpd.conf | 1 + .../0005-Add-support-of-bgp-l3vni-evpn.patch | 121 +++++++++++++ ...0007-ignore-route-from-default-table.patch | 31 ++++ ...008-Use-vrf_id-for-vrf-not-tabled_id.patch | 111 ++++++++++++ ..._lookup_by_tableid-to-zebra_vrf_look.patch | 56 +++--- ...fpm-Use-vrf_id-for-vrf-not-tabled_id.patch | 25 --- ...-fpm-ignore-route-from-default-table.patch | 29 ---- .../0036-Add-support-of-bgp-l3vni-evpn.patch | 164 ------------------ src/sonic-frr/patch/series | 6 +- .../tests/device_metadata.json | 10 ++ .../tests_config/device_metadata.json | 30 ++++ .../yang-models/sonic-device_metadata.yang | 12 ++ 36 files changed, 375 insertions(+), 256 deletions(-) create mode 100644 src/sonic-frr/patch/0005-Add-support-of-bgp-l3vni-evpn.patch create mode 100644 src/sonic-frr/patch/0007-ignore-route-from-default-table.patch create mode 100644 src/sonic-frr/patch/0008-Use-vrf_id-for-vrf-not-tabled_id.patch delete mode 100644 src/sonic-frr/patch/0034-fpm-Use-vrf_id-for-vrf-not-tabled_id.patch delete mode 100644 src/sonic-frr/patch/0035-fpm-ignore-route-from-default-table.patch delete mode 100644 src/sonic-frr/patch/0036-Add-support-of-bgp-l3vni-evpn.patch diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index f13c11f91e48..793ab055c215 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -66,6 +66,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% block bgp_init %} bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy {% if (DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('subtype' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['subtype'].lower() == 'dualtor') %} diff --git a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 index 00b24d697f50..0b26be8d3c45 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 --asic-offload=notify_on_offload priority=4 autostart=false autorestart=false diff --git a/platform/vs/docker-sonic-vs/supervisord.conf.j2 b/platform/vs/docker-sonic-vs/supervisord.conf.j2 index d8c1cf368113..5b988a5a5d92 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 --asic-offload=notify_on_offload priority=13 autostart=false autorestart=false diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py index b15f841f6166..e88dc60b8c55 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py @@ -304,10 +304,11 @@ def apply_op(self, cmd, vrf): :return: True if no errors, False if there are errors """ bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] + enable_bgp_suppress_fib_pending_cmd = 'bgp suppress-fib-pending' if vrf == 'default': - cmd = ('router bgp %s\n' % bgp_asn) + cmd + cmd = ('router bgp %s\n %s\n' % (bgp_asn, enable_bgp_suppress_fib_pending_cmd)) + cmd else: - cmd = ('router bgp %s vrf %s\n' % (bgp_asn, vrf)) + cmd + cmd = ('router bgp %s vrf %s\n %s\n' % (bgp_asn, vrf, enable_bgp_suppress_fib_pending_cmd)) + cmd self.cfg_mgr.push(cmd) return True diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index c39115706d79..a7f34245873a 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -55,6 +55,7 @@ route-map HIDE_INTERNAL permit 20 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index c5ba79d34392..d2dc9e40e892 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf index 77cc9d6fffd8..27d04b953a3e 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf @@ -12,6 +12,7 @@ ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index 00b09bd40d9a..b85dd67a5ca0 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf index 50414a89a389..5ee5ce5443aa 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf @@ -14,6 +14,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00::1/128 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf index a949ce6e4512..6b2e1f257948 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf index 0d9eeebe9e8e..efd45eda1ea9 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index af2e974ee9b7..8856e58db686 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -71,6 +71,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index dfdb9406dd49..1cadd297e527 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -608,7 +608,7 @@ def parse_dpg(dpg, hname): else: prefix = prefix + "/32" static_routes[prefix] = {'nexthop': ",".join(nexthop), 'ifname': ",".join(ifname), 'advertise': advertise} - + if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] for subnet_range in ip_intfs_map: @@ -2131,6 +2131,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw if current_device and current_device['type'] in mgmt_device_types: results["FLEX_COUNTER_TABLE"] = {counter: {"FLEX_COUNTER_STATUS": "disable"} for counter in mgmt_disabled_counters} + # Enable bgp-suppress-fib by default for leafrouter + if current_device and current_device['type'] in leafrouter_device_types: + results['DEVICE_METADATA']['localhost']['suppress-fib-pending'] = 'enabled' + return results def get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, tunnel_qos_remap, mux_tunnel_name, peer_switch_ip): diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf index 2c146698a960..3828af13fd71 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf index d793dfa39a98..45cd03a540a8 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_dualtor.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_dualtor.conf index 364a2c34bcaa..eda11ab9f285 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_dualtor.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_dualtor.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy coalesce-time 10000 diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf index 94bd37e3b90f..8daeff2a61e9 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 2653f8fc0893..032adb8c5106 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -62,6 +62,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf index 20744efaa40f..32a9abf88bac 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf @@ -58,6 +58,7 @@ ip prefix-list PL_LoopbackV4 permit 4.0.0.0/32 router bgp 4000 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf index e7534d4b9781..e5ad8964454a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf index d793dfa39a98..45cd03a540a8 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_dualtor.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_dualtor.conf index 4f606b80838c..0ada9a4f8d60 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_dualtor.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_dualtor.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy coalesce-time 10000 diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf index 94bd37e3b90f..8daeff2a61e9 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 5b7eacefe8ba..d0821f1b11ca 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -62,6 +62,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf index 20744efaa40f..32a9abf88bac 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf @@ -58,6 +58,7 @@ ip prefix-list PL_LoopbackV4 permit 4.0.0.0/32 router bgp 4000 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-frr/patch/0005-Add-support-of-bgp-l3vni-evpn.patch b/src/sonic-frr/patch/0005-Add-support-of-bgp-l3vni-evpn.patch new file mode 100644 index 000000000000..fe2636c2e289 --- /dev/null +++ b/src/sonic-frr/patch/0005-Add-support-of-bgp-l3vni-evpn.patch @@ -0,0 +1,121 @@ +From f5f0018266c98ad96cdbe69ae60d501de21e5600 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:19:31 +0000 +Subject: [PATCH] From 369bbb4d62aa47d5a6d5157ca6ea819c4cb80f15 Mon Sep 17 + 00:00:00 2001 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 + +diff --git a/lib/nexthop.c b/lib/nexthop.c +index 7ebc4fefb..2f7bb0e7b 100644 +--- a/lib/nexthop.c ++++ b/lib/nexthop.c +@@ -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 f1309aa52..7b4bbbafd 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; ++}; ++ + /* Nexthop structure. */ + struct nexthop { + struct nexthop *next; +@@ -137,7 +142,7 @@ struct nexthop { + /* Encapsulation information. */ + enum nh_encap_type nh_encap_type; + union { +- 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 79d79d74b..325199eff 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -1969,6 +1969,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: +@@ -1979,9 +1980,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)) ++ 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 c0945eae2..157c33ced 100644 +--- a/zebra/zapi_msg.c ++++ b/zebra/zapi_msg.c +@@ -1605,6 +1605,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh, + vtep_ip.ipa_type = IPADDR_V4; + memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4), + sizeof(struct in_addr)); ++ memcpy(&(nexthop->nh_encap.encap_data.rmac), ++ &api_nh->rmac, ETH_ALEN); + zebra_rib_queue_evpn_route_add( + api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN); +@@ -1639,6 +1641,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh, + vtep_ip.ipa_type = IPADDR_V6; + memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6), + sizeof(struct in6_addr)); ++ memcpy(&(nexthop->nh_encap.encap_data.rmac), ++ &api_nh->rmac, ETH_ALEN); + zebra_rib_queue_evpn_route_add( + api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN); +diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c +index f6f436f39..c8511bd28 100644 +--- a/zebra/zebra_dplane.c ++++ b/zebra/zebra_dplane.c +@@ -2917,7 +2917,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.encap_data.vni = zl3vni->vni; + } + } + +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0007-ignore-route-from-default-table.patch b/src/sonic-frr/patch/0007-ignore-route-from-default-table.patch new file mode 100644 index 000000000000..52167d765287 --- /dev/null +++ b/src/sonic-frr/patch/0007-ignore-route-from-default-table.patch @@ -0,0 +1,31 @@ +From 1a639f2dcd400997345dab424a2adbc091752661 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 13:07:18 +0000 +Subject: [PATCH] From ca66350aecf7db3354019480d11754fabae3a97c Mon Sep 17 + 00:00:00 2001 Subject: [PATCH 09/13] ignore route from default table + +Signed-off-by: Stepan Blyschak + +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 0a9fecc9d..b18a96353 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -814,6 +814,15 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx) + || op == DPLANE_OP_NH_UPDATE)) + 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; ++ } ++ + nl_buf_len = 0; + + frr_mutex_lock_autounlock(&fnc->obuf_mutex); +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0008-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0008-Use-vrf_id-for-vrf-not-tabled_id.patch new file mode 100644 index 000000000000..ae8b05f06bd0 --- /dev/null +++ b/src/sonic-frr/patch/0008-Use-vrf_id-for-vrf-not-tabled_id.patch @@ -0,0 +1,111 @@ +From 44f3736ee601e06e43e978fa075402c3da4823bd Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Mon, 16 Jan 2023 11:45:19 +0000 +Subject: [PATCH] From 349e3f758860be0077b69919c39764d3486ec44a Mon Sep 17 + 00:00:00 2001 Subject: [PATCH] use vrf id instead of table id + +Signed-off-by: Stepan Blyschak + +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 325199eff..587045eac 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -406,6 +406,30 @@ vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id) + return VRF_DEFAULT; + } + ++static uint32_t table_lookup_by_vrf(vrf_id_t vrf_id, ns_id_t ns_id) ++{ ++ struct vrf *vrf; ++ struct zebra_vrf *zvrf; ++ ++ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { ++ zvrf = vrf->info; ++ if (zvrf == NULL) ++ continue; ++ /* case vrf with netns : match the netnsid */ ++ if (vrf_is_backend_netns()) { ++ if (ns_id == zvrf_id(zvrf)) ++ return zvrf->table_id; ++ } else { ++ /* VRF is VRF_BACKEND_VRF_LITE */ ++ if (zvrf_id(zvrf) != vrf_id) ++ continue; ++ return zvrf->table_id; ++ } ++ } ++ ++ return RT_TABLE_UNSPEC; ++} ++ + /** + * @parse_encap_mpls() - Parses encapsulated mpls attributes + * @tb: Pointer to rtattr to look for nested items in. +@@ -782,14 +806,26 @@ int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, + if (rtm->rtm_family == AF_MPLS) + return 0; + +- /* Table corresponding to route. */ +- if (tb[RTA_TABLE]) +- table = *(int *)RTA_DATA(tb[RTA_TABLE]); +- else +- table = rtm->rtm_table; ++ if (!ctx) { ++ /* Table corresponding to route. */ ++ if (tb[RTA_TABLE]) ++ table = *(int *)RTA_DATA(tb[RTA_TABLE]); ++ else ++ table = rtm->rtm_table; ++ ++ /* Map to VRF */ ++ vrf_id = vrf_lookup_by_table(table, ns_id); ++ } else { ++ /* With FPM, rtm_table contains vrf id, see netlink_route_multipath_msg_encode */ ++ if (tb[RTA_TABLE]) ++ vrf_id = *(int *)RTA_DATA(tb[RTA_TABLE]); ++ else ++ vrf_id = rtm->rtm_table; ++ ++ /* Map to table */ ++ table = table_lookup_by_vrf(vrf_id, ns_id); ++ } + +- /* Map to VRF */ +- vrf_id = vrf_lookup_by_table(table, ns_id); + if (vrf_id == VRF_DEFAULT) { + if (!is_zebra_valid_kernel_table(table) + && !is_zebra_main_routing_table(table)) +@@ -2102,12 +2138,24 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, + + /* 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; ++ } + } + + if (IS_ZEBRA_DEBUG_KERNEL) +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0012-zebra-Rename-vrf_lookup_by_tableid-to-zebra_vrf_look.patch b/src/sonic-frr/patch/0012-zebra-Rename-vrf_lookup_by_tableid-to-zebra_vrf_look.patch index 01f8d04c2b78..ca6517fbf655 100644 --- a/src/sonic-frr/patch/0012-zebra-Rename-vrf_lookup_by_tableid-to-zebra_vrf_look.patch +++ b/src/sonic-frr/patch/0012-zebra-Rename-vrf_lookup_by_tableid-to-zebra_vrf_look.patch @@ -1,4 +1,4 @@ -From 6a3ae11c9b1480966b22d4f9b67a40b76d96aa15 Mon Sep 17 00:00:00 2001 +From 2b9c7592a9857ddccc77b9d3f178e0c5bd5f19ed Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 26 Apr 2023 23:25:27 -0400 Subject: [PATCH] zebra: Rename vrf_lookup_by_tableid to zebra_vrf_lookup.. @@ -9,19 +9,12 @@ we need zebra specific data to find this vrf_id and as such it does not belong in vrf.c Signed-off-by: Donald Sharp ---- - zebra/if_netlink.c | 3 ++- - zebra/rt_netlink.c | 31 ++----------------------------- - zebra/rt_netlink.h | 1 - - zebra/zebra_vrf.c | 27 +++++++++++++++++++++++++++ - zebra/zebra_vrf.h | 1 + - 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c -index cd200d821d7a..cea47b4c30af 100644 +index 81347b550a..4599121261 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c -@@ -325,7 +325,8 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, +@@ -342,7 +342,8 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, if (!vrf_lookup_by_id((vrf_id_t)ifi->ifi_index)) { vrf_id_t exist_id; @@ -32,10 +25,10 @@ index cd200d821d7a..cea47b4c30af 100644 vrf = vrf_lookup_by_id(exist_id); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c -index de01ced411ef..0f542ab80756 100644 +index 587045eac2..6b9b047858 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -380,33 +380,6 @@ static inline int proto2zebra(int proto, int family, bool is_nexthop) +@@ -379,33 +379,6 @@ static inline int proto2zebra(int proto, int family, bool is_nexthop) return proto; } @@ -66,19 +59,19 @@ index de01ced411ef..0f542ab80756 100644 - return VRF_DEFAULT; -} - - /** - * @parse_encap_mpls() - Parses encapsulated mpls attributes - * @tb: Pointer to rtattr to look for nested items in. -@@ -790,7 +763,7 @@ int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, - table = rtm->rtm_table; + static uint32_t table_lookup_by_vrf(vrf_id_t vrf_id, ns_id_t ns_id) + { + struct vrf *vrf; +@@ -814,7 +787,7 @@ int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, + table = rtm->rtm_table; - /* Map to VRF */ -- vrf_id = vrf_lookup_by_table(table, ns_id); -+ vrf_id = zebra_vrf_lookup_by_table(table, ns_id); - if (vrf_id == VRF_DEFAULT) { - if (!is_zebra_valid_kernel_table(table) - && !is_zebra_main_routing_table(table)) -@@ -1079,7 +1052,7 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h, + /* Map to VRF */ +- vrf_id = vrf_lookup_by_table(table, ns_id); ++ vrf_id = zebra_vrf_lookup_by_table(table, ns_id); + } else { + /* With FPM, rtm_table contains vrf id, see netlink_route_multipath_msg_encode */ + if (tb[RTA_TABLE]) +@@ -1114,7 +1087,7 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h, else table = rtm->rtm_table; @@ -88,10 +81,10 @@ index de01ced411ef..0f542ab80756 100644 if (tb[RTA_IIF]) iif = *(int *)RTA_DATA(tb[RTA_IIF]); diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h -index 3ca59ce676f3..d9d0ee76249a 100644 +index 8506367ae4..364aac0f6b 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h -@@ -90,7 +90,6 @@ extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns, +@@ -102,7 +102,6 @@ extern int netlink_macfdb_read_specific_mac(struct zebra_ns *zns, uint16_t vid); extern int netlink_neigh_read_specific_ip(const struct ipaddr *ip, struct interface *vlan_if); @@ -100,10 +93,10 @@ index 3ca59ce676f3..d9d0ee76249a 100644 struct nl_batch; extern enum netlink_msg_status diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c -index 3365cdcdbaa8..74b9d106cdc3 100644 +index be5e91495f..c59cb7c0a7 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c -@@ -376,6 +376,33 @@ struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf) +@@ -389,6 +389,33 @@ struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf) return zvrf; } @@ -138,10 +131,10 @@ index 3365cdcdbaa8..74b9d106cdc3 100644 struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id) { diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h -index b23b7282610b..aef83cd8f172 100644 +index 02e3c197c9..937e7fb144 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h -@@ -237,6 +237,7 @@ extern struct route_table *zebra_vrf_get_table_with_table_id(afi_t afi, +@@ -252,6 +252,7 @@ extern struct route_table *zebra_vrf_get_table_with_table_id(afi_t afi, extern void zebra_vrf_update_all(struct zserv *client); extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id); extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *); @@ -149,3 +142,6 @@ index b23b7282610b..aef83cd8f172 100644 extern struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf); extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t); +-- +2.17.1 + diff --git a/src/sonic-frr/patch/0034-fpm-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0034-fpm-Use-vrf_id-for-vrf-not-tabled_id.patch deleted file mode 100644 index f815cf38455e..000000000000 --- a/src/sonic-frr/patch/0034-fpm-Use-vrf_id-for-vrf-not-tabled_id.patch +++ /dev/null @@ -1,25 +0,0 @@ -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 - ---- - zebra/zebra_fpm_netlink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -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; - - 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; - - /* --- -2.12.2 - diff --git a/src/sonic-frr/patch/0035-fpm-ignore-route-from-default-table.patch b/src/sonic-frr/patch/0035-fpm-ignore-route-from-default-table.patch deleted file mode 100644 index e925b9908fb6..000000000000 --- a/src/sonic-frr/patch/0035-fpm-ignore-route-from-default-table.patch +++ /dev/null @@ -1,29 +0,0 @@ -From bb3b003840959adf5b5be52e91bc798007c9857a Mon Sep 17 00:00:00 2001 -From: Ying Xie -Date: Thu, 8 Sep 2022 04:20:36 +0000 -Subject: [PATCH] From 776a29e8ab32c1364ee601a8730aabb773b0c86b Mon Sep 17 - 00:00:00 2001 Subject: [PATCH] ignore route from default table - -Signed-off-by: Ying Xie ---- - zebra/zebra_fpm_netlink.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index 34be9fb39..d6c875a7e 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -283,6 +283,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; -+ } -+ - memset(ri, 0, sizeof(*ri)); - - ri->prefix = rib_dest_prefix(dest); --- -2.17.1 diff --git a/src/sonic-frr/patch/0036-Add-support-of-bgp-l3vni-evpn.patch b/src/sonic-frr/patch/0036-Add-support-of-bgp-l3vni-evpn.patch deleted file mode 100644 index 01d4df820739..000000000000 --- a/src/sonic-frr/patch/0036-Add-support-of-bgp-l3vni-evpn.patch +++ /dev/null @@ -1,164 +0,0 @@ -From b1b2e40cf43a9d206e2d867bdec4f0f7b740c8b9 Mon Sep 17 00:00:00 2001 -From: stepanb -Date: Tue, 19 Dec 2023 11:27:37 +0000 -Subject: [PATCH] Add support of bgp l3vni evpn - ---- - 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(-) - -diff --git a/lib/nexthop.c b/lib/nexthop.c -index 7ebc4fefb..fe42b9f86 100644 ---- a/lib/nexthop.c -+++ b/lib/nexthop.c -@@ -813,6 +813,8 @@ 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 f1309aa52..7026ce1c2 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; -+}; -+ - /* Nexthop structure. */ - struct nexthop { - struct nexthop *next; -@@ -138,6 +143,7 @@ struct nexthop { - enum nh_encap_type nh_encap_type; - union { - 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 d31732a55..581255158 100644 ---- a/zebra/rt_netlink.c -+++ b/zebra/rt_netlink.c -@@ -1991,7 +1991,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, - return false; - - if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, -- nh->nh_encap.vni)) -+ nh->nh_encap.encap_data.vni)) - return false; - nl_attr_nest_end(n, nest); - break; -diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c -index c0945eae2..157c33ced 100644 ---- a/zebra/zapi_msg.c -+++ b/zebra/zapi_msg.c -@@ -1605,6 +1605,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh, - vtep_ip.ipa_type = IPADDR_V4; - memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4), - sizeof(struct in_addr)); -+ memcpy(&(nexthop->nh_encap.encap_data.rmac), -+ &api_nh->rmac, ETH_ALEN); - zebra_rib_queue_evpn_route_add( - api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN); -@@ -1639,6 +1641,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh, - vtep_ip.ipa_type = IPADDR_V6; - memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6), - sizeof(struct in6_addr)); -+ memcpy(&(nexthop->nh_encap.encap_data.rmac), -+ &api_nh->rmac, ETH_ALEN); - zebra_rib_queue_evpn_route_add( - api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p); - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN); -diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c -index 34d30484a..260a7b497 100644 ---- a/zebra/zebra_dplane.c -+++ b/zebra/zebra_dplane.c -@@ -3394,6 +3394,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, - if (zl3vni && is_l3vni_oper_up(zl3vni)) { - nexthop->nh_encap_type = NET_VXLAN; - 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 ec6090da9..22650eedc 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.30.2 - diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index e2f5bc28a91f..c87c5e61f986 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -2,9 +2,12 @@ 0002-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch 0003-nexthops-compare-vrf-only-if-ip-type.patch 0004-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch +0005-Add-support-of-bgp-l3vni-evpn.patch 0006-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch Disable-ipv6-src-address-test-in-pceplib.patch cross-compile-changes.patch +0007-ignore-route-from-default-table.patch +0008-Use-vrf_id-for-vrf-not-tabled_id.patch 0009-bgpd-Ensure-suppress-fib-pending-works-with-network-.patch 0010-bgpd-Change-log-level-for-graceful-restart-events.patch 0011-zebra-Static-routes-async-notification-do-not-need-t.patch @@ -29,6 +32,3 @@ cross-compile-changes.patch 0030-bgpd-Treat-EOR-as-withdrawn-to-avoid-unwanted-handli.patch 0031-bgpd-Ignore-handling-NLRIs-if-we-received-MP_UNREACH.patch 0032-zebra-Fix-fpm-multipath-encap-addition.patch -0034-fpm-Use-vrf_id-for-vrf-not-tabled_id.patch -0035-fpm-ignore-route-from-default-table.patch -0036-Add-support-of-bgp-l3vni-evpn.patch diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index 65288b8b2db8..141d8b5c8230 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -126,6 +126,16 @@ "DEVICE_METADATA_ADVERTISE_LO_PREFIX_AS_128": { "desc": "Verifying advertising lo prefix as /128." }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "desc": "Enable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "desc": "Disable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "desc": "Enable bgp-suppress-fib-pending when synchronous mode is disabled", + "eStr": ["ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"] + }, "DEVICE_METADATA_VALID_RACK_MGMT_MAP": { "desc": "Verifying rack_mgmt_map configuration." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index b8053aa6ac66..941077205df6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -333,6 +333,36 @@ } } }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "enable", + "suppress-fib-pending": "enabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-fib-pending": "disabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-fib-pending": "enabled" + } + } + } + }, "DEVICE_METADATA_VALID_RACK_MGMT_MAP": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 392bbf941f6f..26e20d196a88 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -205,6 +205,18 @@ module sonic-device_metadata { By default SONiC advertises /128 subnet prefix in Loopback0 as /64 subnet route"; } + leaf suppress-fib-pending { + description "Enable BGP suppress FIB pending feature. BGP will wait for route FIB installation before announcing routes"; + type enumeration { + enum enabled; + enum disabled; + } + default disabled; + + must "((current() = 'disabled') or (current() = 'enabled' and ../synchronous_mode = 'enable'))" { + error-message "ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"; + } + } leaf rack_mgmt_map { type string { length 0..128 {