Skip to content

Commit

Permalink
Frr 8.2 upgrade (sonic-net#10691)
Browse files Browse the repository at this point in the history
Why I did it
Upgrade FRR to version 8.2.2. Build libyang2 required by FRR.

How I did it
Update FRR version and tag.

How to verify it
Following tests were performed on sonic-vs:

BGP docker status check
BGP configuration and session establishment
Route redistribution and ping
Issued show commands to check the bgp neighbor and routes
Checked app-db to ensure bgp routes are installed with correct interface and nexthop.
Create VRF and check FRR knows the VRF
Check VRF routes are installed in app-db with correct Vrf name and next-hop
Establish BGP Evpn session and check if Evpn routes (multicast, mac, prefix) are exchanged and installed correctly in app-db.
  • Loading branch information
hasan-brcm authored May 24, 2022
1 parent 2ead3aa commit a477dbb
Show file tree
Hide file tree
Showing 24 changed files with 281 additions and 596 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rules/docker-fpm-frr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions rules/frr.mk
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions rules/libyang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions rules/libyang2.dep
Original file line number Diff line number Diff line change
@@ -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)

43 changes: 43 additions & 0 deletions rules/libyang2.mk
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ RUN apt-get update && apt-get install -y \
imagemagick \
ghostscript \
groff \
libpcre3-dev \
libpcre2-dev \
gawk \
chrpath \
# For frr build
Expand Down
3 changes: 3 additions & 0 deletions src/libyang2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!.gitignore
!Makefile
40 changes: 40 additions & 0 deletions src/libyang2/Makefile
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/sonic-frr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 23 additions & 24 deletions src/sonic-frr/patch/0001-Add-support-of-bgp-tcp-DSCP-value.patch
Original file line number Diff line number Diff line change
@@ -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 <pavelsh@microsoft.com>
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)
Expand All @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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");

Expand All @@ -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);

Expand All @@ -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

Original file line number Diff line number Diff line change
@@ -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 <pavelsh@microsoft.com>
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

14 changes: 7 additions & 7 deletions src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch
Original file line number Diff line number Diff line change
@@ -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 <pavelsh@microsoft.com>
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

Original file line number Diff line number Diff line change
@@ -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 <pavelsh@microsoft.com>
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)) {
Expand All @@ -22,5 +23,5 @@ index 1c646c03e..df2aa1b4c 100644
return true;
}
--
2.29.2.windows.2
2.12.2

Loading

0 comments on commit a477dbb

Please sign in to comment.