diff --git a/.gitmodules b/.gitmodules index 59cddea4a8f2..3d1a042fb025 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,7 +46,7 @@ [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/Azure/sonic-frr.git - branch = frr/7.5 + branch = frr/8.2 [submodule "platform/p4/p4-hlir/p4-hlir-v1.1"] path = platform/p4/p4-hlir/p4-hlir-v1.1 url = https://github.com/p4lang/p4-hlir.git diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 2249f828a48c..ff594288419c 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -7,10 +7,10 @@ DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) $(SONIC_FRR_MGMT_FRAMEWORK) -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG1) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG2) $(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \ - $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG1_DBG) + $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG2_DBG) $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) diff --git a/rules/frr.mk b/rules/frr.mk index 72cde12ebf75..7bc5cc8024f0 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -1,16 +1,16 @@ # FRRouting (frr) package -FRR_VERSION = 7.5.1 +FRR_VERSION = 8.2.2 FRR_SUBVERSION = 0 -FRR_BRANCH = frr/7.5 -FRR_TAG = frr-7.5.1-s1 +FRR_BRANCH = frr/8.2 +FRR_TAG = frr-8.2.2 export FRR_VERSION FRR_SUBVERSION FRR_BRANCH FRR_TAG FRR = frr_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_$(CONFIGURED_ARCH).deb -$(FRR)_DEPENDS += $(LIBSNMP_DEV) $(LIBYANG1) $(LIBYANG1_DEV) -$(FRR)_RDEPENDS += $(LIBYANG1) -$(FRR)_UNINSTALLS = $(LIBYANG1_DEV) $(LIBYANG1) +$(FRR)_DEPENDS += $(LIBSNMP_DEV) $(LIBYANG2) $(LIBYANG2_DEV) +$(FRR)_RDEPENDS += $(LIBYANG2) +$(FRR)_UNINSTALLS = $(LIBYANG2_DEV) $(LIBYANG2) $(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr SONIC_MAKE_DEBS += $(FRR) diff --git a/rules/libyang.mk b/rules/libyang.mk index c8873c3b3231..b361c9796b92 100644 --- a/rules/libyang.mk +++ b/rules/libyang.mk @@ -29,7 +29,7 @@ LIBYANG_PY3 = python3-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb $(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) $(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY3))) -$(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1))) -$(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV))) +$(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1),$(LIBYANG2))) +$(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV),$(LIBYANG2_DEV))) export LIBYANG LIBYANG_DBG LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3 diff --git a/rules/libyang2.dep b/rules/libyang2.dep new file mode 100644 index 000000000000..a1b3977f2d86 --- /dev/null +++ b/rules/libyang2.dep @@ -0,0 +1,10 @@ + +SPATH := $($(LIBYANG2)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang2.mk rules/libyang2.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(LIBYANG2)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBYANG2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBYANG2)_DEP_FILES := $(DEP_FILES) + diff --git a/rules/libyang2.mk b/rules/libyang2.mk new file mode 100644 index 000000000000..1e181b2a30eb --- /dev/null +++ b/rules/libyang2.mk @@ -0,0 +1,43 @@ +# libyang2 + +LIBYANG2_VERSION_BASE = 2.0 +LIBYANG2_VERSION = $(LIBYANG2_VERSION_BASE).112 +LIBYANG2_SUBVERSION = 6 +LIBYANG2_FULLVERSION = $(LIBYANG2_VERSION)-$(LIBYANG2_SUBVERSION) + +export LIBYANG2_VERSION_BASE +export LIBYANG2_VERSION +export LIBYANG2_SUBVERSION +export LIBYANG2_FULLVERSION + +LIBYANG2 = libyang2_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(LIBYANG2)_SRC_PATH = $(SRC_PATH)/libyang2 +SONIC_MAKE_DEBS += $(LIBYANG2) + +LIBYANG2_DEV = libyang2-dev_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_DEV))) + +LIBYANG2_DBG = libyang2-dbgsym_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_DBG))) + +LIBYANG2_CPP = libyang2-cpp1_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(LIBYANG2_CPP)_DEPENDS += $(LIBYANG2) +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_CPP))) + +LIBYANG2_CPP_DEV = libyang2-cpp-dev_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_CPP_DEV))) + +LIBYANG2_CPP_DBG = libyang2-cpp1-dbgsym_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_CPP_DBG))) + +YANG_TOOLS = yang-tools_$(LIBYANG2_FULLVERSION)_all.deb +$(YANG_TOOLS)_DEPENDS += $(LIBYANG2) +$(eval $(call add_derived_package,$(LIBYANG2),$(YANG_TOOLS))) + +LIBYANG2_TOOLS = libyang2-tools_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_TOOLS))) + +LIBYANG2_TOOLS_DBG = libyang2-tools-dbgsym_$(LIBYANG2_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG2),$(LIBYANG2_TOOLS_DBG))) + +export LIBYANG2 LIBYANG2_DBG LIBYANG2_DEV LIBYANG2_CPP LIBYANG2_CPP_DEV LIBYANG2_CPP_DBG YANG_TOOLS LIBYANG2_TOOLS LIBYANG2_TOOLS_DBG diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 401f032725cf..2a9b49b82811 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -90,7 +90,7 @@ RUN apt-get update && apt-get install -y \ imagemagick \ ghostscript \ groff \ - libpcre3-dev \ + libpcre2-dev \ gawk \ chrpath \ # For frr build diff --git a/src/libyang2/.gitignore b/src/libyang2/.gitignore new file mode 100644 index 000000000000..a0991ff4402b --- /dev/null +++ b/src/libyang2/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!Makefile diff --git a/src/libyang2/Makefile b/src/libyang2/Makefile new file mode 100644 index 000000000000..621717521972 --- /dev/null +++ b/src/libyang2/Makefile @@ -0,0 +1,40 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang + +DSC_FILE = libyang2_$(LIBYANG2_FULLVERSION).dsc +ORIG_FILE = libyang2_$(LIBYANG2_VERSION).orig.tar.gz +DEBIAN_FILE = libyang2_$(LIBYANG2_FULLVERSION).debian.tar.xz + +DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) +ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) +DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) + +MAIN_TARGET = $(LIBYANG2) +DERIVED_TARGETS = $(LIBYANG2_DEV) $(LIBYANG2_DBG) $(LIBYANG2_TOOLS) $(LIBYANG2_TOOLS_DBG) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtaining the libyang + rm -fr ./libyang2-$(LIBYANG2_VERSION) + + # download debian libyang + wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) + wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) + wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) + dpkg-source -x libyang2_$(LIBYANG2_FULLVERSION).dsc + + pushd libyang2-$(LIBYANG2_VERSION) + #sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt + #sed -i 's/libyang2/libyang2/' debian/libyang2.install + # Enable large file support for 32-bit arch + echo 'add_definitions(-D_FILE_OFFSET_BITS=64)' >> CMakeLists.txt + + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 45f37e52781e..a2e2c12885db 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -13,7 +13,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git checkout -b $(FRR_BRANCH) origin/$(FRR_BRANCH) || git checkout $(FRR_BRANCH) stg branch --create $(STG_BRANCH) $(FRR_TAG) stg import -s ../patch/series - tools/tarsource.sh -V -e '-sonic' + gbp dch --ignore-branch --new-version=$(FRR_VERSION)-sonic-$(FRR_SUBVERSION) --dch-opt="--force-bad-version" --commit --git-author dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) stg undo || true git clean -xfdf 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 5f4ce04d3ff5..ba5668394385 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,20 +1,20 @@ -From 71415ae851357025a99b8ead7edf5755a55b6fbb Mon Sep 17 00:00:00 2001 +From 4ab192df23362e64d1a11441fae82329388f103e Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 16 Nov 2020 18:00:12 -0800 -Subject: [PATCH 1/5] Add support of bgp tcp DSCP value +Subject: [PATCH 1/8] Add support of bgp tcp DSCP value --- bgpd/bgp_network.c | 11 ++++------- bgpd/bgp_vty.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ - bgpd/bgpd.c | 2 +- + bgpd/bgpd.c | 1 + bgpd/bgpd.h | 3 +++ - 4 files changed, 52 insertions(+), 8 deletions(-) + 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c -index cae11ae7b..f1d96664d 100644 +index 3fb7619ed..70c771683 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c -@@ -721,11 +721,9 @@ int bgp_connect(struct peer *peer) +@@ -743,11 +743,9 @@ int bgp_connect(struct peer *peer) #ifdef IPTOS_PREC_INTERNETCONTROL frr_with_privs(&bgpd_privs) { if (sockunion_family(&peer->su) == AF_INET) @@ -28,7 +28,7 @@ index cae11ae7b..f1d96664d 100644 } #endif -@@ -801,10 +799,9 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, +@@ -824,10 +822,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 cae11ae7b..f1d96664d 100644 sockopt_v6only(sa->sa_family, sock); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c -index bb2f89f9e..33662b08e 100644 +index 4df2abef8..950d1d25c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c -@@ -1330,6 +1330,42 @@ DEFUN (no_router_bgp, +@@ -1558,6 +1558,42 @@ DEFUN (no_router_bgp, return CMD_SUCCESS; } @@ -88,7 +88,7 @@ index bb2f89f9e..33662b08e 100644 /* BGP router-id. */ -@@ -15549,6 +15585,10 @@ int bgp_config_write(struct vty *vty) +@@ -17053,6 +17089,10 @@ 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"); @@ -97,9 +97,9 @@ index bb2f89f9e..33662b08e 100644 + vty_out(vty, " bgp session-dscp %02X\n", bgp->tcp_dscp >> 2); + /* BGP router ID. */ - if (bgp->router_id_static.s_addr != 0) - vty_out(vty, " bgp router-id %s\n", -@@ -16057,6 +16097,10 @@ void bgp_vty_init(void) + if (bgp->router_id_static.s_addr != INADDR_ANY) + vty_out(vty, " bgp router-id %pI4\n", +@@ -17662,6 +17702,10 @@ void bgp_vty_init(void) /* "no router bgp" commands. */ install_element(CONFIG_NODE, &no_router_bgp_cmd); @@ -111,32 +111,31 @@ index bb2f89f9e..33662b08e 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 cf9ff038d..0e8579843 100644 +index 7e528b219..005523544 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c -@@ -3069,7 +3069,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, - +@@ -3229,6 +3229,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)); -- + + bgp->tcp_dscp = IPTOS_PREC_INTERNETCONTROL; bgp_evpn_init(bgp); + bgp_evpn_vrf_es_init(bgp); bgp_pbr_init(bgp); - diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index 2aa069002..914f296e5 100644 +index 8b93c450e..e780d8a03 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -678,6 +678,9 @@ struct bgp { +@@ -743,6 +743,9 @@ struct bgp { /* Weighted ECMP related config. */ enum bgp_link_bw_handling lb_handling; + /* dscp value for tcp sessions */ + uint8_t tcp_dscp; + - QOBJ_FIELDS - }; - DECLARE_QOBJ_TYPE(bgp) + /* Process Queue for handling routes */ + struct work_queue *process_queue; + -- -2.29.2.windows.2 +2.12.2 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 5e4daafae2d0..764d38463289 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,25 +1,25 @@ -From a81d37fc1558c33426a4fb59ff25c6d73a20f210 Mon Sep 17 00:00:00 2001 +From 15274a197e4d3b7ac0f11ca63a5274f1168739f5 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 16 Nov 2020 18:11:47 -0800 -Subject: [PATCH 2/5] Reduce severity of 'Vty connected from' message +Subject: [PATCH 2/8] Reduce severity of 'Vty connected from' message --- lib/vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vty.c b/lib/vty.c -index 077c6f621..3204948b8 100644 +index 8eaf13619..7edeb5538 100644 --- a/lib/vty.c +++ b/lib/vty.c -@@ -1859,7 +1859,7 @@ static int vty_accept(struct thread *thread) +@@ -1814,7 +1814,7 @@ static int vty_accept(struct thread *thread) zlog_info("can't set sockopt to vty_sock : %s", safe_strerror(errno)); -- zlog_info("Vty connection from %s", -+ zlog_debug("Vty connection from %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); +- zlog_info("Vty connection from %pSU", &su); ++ zlog_debug("Vty connection from %pSU", &su); vty_create(vty_sock, &su); + -- -2.29.2.windows.2 +2.12.2 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 cefeca769c6d..f815cf38455e 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,25 @@ -From ecc9aa458a34f49744a2b90d3a7ebcce951a8478 Mon Sep 17 00:00:00 2001 +From 39bb40dc4bad4462e4ae9c98580d75fa2c92e032 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 16 Nov 2020 18:29:46 -0800 -Subject: [PATCH 3/5] Use vrf_id for vrf, not tabled_id +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 2c0741363..0ab92398f 100644 +index ec22c5dd4..aad0156b3 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c -@@ -286,7 +286,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, - ri->af = rib_dest_af(dest); +@@ -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 = rib_table_info(rib_dest_table(dest))->table_id; +- ri->rtm_table = table_info->table_id; + ri->rtm_table = zvrf_id(rib_dest_vrf(dest)); ri->rtm_protocol = RTPROT_UNSPEC; /* -- -2.29.2.windows.2 +2.12.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 df92c8d65738..9d2f08efb191 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,17 +1,18 @@ -From 70739436fc8ab4d5e507a0185fbc58eca298f7eb Mon Sep 17 00:00:00 2001 +From afff474c79e0c177e090d1b45d68c9f816a52e3e Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 16 Nov 2020 18:33:46 -0800 -Subject: [PATCH 4/5] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate -the vendor bug +Subject: [PATCH 4/8] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to + alleviate + --- bgpd/bgp_route.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c -index 1c646c03e..df2aa1b4c 100644 +index b297ca006..d4b5066c6 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -3354,8 +3354,7 @@ bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, +@@ -3625,8 +3625,7 @@ bool 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)) { @@ -22,5 +23,5 @@ index 1c646c03e..df2aa1b4c 100644 return true; } -- -2.29.2.windows.2 +2.12.2 diff --git a/src/sonic-frr/patch/0005-nexthops-compare-vrf-only-if-ip-type.patch b/src/sonic-frr/patch/0005-nexthops-compare-vrf-only-if-ip-type.patch index 1ca955d175d5..2db1105622eb 100644 --- a/src/sonic-frr/patch/0005-nexthops-compare-vrf-only-if-ip-type.patch +++ b/src/sonic-frr/patch/0005-nexthops-compare-vrf-only-if-ip-type.patch @@ -1,7 +1,7 @@ -From dd66532a0e73b0c3ae6375e795b3b47f16196d09 Mon Sep 17 00:00:00 2001 +From 786087468520db44c55e3566f77438b41f52763f Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 16 Nov 2020 18:35:01 -0800 -Subject: [PATCH 5/5] nexthops compare vrf only if ip type +Subject: [PATCH 5/8] nexthops compare vrf only if ip type --- lib/nexthop.c | 12 ++++++------ @@ -9,10 +9,10 @@ Subject: [PATCH 5/5] nexthops compare vrf only if ip type 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c -index 0ea72d03e..50552df60 100644 +index e17eeb830..a1ce22e3b 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c -@@ -105,12 +105,6 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, +@@ -140,12 +140,6 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, { int ret = 0; @@ -25,7 +25,7 @@ index 0ea72d03e..50552df60 100644 if (next1->type < next2->type) return -1; -@@ -126,6 +120,12 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, +@@ -161,6 +155,12 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, switch (next1->type) { case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV6: @@ -39,10 +39,10 @@ index 0ea72d03e..50552df60 100644 if (ret != 0) return ret; diff --git a/lib/zclient.c b/lib/zclient.c -index fb48d4a12..39132465f 100644 +index 445837017..c104623b7 100644 --- a/lib/zclient.c +++ b/lib/zclient.c -@@ -822,12 +822,6 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, +@@ -864,12 +864,6 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, { int ret = 0; @@ -55,7 +55,7 @@ index fb48d4a12..39132465f 100644 if (next1->type < next2->type) return -1; -@@ -843,6 +837,12 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, +@@ -885,6 +879,12 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, switch (next1->type) { case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV6: @@ -69,5 +69,5 @@ index fb48d4a12..39132465f 100644 &next2->gate); if (ret != 0) -- -2.29.2.windows.2 +2.12.2 diff --git a/src/sonic-frr/patch/0007-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch b/src/sonic-frr/patch/0006-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch similarity index 88% rename from src/sonic-frr/patch/0007-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch rename to src/sonic-frr/patch/0006-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch index de5064885191..6d3db6d518e9 100644 --- a/src/sonic-frr/patch/0007-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch +++ b/src/sonic-frr/patch/0006-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch @@ -1,14 +1,12 @@ -From 31464e3fd0f677bc15286e99d4a30e2e33480c53 Mon Sep 17 00:00:00 2001 +From 0417036a3aece862c95111d4646ca7508a028165 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 25 Nov 2020 22:28:43 +0000 -Subject: [PATCH] [frr] remove frr log outchannel to /var/log/frr.log - +Subject: [PATCH] [PATCH 6/8] [frr] remove frr log outchannel to /var/log/frr.log SONiC runs frr inside a docker and the logs are sent to base image via rsyslog and recorded already. There is no need to keep the frr.log inside the docker. It will grow and take all harddrive space eventually. -Signed-off-by: Ying Xie --- tools/etc/rsyslog.d/45-frr.conf | 19 ------------------- 1 file changed, 19 deletions(-) @@ -44,5 +42,5 @@ index feeeb13f1..fcd23d23a 100644 $programname == 'bgpd' or $programname == 'eigrpd' or -- -2.17.1 +2.12.2 diff --git a/src/sonic-frr/patch/0008-Add-support-of-bgp-l3vni-evpn.patch b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch similarity index 57% rename from src/sonic-frr/patch/0008-Add-support-of-bgp-l3vni-evpn.patch rename to src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch index 8a32e77a825e..5097ad513ef0 100644 --- a/src/sonic-frr/patch/0008-Add-support-of-bgp-l3vni-evpn.patch +++ b/src/sonic-frr/patch/0007-Add-support-of-bgp-l3vni-evpn.patch @@ -1,34 +1,36 @@ -From 2e9ed539d29f13d874c6a5ab3120bf4bb26ab2bb Mon Sep 17 00:00:00 2001 +From 74ee34e4990dbd168b7b8072894eb0cf8927f9d1 Mon Sep 17 00:00:00 2001 From: Kishore Kunal Date: Fri, 15 Jan 2021 15:52:13 -0800 -Subject: [PATCH] This is temp patch till Prefix to ARP indirection is add in neighorch +Subject: [PATCH 7/8] This is temp patch till Prefix to ARP indirection is + add in neighorch --- - lib/nexthop.c | 1 + - lib/nexthop.h | 7 ++++++- + lib/nexthop.c | 2 ++ + lib/nexthop.h | 6 ++++++ zebra/rt_netlink.c | 2 +- - zebra/zapi_msg.c | 2 ++ - zebra/zebra_dplane.c | 2 +- - zebra/zebra_fpm_netlink.c | 19 +++++++++++++++++++ - 6 files changed, 30 insertions(+), 3 deletions(-) + 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 0ea72d03e..02e826048 100644 +index a1ce22e3b..6f3fe2a5f 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c -@@ -657,6 +657,7 @@ void nexthop_copy_no_recurse(struct nexthop *copy, +@@ -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, - &nexthop->nh_label->label[0]); -+ memcpy(©->nh_encap.encap_data.rmac, &nexthop->nh_encap.encap_data.rmac, ETH_ALEN); - } - - void nexthop_copy(struct nexthop *copy, const struct nexthop *nexthop, diff --git a/lib/nexthop.h b/lib/nexthop.h -index cadcea1f4..fd959eb9e 100644 +index 320b46315..0f98dc3c2 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h -@@ -71,6 +71,11 @@ enum nh_encap_type { +@@ -66,6 +66,11 @@ enum nh_encap_type { /* Backup index value is limited */ #define NEXTHOP_BACKUP_IDX_MAX 255 @@ -40,20 +42,19 @@ index cadcea1f4..fd959eb9e 100644 /* Nexthop structure. */ struct nexthop { struct nexthop *next; -@@ -140,7 +145,7 @@ struct nexthop { - /* Encapsulation information. */ +@@ -136,6 +141,7 @@ struct nexthop { 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 50b1a62d8..d8249f8e0 100644 +index 24c01b7f5..5e0f4cd8f 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c -@@ -1590,7 +1590,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, +@@ -1856,7 +1856,7 @@ static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen, return false; if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, @@ -63,43 +64,44 @@ index 50b1a62d8..d8249f8e0 100644 nl_attr_nest_end(n, nest); break; diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c -index e436e5a28..c10d50797 100644 +index 5cf7d815d..529cbb44b 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c -@@ -1477,6 +1477,7 @@ static struct nexthop *nexthop_from_zapi(struct route_entry *re, - zebra_vxlan_evpn_vrf_route_add( - api_nh->vrf_id, &api_nh->rmac, - &vtep_ip, &api->prefix); -+ memcpy(&(nexthop->nh_encap.encap_data.rmac), &api_nh->rmac, ETH_ALEN); +@@ -1577,6 +1577,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); } - break; - case NEXTHOP_TYPE_IPV6: -@@ -1511,6 +1512,7 @@ static struct nexthop *nexthop_from_zapi(struct route_entry *re, - zebra_vxlan_evpn_vrf_route_add( - api_nh->vrf_id, &api_nh->rmac, - &vtep_ip, &api->prefix); -+ memcpy(&(nexthop->nh_encap.encap_data.rmac), &api_nh->rmac, ETH_ALEN); +@@ -1610,6 +1612,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); } - break; - case NEXTHOP_TYPE_BLACKHOLE: diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c -index abd0adb64..e66d7aae5 100644 +index 656ebcf3b..8d125d77e 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c -@@ -1891,7 +1891,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, - zl3vni = zl3vni_from_vrf(nexthop->vrf_id); +@@ -2421,6 +2421,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.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 2c0741363..2731f64fb 100644 +index aad0156b3..34be9fb39 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c -@@ -129,10 +129,12 @@ static const char *fpm_nh_encap_type_to_str(enum fpm_nh_encap_type_t encap_type) +@@ -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; @@ -112,16 +114,17 @@ index 2c0741363..2731f64fb 100644 }; struct fpm_nh_encap_info_t { -@@ -238,6 +240,8 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, - - /* Add VNI to VxLAN encap info */ - nhi.encap_info.vxlan_encap.vni = zl3vni->vni; -+ memcpy(&nhi.encap_info.vxlan_encap.rmac, &(nexthop->nh_encap.encap_data.rmac), -+ ETH_ALEN); +@@ -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); } -@@ -454,9 +458,16 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, + /* +@@ -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; @@ -138,7 +141,7 @@ index 2c0741363..2731f64fb 100644 nl_attr_nest_end(&req->n, nest); break; } -@@ -490,10 +501,18 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, +@@ -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; @@ -158,5 +161,5 @@ index 2c0741363..2731f64fb 100644 break; } -- -2.18.0 +2.12.2 diff --git a/src/sonic-frr/patch/0008-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch b/src/sonic-frr/patch/0008-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch new file mode 100644 index 000000000000..c2ff17dab88c --- /dev/null +++ b/src/sonic-frr/patch/0008-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch @@ -0,0 +1,29 @@ +From 92ab2d74fca06f86c00d886ac249f7f2d89e93fe Mon Sep 17 00:00:00 2001 +From: Akhilesh Samineni +Date: Mon, 5 Apr 2021 13:21:40 -0700 +Subject: [PATCH 8/8] Link local scope was not set while binding socket + with local address causing socket errors for bgp ipv6 link local neighbors. + +--- + bgpd/bgp_network.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c +index 70c771683..dbc9870a5 100644 +--- a/bgpd/bgp_network.c ++++ b/bgpd/bgp_network.c +@@ -662,6 +662,11 @@ static int bgp_update_address(struct interface *ifp, const union sockunion *dst, + return 1; + + prefix2sockunion(sel, addr); ++ ++ if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr)) { ++ addr->sin6.sin6_scope_id = ifp->ifindex; ++ } ++ + return 0; + } + +-- +2.12.2 + diff --git a/src/sonic-frr/patch/0009-Add-bgp-bestpath-peer-type-multipath-relax.patch b/src/sonic-frr/patch/0009-Add-bgp-bestpath-peer-type-multipath-relax.patch deleted file mode 100644 index 0e9af83aa864..000000000000 --- a/src/sonic-frr/patch/0009-Add-bgp-bestpath-peer-type-multipath-relax.patch +++ /dev/null @@ -1,346 +0,0 @@ -From a70c630a504e041da1c2441337b2d47e8fdd3d30 Mon Sep 17 00:00:00 2001 -From: Joanne Mikkelson -Date: Mon, 29 Jun 2020 13:31:49 -0700 -Subject: [PATCH] Add "bgp bestpath peer-type multipath-relax" - -This new BGP configuration is akin to "bgp bestpath aspath -multipath-relax". When applied, paths learned from different peer types -will be eligible to be considered for multipath (ECMP). Paths from all -of eBGP, iBGP, and confederation peers may be included in multipaths -if they are otherwise equal cost. - -This change preserves the existing bestpath behavior of step 10's result -being returned, not the result from steps 8 and 9, in the case where -both 8+9 and 10 determine a winner. - -When "bgp bestpath peer-type multipath-relax" is enabled, multipaths -with both eBGP and iBGP learned routes may exist. It is not desirable -for the iBGP next hops to be discarded from the FIB because they are not -directly connected. When publishing a nexthop group to zebra, the -ZEBRA_FLAG_ALLOW_RECURSION flag is normally not set when the best path -is eBGP; when "bgp bestpath aspath multipath-relax" is configured, the -flag will now be set if any paths are from iBGP peers. This leaves -all-eBGP multipaths still requiring nexthops over connected routes. ---- - bgpd/bgp_route.c | 76 ++++++++++++++++++++++++++++++++++-------------- - bgpd/bgp_vty.c | 43 +++++++++++++++++++++++++++ - bgpd/bgp_zebra.c | 15 +++++++++- - bgpd/bgpd.h | 1 + - doc/user/bgp.rst | 7 +++++ - 5 files changed, 119 insertions(+), 23 deletions(-) - -diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c -index 1c646c03e..73dbf3c5f 100644 ---- a/bgpd/bgp_route.c -+++ b/bgpd/bgp_route.c -@@ -540,6 +540,8 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - int internal_as_route; - int confed_as_route; - int ret = 0; -+ int igp_metric_ret = 0; -+ int peer_sort_ret = -1; - char new_buf[PATH_ADDPATH_STR_BUFFER]; - char exist_buf[PATH_ADDPATH_STR_BUFFER]; - uint32_t new_mm_seq; -@@ -940,7 +942,9 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - zlog_debug( - "%s: %s wins over %s due to eBGP peer > iBGP peer", - pfx_buf, new_buf, exist_buf); -- return 1; -+ if (!CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ return 1; -+ peer_sort_ret = 1; - } - - if (exist_sort == BGP_PEER_EBGP -@@ -950,7 +954,9 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - zlog_debug( - "%s: %s loses to %s due to iBGP peer < eBGP peer", - pfx_buf, new_buf, exist_buf); -- return 0; -+ if (!CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ return 0; -+ peer_sort_ret = 0; - } - - /* 8. IGP metric check. */ -@@ -962,19 +968,19 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - existm = exist->extra->igpmetric; - - if (newm < existm) { -- if (debug) -+ if (debug && peer_sort_ret < 0) - zlog_debug( - "%s: %s wins over %s due to IGP metric %d < %d", - pfx_buf, new_buf, exist_buf, newm, existm); -- ret = 1; -+ igp_metric_ret = 1; - } - - if (newm > existm) { -- if (debug) -+ if (debug && peer_sort_ret < 0) - zlog_debug( - "%s: %s loses to %s due to IGP metric %d > %d", - pfx_buf, new_buf, exist_buf, newm, existm); -- ret = 0; -+ igp_metric_ret = 0; - } - - /* 9. Same IGP metric. Compare the cluster list length as -@@ -992,21 +998,21 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - existm = BGP_CLUSTER_LIST_LENGTH(exist->attr); - - if (newm < existm) { -- if (debug) -+ if (debug && peer_sort_ret < 0) - zlog_debug( - "%s: %s wins over %s due to CLUSTER_LIST length %d < %d", - pfx_buf, new_buf, exist_buf, - newm, existm); -- ret = 1; -+ igp_metric_ret = 1; - } - - if (newm > existm) { -- if (debug) -+ if (debug && peer_sort_ret < 0) - zlog_debug( - "%s: %s loses to %s due to CLUSTER_LIST length %d > %d", - pfx_buf, new_buf, exist_buf, - newm, existm); -- ret = 0; -+ igp_metric_ret = 0; - } - } - } -@@ -1020,7 +1026,10 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - zlog_debug( - "%s: %s wins over %s due to confed-external peer > confed-internal peer", - pfx_buf, new_buf, exist_buf); -- return 1; -+ if (!CHECK_FLAG(bgp->flags, -+ BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ return 1; -+ peer_sort_ret = 1; - } - - if (exist_sort == BGP_PEER_CONFED -@@ -1030,7 +1039,10 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - zlog_debug( - "%s: %s loses to %s due to confed-internal peer < confed-external peer", - pfx_buf, new_buf, exist_buf); -- return 0; -+ if (!CHECK_FLAG(bgp->flags, -+ BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ return 0; -+ peer_sort_ret = 0; - } - } - -@@ -1091,20 +1103,40 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, - * TODO: If unequal cost ibgp multipath is enabled we can - * mark the paths as equal here instead of returning - */ -- if (debug) { -- if (ret == 1) -- zlog_debug( -- "%s: %s wins over %s after IGP metric comparison", -- pfx_buf, new_buf, exist_buf); -- else -- zlog_debug( -- "%s: %s loses to %s after IGP metric comparison", -- pfx_buf, new_buf, exist_buf); -+ -+ /* Prior to the addition of BGP_FLAG_PEERTYPE_MULTIPATH_RELAX, -+ * if either step 7 or 10 (peer type checks) yielded a winner, -+ * that result was returned immediately. Returning from step 10 -+ * ignored the return value computed in steps 8 and 9 (IGP -+ * metric checks). In order to preserve that behavior, if -+ * peer_sort_ret is set, return that rather than igp_metric_ret. -+ */ -+ ret = peer_sort_ret; -+ if (peer_sort_ret < 0) { -+ ret = igp_metric_ret; -+ if (debug) { -+ if (ret == 1) -+ zlog_debug( -+ "%s: %s wins over %s after IGP metric comparison", -+ pfx_buf, new_buf, exist_buf); -+ else -+ zlog_debug( -+ "%s: %s loses to %s after IGP metric comparison", -+ pfx_buf, new_buf, exist_buf); -+ } -+ *reason = bgp_path_selection_igp_metric; - } -- *reason = bgp_path_selection_igp_metric; - return ret; - } - -+ /* -+ * At this point, the decision whether to set *paths_eq = 1 has been -+ * completed. If we deferred returning because of bestpath peer-type -+ * relax configuration, return now. -+ */ -+ if (peer_sort_ret >= 0) -+ return peer_sort_ret; -+ - /* 12. If both paths are external, prefer the path that was received - first (the oldest one). This step minimizes route-flap, since a - newer path won't displace an older one, even if it was the -diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c -index bb2f89f9e..4d1ce5a46 100644 ---- a/bgpd/bgp_vty.c -+++ b/bgpd/bgp_vty.c -@@ -3009,6 +3009,37 @@ DEFUN (no_bgp_bestpath_aspath_multipath_relax, - return CMD_SUCCESS; - } - -+/* "bgp bestpath peer-type multipath-relax" configuration. */ -+DEFUN(bgp_bestpath_peer_type_multipath_relax, -+ bgp_bestpath_peer_type_multipath_relax_cmd, -+ "bgp bestpath peer-type multipath-relax", -+ BGP_STR -+ "Change the default bestpath selection\n" -+ "Peer type\n" -+ "Allow load sharing across routes learned from different peer types\n") -+{ -+ VTY_DECLVAR_CONTEXT(bgp, bgp); -+ SET_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX); -+ bgp_recalculate_all_bestpaths(bgp); -+ -+ return CMD_SUCCESS; -+} -+ -+DEFUN(no_bgp_bestpath_peer_type_multipath_relax, -+ no_bgp_bestpath_peer_type_multipath_relax_cmd, -+ "no bgp bestpath peer-type multipath-relax", -+ NO_STR BGP_STR -+ "Change the default bestpath selection\n" -+ "Peer type\n" -+ "Allow load sharing across routes learned from different peer types\n") -+{ -+ VTY_DECLVAR_CONTEXT(bgp, bgp); -+ UNSET_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX); -+ bgp_recalculate_all_bestpaths(bgp); -+ -+ return CMD_SUCCESS; -+} -+ - /* "bgp log-neighbor-changes" configuration. */ - DEFUN (bgp_log_neighbor_changes, - bgp_log_neighbor_changes_cmd, -@@ -8999,6 +9030,9 @@ static void bgp_show_bestpath_json(struct bgp *bgp, json_object *json) - } else - json_object_string_add(bestpath, "multiPathRelax", "false"); - -+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ json_object_boolean_true_add(bestpath, "peerTypeRelax"); -+ - if (CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID)) - json_object_string_add(bestpath, "compareRouterId", "true"); - if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED) -@@ -15750,6 +15784,10 @@ int bgp_config_write(struct vty *vty) - vty_out(vty, "\n"); - } - -+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)) -+ vty_out(vty, -+ " bgp bestpath peer-type multipath-relax\n"); -+ - /* Link bandwidth handling. */ - if (bgp->lb_handling == BGP_LINK_BW_IGNORE_BW) - vty_out(vty, " bgp bestpath bandwidth ignore\n"); -@@ -16214,6 +16252,11 @@ void bgp_vty_init(void) - install_element(BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); - install_element(BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); - -+ /* "bgp bestpath peer-type multipath-relax" commands */ -+ install_element(BGP_NODE, &bgp_bestpath_peer_type_multipath_relax_cmd); -+ install_element(BGP_NODE, -+ &no_bgp_bestpath_peer_type_multipath_relax_cmd); -+ - /* "bgp log-neighbor-changes" commands */ - install_element(BGP_NODE, &bgp_log_neighbor_changes_cmd); - install_element(BGP_NODE, &no_bgp_log_neighbor_changes_cmd); -diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c -index b20323852..4f7cfeaa2 100644 ---- a/bgpd/bgp_zebra.c -+++ b/bgpd/bgp_zebra.c -@@ -1184,6 +1184,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, - int nh_family; - unsigned int valid_nh_count = 0; - int has_valid_label = 0; -+ bool allow_recursion = false; - uint8_t distance; - struct peer *peer; - struct bgp_path_info *mpinfo; -@@ -1259,7 +1260,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, - || CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK) - || CHECK_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK)) - -- SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); -+ allow_recursion = true; - - if (info->attr->rmap_table_id) { - SET_FLAG(api.message, ZAPI_MESSAGE_TABLEID); -@@ -1397,6 +1398,15 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, - if (!nh_updated) - continue; - -+ /* Allow recursion if it is a multipath group with both -+ * eBGP and iBGP paths. -+ */ -+ if (!allow_recursion -+ && CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX) -+ && (mpinfo->peer->sort == BGP_PEER_IBGP -+ || mpinfo->peer->sort == BGP_PEER_CONFED)) -+ allow_recursion = true; -+ - if (mpinfo->extra - && bgp_is_valid_label(&mpinfo->extra->label[0]) - && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { -@@ -1415,6 +1425,9 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, - valid_nh_count++; - } - -+ if (allow_recursion) -+ SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); -+ - /* - * When we create an aggregate route we must also - * install a Null0 route in the RIB, so overwrite -diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index 2aa069002..e268d5b1e 100644 ---- a/bgpd/bgpd.h -+++ b/bgpd/bgpd.h -@@ -456,6 +456,7 @@ struct bgp { - #define BGP_FLAG_GR_DISABLE_EOR (1 << 24) - #define BGP_FLAG_EBGP_REQUIRES_POLICY (1 << 25) - #define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26) -+#define BGP_FLAG_PEERTYPE_MULTIPATH_RELAX (1 << 31) - - /* This flag is set if the instance is in administrative shutdown */ - #define BGP_FLAG_SHUTDOWN (1 << 27) -diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst -index b58030212..e248ffceb 100644 ---- a/doc/user/bgp.rst -+++ b/doc/user/bgp.rst -@@ -386,6 +386,13 @@ Route Selection - other measures were taken to avoid these. The exact behaviour will be - sensitive to the iBGP and reflection topology. - -+.. clicmd:: bgp bestpath peer-type multipath-relax -+ -+ This command specifies that BGP decision process should consider paths -+ from all peers for multipath computation. If this option is enabled, -+ paths learned from any of eBGP, iBGP, or confederation neighbors will -+ be multipath if they are otherwise considered equal cost. -+ - .. _bgp-distance: - - Administrative Distance Metrics --- -2.29.2 - diff --git a/src/sonic-frr/patch/0009-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch b/src/sonic-frr/patch/0009-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch deleted file mode 100644 index 82a1b26fb98f..000000000000 --- a/src/sonic-frr/patch/0009-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 4b45abcdb107c8c5d58fd63a2616c54c800305b3 Mon Sep 17 00:00:00 2001 -From: Akhilesh Samineni -Date: Mon, 5 Apr 2021 13:21:40 -0700 -Subject: [PATCH] Link local scope was not set while binding socket with local - address causing socket errors for bgp ipv6 link local neighbors. - ---- - bgpd/bgp_network.c | 5 +++++ - bgpd/bgp_zebra.c | 3 +++ - 2 files changed, 8 insertions(+) - -diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c -index 6a5c2c4b3..d7047a154 100644 ---- a/bgpd/bgp_network.c -+++ b/bgpd/bgp_network.c -@@ -556,6 +556,11 @@ static int bgp_update_address(struct interface *ifp, const union sockunion *dst, - return 1; - - prefix2sockunion(sel, addr); -+ -+ if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr)) { -+ addr->sin6.sin6_scope_id = ifp->ifindex; -+ } -+ - return 0; - } - -diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c -index e42d6ee26..8e9fa8903 100644 ---- a/bgpd/bgp_zebra.c -+++ b/bgpd/bgp_zebra.c -@@ -814,6 +814,9 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote, - ? peer->conf_if - : peer->ifname, - peer->bgp->vrf_id); -+ else if (peer->update_if) -+ ifp = if_lookup_by_name(peer->update_if, -+ peer->bgp->vrf_id); - } else if (peer->update_if) - ifp = if_lookup_by_name(peer->update_if, - peer->bgp->vrf_id); --- -2.18.0 - diff --git a/src/sonic-frr/patch/0010-remove-doc-png-install.patch b/src/sonic-frr/patch/0010-remove-doc-png-install.patch deleted file mode 100644 index c911d43eaa29..000000000000 --- a/src/sonic-frr/patch/0010-remove-doc-png-install.patch +++ /dev/null @@ -1,21 +0,0 @@ -Remove the *.png file installation from the frr-doc package. It doesn't look -like it's installed there with Bullseye's tools. - -From: Saikrishna Arcot - ---- - debian/frr-doc.install | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/debian/frr-doc.install b/debian/frr-doc.install -index c48dc5a8d..955c8fc5a 100644 ---- a/debian/frr-doc.install -+++ b/debian/frr-doc.install -@@ -3,7 +3,6 @@ usr/share/doc/frr/html - - # info + images referenced by it - usr/share/info/ --doc/user/_build/texinfo/*.png usr/share/info - - # other - README.md usr/share/doc/frr diff --git a/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch b/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch deleted file mode 100644 index 7a041c02fe15..000000000000 --- a/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c -index 7b0611bf9..b5582ea35 100644 ---- a/zebra/zebra_fpm.c -+++ b/zebra/zebra_fpm.c -@@ -288,6 +288,9 @@ static void zfpm_start_connect_timer(const char *reason); - static void zfpm_start_stats_timer(void); - static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac); - -+static const char ipv4_ll_buf[16] = "169.254.0.1"; -+union g_addr ipv4ll_gateway; -+ - /* - * zfpm_thread_should_yield - */ -@@ -1988,6 +1991,9 @@ static int zfpm_init(struct thread_master *master) - zfpm_stats_init(&zfpm_g->last_ivl_stats); - zfpm_stats_init(&zfpm_g->cumulative_stats); - -+ memset(&ipv4ll_gateway, 0, sizeof(ipv4ll_gateway)); -+ inet_pton(AF_INET, ipv4_ll_buf, &ipv4ll_gateway.ipv4); -+ - install_node(&zebra_node); - install_element(ENABLE_NODE, &show_zebra_fpm_stats_cmd); - install_element(ENABLE_NODE, &clear_zebra_fpm_stats_cmd); -diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index 60ea7f97e..0f8ba5413 100644 ---- a/zebra/zebra_fpm_netlink.c -+++ b/zebra/zebra_fpm_netlink.c -@@ -221,7 +221,12 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, - - if (nexthop->type == NEXTHOP_TYPE_IPV6 - || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { -- nhi.gateway = &nexthop->gate; -+ /* Special handling for IPv4 route with IPv6 Link Local next hop -+ */ -+ if (ri->af == AF_INET) -+ nhi.gateway = &ipv4ll_gateway; -+ else -+ nhi.gateway = &nexthop->gate; - } - - if (nexthop->type == NEXTHOP_TYPE_IFINDEX) { -diff --git a/zebra/zebra_fpm_private.h b/zebra/zebra_fpm_private.h -index c169ee8c2..13415c7e1 100644 ---- a/zebra/zebra_fpm_private.h -+++ b/zebra/zebra_fpm_private.h -@@ -97,6 +97,8 @@ extern int zfpm_netlink_encode_mac(struct fpm_mac_info_t *mac, char *in_buf, - - extern struct route_entry *zfpm_route_for_update(rib_dest_t *dest); - -+extern union g_addr ipv4ll_gateway; -+ - #ifdef __cplusplus - } - #endif diff --git a/src/sonic-frr/patch/Disable-ipv6-src-address-test-in-pceplib.patch b/src/sonic-frr/patch/Disable-ipv6-src-address-test-in-pceplib.patch new file mode 100644 index 000000000000..b924b9a66fc4 --- /dev/null +++ b/src/sonic-frr/patch/Disable-ipv6-src-address-test-in-pceplib.patch @@ -0,0 +1,27 @@ +From dfe0158344ea581370dd2dba8e4db189cf369147 Mon Sep 17 00:00:00 2001 +From: Syed Hasan Raza Naqvi +Date: Wed, 4 May 2022 05:11:01 +0000 +Subject: [PATCH] Disable ipv6 src address test in pcep. Docker lo interface + doesn't have ipv6 enabled. Socket bind returns cannot assign requested + address. + +--- + pceplib/test/pcep_socket_comm_test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pceplib/test/pcep_socket_comm_test.c b/pceplib/test/pcep_socket_comm_test.c +index 116531f12..8b71a5090 100644 +--- a/pceplib/test/pcep_socket_comm_test.c ++++ b/pceplib/test/pcep_socket_comm_test.c +@@ -92,7 +92,7 @@ void pcep_socket_comm_test_setup() + inet_pton(AF_INET, "127.0.0.1", &(test_host_ip)); + inet_pton(AF_INET, "127.0.0.1", &(test_src_ip)); + inet_pton(AF_INET6, "::1", &(test_host_ipv6)); +- inet_pton(AF_INET6, "::1", &(test_src_ipv6)); ++ inet_pton(AF_INET6, "::", &(test_src_ipv6)); + } + + void pcep_socket_comm_test_teardown() +-- +2.20.1 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index b77931d57e9a..43e407a3c952 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -3,9 +3,7 @@ 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-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-Add-bgp-bestpath-peer-type-multipath-relax.patch -0009-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch -0010-remove-doc-png-install.patch -0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch +0006-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch +0007-Add-support-of-bgp-l3vni-evpn.patch +0008-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch +Disable-ipv6-src-address-test-in-pceplib.patch