summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/radvd
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons/radvd')
-rw-r--r--meta-networking/recipes-daemons/radvd/files/radvd.default1
-rwxr-xr-xmeta-networking/recipes-daemons/radvd/files/radvd.init135
-rw-r--r--meta-networking/recipes-daemons/radvd/files/radvd.service11
-rw-r--r--meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd2
-rw-r--r--meta-networking/recipes-daemons/radvd/radvd.inc67
-rw-r--r--meta-networking/recipes-daemons/radvd/radvd_1.14.bb6
6 files changed, 222 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/radvd/files/radvd.default b/meta-networking/recipes-daemons/radvd/files/radvd.default
new file mode 100644
index 000000000..7cb73c771
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/radvd.default
@@ -0,0 +1 @@
OPTIONS="-u radvd"
diff --git a/meta-networking/recipes-daemons/radvd/files/radvd.init b/meta-networking/recipes-daemons/radvd/files/radvd.init
new file mode 100755
index 000000000..8b26317ee
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/radvd.init
@@ -0,0 +1,135 @@
1#! /bin/sh
2#
3### BEGIN INIT INFO
4# Provides: radvd
5# Required-Start: $remote_fs $named $syslog
6# Required-Stop: $remote_fs $named $syslog
7# Default-Start: 3 5
8# Default-Stop: 0 1 2 6
9# Description: router advertisement daemon
10### END INIT INFO
11
12# Source function library.
13. /etc/init.d/functions
14
15PATH=/sbin:/bin:/usr/sbin:/usr/bin
16DAEMON=/usr/sbin/radvd
17NAME=radvd
18DESC=radvd
19CONFIG=/etc/radvd.conf
20SAVED_SETTINGS=/var/run/radvd/saved-settings
21PIDFILE=/var/run/radvd/radvd.pid
22OPTIONS="-u radvd -p $PIDFILE"
23
24test -x $DAEMON || exit 0
25
26set -e
27
28# Check for IPv6 support in kernel
29if test \! -e /proc/sys/net/ipv6; then
30 echo "IPv6 support must be enabled in the kernel for $DESC to work."
31 exit
32fi
33
34save_settings()
35{
36 local file=$1
37
38 rm -f $file
39 for if_conf in /proc/sys/net/ipv6/conf/*; do
40 echo -e "$if_conf/forwarding\t `cat $if_conf/forwarding`" >> $file
41 done
42 return 0
43}
44
45restore_settings()
46{
47 file=$1
48
49 if [ ! -f $file ]; then
50 echo "$0: warning: cannot restore settings"
51 return
52 fi
53
54 (
55 while read f value; do
56 if [ -w $f ]; then
57 echo $value > $f
58 fi
59 done
60 ) < $file
61}
62
63chkconfig() {
64 if [ ! -e $CONFIG -o ! -s $CONFIG ]; then
65 echo ""
66 echo "* $CONFIG does not exist or is empty."
67 echo "* See /usr/share/doc/radvd/radvd.conf.example for a simple"
68 echo "* configuration suitable for most systems, and radvd.conf(5)"
69 echo "* for configuration file syntax. radvd will *not* be started."
70 exit 0
71 fi
72}
73
74case "$1" in
75 start)
76 echo -n "Starting $DESC: "
77 chkconfig
78 save_settings $SAVED_SETTINGS
79
80 # We must enable IPv6 forwarding for radvd to work
81 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
82
83 # Check for stale pidfile; radvd won't start if one is lying around
84 if [ -f $PIDFILE ] && ! ps `cat $PIDFILE` > /dev/null; then
85 rm -f $PIDFILE
86 fi
87 if ! start-stop-daemon --oknodo --start --pidfile $PIDFILE \
88 --exec $DAEMON -- $OPTIONS; then
89 echo "failed." && exit 1
90 fi
91 echo "$NAME."
92 ;;
93 stop)
94 echo -n "Stopping $DESC: "
95 if ! [ -f $PIDFILE ] ; then
96 echo "not running."
97 exit 0
98 fi
99 start-stop-daemon --oknodo --stop --pidfile $PIDFILE \
100 --exec $DAEMON
101 restore_settings $SAVED_SETTINGS
102 rm -f $SAVED_SETTINGS
103 echo "$NAME."
104 ;;
105 status)
106 status $DAEMON;
107 exit $?
108 ;;
109 reload|force-reload)
110 echo "Reloading $DESC configuration files."
111 start-stop-daemon --stop --signal HUP --quiet --pidfile \
112 $PIDFILE --exec $DAEMON
113 ;;
114 restart)
115 chkconfig
116 echo -n "Restarting $DESC: "
117 if ! start-stop-daemon --stop --quiet --pidfile \
118 $PIDFILE --exec $DAEMON; then
119 # stop failed, so we were not running
120 save_settings $SAVED_SETTINGS
121 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
122 fi
123 sleep 1
124 start-stop-daemon --start --quiet --pidfile \
125 $PIDFILE --exec $DAEMON -- $OPTIONS
126 echo "$NAME."
127 ;;
128 *)
129 N=/etc/init.d/$NAME
130 echo "Usage: $N {start|stop|status|restart|reload|force-reload}" >&2
131 exit 1
132 ;;
133esac
134
135exit 0
diff --git a/meta-networking/recipes-daemons/radvd/files/radvd.service b/meta-networking/recipes-daemons/radvd/files/radvd.service
new file mode 100644
index 000000000..e60798a6b
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/radvd.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Router advertisement daemon for IPv6
3After=network.target
4ConditionPathExists=@SYSCONFDIR@/radvd.conf
5
6[Service]
7EnvironmentFile=-@SYSCONFDIR@/default/radvd
8ExecStart=@SBINDIR@/radvd -n $OPTIONS
9
10[Install]
11WantedBy=multi-user.target
diff --git a/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd b/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd
new file mode 100644
index 000000000..89256a40e
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd
@@ -0,0 +1,2 @@
1# <type> <owner> <group> <mode> <path> <linksource>
2d radvd root 0755 /var/run/radvd none
diff --git a/meta-networking/recipes-daemons/radvd/radvd.inc b/meta-networking/recipes-daemons/radvd/radvd.inc
new file mode 100644
index 000000000..6b595b07f
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/radvd.inc
@@ -0,0 +1,67 @@
1SUMMARY = "IPv6 router advertisement daemon"
2DESCRIPTION = "radvd is the router advertisement daemon for IPv6. It \
3listens to router solicitations and sends router \
4advertisements as described in RFC 2461, Neighbor \
5Discovery for IP Version 6 (IPv6). With these \
6advertisements hosts can automatically configure their \
7addresses and some other parameters. They also can \
8choose a default router based on these advertisements."
9HOMEPAGE = "http://www.litech.org/radvd/"
10SECTION = "console/network"
11DEPENDS = "flex-native libdaemon"
12
13# License is BSD-Style (with advertising clause) but also has an additional 0th clause
14LICENSE = "radvd"
15LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=73ebbf7182ae996e65e8fadc9a8c45db"
16
17SRC_URI = "http://v6web.litech.org/radvd/dist/radvd-${PV}.tar.gz \
18 file://radvd.init \
19 file://radvd.service \
20 file://volatiles.03_radvd \
21 file://radvd.default"
22
23inherit autotools update-rc.d useradd pkgconfig systemd
24
25SYSTEMD_SERVICE_${PN} = "radvd.service"
26SYSTEMD_AUTO_ENABLE = "disable"
27
28do_install_append () {
29 install -m 0755 -d ${D}${sysconfdir}/init.d \
30 ${D}${sysconfdir}/default/volatiles \
31 ${D}${docdir}/radvd
32 # Install init script and volatiles
33 install -m 0755 ${WORKDIR}/radvd.init ${D}${sysconfdir}/init.d/radvd
34 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/radvd
35 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/radvd
36 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/radvd
37 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/radvd
38
39 install -m 0644 ${WORKDIR}/volatiles.03_radvd ${D}${sysconfdir}/default/volatiles/volatiles.03_radvd
40
41 # Install systemd service files
42 install -d ${D}${systemd_unitdir}/system
43 install -m 0644 ${WORKDIR}/radvd.service ${D}${systemd_unitdir}/system
44 sed -i -e 's#@SYSCONFDIR@#${sysconfdir}#g' \
45 -e 's#@SBINDIR@#${sbindir}#g' \
46 -e 's#@BASE_BINDIR@#${base_bindir}#g' ${D}${systemd_unitdir}/system/radvd.service
47
48 # Install default environment file
49 install -m 0644 ${WORKDIR}/radvd.default ${D}${sysconfdir}/default/radvd
50
51 # Documentation
52 for i in radvd.conf.example README; do \
53 install -m 0644 ${S}/$i ${D}${docdir}/radvd; \
54 done
55}
56
57INITSCRIPT_NAME = "radvd"
58INITSCRIPT_PARAMS = "defaults 20 80"
59
60USERADD_PACKAGES = "${PN}"
61USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/radvd/ -M -g nogroup radvd"
62
63pkg_postinst_${PN} () {
64 if [ -z "$D" -a -x /etc/init.d/populate-volatile.sh ]; then
65 /etc/init.d/populate-volatile.sh update
66 fi
67}
diff --git a/meta-networking/recipes-daemons/radvd/radvd_1.14.bb b/meta-networking/recipes-daemons/radvd/radvd_1.14.bb
new file mode 100644
index 000000000..bf572e3bb
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/radvd_1.14.bb
@@ -0,0 +1,6 @@
1
2require radvd.inc
3
4SRC_URI[md5sum] = "a257e05bd6a435ef948d3b407726d56f"
5SRC_URI[sha256sum] = "3b16dd9ef3d6c8b889cdabfdb16c81db8bd61b0f1fc42f6acc52d3cf300c6d07"
6