commit: ea8251b491b49eb3625494e45a162aa7b86298bb Author: 65278 <felix <AT> adjust <DOT> com> AuthorDate: Sun Apr 8 10:59:07 2018 +0000 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> CommitDate: Tue Apr 10 10:57:31 2018 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=ea8251b4
net-misc/radvd: ebuild and header patch net-misc/radvd/Manifest | 1 + net-misc/radvd/files/radvd-1.9.1.init | 70 +++++++++++++++++++++++++++ net-misc/radvd/files/radvd-2.15.init | 70 +++++++++++++++++++++++++++ net-misc/radvd/files/radvd-2.17-r1-musl.patch | 36 ++++++++++++++ net-misc/radvd/files/radvd.conf | 10 ++++ net-misc/radvd/files/radvd.service | 23 +++++++++ net-misc/radvd/files/radvd.tmpfilesd | 1 + net-misc/radvd/metadata.xml | 12 +++++ net-misc/radvd/radvd-2.17-r1.ebuild | 69 ++++++++++++++++++++++++++ 9 files changed, 292 insertions(+) diff --git a/net-misc/radvd/Manifest b/net-misc/radvd/Manifest new file mode 100644 index 0000000..bdb319c --- /dev/null +++ b/net-misc/radvd/Manifest @@ -0,0 +1 @@ +DIST radvd-2.17.tar.gz 214937 BLAKE2B 1eec22e09607c0396f9539aef203b76d5beca18d1fdf5aa0ff202dcb2ff0e36ed8af74fc7900eb7b16012bfb0672f9660f17c88c222ac0269947d3cf4a270db3 SHA512 117a42c2c007d730b956cf999ac281f50a1a9b57c9428fe0f860cb211ac234ec62f59fead244a80191aaa15ef4ce96fb7dba9bd1a3cb6c3b29f1b6897d7a6132 diff --git a/net-misc/radvd/files/radvd-1.9.1.init b/net-misc/radvd/files/radvd-1.9.1.init new file mode 100644 index 0000000..cea8807 --- /dev/null +++ b/net-misc/radvd/files/radvd-1.9.1.init @@ -0,0 +1,70 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CONFIGFILE=/etc/radvd.conf +PIDFILE=/var/run/radvd/radvd.pid +SYSCTL_FORWARD=net.ipv6.conf.all.forwarding + +extra_started_commands="reload" + +depend() { + need net +} + +checkconfig() { + if [ ! -f "${CONFIGFILE}" ]; then + eerror "Configuration file ${CONFIGFILE} not found" + return 1 + fi + + if ! /usr/sbin/radvd -c -C "${CONFIGFILE}" ; then + eerror "Configuration file ${CONFIGFILE} failed test" + return 1 + fi + + checkpath -d -o radvd:radvd ${PIDFILE%/*} +} + +start() { + if [ "${FORWARD}" != "no" ]; then + ebegin "Enabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=1" >/dev/null + eend $? + fi + + checkconfig || return 1 + + ebegin "Starting IPv6 Router Advertisement Daemon" + start-stop-daemon --start --exec /usr/sbin/radvd \ + --pidfile "${PIDFILE}" \ + -- -C "${CONFIGFILE}" -p "${PIDFILE}" -u radvd ${OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping IPv6 Router Advertisement Daemon" + start-stop-daemon --stop --exec /usr/sbin/radvd --pidfile "${PIDFILE}" + eend $? + + if [ "${FORWARD}" != "no" ]; then + ebegin "Disabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=0" > /dev/null + eend $? + fi +} + +reload() { + if [ "${FORWARD}" != "no" ]; then + ebegin "Enabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=1" >/dev/null + eend $? + fi + + checkconfig || return 1 + + ebegin "Reloading IPv6 Router Advertisement Daemon" + start-stop-daemon --signal HUP \ + --exec /usr/sbin/radvd --pidfile "${PIDFILE}" + eend $? +} diff --git a/net-misc/radvd/files/radvd-2.15.init b/net-misc/radvd/files/radvd-2.15.init new file mode 100644 index 0000000..2c96cca --- /dev/null +++ b/net-misc/radvd/files/radvd-2.15.init @@ -0,0 +1,70 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +CONFIGFILE=/etc/radvd.conf +PIDFILE=/run/radvd/radvd.pid +SYSCTL_FORWARD=net.ipv6.conf.all.forwarding + +extra_started_commands="reload" + +depend() { + need net +} + +checkconfig() { + if [ ! -f "${CONFIGFILE}" ]; then + eerror "Configuration file ${CONFIGFILE} not found" + return 1 + fi + + if ! /usr/sbin/radvd -c -C "${CONFIGFILE}" ; then + eerror "Configuration file ${CONFIGFILE} failed test" + return 1 + fi + + checkpath -d -o radvd:radvd ${PIDFILE%/*} +} + +start() { + if [ "${FORWARD}" != "no" ]; then + ebegin "Enabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=1" >/dev/null + eend $? + fi + + checkconfig || return 1 + + ebegin "Starting IPv6 Router Advertisement Daemon" + start-stop-daemon --start --exec /usr/sbin/radvd \ + --pidfile "${PIDFILE}" \ + -- -C "${CONFIGFILE}" -p "${PIDFILE}" -u radvd ${OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping IPv6 Router Advertisement Daemon" + start-stop-daemon --stop --exec /usr/sbin/radvd --pidfile "${PIDFILE}" + eend $? + + if [ "${FORWARD}" != "no" ]; then + ebegin "Disabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=0" > /dev/null + eend $? + fi +} + +reload() { + if [ "${FORWARD}" != "no" ]; then + ebegin "Enabling IPv6 forwarding" + sysctl -w "${SYSCTL_FORWARD}=1" >/dev/null + eend $? + fi + + checkconfig || return 1 + + ebegin "Reloading IPv6 Router Advertisement Daemon" + start-stop-daemon --signal HUP \ + --exec /usr/sbin/radvd --pidfile "${PIDFILE}" + eend $? +} diff --git a/net-misc/radvd/files/radvd-2.17-r1-musl.patch b/net-misc/radvd/files/radvd-2.17-r1-musl.patch new file mode 100644 index 0000000..157c0b1 --- /dev/null +++ b/net-misc/radvd/files/radvd-2.17-r1-musl.patch @@ -0,0 +1,36 @@ +Index: radvd-2.17/includes.h +=================================================================== +--- radvd-2.17.orig/includes.h ++++ radvd-2.17/includes.h +@@ -76,7 +76,12 @@ + #include <sys/sysctl.h> + #endif + ++#if !defined(__GLIBC__) && defined(linux) ++#include <linux/if.h> ++#define IF_NAMESIZE IFNAMSIZ ++#else + #include <net/if.h> ++#endif + + #ifdef HAVE_NET_IF_DL_H + #include <net/if_dl.h> +Index: radvd-2.17/netlink.c +=================================================================== +--- radvd-2.17.orig/netlink.c ++++ radvd-2.17/netlink.c +@@ -22,7 +22,14 @@ + #include <errno.h> + #include <linux/netlink.h> + #include <linux/rtnetlink.h> ++ ++#if !defined(__GLIBC__) && defined(linux) ++#include <linux/if.h> ++#define IF_NAMESIZE IFNAMSIZ ++#else + #include <net/if.h> ++#endif ++ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/net-misc/radvd/files/radvd.conf b/net-misc/radvd/files/radvd.conf new file mode 100644 index 0000000..6ba8f65 --- /dev/null +++ b/net-misc/radvd/files/radvd.conf @@ -0,0 +1,10 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Extra options to pass to radvd +OPTIONS="" + +# Set this to "no" to tell the init script NOT to set up IPv6 forwarding +# using /proc/sys/net/ipv6/conf/all/forwarding +# Only change this if you know what you're doing! +FORWARD="yes" diff --git a/net-misc/radvd/files/radvd.service b/net-misc/radvd/files/radvd.service new file mode 100644 index 0000000..b496267 --- /dev/null +++ b/net-misc/radvd/files/radvd.service @@ -0,0 +1,23 @@ +[Unit] +Description=Router advertisement daemon for IPv6 +Documentation=man:radvd(8) +After=network.target + +[Service] +Type=forking +ExecStartPre=/usr/sbin/radvd --configtest +ExecStart=/usr/sbin/radvd --username radvd --logmethod stderr --debug 0 +ExecReload=/usr/sbin/radvd --configtest ; \ + /bin/kill -HUP $MAINPID +CPUSchedulingPolicy=idle +PIDFile=/run/radvd/radvd.pid +RuntimeDirectory=radvd +CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE CAP_NET_RAW +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +ProtectHome=yes +NoNewPrivileges=yes + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/radvd/files/radvd.tmpfilesd b/net-misc/radvd/files/radvd.tmpfilesd new file mode 100644 index 0000000..26f203d --- /dev/null +++ b/net-misc/radvd/files/radvd.tmpfilesd @@ -0,0 +1 @@ +d /run/radvd 0755 radvd radvd diff --git a/net-misc/radvd/metadata.xml b/net-misc/radvd/metadata.xml new file mode 100644 index 0000000..8307f5e --- /dev/null +++ b/net-misc/radvd/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>x...@gentoo.org</email> + <name>Michael Weber</name> + </maintainer> + <maintainer type="person"> + <email>prometheanf...@gentoo.org</email> + <name>Matthew Thode</name> + </maintainer> +</pkgmetadata> diff --git a/net-misc/radvd/radvd-2.17-r1.ebuild b/net-misc/radvd/radvd-2.17-r1.ebuild new file mode 100644 index 0000000..797a52e --- /dev/null +++ b/net-misc/radvd/radvd-2.17-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2018 Gentoo Foundation +# 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}"/"${PN}"-2.17-r1-musl.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."