From 3220491a2ad6ebff50eeb727b136dfe2b142f7b6 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 7 Oct 2019 15:03:01 -0700 Subject: [PATCH 1/2] Build 7.1 without patches --- .gitmodules | 2 +- rules/frr.mk | 2 +- src/sonic-frr/Makefile | 10 +++++----- src/sonic-frr/frr | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3d2a8e3f7a1d..d02ee6fb942b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -47,7 +47,7 @@ [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/Azure/sonic-frr.git - branch = frr/7.0 + branch = frr/7.1 [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/frr.mk b/rules/frr.mk index a14d398f89a1..83c359992ac3 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -1,6 +1,6 @@ # FRRouting (frr) package -FRR_VERSION = 7.0.1 +FRR_VERSION = 7.1 FRR_SUBVERSION = 0 export FRR_VERSION FRR_SUBVERSION diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index e7c13a1f8b6f..0dec15057479 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -9,14 +9,14 @@ BRANCH = $(shell date +%Y%m%d\.%H%M%S) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd ./frr - git checkout -b $(BRANCH) origin/frr/7.0 - stg init - stg import -s ../patch/series + git checkout -b $(BRANCH) origin/frr/7.1 +# stg init +# stg import -s ../patch/series tools/tarsource.sh -V -e '-sonic' dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) - stg undo +# stg undo git clean -xfdf - git checkout frr/7.0 + git checkout frr/7.1 git branch -D $(BRANCH) popd mv $(DERIVED_TARGET) $* $(DEST)/ diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index cd305c0973be..8c5e037c4960 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit cd305c0973be0baa1173e09f9d72e096c03e7e7e +Subproject commit 8c5e037c496025597406f496010d6ef6b1d2e73d From 80215c397b7952fa5932ea9a277cb3259712b190 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 7 Oct 2019 17:17:27 -0700 Subject: [PATCH 2/2] Port patches --- src/sonic-frr/Makefile | 6 +- ...01-Add-support-of-bgp-tcp-DSCP-value.patch | 28 ++-- ...verity-of-Vty-connected-from-message.patch | 10 +- ...xthop-attribute-when-NLRI-is-present.patch | 156 ------------------ ...EXT_HOP-to-be-0.0.0.0-due-to-allevia.patch | 12 +- src/sonic-frr/patch/0005-Support-VRF.patch | 12 +- src/sonic-frr/patch/series | 1 - 7 files changed, 34 insertions(+), 191 deletions(-) delete mode 100644 src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 0dec15057479..4a31f23436ec 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -10,11 +10,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd ./frr git checkout -b $(BRANCH) origin/frr/7.1 -# stg init -# stg import -s ../patch/series + stg init + stg import -s ../patch/series tools/tarsource.sh -V -e '-sonic' dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) -# stg undo + stg undo git clean -xfdf git checkout frr/7.1 git branch -D $(BRANCH) 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 e9f496d7af62..c7676fd65cb4 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,7 +1,7 @@ -From ef017a613691a40f32cdaa5396bbd4889b1cb647 Mon Sep 17 00:00:00 2001 +From ab8ae984def8ee5cea22f802b2a60a05214c11d2 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Fri, 14 Jun 2019 17:45:31 -0700 -Subject: [PATCH] Add support of bgp tcp DSCP value +Date: Mon, 7 Oct 2019 17:00:15 -0700 +Subject: [PATCH 1/1] Add support of bgp tcp DSCP value --- bgpd/bgp_network.c | 11 ++++------- @@ -11,10 +11,10 @@ Subject: [PATCH] Add support of bgp tcp DSCP value 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c -index 4153da5a6..fed133eb7 100644 +index 6a5c2c4b3..9ec162aa4 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c -@@ -569,11 +569,9 @@ int bgp_connect(struct peer *peer) +@@ -627,11 +627,9 @@ int bgp_connect(struct peer *peer) #ifdef IPTOS_PREC_INTERNETCONTROL frr_elevate_privs(&bgpd_privs) { if (sockunion_family(&peer->su) == AF_INET) @@ -28,7 +28,7 @@ index 4153da5a6..fed133eb7 100644 } #endif -@@ -643,10 +641,9 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, +@@ -707,10 +705,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 4153da5a6..fed133eb7 100644 sockopt_v6only(sa->sa_family, sock); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c -index 7445df883..f91b908a4 100644 +index d05432327..a15a0f526 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c -@@ -1113,6 +1113,42 @@ DEFUN (no_router_bgp, +@@ -1139,6 +1139,42 @@ DEFUN (no_router_bgp, return CMD_SUCCESS; } @@ -88,7 +88,7 @@ index 7445df883..f91b908a4 100644 /* BGP router-id. */ -@@ -12798,6 +12834,10 @@ void bgp_vty_init(void) +@@ -12929,6 +12965,10 @@ void bgp_vty_init(void) /* "no router bgp" commands. */ install_element(CONFIG_NODE, &no_router_bgp_cmd); @@ -100,10 +100,10 @@ index 7445df883..f91b908a4 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 6fb3a70c7..503e6b4ed 100644 +index 8c0b5336e..55aeb2dd8 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c -@@ -2995,7 +2995,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, +@@ -3040,7 +3040,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, bgp->evpn_info = XCALLOC(MTYPE_BGP_EVPN_INFO, sizeof(struct bgp_evpn_info)); @@ -112,7 +112,7 @@ index 6fb3a70c7..503e6b4ed 100644 bgp_evpn_init(bgp); bgp_pbr_init(bgp); return bgp; -@@ -7516,6 +7516,9 @@ int bgp_config_write(struct vty *vty) +@@ -7629,6 +7629,9 @@ int bgp_config_write(struct vty *vty) if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) vty_out(vty, " no bgp fast-external-failover\n"); @@ -123,10 +123,10 @@ index 6fb3a70c7..503e6b4ed 100644 if (bgp->router_id_static.s_addr != 0) vty_out(vty, " bgp router-id %s\n", diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index df3fde840..a6546457c 100644 +index b0f656753..32983a0a9 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h -@@ -553,6 +553,9 @@ struct bgp { +@@ -569,6 +569,9 @@ struct bgp { /* Count of peers in established state */ uint32_t established_peers; 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 ae2b3ba91223..9ec7b980ae84 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,17 +1,17 @@ -From 87760a6a04d6ffbcc7a1093549bfb76656002b61 Mon Sep 17 00:00:00 2001 +From 5a30a4e91a91f8e19c69ef219cd6d8b19e9b6fae Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Fri, 14 Jun 2019 17:48:50 -0700 -Subject: [PATCH] Reduce severity of 'Vty connected from' message +Date: Mon, 7 Oct 2019 17:06:27 -0700 +Subject: [PATCH 1/1] 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 8450922c2..f159d1b4b 100644 +index b1ed3d63c..5aa4b56cb 100644 --- a/lib/vty.c +++ b/lib/vty.c -@@ -1875,7 +1875,7 @@ static int vty_accept(struct thread *thread) +@@ -1870,7 +1870,7 @@ static int vty_accept(struct thread *thread) zlog_info("can't set sockopt to vty_sock : %s", safe_strerror(errno)); diff --git a/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch b/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch deleted file mode 100644 index 5d55ce547fd1..000000000000 --- a/src/sonic-frr/patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 7c31178d8f1b8cc3a9627dc7c7bd1d2a51fe54ce Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Tue, 18 Jun 2019 15:27:19 -0700 -Subject: [PATCH] ignore nexthop attribute when NLRI is present - -Backport of https://github.com/FRRouting/frr/pull/4258 ---- - bgpd/bgp_attr.c | 73 ++++++++++++++++++++++++++++++----------------- - bgpd/bgp_attr.h | 3 ++ - bgpd/bgp_packet.c | 11 +++++++ - 3 files changed, 61 insertions(+), 26 deletions(-) - -diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c -index 05e103142..ea7f761ab 100644 ---- a/bgpd/bgp_attr.c -+++ b/bgpd/bgp_attr.c -@@ -1257,6 +1257,32 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args, - return BGP_ATTR_PARSE_PROCEED; - } - -+/* -+ * Check that the nexthop attribute is valid. -+ */ -+bgp_attr_parse_ret_t -+bgp_attr_nexthop_valid(struct peer *peer, struct attr *attr) -+{ -+ in_addr_t nexthop_h; -+ -+ nexthop_h = ntohl(attr->nexthop.s_addr); -+ if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) -+ || IPV4_CLASS_DE(nexthop_h)) -+ && !BGP_DEBUG(allow_martians, ALLOW_MARTIANS)) { -+ char buf[INET_ADDRSTRLEN]; -+ -+ inet_ntop(AF_INET, &attr->nexthop.s_addr, buf, -+ INET_ADDRSTRLEN); -+ flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", -+ buf); -+ bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, -+ BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP); -+ return BGP_ATTR_PARSE_ERROR; -+ } -+ -+ return BGP_ATTR_PARSE_PROCEED; -+} -+ - /* Nexthop attribute. */ - static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) - { -@@ -1264,8 +1290,6 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) - struct attr *const attr = args->attr; - const bgp_size_t length = args->length; - -- in_addr_t nexthop_h, nexthop_n; -- - /* Check nexthop attribute length. */ - if (length != 4) { - flog_err(EC_BGP_ATTR_LEN, -@@ -1275,30 +1299,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) - args->total); - } - -- /* According to section 6.3 of RFC4271, syntactically incorrect NEXT_HOP -- attribute must result in a NOTIFICATION message (this is implemented -- below). -- At the same time, semantically incorrect NEXT_HOP is more likely to -- be just -- logged locally (this is implemented somewhere else). The UPDATE -- message -- gets ignored in any of these cases. */ -- nexthop_n = stream_get_ipv4(peer->curr); -- nexthop_h = ntohl(nexthop_n); -- if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) -- || IPV4_CLASS_DE(nexthop_h)) -- && !BGP_DEBUG( -- allow_martians, -- ALLOW_MARTIANS)) /* loopbacks may be used in testing */ -- { -- char buf[INET_ADDRSTRLEN]; -- inet_ntop(AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN); -- flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); -- return bgp_attr_malformed( -- args, BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, args->total); -- } -- -- attr->nexthop.s_addr = nexthop_n; -+ attr->nexthop.s_addr = stream_get_ipv4(peer->curr); - attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); - - return BGP_ATTR_PARSE_PROCEED; -@@ -2669,6 +2670,26 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, - return BGP_ATTR_PARSE_ERROR; - } - -+ /* -+ * RFC4271: If the NEXT_HOP attribute field is syntactically incorrect, -+ * then the Error Subcode MUST be set to Invalid NEXT_HOP Attribute. -+ * This is implemented below and will result in a NOTIFICATION. If the -+ * NEXT_HOP attribute is semantically incorrect, the error SHOULD be -+ * logged, and the route SHOULD be ignored. In this case, a NOTIFICATION -+ * message SHOULD NOT be sent. This is implemented elsewhere. -+ * -+ * RFC4760: An UPDATE message that carries no NLRI, other than the one -+ * encoded in the MP_REACH_NLRI attribute, SHOULD NOT carry the NEXT_HOP -+ * attribute. If such a message contains the NEXT_HOP attribute, the BGP -+ * speaker that receives the message SHOULD ignore this attribute. -+ */ -+ if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) -+ && !CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_MP_REACH_NLRI))) { -+ if (bgp_attr_nexthop_valid(peer, attr) < 0) { -+ return BGP_ATTR_PARSE_ERROR; -+ } -+ } -+ - /* Check all mandatory well-known attributes are present */ - if ((ret = bgp_attr_check(peer, attr)) < 0) { - if (as4_path) -diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h -index 47a4182fe..a86684583 100644 ---- a/bgpd/bgp_attr.h -+++ b/bgpd/bgp_attr.h -@@ -350,6 +350,9 @@ extern void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, - uint32_t, int, uint32_t, struct attr *); - extern void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt); - -+extern bgp_attr_parse_ret_t bgp_attr_nexthop_valid(struct peer *peer, -+ struct attr *attr); -+ - static inline int bgp_rmap_nhop_changed(uint32_t out_rmap_flags, - uint32_t in_rmap_flags) - { -diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c -index fe8a1a256..13f4cf436 100644 ---- a/bgpd/bgp_packet.c -+++ b/bgpd/bgp_packet.c -@@ -1533,6 +1533,17 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) - nlris[NLRI_UPDATE].nlri = stream_pnt(s); - nlris[NLRI_UPDATE].length = update_len; - stream_forward_getp(s, update_len); -+ -+ if (CHECK_FLAG(attr.flag, ATTR_FLAG_BIT(BGP_ATTR_MP_REACH_NLRI))) { -+ /* -+ * We skipped nexthop attribute validation earlier so -+ * validate the nexthop now. -+ */ -+ if (bgp_attr_nexthop_valid(peer, &attr) < 0) { -+ bgp_attr_unintern_sub(&attr); -+ return BGP_Stop; -+ } -+ } - } - - if (BGP_DEBUG(update, UPDATE_IN)) --- -2.17.1.windows.2 - diff --git a/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch b/src/sonic-frr/patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch index 22cf08b82cd4..cb3c30c781d2 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,18 +1,18 @@ -From 4cd83e56e4f67fdc06325d92a82534fb4cb69952 Mon Sep 17 00:00:00 2001 +From 9fa0ffcc8f9ec987af527e911cd748014aeacffe Mon Sep 17 00:00:00 2001 From: Pavel Shirshov -Date: Thu, 20 Jun 2019 15:35:50 -0700 -Subject: [PATCH] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate the - vendor bug +Date: Mon, 7 Oct 2019 17:15:15 -0700 +Subject: [PATCH 1/1] Allow BGP attr NEXT_HOP to be 0.0.0.0 due to alleviate + the vendor bug --- 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 38f3cad5a..55240eab8 100644 +index f8eae135e..732115756 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c -@@ -2873,8 +2873,7 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, +@@ -2904,8 +2904,7 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, /* If NEXT_HOP is present, validate it. */ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { diff --git a/src/sonic-frr/patch/0005-Support-VRF.patch b/src/sonic-frr/patch/0005-Support-VRF.patch index c6de0e5ecf0e..8d6689e5240a 100644 --- a/src/sonic-frr/patch/0005-Support-VRF.patch +++ b/src/sonic-frr/patch/0005-Support-VRF.patch @@ -1,14 +1,14 @@ -From 81990d9aafdfd459c0caa6cf07501fa628ada454 Mon Sep 17 00:00:00 2001 -From: Tyler Li -Date: Mon, 3 Jun 2019 01:48:11 -0700 -Subject: [PATCH] Support VRF +From b7ae4e11c2dc14f9208b62ea060bb5ecbf4cddb2 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Mon, 7 Oct 2019 17:17:54 -0700 +Subject: [PATCH 1/1] Support VRF --- zebra/zebra_fpm_netlink.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c -index 207cbc099..b98c6886b 100644 +index 88f0c3250..29f07f801 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -327,7 +327,12 @@ static int netlink_route_info_encode(netlink_route_info_t *ri, char *in_buf, @@ -26,5 +26,5 @@ index 207cbc099..b98c6886b 100644 req->r.rtm_protocol = ri->rtm_protocol; req->r.rtm_scope = RT_SCOPE_UNIVERSE; -- -2.11.0 +2.17.1.windows.2 diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index 4033e555fe7f..dc5eaa2fcd36 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -1,5 +1,4 @@ 0001-Add-support-of-bgp-tcp-DSCP-value.patch 0002-Reduce-severity-of-Vty-connected-from-message.patch -0003-ignore-nexthop-attribute-when-NLRI-is-present.patch 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch 0005-Support-VRF.patch