From a00f9da027cf5db527eaf6605240f1d9bc87f35a Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sun, 11 Apr 2010 20:43:41 +0000 Subject: [PATCH] [package] allow a script to get the ip address, patch from Tomasz Fornal SVN-Revision: 20810 --- net/ddns-scripts/Makefile | 2 +- net/ddns-scripts/files/etc/config/ddns | 6 ++++++ .../files/usr/lib/ddns/dynamic_dns_functions.sh | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index b9f715d31b..3811865dee 100644 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ddns-scripts PKG_VERSION:=1.0.0 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/net/ddns-scripts/files/etc/config/ddns b/net/ddns-scripts/files/etc/config/ddns index 7c3f3c1a7c..2545215ed6 100644 --- a/net/ddns-scripts/files/etc/config/ddns +++ b/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 @@ -77,6 +80,9 @@ config service "myddns" #option ip_source "interface" #option ip_interface "eth0.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" diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh index 07ea4b8ffe..82f01ca830 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh @@ -53,7 +53,7 @@ get_current_ip() { #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 @@ get_current_ip() 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 -- 2.30.2