NetworkManager support

This commit is contained in:
2021-05-05 17:45:36 +02:00
parent 72d76f6029
commit ad1c759310
3 changed files with 29 additions and 4 deletions

View File

@@ -224,7 +224,12 @@ EOF
}
function check_ip() {
local ips=`nslookup $1 | awk '/^Address: / { print \$2 }'`
# $1 - hostname
# $2 - IP
# $3 - Replace
# $4 - Server
local ips=`nslookup $1 $4 | awk '/^Address: / { print \$2 }'`
local count=`echo $ips | wc -l`
if [ "$3" == "yes" ]; then
@@ -281,7 +286,7 @@ function parse_ddns_config() {
tsig_key_secret=${DDNS_TSIG_KEY_SECRET}
echo replace $DDNS_REPLACE
if check_ip "$rr_name" "$rr_data" "$replace"; then
if check_ip "$rr_name" "$rr_data" "$replace" "$server"; then
run_nsupdate "${rr_name}" "${ttl}" "${type}" "${rr_data}" "${replace}" "${server}" "${tcp}" "${zone}" "${gss_tsig}" "${gss_keytab}" "${gss_principal}" "${tsig_file}" "${tsig_key_type}" "${tsig_key_name}" "${tsig_key_secret}"
fi
fi
@@ -306,7 +311,7 @@ function parse_ddns_config() {
tsig_key_name=$(eval echo "\${DDNS${hostnum}_TSIG_KEY_NAME-\${DDNS_TSIG_KEY_NAME}}")
tsig_key_secret=$(eval echo "\${DDNS${hostnum}_TSIG_KEY_SECRET-\${DDNS_TSIG_KEY_SECRET}}")
if check_ip "$rr_name" "$rr_data" "$replace"; then
if check_ip "$rr_name" "$rr_data" "$replace" "$server"; then
run_nsupdate "${rr_name}" "${ttl}" "${type}" "${rr_data}" "${replace}" "${server}" "${tcp}" "${zone}" "${gss_tsig}" "${gss_keytab}" "${gss_principal}" "${tsig_file}" "${tsig_key_type}" "${tsig_key_name}" "${tsig_key_secret}"
fi
(( hostnum++ ))