commit:     ab71ee7a03166f69b15849ab336ed5056aa0b8d0
Author:     Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 25 16:03:14 2018 +0000
Commit:     Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
CommitDate: Thu Jan 25 16:03:28 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab71ee7a

net-misc/quagga: revision bump

Backport fixes for test failures on sparc and incorrect ipv6 route handling

Closes: https://bugs.gentoo.org/638906
Closes: https://bugs.gentoo.org/641736

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 net-misc/quagga/files/quagga-1.2.2-ipv6-bgp.patch  |  42 +++++++
 .../quagga/files/quagga-1.2.2-sparc-tests.patch    |  31 +++++
 net-misc/quagga/quagga-1.2.2-r1.ebuild             | 137 +++++++++++++++++++++
 3 files changed, 210 insertions(+)

diff --git a/net-misc/quagga/files/quagga-1.2.2-ipv6-bgp.patch 
b/net-misc/quagga/files/quagga-1.2.2-ipv6-bgp.patch
new file mode 100644
index 00000000000..0ee5f322f76
--- /dev/null
+++ b/net-misc/quagga/files/quagga-1.2.2-ipv6-bgp.patch
@@ -0,0 +1,42 @@
+commit 1db1b9baea511995b67a9b282d5c97e87479fe5d
+Author: Mathieu Jadin <mathja...@gmail.com>
+Date:   Thu Dec 14 17:53:53 2017 +0100
+
+    bgpd: Fix mistake in NHT of connected IPv6 next-hops preventing route 
advertisement
+    
+    Since quagga-1.2.0, the Next Hop validation for directly connected peers
+    using IPv6 does not work.
+    
+    In this setup, BGP updates contain two next hops: a global IPv6 address and
+    a link-local IPv6 address (a correct behavior according to RFC 2545).  This
+    means that the length of the next hop attribute is 32 and not 16.
+    
+    The problem comes from the function "make_prefix()" in "bgpd/bgp_nht.c".  
It
+    refuses to build a prefix structure for a route when the length of the
+    [Anext hop attribute is different from 16, even if a valid global IPv6
+    address is available.
+    
+    The route is mistakenly considered invalid and thus, it is not installed in
+    the routing table.
+    
+    Details: "make_prefix()" was not modified in quagga-1.2.0 but its
+    interpretation was changed in commit
+    3dda6b3eccb9a2a88d607372c83c04c796e7daac.  Before this commit, the failure
+    of "make_prefix()" was interpreted as a successful validation of the next
+    hop.
+
+diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
+index 1158ab15..d734c201 100644
+--- a/bgpd/bgp_nht.c
++++ b/bgpd/bgp_nht.c
+@@ -409,8 +409,8 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix 
*p)
+       break;
+ #ifdef HAVE_IPV6
+     case AFI_IP6:
+-      if (ri->attr->extra->mp_nexthop_len != 16
+-        || IN6_IS_ADDR_LINKLOCAL (&ri->attr->extra->mp_nexthop_global))
++      if (ri->attr->extra->mp_nexthop_len == 16
++        && IN6_IS_ADDR_LINKLOCAL (&ri->attr->extra->mp_nexthop_global))
+       return -1;
+ 
+       p->family = AF_INET6;

diff --git a/net-misc/quagga/files/quagga-1.2.2-sparc-tests.patch 
b/net-misc/quagga/files/quagga-1.2.2-sparc-tests.patch
new file mode 100644
index 00000000000..054d15f0355
--- /dev/null
+++ b/net-misc/quagga/files/quagga-1.2.2-sparc-tests.patch
@@ -0,0 +1,31 @@
+commit adda534f95ec87206c9dfd1b3bae05221dc29730
+Author: Rolf Eike Beer <e...@sf-mail.de>
+Date:   Mon Dec 4 18:36:21 2017 +0100
+
+    bgpd: fix SIGBUS
+    
+    There is one test failure in the testsuite on sparc:
+    
+    Running ./bgpd.tests/testbgpcap.exp ...
+    failed: testbgpcap ORF: ORF, simple, single entry, single tuple -- 
testbgpcap  aborted!
+    
+    The error is a SIGBUS in bgp_capability_mp_data() because of an unaligned
+    memory access.  Use memcpy() instead of direct assignments.  Compilers on
+    platforms that support unaligned accesses should be clever enough to
+    optimize the function call away and do the direct store, so this should not
+    hurt there.
+
+diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
+index 28004230..d9ec4bef 100644
+--- a/bgpd/bgp_open.c
++++ b/bgpd/bgp_open.c
+@@ -120,7 +120,8 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer)
+ static void 
+ bgp_capability_mp_data (struct stream *s, struct capability_mp_data *mpc)
+ {
+-  mpc->afi = stream_getw (s);
++  afi_t afi = stream_getw (s);
++  memcpy(&mpc->afi, &afi, sizeof(mpc->afi));
+   mpc->reserved = stream_getc (s);
+   mpc->safi = stream_getc (s);
+ }

