Re: [OpenWrt-Devel] [patch] ddns-scripts feature

2010-04-11 Thread Florian Fainelli
Hello Tomasz,

Le mercredi 24 mars 2010 12:30:15, Tomasz Fornal a écrit :
 Hello
 
 I added small feature to ddns-script form myself, but it might be useful
 for others.
 This enhancement allow user to specify any script to obtain IP address.
 In configuration file option ip_source should be set to script and
 option ip_script should contain path to user script. Script must just
 return IP address.
 
 I use this to obtain address from status page generated by my modem (and
 wait a little time if connection isn't established).
 
 I attach file with differences in the dynamic_dns_functions.sh file (and
 also proposed additions to configuration file). I hope i do it right (i
 don't have any experience with that :)). I edited this files right on my
 router.
 
 What do you think about this idea?
 

Applied in r20810, thanks!



signature.asc
Description: This is a digitally signed message part.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [patch] ddns-scripts feature

2010-03-24 Thread Tomasz Fornal
Hello

I added small feature to ddns-script form myself, but it might be useful
for others.
This enhancement allow user to specify any script to obtain IP address.
In configuration file option ip_source should be set to script and
option ip_script should contain path to user script. Script must just
return IP address.

I use this to obtain address from status page generated by my modem (and
wait a little time if connection isn't established).

I attach file with differences in the dynamic_dns_functions.sh file (and
also proposed additions to configuration file). I hope i do it right (i
don't have any experience with that :)). I edited this files right on my
router.

What do you think about this idea?
Index: packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
===
--- a/packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
+++ b/packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
@@ -53,7 +53,7 @@
 {
 
#if ip source is not defined, assume we want to get ip from wan 
-   if [ $ip_source != interface ]  [ $ip_source != web ]
+   if [ $ip_source != interface ]  [ $ip_source != web ]  [ 
$ip_source != script ]
then
ip_source=network
ip_network=wan
@@ -74,6 +74,10 @@
if [ $ip_source = network ] || [ $ip_source = interface ]
then
current_ip=$(ifconfig $ip_interface | grep -o 'inet 
addr:[0-9.]*' | grep -o $ip_regex)
+   elif [ $ip_source = script ]
+   then
+   # get ip from script
+   current_ip=$($ip_script)
else
# get ip from web
# we check each url in order in ip_url variable, and if no ips 
are found we use dyndns ip checker
Index: packages/net/ddns-scripts/files/etc/config/ddns
===
--- a/packages/net/ddns-scripts/files/etc/config/ddns
+++ b/packages/net/ddns-scripts/files/etc/config/ddns
@@ -31,6 +31,9 @@
 # (e.g. eth1) and whatever the current ip of this interface is
 # will be associated with the domain when an update is performed.
 #
+# If ip_source is script you specify a script to obtain ip address.
+# The ip_script option should contain path to your script.
+#
 # The last possibility is that ip_source is web, which means
 # that in order to obtain our ip address we will connect to a 
 # website, and the first valid ip address listed on that page
@@ -76,6 +79,9 @@
 
#option ip_source   interface
#option ip_interfaceeth0.1
+
+   #option ip_source   script
+   #option ip_script   path to your scrip
 
#option ip_source   web
#option ip_url  
http://www.whatismyip.com/automation/n09230945.asp;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel