Module Name:    src
Committed By:   roy
Date:           Wed Mar 26 09:59:17 UTC 2025

Modified Files:
        src/external/bsd/openresolv/dist: libc.in resolvconf.8.in
            resolvconf.conf.5.in resolvconf.in unbound.in

Log Message:
Sync with openresolv-3.14.0


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/openresolv/dist/libc.in
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/openresolv/dist/resolvconf.8.in
cvs rdiff -u -r1.22 -r1.23 \
    src/external/bsd/openresolv/dist/resolvconf.conf.5.in
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/openresolv/dist/resolvconf.in
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/openresolv/dist/unbound.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/openresolv/dist/libc.in
diff -u src/external/bsd/openresolv/dist/libc.in:1.6 src/external/bsd/openresolv/dist/libc.in:1.7
--- src/external/bsd/openresolv/dist/libc.in:1.6	Tue Jun 27 17:07:53 2023
+++ src/external/bsd/openresolv/dist/libc.in	Wed Mar 26 09:59:17 2025
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2023 Roy Marples
+# Copyright (c) 2007-2025 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -96,7 +96,7 @@ fi
 : ${resolv_conf:=/etc/resolv.conf}
 : ${resolv_conf_tmp:="$resolv_conf.$$.openresolv"}
 : ${libc_service:=nscd}
-: ${list_resolv:=@SBINDIR@/resolvconf -l}
+: ${list_resolv:=@SBINDIR@/resolvconf -L}
 if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ]
 then
 	resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"

Index: src/external/bsd/openresolv/dist/resolvconf.8.in
diff -u src/external/bsd/openresolv/dist/resolvconf.8.in:1.12 src/external/bsd/openresolv/dist/resolvconf.8.in:1.13
--- src/external/bsd/openresolv/dist/resolvconf.8.in:1.12	Tue Jun 27 17:07:53 2023
+++ src/external/bsd/openresolv/dist/resolvconf.8.in	Wed Mar 26 09:59:17 2025
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2023 Roy Marples
+.\" Copyright (c) 2007-2025 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 23, 2016
+.Dd March 24, 2025
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME
@@ -46,7 +46,7 @@
 .Fl d Ar interface Ns Op Ar .protocol
 .Nm
 .Op Fl x
-.Fl il Ar pattern
+.Fl iLl Ar pattern
 .Nm
 .Fl u
 .Nm
@@ -168,6 +168,17 @@ List the interfaces and protocols, optio
 we have
 .Pa resolv.conf
 files for.
+.It Fl L Ar pattern
+List the
+.Pa resolv.conf
+files we have,
+post-processed by the
+.Xr resolvconf.conf 5
+configuration.
+If
+.Ar pattern
+is specified then we list the files for the interfaces and protocols
+that match it.
 .It Fl l Ar pattern
 List the
 .Pa resolv.conf

Index: src/external/bsd/openresolv/dist/resolvconf.conf.5.in
diff -u src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.22 src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.23
--- src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.22	Tue Jun 27 17:07:53 2023
+++ src/external/bsd/openresolv/dist/resolvconf.conf.5.in	Wed Mar 26 09:59:17 2025
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2023 Roy Marples
+.\" Copyright (c) 2009-2025 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 23, 2023
+.Dd March 24, 2025
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -65,6 +65,19 @@ Defaults to YES.
 If set, only these interfaces will be processed.
 .It Sy deny_interfaces
 If set, these interfaces will not be processed.
+.It Sy exclude
+Is a space separated list of key/value pairs to match.
+If all key/value pairs in one element can be found in the file,
+then the whole file will be excluded from processing.
+The syntax is this:
+.Va $keyword Ns / Ns Va $match Ns Op / Ns Va $keyword Ns / Ns Va $match
+.Pp
+For example given this configuration:
+.Bd -compact -literal -offset indent
+exclude="search/foo*/nameserver/1.2.3.4 search/bar.org"
+.Ed
+Then any resolv.conf with both a search option starting with foo with a nameserver of 1.2.3.4
+OR a search option of bar.org would be excluded.
 .It Sy interface_order
 These interfaces will always be processed first.
 If unset, defaults to the following:-
@@ -328,6 +341,8 @@ forward-zones-file=/etc/pdns/recursor-zo
 This file tells unbound about specific and global name servers.
 .It Sy unbound_insecure
 When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC.
+.It Sy unbound_private
+When set to YES, unbound marks the domains as private, allowing it and its subdomains to contain private addresses.
 .It Sy unbound_forward_zone_options
 Options appended to each forward zone.
 Each option should be separated by an embedded new line.

