Re: git: f0a861efbafe - main - local-unbound-setup: Support IPv6-only systems

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Fri, 26 Jun 2026 18:33:18 UTC
On Fri, Jun 26, 2026 at 02:43:37PM +0000, Dag-Erling Smørgrav wrote:
> The branch main has been updated by des:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=f0a861efbafeb81428d5e8c23dac9da73fe14007
> 
> commit f0a861efbafeb81428d5e8c23dac9da73fe14007
> Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
> AuthorDate: 2026-06-26 14:43:26 +0000
> Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
> CommitDate: 2026-06-26 14:43:26 +0000
> 
>     local-unbound-setup: Support IPv6-only systems
>     
>     * In the server configuration, disable protocols not supported by the
>       kernel.
>     
>     * In resolv.conf, instead of only using 127.0.0.1, use either 127.0.0.1,
>       ::1, or both depending on which protocols the kernel supports.
>     
>     MFC after:      1 week
>     Reviewed by:    jlduran
>     Differential Revision:  https://reviews.freebsd.org/D57840
> ---
>  usr.sbin/unbound/setup/local-unbound-setup.sh | 50 +++++++++++++++++++++------
>  1 file changed, 40 insertions(+), 10 deletions(-)
> 
> diff --git a/usr.sbin/unbound/setup/local-unbound-setup.sh b/usr.sbin/unbound/setup/local-unbound-setup.sh
> index ec3aeb673ecc..6b217ec574cd 100755
> --- a/usr.sbin/unbound/setup/local-unbound-setup.sh
> +++ b/usr.sbin/unbound/setup/local-unbound-setup.sh
> @@ -72,6 +72,19 @@ RE_forward_addr="((${RE_ipv4}|${RE_ipv6})(@${RE_port})?)"
>  RE_forward_name="(${RE_dnsname}(@${RE_port})?)"
>  RE_forward_tls="(${RE_forward_addr}(#${RE_dnsname})?)"
>  
> +#
> +# Check if a kernel feature is available
> +#
> +has_feature() {
> +	local name=$1 v
> +	eval "v=\$kern_features_${name}"
> +	if [ -z "$v" ] ; then
> +		v="$(sysctl -qn "kern.features.${name}")"
> +		eval "kern_features_${name}=$((v))"
> +	fi
> +	return $((!v))
> +}
> +

The function above seems like it might be useful outside the context
of local-unbound. I'm wondering if this would be a better fit for
libexec/rc/rc.subr.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Signal Username:  shawn_webb.74
Tor-ified Signal: +1 (719) 756-1197 / activist_opsec.27
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc