Browse Source

ddns-scripts: initialise the is_glue variable

Improve the code as suggested by Christian Schoenebeck.

Signed-off-by: Mathias Kresin <dev@kresin.me>
lilik-openwrt-22.03
Mathias Kresin 9 years ago
parent
commit
ed11871c56
4 changed files with 4 additions and 4 deletions
  1. +1
    -1
      net/ddns-scripts/Makefile
  2. +1
    -3
      net/ddns-scripts/files/dynamic_dns_functions.sh
  3. +1
    -0
      net/ddns-scripts/files/dynamic_dns_lucihelper.sh
  4. +1
    -0
      net/ddns-scripts/files/dynamic_dns_updater.sh

+ 1
- 1
net/ddns-scripts/Makefile View File

@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
PKG_VERSION:=2.7.1 PKG_VERSION:=2.7.1
# 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:=2
PKG_RELEASE:=3
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com> PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>


+ 1
- 3
net/ddns-scripts/files/dynamic_dns_functions.sh View File

@ -956,7 +956,7 @@ get_registered_ip() {
# 1 no IP detected # 1 no IP detected
[ $# -lt 1 -o $# -gt 2 ] && write_log 12 "Error calling 'get_registered_ip()' - wrong number of parameters" [ $# -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" write_log 7 "Detect registered/public IP"
# set correct regular expression # set correct regular expression
@ -1040,8 +1040,6 @@ get_registered_ip() {
write_log 7 "$(cat $ERRFILE)" write_log 7 "$(cat $ERRFILE)"
else else
if [ "$__PROG" = "BIND host" ]; then if [ "$__PROG" = "BIND host" ]; then
__DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' )
if [ $is_glue -eq 1 ]; then if [ $is_glue -eq 1 ]; then
__DATA=$(cat $DATFILE | grep "^$lookup_host" | grep -m 1 -o "$__REGEX" ) __DATA=$(cat $DATFILE | grep "^$lookup_host" | grep -m 1 -o "$__REGEX" )
else else


+ 1
- 0
net/ddns-scripts/files/dynamic_dns_lucihelper.sh View File

@ -33,6 +33,7 @@ case "$1" in
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
dns_server=${6:-""} # DNS server - default No DNS 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" write_log 7 "-----> get_registered_ip IP"
get_registered_ip IP get_registered_ip IP
__RET=$? __RET=$?


+ 1
- 0
net/ddns-scripts/files/dynamic_dns_updater.sh View File

@ -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_ipversion" ] && force_ipversion=0 # default let system decide
[ -z "$force_dnstcp" ] && force_dnstcp=0 # default UDP [ -z "$force_dnstcp" ] && force_dnstcp=0 # default UDP
[ -z "$ip_source" ] && ip_source="network" [ -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 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" = "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" [ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 0 ] && ip_url="http://checkip.dyndns.com"


Loading…
Cancel
Save