Commit 3f77cee1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

router/functions: fix EXTRA_DNS checks returning false when unset

Same issue as vlog() — [ -n "$EXTRA_DNS" ] && cmd returns exit code 1 when EXTRA_DNS is empty, which can affect callers. Add || true to all four occurrences. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent da851e47
......@@ -61,14 +61,14 @@ get_ipv4_list()
{
echo "$1" | grep -q "[a-z]" || return 0
dig "$1" A | grep -v "^;" | grep "IN[[:space:]]*A[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort
[ -n "$EXTRA_DNS" ] && dig @$EXTRA_DNS "$1" A | grep -v "^;" | grep "IN[[:space:]]*A[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort
[ -n "$EXTRA_DNS" ] && dig @$EXTRA_DNS "$1" A | grep -v "^;" | grep "IN[[:space:]]*A[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort || true
}
get_ipv6_list()
{
echo "$1" | grep -q "[a-z]" || return 0
dig "$1" AAAA | grep -v "^;" | grep "IN[[:space:]]*AAAA[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort
[ -n "$EXTRA_DNS" ] && dig @$EXTRA_DNS "$1" AAAA | grep -v "^;" | grep "IN[[:space:]]*AAAA[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort
[ -n "$EXTRA_DNS" ] && dig @$EXTRA_DNS "$1" AAAA | grep -v "^;" | grep "IN[[:space:]]*AAAA[[:space:]]" | sed -e "s|.*[[:space:]]||" | sort || true
}
is_ipv4()
......@@ -139,7 +139,7 @@ get_ipv4_list_bulk()
# Bulk async resolve: local resolver + Google DNS (if reachable)
{
adnshost -a -t a -Fi -f < "$domains"
[ -n "$EXTRA_DNS" ] && adnshost -a -t a -Fi -f --config "nameserver $EXTRA_DNS" < "$domains"
[ -n "$EXTRA_DNS" ] && adnshost -a -t a -Fi -f --config "nameserver $EXTRA_DNS" < "$domains" || true
} > "$adns_out" 2>/dev/null
# Output resolved IPs grouped by domain
......@@ -182,7 +182,7 @@ get_ipv6_list_bulk()
# Bulk async resolve: local resolver + Google DNS (if reachable)
{
adnshost -a -t aaaa -Fi -f < "$domains"
[ -n "$EXTRA_DNS" ] && adnshost -a -t aaaa -Fi -f --config "nameserver $EXTRA_DNS" < "$domains"
[ -n "$EXTRA_DNS" ] && adnshost -a -t aaaa -Fi -f --config "nameserver $EXTRA_DNS" < "$domains" || true
} > "$adns_out" 2>/dev/null
# Output resolved IPs grouped by domain
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment