svn commit: r312970 - vendor/openresolv/dist

Pedro F. Giffuni pfg at FreeBSD.org
Sun Jan 29 22:33:02 UTC 2017


Author: pfg
Date: Sun Jan 29 22:33:00 2017
New Revision: 312970
URL: https://svnweb.freebsd.org/changeset/base/312970

Log:
  Import openresolv 3.9.0
  
  Obtained from:	http://roy.marples.name/projects/openresolv

Modified:
  vendor/openresolv/dist/Makefile
  vendor/openresolv/dist/configure
  vendor/openresolv/dist/libc.in
  vendor/openresolv/dist/pdns_recursor.in
  vendor/openresolv/dist/resolvconf.8.in
  vendor/openresolv/dist/resolvconf.conf.5.in
  vendor/openresolv/dist/resolvconf.in

Modified: vendor/openresolv/dist/Makefile
==============================================================================
--- vendor/openresolv/dist/Makefile	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/Makefile	Sun Jan 29 22:33:00 2017	(r312970)
@@ -37,6 +37,11 @@ SED_STATUSARG=		-e 's:@STATUSARG@:${STAT
 DISTPREFIX?=	${PKG}-${VERSION}
 DISTFILEGZ?=	${DISTPREFIX}.tar.gz
 DISTFILE?=	${DISTPREFIX}.tar.xz
+DISTINFO=	${DISTFILE}.distinfo
+DISTINFOSIGN=	${DISTINFO}.asc
+CKSUM?=		cksum -a SHA256
+PGP?=		netpgp
+
 FOSSILID?=	current
 
 .SUFFIXES: .in
@@ -53,7 +58,7 @@ clean:
 	rm -f ${TARGET}
 
 distclean: clean
-	rm -f config.mk ${DISTFILE}
+	rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
 
 installdirs:
 
@@ -83,3 +88,11 @@ dist:
 	fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
 	gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
 	rm ${DISTFILEGZ}
+
+distinfo: dist
+	rm -f ${DISTINFO} ${DISTINFOSIGN}
+	${CKSUM} ${DISTFILE} >${DISTINFO}
+	#printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
+	${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
+	chmod 644 ${DISTINFOSIGN}
+	ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}

Modified: vendor/openresolv/dist/configure
==============================================================================
--- vendor/openresolv/dist/configure	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/configure	Sun Jan 29 22:33:00 2017	(r312970)
@@ -120,14 +120,21 @@ echo "Configuring openresolv for ... $OS
 rm -rf $CONFIG_MK
 echo "# $OS" >$CONFIG_MK
 
-# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
-# regardless of if it's not running.
-# So we force onestatus to work around this silly bug.
-if [ -z "$STATUSARG" ]; then
-	case "$OS" in
-	freebsd*)	STATUSARG="onestatus";;
-	esac
-fi
+case "$OS" in
+freebsd*)
+	# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
+	# regardless of if it's not running.
+	# So we force onestatus to work around this silly bug.
+	if [ -z "$STATUSARG" ]; then
+		STATUSARG="onestatus"
+	fi
+	;;
+linux*)
+	# cksum does't support -a and netpgp is rare
+	echo "CKSUM=		sha256sum --tag" >>$CONFIG_MK
+	echo "PGP=		gpg2" >>$CONFIG_MK
+	;;
+esac
 
 for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
 do

Modified: vendor/openresolv/dist/libc.in
==============================================================================
--- vendor/openresolv/dist/libc.in	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/libc.in	Sun Jan 29 22:33:00 2017	(r312970)
@@ -216,7 +216,7 @@ fi
 if $backup; then
 	if [ "$newconf" = "$signature$NL" ]; then
 		if [ -e "$resolv_conf.bak" ]; then
-			newconf="$(cat "$resolv_conf.bak")"
+			newconf="$(cat "$resolv_conf.bak")$NL"
 		fi
 	elif [ -e "$resolv_conf" ]; then
 		read line <"$resolv_conf"

