Hi folks!
First a bit of context:
I have a functional Openvpn ipv4 server that can tunnel ipv4/ipv6 on my gl-ar750s router. This router is configured more like a switch or an AP (but with wifi is off). There are only 2 interfaces LAN & LAN6 both configured as DHCP clients to the ISP router. I used a splitted /64 address space between the openvpn server and regular lan services as described in here.
Not surprisingly, the ISP GUA is dynamic. So I studied this guide only to discover that I needed to do some extensive modifications to make it work in my context:
- I am not using wan6 but lan6 (easy to correct)
- I followed this guide to install the server and to my knowledge it does not store configuration in the UCI managed space as required in the script.
- The install directory for my openvpn server is not the one assumed by the dynamic update script
So I came up with this revised version (my script skills may be a bit rusty) that does not require a extra interface and directly updates the server config:
#!/bin/sh
if [ "$INTERFACE" = "lan6" -a "$IFUPDATE_ADDRESSES" = "1" ]
then
##################
# PD fix
##################
# reload interface to update PD to downstream interfaces, refer to bug described here https://forum.openwrt.org/t/delegated-ipv6-prefix-not-updated/56135
/sbin/ifup lan6
# wait some time to get IPv6 up
sleep 30
source /lib/functions/network.sh
network_get_ipaddr6 LAN6_PREFIX "lan6"
LAN6_PREFIX=`echo $LAN6_PREFIX | sed "s/::[0-9,A-F]*//"`
OVPN6_PREFIX=`cat /etc/openvpn/server.conf | grep server-ipv6 | sed "s/server-ipv6 *//" | sed "s/:8000::\/65//"`
if [ $OVPN6_PREFIX != $LAN6_PREFIX ]
then
cat /etc/openvpn/server.conf.tmpl | sed "s/{IPV6_PREFIX}/$LAN6_PREFIX/" >server.conf
service openvpn reload
fi
fi
but the main condition (top if statement) does not seems to trigger the update altough the internal part does update server.conf correctly if executed manually. Any ideas on why it does not get triggered?