Index: src/external/bsd/openresolv/dist/resolvconf.in
diff -u src/external/bsd/openresolv/dist/resolvconf.in:1.10 src/external/bsd/openresolv/dist/resolvconf.in:1.11
--- src/external/bsd/openresolv/dist/resolvconf.in:1.10	Tue Jun 27 17:07:53 2023
+++ src/external/bsd/openresolv/dist/resolvconf.in	Wed Mar 26 09:59:17 2025
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2023 Roy Marples
+# Copyright (c) 2007-2025 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.13.2"
+OPENRESOLV_VERSION="3.14.0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
@@ -34,7 +34,7 @@ RESTARTCMD=@RESTARTCMD@
 
 if [ "$1" = "--version" ]; then
 	echo "openresolv $OPENRESOLV_VERSION"
-	echo "Copyright (c) 2007-2020 Roy Marples"
+	echo "Copyright (c) 2007-2025 Roy Marples"
 	exit 0
 fi
 
@@ -48,6 +48,27 @@ dynamic_order="tap[0-9]* tun[0-9]* vpn v
 interface_order="lo lo[0-9]*"
 name_server_blacklist="0.0.0.0"
 
+# Poor mans cat
+# /usr might not be available
+cat()
+{
+	OIFS="$IFS"
+	IFS=''
+	if [ -n "$1" ]; then
+		while read -r line; do
+			printf "%s\n" "$line"
+		done < "$1"
+	else
+		while read -r line; do
+			printf "%s\n" "$line"
+		done
+	fi
+	retval=$?
+	IFS="$OIFS"
+	return $retval
+}
+
+
 # Support original resolvconf configuration layout
 # as well as the openresolv config file
 if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
@@ -98,6 +119,7 @@ usage()
                    pattern
 	  -l [\$PATTERN]    Show DNS information, optionally from interfaces
 	                   that match the specified pattern
+	  -L [\$PATTERN]    Same as -l, but adjusted by our config
 
 	  -u               Run updates from our current DNS information
 	  --version        Echo the ${RESOLVCONF##*/} version
@@ -329,7 +351,7 @@ detect_init()
 		   fi'
 	elif [ -x /usr/bin/s6-rc ] && [ -x /usr/bin/s6-svc ]; then
 		RESTARTCMD='
-		   if s6-rc -a list | grep -qFx $1-srv
+		   if s6-rc -a list 2>/dev/null | grep -qFx $1-srv
 		   then
 			s6-svc -r /run/service/$1-srv
 		   fi'
@@ -434,12 +456,68 @@ deprecated_interface()
 	return 1
 }
 
+match()
+{
+	match="$1"
+	file="$2"
+	retval=1
+	count=0
+
+	while read -r keyword value; do
+		new_match=
+		for om in $match; do
+			m="$om"
+			keep=
+			while [ -n "$m" ]; do
+				k="${m%%/*}"
+				r="${m#*/}"
+				f="${r%%/*}"
+				r="${r#*/}"
+				# If the length of m is the same as k/f then
+				# we know that we are done
+				if [ ${#m} = $((${#k} + 1 + ${#f})) ]; then
+					r=
+				fi
+				m="$r"
+				matched=false
+				case "$keyword" in
+				$k)
+					case "$value" in
+					$f)
+						matched=true
+						;;
+					esac
+					;;
+				esac
+				if ! $matched; then
+					keep="$keep${keep:+/}$k/$f"
+				fi
+			done
+			if [ -n "$om" ] && [ -z "$keep" ]; then
+				retval=0
+				break 2
+			fi
+			new_match="${new_match}${new_match:+ }${keep}"
+		done
+		match="${new_match}"
+	done < "$file"
+	return $retval
+}
+
 list_resolv()
 {
 	[ -d "$IFACEDIR" ] || return 0
 
-	cmd="$1"
-	shift
+	OPTIND=
+	list_cmd=
+	while getopts iLl OPT; do
+		case "$OPT" in
+		'?') exit 1;;
+		*) list_cmd="$OPT";;
+		esac
+	done
+	shift $(($OPTIND - 1))
+
 	pattern_specified="$1"
 
 	excl=false
@@ -540,7 +618,7 @@ list_resolv()
 			continue
 		fi
 
-		if ! $ALLIFACES; then
+		if [ "$list_cmd" = L ]; then
 			if [ -n "$allow_interfaces" ]; then
 				x=false
 				for j in $allow_interfaces; do