Modified: vendor/openresolv/dist/pdns_recursor.in
==============================================================================
--- vendor/openresolv/dist/pdns_recursor.in	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/pdns_recursor.in	Sun Jan 29 22:33:00 2017	(r312970)
@@ -34,7 +34,6 @@ NL="
 "
 
 : ${pdns_service:=pdns_recursor}
-: ${pdns_restart:=@RESTARTCMD ${pdns_service}@}
 
 newzones=
 
@@ -68,5 +67,12 @@ if [ ! -f "$pdns_zones" ] || \
 	[ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ]
 then
 	printf %s "$newzones" >"$pdns_zones"
-	eval $pdns_restart
+	if [ -n "$pdns_restart" ]; then
+		eval $pdns_restart
+	elif [ -n "$RESTARTCMD" ]; then
+		set -- ${pdns_service}
+		eval $RESTARTCMD
+	else
+		@SBINDIR@/resolvconf -r ${pdns_service}
+	fi
 fi

Modified: vendor/openresolv/dist/resolvconf.8.in
==============================================================================
--- vendor/openresolv/dist/resolvconf.8.in	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/resolvconf.8.in	Sun Jan 29 22:33:00 2017	(r312970)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 7, 2016
+.Dd November 29, 2016
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME
@@ -45,6 +45,8 @@
 .Fl il Ar pattern
 .Nm
 .Fl u
+.Nm
+.Fl Fl version
 .Sh DESCRIPTION
 .Nm
 manages
@@ -106,7 +108,7 @@ See
 .Xr resolvconf.conf 5
 for how to configure
 .Nm
-to use a local name server.
+to use a local name server and how to remove the private marking.
 .Pp
 .Nm
 can mark an interfaces
@@ -126,7 +128,7 @@ on the
 .Ar interface .
 .Pp
 Here are some options for the above commands:-
-.Bl -tag -width indent
+.Bl -tag -width pattern_opt
 .It Fl f
 Ignore non existent interfaces.
 Only really useful for deleting interfaces.
@@ -146,7 +148,7 @@ as exclusive when adding, otherwise only
 .Pp
 .Nm
 has some more commands for general usage:-
-.Bl -tag -width indent
+.Bl -tag -width pattern_opt
 .It Fl i Ar pattern
 List the interfaces and protocols, optionally matching
 .Ar pattern ,
@@ -168,12 +170,15 @@ to update all its subscribers.
 .Nm
 does not update the subscribers when adding a resolv.conf that matches
 what it already has for that interface.
+.It Fl Fl version
+Echo the resolvconf version to
+.Em stdout .
 .El
 .Pp
 .Nm
 also has some commands designed to be used by it's subscribers and
 system startup:-
-.Bl -tag -width indent
+.Bl -tag -width pattern_opt
 .It Fl I
 Initialise the state directory
 .Pa @VARDIR@ .
@@ -223,7 +228,7 @@ Here are some suggested protocol tags to
 .Pa resolv.conf
 file registered on an
 .Ar interface Ns No :-
-.Bl -tag -width indent
+.Bl -tag -width pattern_opt
 .It dhcp
 Dynamic Host Configuration Protocol.
 Initial versions of

Modified: vendor/openresolv/dist/resolvconf.conf.5.in
==============================================================================
--- vendor/openresolv/dist/resolvconf.conf.5.in	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/resolvconf.conf.5.in	Sun Jan 29 22:33:00 2017	(r312970)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 28, 2016
+.Dd December 29, 2016
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -69,6 +69,11 @@ If unset, defaults to the following:-
 These interfaces will be processed next, unless they have a metric.
 If unset, defaults to the following:-
 .D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*
+.It Sy inclusive_interfaces
+Ignore any exlcusive marking for these interfaces.
+This is handy when 3rd party integrations force the
+.Nm resolvconf -x
+option and you want to disable it easily.
 .It Sy local_nameservers
 If unset, defaults to the following:-
 .D1 127.* 0.0.0.0 255.255.255.255 ::1
@@ -102,6 +107,11 @@ Requires a local nameserver other than l
 This is equivalent to the
 .Nm resolvconf -p
 option.