diff --git a/net-misc/quagga/quagga-1.2.2-r1.ebuild 
b/net-misc/quagga/quagga-1.2.2-r1.ebuild
new file mode 100644
index 00000000000..5e0fc3e952d
--- /dev/null
+++ b/net-misc/quagga/quagga-1.2.2-r1.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CLASSLESS_BGP_PATCH=ht-20040304-classless-bgp.patch
+
+inherit autotools eutils flag-o-matic multilib pam readme.gentoo-r1 systemd 
tmpfiles user
+
+DESCRIPTION="A free routing daemon replacing Zebra supporting RIP, OSPF and 
BGP"
+HOMEPAGE="http://quagga.net/";
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz
+       bgpclassless? ( 
http://hasso.linux.ee/stuff/patches/quagga/${CLASSLESS_BGP_PATCH} )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~s390 ~sparc ~x86"
+
+IUSE="bgpclassless caps fpm doc elibc_glibc ipv6 multipath nhrpd ospfapi pam 
protobuf +readline snmp tcp-zebra test"
+
+COMMON_DEPEND="
+       caps? ( sys-libs/libcap )
+       nhrpd? ( net-dns/c-ares:0= )
+       protobuf? ( dev-libs/protobuf-c:0= )
+       readline? (
+               sys-libs/readline:0=
+               pam? ( sys-libs/pam )
+       )
+       snmp? ( net-analyzer/net-snmp )
+       !elibc_glibc? ( dev-libs/libpcre )"
+DEPEND="${COMMON_DEPEND}
+       sys-apps/gawk
+       sys-devel/libtool:2
+       test? ( dev-util/dejagnu )"
+RDEPEND="${COMMON_DEPEND}
+       sys-apps/iproute2"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.99.22.4-ipctl-forwarding.patch"
+       "${FILESDIR}/${P}-ipv6-bgp.patch"
+       "${FILESDIR}/${P}-sparc-tests.patch"
+)
+
+DISABLE_AUTOFORMATTING=1
+DOC_CONTENTS="Sample configuration files can be found in 
/usr/share/doc/${PF}/samples
+You have to create config files in /etc/quagga before
+starting one of the daemons.
+
+You can pass additional options to the daemon by setting the EXTRA_OPTS
+variable in their respective file in /etc/conf.d"
+
+pkg_setup() {
+       enewgroup quagga
+       enewuser quagga -1 -1 /var/empty quagga
+}
+
+src_prepare() {
+       # Classless prefixes for BGP
+       # http://hasso.linux.ee/doku.php/english:network:quagga
+       use bgpclassless && eapply -p0 "${DISTDIR}/${CLASSLESS_BGP_PATCH}"
+
+       eapply "${PATCHES[@]}"
+       eapply_user
+       eautoreconf
+}
+
+src_configure() {
+       append-flags -fno-strict-aliasing
+
+       # do not build PDF docs
+       export ac_cv_prog_PDFLATEX=no
+       export ac_cv_prog_LATEXMK=no
+
+       econf \
+               --enable-exampledir=/usr/share/doc/${PF}/samples \
+               --enable-irdp \
+               --enable-isisd \
+               --enable-isis-topology \
+               --enable-pimd \
+               --enable-user=quagga \
+               --enable-group=quagga \
+               --enable-vty-group=quagga \
+               --with-cflags="${CFLAGS}" \
+               --with-pkg-extra-version="-gentoo" \
+               --sysconfdir=/etc/quagga \
+               --localstatedir=/run/quagga \
+               --disable-static \
+               $(use_enable caps capabilities) \
+               $(usex snmp '--enable-snmp' '' '' '') \
+               $(use_enable !elibc_glibc pcreposix) \
+               $(use_enable fpm) \
+               $(use_enable tcp-zebra) \
+               $(use_enable doc) \
+               $(usex multipath $(use_enable multipath) '' '=0' '') \
+               $(usex ospfapi '--enable-ospfclient' '' '' '') \
+               $(use_enable readline vtysh) \
+               $(use_with pam libpam) \
+               $(use_enable nhrpd) \
+               $(use_enable protobuf) \
+               $(use_enable ipv6 ripngd) \
+               $(use_enable ipv6 ospf6d) \
+               $(use_enable ipv6 rtadv)
+}
+
+src_install() {
+       default
+       prune_libtool_files
+       readme.gentoo_create_doc
+
+       keepdir /etc/quagga
+       fowners root:quagga /etc/quagga
+       fperms 0770 /etc/quagga
+
+       # Install systemd-related stuff, bug #553136
+       dotmpfiles "${FILESDIR}/systemd/quagga.conf"
+       systemd_dounit "${FILESDIR}/systemd/zebra.service"
+
+       # install zebra as a file, symlink the rest
+       newinitd "${FILESDIR}"/quagga-services.init.3 zebra
+
+       for service in bgpd isisd ospfd pimd ripd $(use ipv6 && echo ospf6d 
ripngd) $(use nhrpd && echo nhrpd); do
+               dosym zebra /etc/init.d/${service}
+               systemd_dounit "${FILESDIR}/systemd/${service}.service"
+       done
+
+       use readline && use pam && newpamd "${FILESDIR}/quagga.pam" quagga
+
+       insinto /etc/logrotate.d
+       newins redhat/quagga.logrotate quagga
+}
+
+pkg_postinst() {
+       # Path for PIDs before first reboot should be created here, bug #558194
+       tmpfiles_process quagga.conf
+
+       readme.gentoo_print_elog
+}

Reply via email to