- moved /usr/lib/ddns/dynamic_dns_lucihelper.sh from luci-app-ddns into this package (Github openwrt/luci issue 251) (OpenWrt Trac tickets 18326 18347) - fix: dynamic_dns_update.sh did not loop (OpenWrt Trac ticket 18336) - add provider cloudflare.com IPv4 and IPv6 (Thanks to Paul for support and testing) (OpenWrt Trac ticket 12500) - modified detection, if dynamic_dns_fuctions are used by dynamic_dns_lucihelper.sh - redirect stdout of wget,curl,host,nslookup,nc etc to /tmp/ddns_$$.dat and *.err instead of variables - extended error detection in get_local_ip function - modified verify of option ip_script to allow parameters, when calling - add provider selfhost.de IPv4 - add provider no-ip.pl (nothing to do with no-ip.com) (Github openwrt/packages issue #542) IPv4 (tested) and also added for IPv6 (NOT tested) because client IP is autodetected be provider - add getlocalip_sample.sh as sample script for usage of option ip_source 'script' together with option ip_script '/usr/lib/ddns/getlocalip.sh -4' - cleanup whitespaces at line ends Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
47 lines
1.7 KiB
Bash
47 lines
1.7 KiB
Bash
#
|
|
# script for sending updates to no-ip.com / noip.com
|
|
# 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
|
#
|
|
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
|
#
|
|
# provider did not reactivate records, if no IP change was recognized
|
|
# so we send a dummy (localhost) and a seconds later we send the correct IP addr
|
|
#
|
|
local __DUMMY
|
|
local __UPDURL="http://[USERNAME]:[PASSWORD]@dynupdate.no-ip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
|
|
|
# set IP version dependend dummy (localhost)
|
|
[ $use_ipv6 -eq 0 ] && __DUMMY="127.0.0.1" || __DUMMY="::1"
|
|
|
|
# lets do DUMMY transfer
|
|
write_log 7 "sending dummy IP to 'no-ip.com'"
|
|
__URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
|
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__DUMMY#g")
|
|
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
|
|
|
do_transfer "$__URL" || return 1
|
|
|
|
write_log 7 "'no-ip.com' answered:\n$(cat $DATFILE)"
|
|
# analyse provider answers
|
|
# "good [IP_ADR]" = successful
|
|
# "nochg [IP_ADR]" = no change but OK
|
|
grep -E "good|nochg" $DATFILE >/dev/null 2>&1 || return 1
|
|
|
|
# lets wait a seconds
|
|
sleep 1
|
|
|
|
# now send the correct data
|
|
write_log 7 "sending real IP to 'no-ip.com'"
|
|
__URL=$(echo $__UPDURL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
|
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
|
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
|
|
|
do_transfer "$__URL" || return 1
|
|
|
|
write_log 7 "'no-ip.com' answered:\n$(cat $DATFILE)"
|
|
# analyse provider answers
|
|
# "good [IP_ADR]" = successful
|
|
# "nochg [IP_ADR]" = no change but OK
|
|
grep -E "good|nochg" $DATFILE >/dev/null 2>&1
|
|
return $? # "0" if "good" or "nochg" found
|
|
|