ddns-scripts: initialise the is_glue variable
Improve the code as suggested by Christian Schoenebeck. Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
parent
9946769206
commit
ed11871c56
4 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
|
|||
PKG_VERSION:=2.7.1
|
||||
# Release == build
|
||||
# increase on changes of services files or tld_names.dat
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
||||
|
|
|
@ -956,7 +956,7 @@ get_registered_ip() {
|
|||
# 1 no IP detected
|
||||
|
||||
[ $# -lt 1 -o $# -gt 2 ] && write_log 12 "Error calling 'get_registered_ip()' - wrong number of parameters"
|
||||
[ $is_glue -eq 1 ] && [ -z "$(which host)" ] && write_log 12 "Update of glue records is only supported using BIND host"
|
||||
[ $is_glue -eq 1 -a -z "$(which host)" ] && write_log 12 "Update of glue records is only supported using BIND host"
|
||||
write_log 7 "Detect registered/public IP"
|
||||
|
||||
# set correct regular expression
|
||||
|
@ -1040,8 +1040,6 @@ get_registered_ip() {
|
|||
write_log 7 "$(cat $ERRFILE)"
|
||||
else
|
||||
if [ "$__PROG" = "BIND host" ]; then
|
||||
__DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' )
|
||||
|
||||
if [ $is_glue -eq 1 ]; then
|
||||
__DATA=$(cat $DATFILE | grep "^$lookup_host" | grep -m 1 -o "$__REGEX" )
|
||||
else
|
||||
|
|
|
@ -33,6 +33,7 @@ case "$1" in
|
|||
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
||||
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
|
||||
dns_server=${6:-""} # DNS server - default No DNS
|
||||
is_glue=${7:-"0"} # Is glue record - default 0 - No
|
||||
write_log 7 "-----> get_registered_ip IP"
|
||||
get_registered_ip IP
|
||||
__RET=$?
|
||||
|
|
|
@ -131,6 +131,7 @@ ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
|||
[ -z "$force_ipversion" ] && force_ipversion=0 # default let system decide
|
||||
[ -z "$force_dnstcp" ] && force_dnstcp=0 # default UDP
|
||||
[ -z "$ip_source" ] && ip_source="network"
|
||||
[ -z "$is_glue" ] && is_glue=0 # default the ddns record is not a glue record
|
||||
[ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 0 ] && ip_network="wan" # IPv4: default wan
|
||||
[ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 1 ] && ip_network="wan6" # IPv6: default wan6
|
||||
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 0 ] && ip_url="http://checkip.dyndns.com"
|
||||
|
|
Loading…
Reference in a new issue