+.It Sy public_interfaces
+Force these interface to be public, overriding the private marking.
+This is handy when 3rd party integrations force the
+.Nm resolvconf -p
+option and you want to disable it easily.
 .It Sy replace
 Is a space separated list of replacement keywords.
 The syntax is this:

Modified: vendor/openresolv/dist/resolvconf.in
==============================================================================
--- vendor/openresolv/dist/resolvconf.in	Sun Jan 29 22:06:52 2017	(r312969)
+++ vendor/openresolv/dist/resolvconf.in	Sun Jan 29 22:33:00 2017	(r312970)
@@ -25,13 +25,19 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.8.1"
+OPENRESOLV_VERSION="3.9.0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
 RCDIR=@RCDIR@
 RESTARTCMD=@RESTARTCMD@
 
+if [ "$1" = "--version" ]; then
+	echo "openresolv $OPENRESOLV_VERSION"
+	echo "Copyright (c) 2007-2016 Roy Marples"
+	exit 0
+fi
+
 # Disregard dhcpcd setting
 unset interface_order state_dir
 
@@ -90,6 +96,7 @@ usage()
 	                   that match the specified pattern
 
 	  -u               Run updates from our current DNS information
+	  --version        Echo the ${RESOLVCONF##*/} version
 
 	Options:
 	  -f               Ignore non existent interfaces
@@ -129,6 +136,34 @@ strip_trailing_dots()
 	printf "\n"
 }
 
+private_iface()
+{
+	local p
+
+	# Allow expansion
+	cd "$IFACEDIR"
+
+	# Public interfaces override private ones.
+	for p in $public_interfaces; do
+		case "$iface" in
+		"$p"|"$p":*) return 1;;
+		esac
+	done
+
+	if [ -e "$PRIVATEDIR/$iface" ]; then
+		return 0
+	fi
+	
+	for p in $private_interfaces; do
+		case "$iface" in
+		"$p"|"$p":*) return 0;;
+		esac
+	done
+
+	# Not a private interface
+	return 1
+}
+
 # Parse resolv.conf's and make variables
 # for domain name servers, search name servers and global nameservers
 parse_resolv()
@@ -144,20 +179,10 @@ parse_resolv()
 			if ${new}; then
 				iface="${line#\# resolv.conf from *}"
 				new=false
-				if [ -e "$PRIVATEDIR/$iface" ]; then
+				if private_iface "$iface"; then
 					private=true
 				else
-					# Allow expansion
-					cd "$IFACEDIR"
 					private=false
-					for p in $private_interfaces; do
-						case "$iface" in
-						"$p"|"$p":*)
-							private=true
-							break
-							;;
-						esac
-					done
 				fi
 			fi
 			;;
@@ -301,9 +326,9 @@ fi"
 	/usr/sbin/service \$1 restart;
 fi"
 	elif [ -x /bin/sv ]; then
-		RESTARTCMD="/bin/sv try-restart \$1"
+		RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1"
 	elif [ -x /usr/bin/sv ]; then
-		RESTARTCMD="/usr/bin/sv try-restart \$1"
+		RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1"
 	elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then
 		RCDIR=/etc/rc.d
 		RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then
@@ -378,6 +403,14 @@ list_resolv()
 			done
 		fi
 		excl=true
+		cd "$IFACEDIR"
+		for i in $inclusive_interfaces; do
+			if [ -f "$i" -a "$list" = "$i" ]; then
+				list=
+				excl=false
+				break
+			fi
+		done
 		;;
 	*)
 		excl=false
@@ -418,7 +451,6 @@ list_resolv()
 
 	cd "$IFACEDIR"
 	retval=1
-	excl=true
 	for i in $(uniqify $list); do
 		# Only list interfaces which we really have
 		if ! [ -f "$i" ]; then
@@ -432,8 +464,7 @@ list_resolv()
 		if [ "$cmd" = i -o "$cmd" = "-i" ]; then
 			printf %s "$i "
 		else
-			echo_resolv "$i"
-			echo
+			echo_resolv "$i" && echo
 		fi
 		[ $? = 0 -a "$retval" = 1 ] && retval=0
 	done


More information about the svn-src-all mailing list