[LEDE-DEV] DDNS for ipv6

e9hack e9hack at gmail.com
Thu Jan 18 16:06:13 PST 2018


Am 17.01.2018 um 21:50 schrieb Christian Schoenebeck:
>> Independently of this, I'm the opinion, ddns for ipv6 can't work with a deal-in or modem connection. My wan interface is
>> pppoe-wan. If the logical interface wan_6 is started, it (or pppoe-wan) doesn't have a global ipv6 address. It does only
>> have a link local address. The global address is assigned later. If the ddns script is started before the global address
>> is assigned, the script will be stopped and never restart.
> 
> Is the an event (reported in syslog) when glocal IPv6 assigned which possibly can be used to (re)activate ddns-scripts?
It is frequently (every 5..10min) send ifupdate for interface wan_6.

> Is the IPv6 assigned by the provider via dhcpv6 request?
The ISP sends a 64bit prefix per router advertisement.

I modify the scripts a little bit, that the script is start by action ifupdate too, if it isn't already running. The
only disadvantage is that it needs sometimes till 10min for the first ifupdate.

Regards,
Hartmut

diff --git a/net/ddns-scripts/files/ddns.hotplug b/net/ddns-scripts/files/ddns.hotplug
index 9ef172d..18fb7af 100755
--- a/net/ddns-scripts/files/ddns.hotplug
+++ b/net/ddns-scripts/files/ddns.hotplug
@@ -2,9 +2,10 @@

 # there are other ACTIONs like ifupdate we don't need
 case "$ACTION" in
-	ifup)					# OpenWrt is giving a network not phys. Interface
+	ifup|ifupdate)				# OpenWrt is giving a network not phys. Interface
 		/etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- start
 		;;
+
 	ifdown)
 		/usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- stop
 		;;
diff --git a/net/ddns-scripts/files/dynamic_dns_functions.sh b/net/ddns-scripts/files/dynamic_dns_functions.sh
index 90501ac..9306119 100755
--- a/net/ddns-scripts/files/dynamic_dns_functions.sh
+++ b/net/ddns-scripts/files/dynamic_dns_functions.sh
@@ -177,16 +177,29 @@ start_daemon_for_all_ddns_sections()
 	local __SECTIONS=""
 	local __SECTIONID=""
 	local __IFACE=""
+	local __PIDFILE=""
+	local __PID=0

 	load_all_service_sections __SECTIONS
 	for __SECTIONID in $__SECTIONS; do
 		config_get __IFACE "$__SECTIONID" interface "wan"
 		[ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue
-		if [ $VERBOSE -eq 0 ]; then	# start in background
-			/usr/lib/ddns/dynamic_dns_updater.sh -v 0 -S "$__SECTIONID" -- start &
-		else
-			/usr/lib/ddns/dynamic_dns_updater.sh -v "$VERBOSE" -S "$__SECTIONID" -- start
-		fi
+
+		__PIDFILE="$ddns_rundir/$__SECTIONID.pid"
+		__PID=0
+
+		[ -e "$__PIDFILE" ] && {
+			__PID=$(cat $__PIDFILE)
+			ps | grep "^[\t ]*$__PID" >/dev/null 2>&1 || __PID=0
+		}
+
+		[  $__PID -eq 0 ] && {
+			if [ $VERBOSE -eq 0 ]; then	# start in background
+				/usr/lib/ddns/dynamic_dns_updater.sh -v 0 -S "$__SECTIONID" -- start &
+			else
+				/usr/lib/ddns/dynamic_dns_updater.sh -v "$VERBOSE" -S "$__SECTIONID" -- start
+			fi
+		}
 	done
 }








More information about the Lede-dev mailing list