summaryrefslogtreecommitdiff
path: root/aports/dhcpcd/99-radvd.conf
diff options
context:
space:
mode:
Diffstat (limited to 'aports/dhcpcd/99-radvd.conf')
-rw-r--r--aports/dhcpcd/99-radvd.conf20
1 files changed, 20 insertions, 0 deletions
diff --git a/aports/dhcpcd/99-radvd.conf b/aports/dhcpcd/99-radvd.conf
new file mode 100644
index 0000000..8bab674
--- /dev/null
+++ b/aports/dhcpcd/99-radvd.conf
@@ -0,0 +1,20 @@
+# Update domain name server IPv6 addresses and
+# restart radvd on reconfiguration of the interface.
+
+RESOLV_CONF="/etc/resolv.conf"
+RADVD_CONF="/tmp/radvd.conf"
+RADVD_CONF_TEMPLATE="/etc/radvd.conf"
+
+if $if_configured; then
+ [ ! -f "$RESOLV_CONF" ] && return
+
+ # Filter resolv.conf to get the IPv6 name servers
+ # only.
+ dns=$(grep -F nameserver $RESOLV_CONF | cut -c 12- | grep -E "^[0-9]*:")
+
+ cat $RADVD_CONF_TEMPLATE \
+ | sed "s!%%DNS%%!$dns!" \
+ > $RADVD_CONF
+ chmod a+r "$RADVD_CONF"
+ service radvd --ifstarted restart
+fi