Prevent updates to DynDNS if the ip address hasn't changed.
authorthepeople <thepeople@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 15 Jul 2008 02:45:48 +0000 (02:45 +0000)
committerthepeople <thepeople@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 15 Jul 2008 02:45:48 +0000 (02:45 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@11834 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/updatedd/files/updatedd.init

index 7b6a9b1..d364659 100644 (file)
@@ -11,7 +11,19 @@ start_service () {
        config_get update   "$section" update
 
        [ "$update" = 1 ] && {
-               /usr/bin/updatedd -Y $service -- $username:$password $host
+               if [ "$service" = "dyndns" ]; then
+                       wget http://checkip.dyndns.org -O /tmp/updatedd_ip_check
+                       current_ip=`cat /tmp/updatedd_ip_check |cut -d':' -f2|cut -d'<' -f1 |cut -d' ' -f2`
+                       rm /tmp/updatedd_ip_check
+                       old_ip=`nslookup "$host" |grep "$host" -A 1 |grep Address |cut -d' ' -f3`
+                       if [ "$current_ip" = "$old_ip" ]; then
+                               echo "Preventing abusive update"
+                               abusive=1
+                       fi
+               fi
+               if [ "$abusive" != "1" ]; then
+                       /usr/bin/updatedd -Y $service -- $username:$password $host
+               fi
        }
 }