From nobody Fri Apr 21 22:08:14 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q37vM03WZz1HCPk; Fri, 21 Apr 2023 22:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q37vL6Fzzz41K9; Fri, 21 Apr 2023 22:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682114894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=29rFyrcqFGAEgDlNE+QZwMGKqBoopwd66QSCMgziX90=; b=KWhLqL/RP6b1tQBD23rD2Pw28j8/TdJp9iQLURpyrM4umbRcX+UarQ+qy8xv8V4XhQnssM WLgYSJSEibpgWwpTqpL836FKCqPtduGgGW3kytZPkLPALodRaVdPY/R88YdiPiRYPNJ1QZ Hd/LQi/hriplYxsV7uVJudF0QJbDzt6Ev9pre5c8G61HV59LXC2woC9wWj05HLYCVcaRkY Ps9zzNhy5dT3JdpnSsmR7MjmS3v0RsEeR1f6z02ZsyrQgLJ+jBGkFCgJ9kCiRzT/kPAbqe 58jyS9PGkOUfDZUcGr2LUjp/rteHNlx29BC7KD9hrk048bNFmuEjir1gEtxe1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682114894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=29rFyrcqFGAEgDlNE+QZwMGKqBoopwd66QSCMgziX90=; b=r6JAPc1khSbLM2p9b5goVzSuYyAcy/wGQ9JoGcj4gjwVtmf5A06W2DMewtS+4RehIEUPPE 9CgX+xH1e9tnlNdCrGugQ1eLlU3wWPBT2jP0dImp+YVgxeqawAAgg0/XYcFTduiTjgKk2L LwGfVMZlOCbogxgMaGuX7i0uFrPZcdqu3hR91fEIJ29Mu6CrJ+52KojbijYhhwg5Hn9TH6 sblS0TmMozHKBmu3C5at6kFPKWJVcceJaU0eI2uXUoNcW37IxNqmA72M6LrS3bwcVO3byk L5WIETPxKKpIl9azcOYJ+aY/7DsS7ZAEyDgAOnrhJzkdZnC7wzYhDNCjX6Y7bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682114894; a=rsa-sha256; cv=none; b=OFc0EPahRg/H86OMjf+fSLkZhNYVvjdyc8YOgsNaCPtJiEJRq8DHPAO7X3FdiodnH5akjj PI7MM/vgCfP+qK2gEQkpjp5RjkZR5Yi/ZOJ+Nwik45ArIM77MwJtYT0kkYMpdUfJ/0qgHk 5RTJLWB28suDX5JU1LTJfVVABokEXrjXFshc6Emem0k4g8Im5EXDXu6FEe7z3eJzIRV77i OnYxOuLxQLBJUH7c7g3pgZOxFWbktJnabbiWHR9ODjJFMq+EhfPcF4jdNJJkyYhSRA92SU Dc/c0UvLn0OKwlYrnOSFS/NoxCXPIcatUVwn3OFr/qIgLiNzzGFD4mSVuO+9nw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q37vL4gB9zcRF; Fri, 21 Apr 2023 22:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33LM8EdV094846; Fri, 21 Apr 2023 22:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33LM8E81094845; Fri, 21 Apr 2023 22:08:14 GMT (envelope-from git) Date: Fri, 21 Apr 2023 22:08:14 GMT Message-Id: <202304212208.33LM8E81094845@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Olivier Cochard Subject: git: dc2c49ff3210 - main - net/frr8: Fix bgpd crash with large communities and enable backtrace List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olivier X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc2c49ff321068aacbb763d951f301b90094958b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/ports/commit/?id=dc2c49ff321068aacbb763d951f301b90094958b commit dc2c49ff321068aacbb763d951f301b90094958b Author: Olivier Cochard AuthorDate: 2023-04-21 21:25:25 +0000 Commit: Olivier Cochard CommitDate: 2023-04-21 21:34:01 +0000 net/frr8: Fix bgpd crash with large communities and enable backtrace PR: 270910 Reported by: pi --- net/frr8/Makefile | 14 +++++----- net/frr8/files/patch-bgpd_bgp__lcommunity.c | 42 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/net/frr8/Makefile b/net/frr8/Makefile index 610fdeeb6edb..acdfa1ea0581 100644 --- a/net/frr8/Makefile +++ b/net/frr8/Makefile @@ -1,6 +1,7 @@ PORTNAME= frr PORTVERSION= 8.5 DISTVERSIONPREFIX= frr- +PORTREVISION= 1 CATEGORIES= net .if defined(PYTHONTOOLS) PKGNAMESUFFIX= 8-pythontools @@ -67,16 +68,17 @@ PKGMESSAGE= "" .else INFO= frr -OPTIONS_DEFINE= CONFIGROLLBACKS FPM DATACENTER LDPD PAM SHELLACCESS \ +OPTIONS_DEFINE= BACKTRACE CONFIGROLLBACKS FPM DATACENTER LDPD PAM SHELLACCESS \ VTYSH MANPAGES MULTIPATH TCMALLOC RPKI SHARPD SNMP -OPTIONS_DEFAULT= VTYSH RPKI FPM MANPAGES +OPTIONS_DEFAULT= BACKTRACE VTYSH RPKI FPM MANPAGES OPTIONS_SUB= yes +BACKTRACE_DESC= Enable backtrace CONFIGROLLBACKS_DESC= Enable configuration rollback support FPM_DESC= Enable Forwarding Plane Manager support DATACENTER_DESC= Use reduced BGP timers LDPD_DESC= Build ldpd -MULTIPATH_DESC= Enable multipath function +MULTIPATH_DESC= Allow 64 multipath routes (16 default) PAM_DESC= Use libpam for PAM support in vtysh RPKI_DESC= Add BGP RPKI (RFC 6810) support SHELLACCESS_DESC= Allow users to access shell/telnet/ssh @@ -91,23 +93,23 @@ GROUPS= frr frrvty CPPFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib -# PIM compile but didn't work on FreeBSD +# PIM compile but doesn't work on FreeBSD CONFIGURE_ARGS= --enable-user=frr \ --enable-group=frr \ --enable-vty-group=frrvty \ --disable-doc-html \ --sysconfdir=${ETCDIR} \ --localstatedir=/var/run/frr \ - --disable-backtrace \ --disable-nhrpd \ --disable-pathd \ --disable-ospfclient \ --disable-pimd \ - --disable-vrrpd \ --with-vtysh-pager=cat MANPAGES_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=0,1:textproc/py-sphinx@${PY_FLAVOR} MANPAGES_CONFIGURE_OFF= --disable-doc +BACKTRACE_LIB_DEPENDS= libunwind.so:devel/libunwind +BACKTRACE_CONFIGURE_ENABLE= backtrace CONFIGROLLBACKS_LIB_DEPENDS= libsqlite3.so:databases/sqlite3 CONFIGROLLBACKS_CONFIGURE_ENABLE= config-rollbacks DATACENTER_CONFIGURE_ENABLE= datacenter diff --git a/net/frr8/files/patch-bgpd_bgp__lcommunity.c b/net/frr8/files/patch-bgpd_bgp__lcommunity.c new file mode 100644 index 000000000000..9f8566cea61d --- /dev/null +++ b/net/frr8/files/patch-bgpd_bgp__lcommunity.c @@ -0,0 +1,42 @@ +--- bgpd/bgp_lcommunity.c.orig 2023-03-13 14:01:47 UTC ++++ bgpd/bgp_lcommunity.c +@@ -211,12 +211,13 @@ static void set_lcommunity_string(struct lcommunity *l + } + + /* 1 space + lcom->size lcom strings + null terminator */ +- size_t str_buf_sz = BUFSIZ; ++ size_t str_buf_sz = (LCOMMUNITY_STRLEN * lcom->size) + 2; + str_buf = XCALLOC(MTYPE_LCOMMUNITY_STR, str_buf_sz); + ++ len = 0; + for (i = 0; i < lcom->size; i++) { + if (i > 0) +- strlcat(str_buf, " ", str_buf_sz); ++ len = strlcat(str_buf, " ", str_buf_sz); + + pnt = lcom->val + (i * LCOMMUNITY_SIZE); + pnt = ptr_get_be32(pnt, &global); +@@ -229,11 +230,22 @@ static void set_lcommunity_string(struct lcommunity *l + snprintf(lcsb, sizeof(lcsb), "%u:%u:%u", global, local1, + local2); + ++ /* ++ * Aliases can cause havoc, if the alias length is greater ++ * than the LCOMMUNITY_STRLEN for a particular item ++ * then we need to realloc the memory associated ++ * with the string so that it can fit ++ */ + const char *com2alias = + translate_alias ? bgp_community2alias(lcsb) : lcsb; ++ size_t individual_len = strlen(com2alias); ++ if (individual_len + len > str_buf_sz) { ++ str_buf_sz = individual_len + len + 1; ++ str_buf = XREALLOC(MTYPE_LCOMMUNITY_STR, str_buf, ++ str_buf_sz); ++ } + + len = strlcat(str_buf, com2alias, str_buf_sz); +- assert((unsigned int)len < str_buf_sz); + + if (make_json) { + json_string = json_object_new_string(com2alias);