@@ -555,16 +633,20 @@ list_resolv()
 					continue 2
 				fi
 			done
+
+			if [ -n "$exclude" ] && match "$exclude" "$i"; then
+				continue
+			fi
 		fi
 
-		if [ "$cmd" = i ] || [ "$cmd" = "-i" ]; then
+		if [ "$list_cmd" = i ]; then
 			printf %s "$i "
 		else
 			echo_resolv "$i" && echo
 		fi
 		[ $? = 0 ] && [ "$retval" = 1 ] && retval=0
 	done
-	[ "$cmd" = i ] || [ "$cmd" = "-i" ] && echo
+	[ "$list_cmd" = i ] && echo
 	return $retval
 }
 
@@ -674,7 +756,7 @@ make_vars()
 	if [ -z "$VFLAG" ]; then
 		IF_EXCLUSIVE=1
 		list_resolv -i "$@" >/dev/null || IF_EXCLUSIVE=0
-		eval "$(list_resolv -l "$@" | replace | parse_resolv)"
+		eval "$(list_resolv -L "$@" | replace | parse_resolv)"
 	fi
 	if [ -n "${name_servers_append}${search_domains_append}" ]; then
 		eval "$(echo_append | parse_resolv)"
@@ -724,7 +806,7 @@ make_vars()
 
 force=false
 VFLAG=
-while getopts a:C:c:Dd:fhIilm:pRruvVx OPT; do
+while getopts a:C:c:Dd:fhIiLlm:pRruvVx OPT; do
 	case "$OPT" in
 	f) force=true;;
 	h) usage;;
@@ -762,11 +844,14 @@ fi
 
 # -l lists our resolv files, optionally for a specific interface
 if [ "$cmd" = l ] || [ "$cmd" = i ]; then
-	ALLIFACES=true
-	list_resolv "$cmd" "$args"
+	list_resolv "-$cmd" "$args"
 	exit $?
 fi
-ALLIFACES=false
+# -L is the same as -l, but post-processed from our config
+if [ "$cmd" = L ]; then
+	list_resolv "-$cmd" "$args" | replace
+	exit $?2
+fi
 
 # Restart a service or echo the command to restart a service
 if [ "$cmd" = r ] || [ "$cmd" = R ]; then
@@ -1077,7 +1162,7 @@ export RESTARTCMD RCDIR _NOINIT_WARNED
 
 eval "$(make_vars)"
 export RESOLVCONF DOMAINS SEARCH NAMESERVERS LOCALNAMESERVERS
-: ${list_resolv:=list_resolv -l}
+: ${list_resolv:=list_resolv -L}
 retval=0
 
 # Run scripts in the same directory resolvconf is run from

Index: src/external/bsd/openresolv/dist/unbound.in
diff -u src/external/bsd/openresolv/dist/unbound.in:1.4 src/external/bsd/openresolv/dist/unbound.in:1.5
--- src/external/bsd/openresolv/dist/unbound.in:1.4	Tue Jun 27 17:07:53 2023
+++ src/external/bsd/openresolv/dist/unbound.in	Wed Mar 26 09:59:17 2025
@@ -27,6 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 unbound_insecure=
+unbound_private=
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
@@ -42,12 +43,25 @@ newconf="# Generated by resolvconf$NL"
 for d in $DOMAINS; do
 	dn="${d%%:*}"
 	ns="${d#*:}"
+	create_unbound_insecure=false
+	create_unbound_private=false
 	case "$unbound_insecure" in
 	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
-		newconf="$newconf${NL}server:$NL"
-		newconf="$newconf	domain-insecure: \"$dn\"$NL"
-		;;
+		create_unbound_insecure=true ;;
+	esac
+	case "$unbound_private" in
+	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+		create_unbound_private=true ;;
 	esac
+	if $create_unbound_insecure || $create_unbound_private; then
+		newconf="$newconf${NL}server:$NL"
+		if $create_unbound_insecure; then
+			newconf="$newconf	domain-insecure: \"$dn\"$NL"
+		fi
+		if $create_unbound_private; then
+			newconf="$newconf	private-domain: \"$dn\"$NL"
+		fi
+	fi
 	newconf="$newconf${NL}forward-zone:$NL	name: \"$dn\"$NL"
 	if [ -n "$unbound_forward_zone_options" ]; then
 		newconf="$newconf	$unbound_forward_zone_options${NL}"

Reply via email to