summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2018-11-25 11:13:28 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2018-11-25 11:14:13 +0000
commit6b771c256f85e302da9fb833d9f162971d752c91 (patch)
tree9202998bb9e616d26b2ae7ec876bc2f08edc14bc /net-misc/radvd
parentsys-auth/pam_fprint: Add pam-bugs to metadata (diff)
downloadgentoo-6b771c256f85e302da9fb833d9f162971d752c91.tar.gz
gentoo-6b771c256f85e302da9fb833d9f162971d752c91.tar.bz2
gentoo-6b771c256f85e302da9fb833d9f162971d752c91.zip
net-misc/radvd: backport nd_opt_6co serialization, bug #637958
Reported-by: Rolf Eike Beer Bug: https://github.com/reubenhwk/radvd/issues/77 Closes: https://bugs.gentoo.org/637958 Package-Manager: Portage-2.3.52, Repoman-2.3.12 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'net-misc/radvd')
-rw-r--r--net-misc/radvd/files/radvd-2.17-nd_opt_6co.patch48
-rw-r--r--net-misc/radvd/radvd-2.17-r2.ebuild70
2 files changed, 118 insertions, 0 deletions
diff --git a/net-misc/radvd/files/radvd-2.17-nd_opt_6co.patch b/net-misc/radvd/files/radvd-2.17-nd_opt_6co.patch
new file mode 100644
index 000000000000..09fb29f9e318
--- /dev/null
+++ b/net-misc/radvd/files/radvd-2.17-nd_opt_6co.patch
@@ -0,0 +1,48 @@
+nd_opt_6co: fix serialization
+
+Bug: https://github.com/reubenhwk/radvd/issues/77
+Bug: https://bugs.gentoo.org/637958
+--- a/radvd.h
++++ b/radvd.h
+@@ -261,5 +261,3 @@ struct nd_opt_6co {
+ uint8_t nd_opt_6co_context_len;
+- uint8_t nd_opt_6co_res : 3;
+- uint8_t nd_opt_6co_c : 1;
+- uint8_t nd_opt_6co_cid : 4;
++ uint8_t nd_opt_6co_res_c_cid; /* [ res=3-bits | c=1-bit | cid=4-bits ] */
+ uint16_t nd_opt_6co_reserved;
+--- a/send.c
++++ b/send.c
+@@ -621,5 +621,5 @@ static void add_ra_option_lowpanco(struct safe_buffer *sb, struct AdvLowpanCo co
+ co.nd_opt_6co_context_len = lowpanco->ContextLength;
+- co.nd_opt_6co_c = lowpanco->ContextCompressionFlag;
+- co.nd_opt_6co_cid = lowpanco->AdvContextID;
+- co.nd_opt_6co_valid_lifetime = lowpanco->AdvLifeTime;
++ co.nd_opt_6co_res_c_cid = ((lowpanco->ContextCompressionFlag ? 1 : 0) << 4)
++ | (lowpanco->AdvContextID & 0x0F);
++ co.nd_opt_6co_valid_lifetime = htons(lowpanco->AdvLifeTime);
+ co.nd_opt_6co_con_prefix = lowpanco->AdvContextPrefix;
+@@ -637,5 +637,5 @@ static void add_ra_option_abro(struct safe_buffer *sb, struct AdvAbro const *abr
+ abro.nd_opt_abro_len = 3;
+- abro.nd_opt_abro_ver_low = abroo->Version[1];
+- abro.nd_opt_abro_ver_high = abroo->Version[0];
+- abro.nd_opt_abro_valid_lifetime = abroo->ValidLifeTime;
++ abro.nd_opt_abro_ver_low = htons(abroo->Version[1]);
++ abro.nd_opt_abro_ver_high = htons(abroo->Version[0]);
++ abro.nd_opt_abro_valid_lifetime = htons(abroo->ValidLifeTime);
+ abro.nd_opt_abro_6lbr_address = abroo->LBRaddress;
+--- a/test/send.c
++++ b/test/send.c
+@@ -311,6 +311,5 @@ START_TEST(test_add_ra_option_lowpanco)
+ unsigned char expected[] = {
+- 0x22, 0x03, 0x32, 0x48, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
++ 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
+-
+ ck_assert_int_eq(sb.used, sizeof(expected));
+@@ -336,3 +335,3 @@ START_TEST(test_add_ra_option_abro)
+ unsigned char expected[] = {
+- 0x23, 0x03, 0x0a, 0x00, 0x02, 0x00, 0x02, 0x00, 0xfe, 0x80, 0x00, 0x00,
++ 0x23, 0x03, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x02, 0xfe, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
diff --git a/net-misc/radvd/radvd-2.17-r2.ebuild b/net-misc/radvd/radvd-2.17-r2.ebuild
new file mode 100644
index 000000000000..aeaf39fdd2b1
--- /dev/null
+++ b/net-misc/radvd/radvd-2.17-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit systemd user eutils readme.gentoo-r1
+
+DESCRIPTION="Linux IPv6 Router Advertisement Daemon"
+HOMEPAGE="http://v6web.litech.org/radvd/"
+SRC_URI="http://v6web.litech.org/radvd/dist/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="kernel_FreeBSD selinux test"
+
+CDEPEND="dev-libs/libdaemon"
+DEPEND="${CDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ virtual/pkgconfig
+ test? ( dev-libs/check )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-radvd )
+"
+DOCS=( CHANGES README TODO radvd.conf.example )
+
+PATCHES=(
+ "${FILESDIR}"/${P}-nd_opt_6co.patch
+)
+
+pkg_setup() {
+ enewgroup radvd
+ enewuser radvd -1 -1 /dev/null radvd
+}
+
+src_configure() {
+ econf --with-pidfile=/run/radvd/radvd.pid \
+ --disable-silent-rules \
+ --with-systemdsystemunitdir=no \
+ $(use_with test check)
+}
+
+src_install() {
+ default
+
+ insinto /usr/share/doc/${PF}/html
+ doins INTRO.html
+
+ newinitd "${FILESDIR}"/${PN}-2.15.init ${PN}
+ newconfd "${FILESDIR}"/${PN}.conf ${PN}
+
+ systemd_dounit "${FILESDIR}"/${PN}.service
+
+ if use kernel_FreeBSD ; then
+ sed -i -e \
+ 's/^SYSCTL_FORWARD=.*$/SYSCTL_FORWARD=net.inet6.ip6.forwarding/g' \
+ "${D}"/etc/init.d/${PN} || die
+ fi
+
+ readme.gentoo_create_doc
+}
+
+DISABLE_AUTOFORMATTING=1
+DOC_CONTENTS="Please create a configuration file ${ROOT}etc/radvd.conf.
+See ${ROOT}usr/share/doc/${PF} for an example.
+
+grsecurity users should allow a specific group to read /proc
+and add the radvd user to that group, otherwise radvd may
+segfault on startup."