ddns-scripts: fix comparing IPv6 addresses
fix comparing IPv6 addresses Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
parent
51795430fd
commit
32c9818b14
3 changed files with 6 additions and 8 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=ddns-scripts
|
PKG_NAME:=ddns-scripts
|
||||||
# Version == major.minor.patch
|
# Version == major.minor.patch
|
||||||
# increase on new functionality (minor) or patches (patch)
|
# increase on new functionality (minor) or patches (patch)
|
||||||
PKG_VERSION:=2.6.3
|
PKG_VERSION:=2.6.4
|
||||||
# Release == build
|
# Release == build
|
||||||
# increase on changes of services files or tld_names.dat
|
# increase on changes of services files or tld_names.dat
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
# GLOBAL VARIABLES #
|
# GLOBAL VARIABLES #
|
||||||
VERSION="2.6.3-1"
|
VERSION="2.6.4-1"
|
||||||
SECTION_ID="" # hold config's section name
|
SECTION_ID="" # hold config's section name
|
||||||
VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter
|
VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter
|
||||||
|
|
||||||
|
|
|
@ -265,18 +265,15 @@ get_registered_ip REGISTERED_IP "NO_RETRY"
|
||||||
ERR_LAST=$?
|
ERR_LAST=$?
|
||||||
# No error or No IP set otherwise retry
|
# No error or No IP set otherwise retry
|
||||||
[ $ERR_LAST -eq 0 -o $ERR_LAST -eq 127 ] || get_registered_ip REGISTERED_IP
|
[ $ERR_LAST -eq 0 -o $ERR_LAST -eq 127 ] || get_registered_ip REGISTERED_IP
|
||||||
|
# on IPv6 we use expanded version to be shure when comparing
|
||||||
|
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$REGISTERED_IP" REGISTERED_IP
|
||||||
|
|
||||||
# loop endlessly, checking ip every check_interval and forcing an updating once every force_interval
|
# loop endlessly, checking ip every check_interval and forcing an updating once every force_interval
|
||||||
write_log 6 "Starting main loop at $(eval $DATE_PROG)"
|
write_log 6 "Starting main loop at $(eval $DATE_PROG)"
|
||||||
while : ; do
|
while : ; do
|
||||||
|
|
||||||
get_local_ip LOCAL_IP # read local IP
|
get_local_ip LOCAL_IP # read local IP
|
||||||
|
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$LOCAL_IP" LOCAL_IP # on IPv6 we use expanded version
|
||||||
# on IPv6 we use expanded version to be shure when comparing
|
|
||||||
[ $use_ipv6 -eq 1 ] && {
|
|
||||||
expand_ipv6 "$LOCAL_IP" LOCAL_IP
|
|
||||||
expand_ipv6 "$REGISTERED_IP" REGISTERED_IP
|
|
||||||
}
|
|
||||||
|
|
||||||
# prepare update
|
# prepare update
|
||||||
# never updated or forced immediate then NEXT_TIME = 0
|
# never updated or forced immediate then NEXT_TIME = 0
|
||||||
|
@ -332,6 +329,7 @@ while : ; do
|
||||||
|
|
||||||
REGISTERED_IP="" # clear variable
|
REGISTERED_IP="" # clear variable
|
||||||
get_registered_ip REGISTERED_IP # get registered/public IP
|
get_registered_ip REGISTERED_IP # get registered/public IP
|
||||||
|
[ $use_ipv6 -eq 1 ] && expand_ipv6 "$REGISTERED_IP" REGISTERED_IP # on IPv6 we use expanded version
|
||||||
|
|
||||||
# IP's are still different
|
# IP's are still different
|
||||||
if [ "$LOCAL_IP" != "$REGISTERED_IP" ]; then
|
if [ "$LOCAL_IP" != "$REGISTERED_IP" ]; then
|
||||||
|
|
Loading…
Reference in a new issue