Skip to content

Commit

Permalink
dns: skip ipv6 addr in /etc/resolv.conf w/o IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Feb 21, 2025
1 parent b1fe631 commit 6044e43
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions provision/dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ configure_unbound()
enable_control
tweak_unbound_conf

get_public_ip
get_public_ip ipv6
get_public_ip

install_access_conf
install_local_conf
Expand Down Expand Up @@ -185,9 +185,15 @@ switch_host_resolver()
if grep "^nameserver $(get_jail_ip dns)" /etc/resolv.conf; then return; fi

echo "switching host resolver to local"
sysrc -f /etc/resolvconf.conf name_servers="$(get_jail_ip dns) $(get_jail_ip6 dns)"
echo "nameserver $(get_jail_ip dns)
nameserver $(get_jail_ip6 dns)" | resolvconf -a "$PUBLIC_NIC"
local _NSLIST="nameserver $(get_jail_ip dns)"

sysrc -f /etc/resolvconf.conf name_servers="$(get_jail_ip dns)"
if [ -n "$PUBLIC_IP6" ]; then
sysrc -f /etc/resolvconf.conf name_servers+=" $(get_jail_ip6 dns)"
_NSLIST="$_NSLIST
nameserver $(get_jail_ip6 dns)"
fi
echo "$_NSLIST" | resolvconf -a "$PUBLIC_NIC"
sysrc -f /etc/resolvconf.conf resolvconf=NO
}

Expand Down

0 comments on commit 6044e43

Please sign in to comment.