From 12192865c3ca0e1c2139afabab508e0087b14982 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Wed, 23 Feb 2022 20:19:37 -0500 Subject: Initial --- etc/local.d/radvd.hook | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 etc/local.d/radvd.hook (limited to 'etc/local.d/radvd.hook') diff --git a/etc/local.d/radvd.hook b/etc/local.d/radvd.hook new file mode 100755 index 0000000..8137d0b --- /dev/null +++ b/etc/local.d/radvd.hook @@ -0,0 +1,42 @@ +#!/bin/sh +# Brutally simply hook for dhcpcd assuming you only have a single interface with +# delegated prefixes, which is the case for most home routers. + +# This writes out a radvd conf for the interface and prefix in question and +# blindly restarts the daemon. + +write_radvd() { + +if [ -z "$new_delegated_dhcp6_prefix" ] ; then + echo "Cannot continue without delegated prefix" + exit 1; +fi + +conf="interface $interface { + AdvSendAdvert on;" + +for prefix in $new_delegated_dhcp6_prefix ; do +conf="$conf + prefix $prefix + { + AdvOnLink on; + AdvAutonomous on; + AdvRouterAddr on; + }; +" +done + +conf="$conf +};" + +echo "$conf" > /etc/radvd.conf + +/etc/init.d/radvd restart +} + +case "$reason" in +DELEGATED6) +write_radvd +;; +esac + -- cgit v1.2.3