Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 May 2015 01:33:34 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r282746 - in stable/10: contrib/openresolv sbin/resolvconf
Message-ID:  <201505110133.t4B1XYAr002878@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Mon May 11 01:33:34 2015
New Revision: 282746
URL: https://svnweb.freebsd.org/changeset/base/282746

Log:
  MFC r282434:
    MFV r225523, r282431:
     r225523 (hrs):
      Import openresolv-3.4.4.
  
     r282431:
      Import openresolv-3.7.0.
  
  PR:		199854
  Submitted by:	yuri@rawbw.com
  Relnotes:	yes
  Sponsored by:	The FreeBSD Foundation

Added:
  stable/10/contrib/openresolv/GNUmakefile
     - copied unchanged from r282434, head/contrib/openresolv/GNUmakefile
  stable/10/contrib/openresolv/config-null.mk
     - copied unchanged from r282434, head/contrib/openresolv/config-null.mk
  stable/10/contrib/openresolv/pdns_recursor.in
     - copied unchanged from r282434, head/contrib/openresolv/pdns_recursor.in
Modified:
  stable/10/contrib/openresolv/Makefile
  stable/10/contrib/openresolv/configure
  stable/10/contrib/openresolv/dnsmasq.in
  stable/10/contrib/openresolv/libc.in
  stable/10/contrib/openresolv/named.in
  stable/10/contrib/openresolv/pdnsd.in
  stable/10/contrib/openresolv/resolvconf.8.in
  stable/10/contrib/openresolv/resolvconf.conf.5.in
  stable/10/contrib/openresolv/resolvconf.in
  stable/10/contrib/openresolv/unbound.in
  stable/10/sbin/resolvconf/Makefile
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/contrib/openresolv/GNUmakefile (from r282434, head/contrib/openresolv/GNUmakefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/contrib/openresolv/GNUmakefile	Mon May 11 01:33:34 2015	(r282746, copy of r282434, head/contrib/openresolv/GNUmakefile)
@@ -0,0 +1,4 @@
+# Nasty hack so that make clean works without configure being run
+CONFIG_MK?=$(shell test -e config.mk && echo config.mk || echo config-null.mk)
+
+include Makefile

Modified: stable/10/contrib/openresolv/Makefile
==============================================================================
--- stable/10/contrib/openresolv/Makefile	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/Makefile	Mon May 11 01:33:34 2015	(r282746)
@@ -1,8 +1,19 @@
-include config.mk
+PKG=		openresolv
+VERSION=	3.7.0
 
-NAME=		openresolv
-VERSION=	3.4.1
-PKG=		${NAME}-${VERSION}
+# Nasty hack so that make clean works without configure being run
+_CONFIG_MK!=	test -e config.mk && echo config.mk || echo config-null.mk
+CONFIG_MK?=	${_CONFIG_MK}
+include		${CONFIG_MK}
+
+SBINDIR?=	/sbin
+SYSCONFDIR?=	/etc
+LIBEXECDIR?=	/libexec/resolvconf
+VARDIR?=	/var/run/resolvconf
+RCDIR?=		/etc/rc.d
+RESTARTCMD?=	if ${RCDIR}/\1 status >/dev/null 2>\&1; then \
+			${RCDIR}/\1 restart; \
+		fi
 
 INSTALL?=	install
 SED?=		sed
@@ -17,31 +28,36 @@ TARGET=		${RESOLVCONF} ${SUBSCRIBERS}
 SRCS=		${TARGET:C,$,.in,} # pmake
 SRCS:=		${TARGET:=.in} # gmake
 
-SED_PREFIX=		-e 's:@PREFIX@:${PREFIX}:g'
+SED_SBINDIR=		-e 's:@SBINDIR@:${SBINDIR}:g'
 SED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
 SED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
 SED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
 SED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
 SED_RESTARTCMD=		-e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
 
+DISTPREFIX?=	${PKG}-${VERSION}
+DISTFILEGZ?=	${DISTPREFIX}.tar.gz
+DISTFILE?=	${DISTPREFIX}.tar.bz2
+FOSSILID?=	current
+
 .SUFFIXES: .in
 
 all: ${TARGET}
 
 .in:
-	${SED}	${SED_PREFIX} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
+	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
 		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
 		$< > $@
 
 clean:
-	rm -f ${TARGET} openresolv-${VERSION}.tar.bz2
+	rm -f ${TARGET}
 
 distclean: clean
-	rm -f config.mk
+	rm -f config.mk ${DISTFILE}
 
 installdirs:
 
-install: ${TARGET}
+proginstall: ${TARGET}
 	${INSTALL} -d ${DESTDIR}${SBINDIR}
 	${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
 	${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
@@ -49,18 +65,21 @@ install: ${TARGET}
 	${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
 	${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
 	${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
+
+maninstall:
 	${INSTALL} -d ${DESTDIR}${MANDIR}/man8
 	${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
 	${INSTALL} -d ${DESTDIR}${MANDIR}/man5
 	${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
 
+install: proginstall maninstall
+
 import:
-	rm -rf /tmp/${PKG}
-	${INSTALL} -d /tmp/${PKG}
-	cp README ${SRCS} /tmp/${PKG}
-
-dist: import
-	cp configure Makefile resolvconf.conf /tmp/${PKG}
-	tar cvjpf ${PKG}.tar.bz2 -C /tmp ${PKG} 
-	rm -rf /tmp/${PKG} 
-	ls -l ${PKG}.tar.bz2
+	rm -rf /tmp/${DISTPREFIX}
+	${INSTALL} -d /tmp/${DISTPREFIX}
+	cp README ${SRCS} /tmp/${DISPREFIX}
+
+dist:
+	fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
+	gunzip -c ${DISTFILEGZ} |  bzip2 >${DISTFILE}
+	rm ${DISTFILEGZ}

Copied: stable/10/contrib/openresolv/config-null.mk (from r282434, head/contrib/openresolv/config-null.mk)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/contrib/openresolv/config-null.mk	Mon May 11 01:33:34 2015	(r282746, copy of r282434, head/contrib/openresolv/config-null.mk)
@@ -0,0 +1 @@
+# This space left intentionally blank

Modified: stable/10/contrib/openresolv/configure
==============================================================================
--- stable/10/contrib/openresolv/configure	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/configure	Mon May 11 01:33:34 2015	(r282746)
@@ -9,7 +9,7 @@ TARGET=
 RESTARTCMD=
 RCDIR=
 
-for x; do
+for x do
 	opt=${x%%=*}
 	var=${x#*=}
 	case "$opt" in
@@ -18,7 +18,7 @@ for x; do
 	--debug) DEBUG=$var;;
 	--disable-debug) DEBUG=no;;
 	--enable-debug) DEBUG=yes;;
-	--prefix) prefix=$var;;
+	--prefix) PREFIX=$var;;
 	--sysconfdir) SYSCONFDIR=$var;;
 	--bindir|--sbindir) SBINDIR=$var;;
 	--libexecdir) LIBEXECDIR=$var;;
@@ -41,68 +41,76 @@ for x; do
 	esac
 done
 
+if [ -z "$LIBEXECDIR" ]; then
+	printf "Checking for directory /libexec ... "
+	if [ -d /libexec ]; then
+		echo "yes"
+		LIBEXECDIR=$PREFIX/libexec/resolvconf
+	else
+		echo "no"
+		LIBEXECDIR=$PREFIX/lib/resolvconf
+	fi
+fi
+if [ -z "$RUNDIR" ]; then
+	printf "Checking for directory /run ... "
+	if [ -d /run ]; then
+		echo "yes"
+		RUNDIR=/run
+	else
+		echo "no"
+		RUNDIR=/var/run
+	fi
+fi	
+
 : ${SED:=sed}
 
-: ${PREFIX:=$prefix}
 : ${SYSCONFDIR:=$PREFIX/etc}
 : ${SBINDIR:=$PREFIX/sbin}
-: ${LIBEXECDIR:=$PREFIX/libexec}
+: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf}
 : ${STATEDIR:=/var}
 : ${RUNDIR:=$STATEDIR/run}
 : ${MANDIR:=${PREFIX:-/usr}/share/man}
 
 eval SYSCONFDIR="$SYSCONFDIR"
 eval SBINDIR="$SBINDIR"
-eval LIBEXECDIR="$LIBEXECDIR/resolvconf"
+eval LIBEXECDIR="$LIBEXECDIR"
 eval VARDIR="$RUNDIR/resolvconf"
 eval MANDIR="$MANDIR"
 
 CONFIG_MK=config.mk
 
 if [ -z "$BUILD" ]; then
-	BUILD=`uname -m`-`uname -s | tr '[:upper:]' '[:lower:]'`
-fi
-if [ -z "$HOST" ]; then
-	[ -z "$TARGET" ] && TARGET=$BUILD
-	HOST=$TARGET
-fi
-if [ -z "$TARGET" ]; then
-	[ -z "$HOST" ] && HOST=$BUILD
-	TARGET=$HOST
-fi
-
-# Debian and Slackware have linux in different places when dealing with
-# autoconf, so we deal with that here.
-if [ -z "$OS" ]; then
-	case "$TARGET" in
-	*-linux-*|linux-*|*-linux|linux) OS=linux;;
-	esac
+	# autoconf target triplet: cpu-vendor-os
+	BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
 fi
+: ${HOST:=$BUILD}
 
 if [ -z "$OS" ]; then
-	# Derive OS from cpu-manufacturer-os-kernel
-	CPU=${TARGET%%-*}
-	REST=${TARGET#*-}
+	echo "Deriving operating system from ... $HOST"
+	# Derive OS from cpu-vendor-[kernel-]os
+	CPU=${HOST%%-*}
+	REST=${HOST#*-}
 	if [ "$CPU" != "$REST" ]; then
-		MANU=${REST%%-*}
+		VENDOR=${REST%%-*}
 		REST=${REST#*-}
-		if [ "$MANU" != "$REST" ]; then
+		if [ "$VENDOR" != "$REST" ]; then
+			# Use kernel if given, otherwise os
 			OS=${REST%%-*}
-			REST=${REST#*-}
-			if [ "$OS" != "$REST" ]; then
-				KERNEL=${REST%%-*}
-			else
-				# 3 tupple
-				KERNEL=$OS
-				OS=$MANU
-				MANU=
-			fi
 		else
 			# 2 tupple
-			OS=$MANU
-			MANU=
+			OS=$VENDOR
+			VENDOR=
 		fi
 	fi
+
+        # Work with cpu-kernel-os, ie Debian
+	case "$VENDOR" in
+	linux*|kfreebsd*) OS=$VENDOR; VENDOR= ;;
+	esac
+	# Special case
+	case "$OS" in
+	gnu*) OS=hurd;; # No HURD support as yet
+	esac
 fi
 
 echo "Configuring openresolv for ... $OS"
@@ -118,17 +126,36 @@ for x in SYSCONFDIR SBINDIR LIBEXECDIR V
 	echo "$x=$t	$v" >>$CONFIG_MK
 done
 
-if [ -e /etc/arch-release -a -d /etc/rc.d ]; then
-	echo "Overriding service status check for Arch Linux"
-	RCDIR=/etc/rc.d
-	RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
-	echo "yes"
+if [ -z "$RESTARTCMD" ]; then
+	printf "Checking for systemd ... "
+	if [ -x /bin/systemctl ]; then
+		RESTARTCMD="/bin/systemctl try-restart \1"
+		echo "yes"
+	elif [ -x /usr/bin/systemctl ]; then
+		RESTARTCMD="/usr/bin/systemctl try-restart \1"
+		echo "yes"
+	else
+		echo "no"
+	fi
+fi
+
+# Arch upgraded to systemd, so this check has to be just after systemd
+# but higher than the others
+if [ -z "$RESTARTCMD" ]; then
+	printf "Checking for Arch ... "
+	if [ -e /etc/arch-release -a -d /etc/rc.d ]; then
+		RCDIR=/etc/rc.d
+		RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
+		echo "yes"
+	else
+		echo "no"
+	fi
 fi
 
 if [ -z "$RESTARTCMD" ]; then
 	printf "Checking for OpenRC ... "
 	if [ -x /sbin/rc-service ]; then
-		RESTARTCMD="/sbin/rc-service -e \1 \&\& /sbin/rc-service \1 -- -Ds restart"
+		RESTARTCMD="if /sbin/rc-service -e \1; then /sbin/rc-service \1 -- -Ds restart; fi"
 		echo "yes"
 	else
 		echo "no"
@@ -138,7 +165,7 @@ if [ -z "$RESTARTCMD" ]; then
 	printf "Checking for invoke-rc.d ... "
 	if [ -x /usr/sbin/invoke-rc.d ]; then
 		RCDIR=/etc/init.d
-		RESTARTCMD="/usr/sbin/invoke-rc.d --quiet \1 status >/dev/null 2>\&1 \&\& /usr/sbin/invoke-rc.d \1 restart"
+		RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \1 status >/dev/null 2>\&1; then /usr/sbin/invoke-rc.d \1 restart; fi"
 		echo "yes"
 	else
 		echo "no"
@@ -148,7 +175,19 @@ if [ -z "$RESTARTCMD" ]; then
 	printf "Checking for service ... "
 	if [ -x /sbin/service ]; then
 		RCDIR=/etc/init.d
-		RESTARTCMD="/sbin/service \1 \&\& /sbin/service \1 restart"
+		RESTARTCMD="if /sbin/service \1; then /sbin/service \1 restart; fi"
+		echo "yes"
+	else
+		echo "no"
+	fi
+fi
+if [ -z "$RESTARTCMD" ]; then
+	printf "Checking for runit... "
+	if [ -x /bin/sv ]; then
+		RESTARTCMD="/bin/sv try-restart \1"
+		echo "yes"
+	elif [ -x /usr/bin/sv ]; then
+		RESTARTCMD="/usr/bin/sv try-restart \1"
 		echo "yes"
 	else
 		echo "no"
@@ -159,7 +198,7 @@ if [ -z "$RESTARTCMD" ]; then
 		printf "Checking for $x ... "
 		if [ -d $x ]; then
 			RCDIR=$x
-			RESTARTCMD="$x/\1 status >/dev/null 2>\&1 \&\& $x/\1 restart"
+			RESTARTCMD="if $x/\1 status >/dev/null 2>\&1; then $x/\1 restart; fi"
 			echo "yes"
 			break
 		else
@@ -169,7 +208,7 @@ if [ -z "$RESTARTCMD" ]; then
 fi
 
 if [ -z "$RESTARTCMD" ]; then
-	echo "WARNING! No means of interacting with system services detected!"
+	echo "$0: WARNING: No means of interacting with system services detected!"
 	exit 1
 fi
 

Modified: stable/10/contrib/openresolv/dnsmasq.in
==============================================================================
--- stable/10/contrib/openresolv/dnsmasq.in	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/dnsmasq.in	Mon May 11 01:33:34 2015	(r282746)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2012 Roy Marples
 # All rights reserved
 
 # dnsmasq subscriber for resolvconf
@@ -29,12 +29,13 @@
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0
-[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
 NL="
 "
 
 : ${dnsmasq_pid:=/var/run/dnsmasq.pid}
 [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
+[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
 : ${dnsmasq_service:=dnsmasq}
 : ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
 newconf="# Generated by resolvconf$NL"
@@ -46,21 +47,18 @@ newresolv="$newconf"
 # so we need to validate a few things first.
 # Check for DBus support in the binary
 dbus=false
-: ${dbus_pid:=/var/run/dbus/dbus.pid}
-[ -s "$dbus_pid" ] || dbus_pid=/var/run/dbus.pid
-[ -s "$dbus_pid" ] || dbus_pid=/var/run/dbus/pid
-if [ -s "$dbus_pid" -a -s "$dnsmasq_pid" ]; then
-	if dnsmasq --version 2>/dev/null | \
-		grep -q "^Compile time options.*[[:space:]]DBus[[:space:]]"
+dbus_ex=false
+dbus_introspect=$(dbus-send --print-reply --system \
+	--dest=uk.org.thekelleys.dnsmasq \
+	/uk/org/thekelleys/dnsmasq \
+	org.freedesktop.DBus.Introspectable.Introspect \
+	2>/dev/null)
+if [ $? = 0 ]; then
+	dbus=true
+	if printf %s "$dbus_introspect" | \
+	    grep -q '<method name="SetDomainServers">'
 	then
-		# Sanity - check that dnsmasq and dbus are running
-		if kill -0 $(cat "$dbus_pid") 2>/dev/null && \
-			kill -0 $(cat "$dnsmasq_pid") 2>/dev/null
-		then
-			dbus=true
-			newconf="$newconf$NL# Domain specific servers will"
-			newconf="$newconf be sent over dbus${NL}enable-dbus$NL"
-		fi
+		dbus_ex=true
 	fi
 fi
 
@@ -69,30 +67,97 @@ for n in $NAMESERVERS; do
 done
 
 dbusdest=
+dbusdest_ex=
+conf=
 for d in $DOMAINS; do
 	dn="${d%%:*}"
 	ns="${d#*:}"
 	while [ -n "$ns" ]; do
-		if $dbus; then
-			SIFS=${IFS-y} OIFS=$IFS
-			IFS=.
-			set -- ${ns%%,*}
-			num="0x$(printf %02x $1 $2 $3 $4)"
-			if [ "$SIFS" = yi ]; then
-				unset IFS
-			else
-				IFS=$OIFS
-			fi
-			dbusdest="$dbusdest uint32:$(printf %u $num)"
-			dbusdest="$dbusdest string:$dn"
-		else
-			newconf="${newconf}server=/$dn/${ns%%,*}$NL"
+		n="${ns%%,*}"
+		if $dbus && ! $dbus_ex; then
+			case "$n" in
+			*.*.*.*)
+				SIFS=${IFS-y} OIFS=$IFS
+				IFS=.
+				set -- $n
+				num="0x$(printf %02x $1 $2 $3 $4)"
+				if [ "$SIFS" = y ]; then
+					unset IFS
+				else
+					IFS=$OIFS
+				fi
+				dbusdest="$dbusdest uint32:$(printf %u $num)"
+				dbusdest="$dbusdest string:$dn"
+				;;
+			*:*%*)
+				# This version of dnsmasq won't accept
+				# scoped IPv6 addresses
+				dbus=false
+				;;
+			*:*)
+				SIFS=${IFS-y} OIFS=$IFS bytes= front= back=
+				empty=false i=0
+				IFS=:
+				set -- $n
+				while [ -n "$1" -o -n "$2" ]; do
+					addr="$1"
+					shift
+					if [ -z "$addr" ]; then
+						empty=true
+						continue
+					fi
+					i=$(($i + 1))
+					while [ ${#addr} -lt 4 ]; do
+						addr="0${addr}"
+					done
+					byte1="$(printf %d 0x${addr%??})"
+					byte2="$(printf %d 0x${addr#??})"
+					if $empty; then
+						back="$back byte:$byte1 byte:$byte2"
+					else
+						front="$front byte:$byte1 byte:$byte2"
+					fi
+				done
+				while [ $i != 8 ]; do
+				i=$(($i + 1))
+					front="$front byte:0 byte:0"
+				done
+				front="${front}$back"
+				if [ "$SIFS" = y ]; then
+					unset IFS
+				else
+					IFS=$OIFS
+				fi
+				dbusdest="${dbusdest}$front string:$dn"
+				;;
+			*)
+				if ! $dbus_ex; then
+					dbus=false
+				fi
+				;;
+			esac
 		fi
+		dbusdest_ex="$dbusdest_ex${dbusdest_ex:+,}/$dn/$n"
+		conf="${conf}server=/$dn/$n$NL"
 		[ "$ns" = "${ns#*,}" ] && break
 		ns="${ns#*,}"
 	done
 done
 
+if $dbus; then
+	newconf="$newconf$NL# Domain specific servers will"
+	newconf="$newconf be sent over dbus${NL}"
+else
+	newconf="$newconf$conf"
+fi
+
+# Try to ensure that config dirs exist
+if type config_mkdirs >/dev/null 2>&1; then
+	config_mkdirs "$dnsmasq_conf" "$dnsmasq_resolv"
+else
+	@SBINDIR@/resolvconf -D "$dnsmasq_conf" "$dnsmasq_resolv"
+fi
+
 changed=false
 if [ -n "$dnsmasq_conf" ]; then
 	if [ ! -f "$dnsmasq_conf" ] || \
@@ -103,14 +168,13 @@ if [ -n "$dnsmasq_conf" ]; then
 	fi
 fi
 if [ -n "$dnsmasq_resolv" ]; then
+	# dnsmasq polls this file so no need to set changed=true
 	if [ -f "$dnsmasq_resolv" ]; then
 		if [ "$(cat "$dnsmasq_resolv")" != "$(printf %s "$newresolv")" ]
 		then
-			changed=true
 			printf %s "$newresolv" >"$dnsmasq_resolv"
 		fi
 	else
-		# dnsmasq polls this file so no need to set changed=true
 		printf %s "$newresolv" >"$dnsmasq_resolv"
 	fi
 fi
@@ -119,9 +183,20 @@ if $changed; then
 	eval $dnsmasq_restart
 fi
 if $dbus; then
-	$changed || kill -HUP $(cat "$dnsmasq_pid")
+	if [ -s "$dnsmasq_pid" ]; then
+        	$changed || kill -HUP $(cat "$dnsmasq_pid")
+	fi
 	# Send even if empty so old servers are cleared
+	if $dbus_ex; then
+		method=SetDomainServers
+		if [ -n "$dbusdest_ex" ]; then
+			dbusdest_ex="array:string:$dbusdest_ex"
+		fi
+		dbusdest="$dbusdest_ex"
+	else
+		method=SetServers
+	fi
 	dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
- 		/uk/org/thekelleys/dnsmasq uk.org.thekelleys.SetServers \
+ 		/uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \
   		$dbusdest
 fi

Modified: stable/10/contrib/openresolv/libc.in
==============================================================================
--- stable/10/contrib/openresolv/libc.in	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/libc.in	Mon May 11 01:33:34 2015	(r282746)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2014 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -36,18 +36,18 @@ NL="
 # sed may not be available, and this is faster on small files
 key_get_value()
 {
-	local key="$1" value= x= line=
+	local key="$1" x= line=
 
 	shift
 	if [ $# -eq 0 ]; then
-		while read line; do
+		while read -r line; do
 			case "$line" in
 			"$key"*) echo "${line##$key}";;
 			esac
 		done
 	else
-		for x; do
-			while read line; do
+		for x do
+			while read -r line; do
 				case "$line" in
 				"$key"*) echo "${line##$key}";;
 				esac
@@ -56,6 +56,24 @@ key_get_value()
 	fi
 }
 
+keys_remove()
+{
+	local key x line found
+
+	while read -r line; do
+		found=false
+		for key do
+			case "$line" in
+			"$key"*|"#"*|" "*|"	"*|"") found=true;;
+			esac
+			$found && break
+		done
+		$found || echo "$line"
+	done
+}
+
+local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1"
+
 # Support original resolvconf configuration layout
 # as well as the openresolv config file
 if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
@@ -64,12 +82,11 @@ elif [ -d "$SYSCONFDIR"/resolvconf ]; th
 	SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d"
 	base="$SYSCONFDIR/resolv.conf.d/base"
 	if [ -f "$base" ]; then
-		name_servers="$(key_get_value "nameserver " "$base")"
-		search_domains="$(key_get_value "search " "$base")"
-		if [ -z "$search_domains" ]; then
-			search_domains="$(key_get_value "domain " "$base")"
-		fi
+		prepend_nameservers="$(key_get_value "nameserver " "$base")"
+		domain="$(key_get_value "domain " "$base")"
+		prepend_search="$(key_get_value "search " "$base")"
 		resolv_conf_options="$(key_get_value "options " "$base")"
+		resolv_conf_sortlist="$(key_get_value "sortlist " "$base")"
 	fi
 	if [ -f "$SYSCONFDIR"/resolv.conf.d/head ]; then
 		resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.d/head)"
@@ -81,7 +98,7 @@ fi
 : ${resolv_conf:=/etc/resolv.conf}
 : ${libc_service:=nscd}
 : ${libc_restart:=@RESTARTCMD ${libc_service}@}
-: ${list_resolv:=@PREFIX@/sbin/resolvconf -l}
+: ${list_resolv:=@SBINDIR@/resolvconf -l}
 if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then
 	resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"
 fi
@@ -89,6 +106,9 @@ if [ "${resolv_conf_tail-x}" = x -a -f "
 	resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)"
 fi
 
+backup=true
+signature="# Generated by resolvconf"
+ 
 uniqify()
 {
 	local result=
@@ -104,6 +124,7 @@ uniqify()
 
 case "${resolv_conf_passthrough:-NO}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+	backup=false
 	newest=
 	for conf in "$IFACEDIR"/*; do
 		if [ -z "$newest" -o "$conf" -nt "$newest" ]; then
@@ -113,31 +134,70 @@ case "${resolv_conf_passthrough:-NO}" in
 	[ -z "$newest" ] && exit 0
 	newconf="$(cat "$newest")$NL"
 	;;
+/dev/null|[Nn][Uu][Ll][Ll])
+	: ${resolv_conf_local_only:=NO}
+	if [ "$local_nameservers" = "127.* 0.0.0.0 255.255.255.255 ::1" ]; then
+		local_nameservers=
+	fi
+	# Need to overwrite our variables.
+	eval "$(@SBINDIR@/resolvconf -V)"
+	;;
+
+*)
+	[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
+	;;
+esac
+case "${resolv_conf_passthrough:-NO}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) ;;
 *)
-	[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
-	newsearch="$(uniqify $search_domains $SEARCH $search_domains_append)"
+	: ${domain:=$DOMAIN}
+	newsearch="$(uniqify $prepend_search $SEARCH $append_search)"
 	NS="$LOCALNAMESERVERS $NAMESERVERS"
-	newns="$(uniqify $name_servers $NS $name_servers_append)"
+	newns=
+	gotlocal=false
+	for n in $(uniqify $prepend_nameservers $NS $append_nameservers); do
+		add=true
+		islocal=false
+		for l in $local_nameservers; do
+			case "$n" in
+			$l) islocal=true; gotlocal=true; break;;
+			esac
+		done
+		if ! $islocal; then
+			case "${resolv_conf_local_only:-YES}" in
+			[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+				$gotlocal && add=false;;
+			esac
+		fi
+		$add && newns="$newns $n"
+	done
 
 	# Hold our new resolv.conf in a variable to save on temporary files
-	newconf="# Generated by resolvconf$NL"
+	newconf="$signature$NL"
 	if [ -n "$resolv_conf_head" ]; then
 		newconf="$newconf$resolv_conf_head$NL"
 	fi
-	[ -n "$newsearch" ] && newconf="${newconf}search $newsearch$NL"
+
+	[ -n "$domain" ] && newconf="${newconf}domain $domain$NL"
+	if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then
+		newconf="${newconf}search $newsearch$NL"
+	fi
 	for n in $newns; do
 		newconf="${newconf}nameserver $n$NL"
 	done
 
-	# Now get any configured options
-	opts="$resolv_conf_options${resolv_conf_options:+ }"
-	opts="$opts$($list_resolv | key_get_value "options ")"
-	if [ -n "$opts" ]; then
-		newconf="${newconf}options"
-		for opt in $(uniqify $opts); do
-			newconf="${newconf} $opt"
-		done
-		newconf="$newconf$NL"
+	# Now add anything we don't care about such as sortlist and options
+	stuff="$($list_resolv | keys_remove nameserver domain search)"
+	if [ -n "$stuff" ]; then
+		newconf="$newconf$stuff$NL"
+	fi
+
+	# Append any user defined ones
+	if [ -n "$resolv_conf_options" ]; then
+		newconf="${newconf}options $resolv_conf_options$NL"
+	fi
+	if [ -n "$resolv_conf_sortlist" ]; then
+		newconf="${newconf}sortlist $resolv_conf_sortlist$NL"
 	fi
 
 	if [ -n "$resolv_conf_tail" ]; then
@@ -151,6 +211,22 @@ if [ -e "$resolv_conf" ]; then
 	[ "$(cat "$resolv_conf")" = "$(printf %s "$newconf")" ] && exit 0
 fi
 
+# Change is good.
+# If the old file does not have our signature, back it up.
+# If the new file just has our signature, restore the backup.
+if $backup; then
+	if [ "$newconf" = "$signature$NL" ]; then
+		if [ -e "$resolv_conf.bak" ]; then
+			newconf="$(cat "$resolv_conf.bak")"
+		fi
+	elif [ -e "$resolv_conf" ]; then
+		read line <"$resolv_conf"
+		if [ "$line" != "$signature" ]; then
+			cp "$resolv_conf" "$resolv_conf.bak"
+		fi
+	fi
+fi
+
 # Create our resolv.conf now
 (umask 022; echo "$newconf" >"$resolv_conf")
 eval $libc_restart
@@ -162,7 +238,7 @@ for script in "$LIBEXECDIR"/libc.d/*; do
 		if [ -x "$script" ]; then
 			"$script" "$@"
 		else
-			(. "$script" "$@")
+			(. "$script")
 		fi
 		retval=$(($retval + $?))
 	fi

Modified: stable/10/contrib/openresolv/named.in
==============================================================================
--- stable/10/contrib/openresolv/named.in	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/named.in	Mon May 11 01:33:34 2015	(r282746)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2012 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
@@ -29,7 +29,7 @@
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$named_zones" -a -z "$named_options" ] && exit 0
-[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
 NL="
 "
 
@@ -40,6 +40,9 @@ then
 	if [ -x "@RCDIR@"/bind9 ]; then
 		# Debian and derivatives
 		named_service=bind9
+	elif [ -x "@RCDIR@"/rc.bind ]; then
+		# Slackware
+		named_service=rc.bind
 	fi
 fi
 : ${named_service:=named}
@@ -71,6 +74,13 @@ for d in $DOMAINS; do
 	newzones="$newzones	};$NL};$NL"
 done
 
+# Try to ensure that config dirs exist
+if type config_mkdirs >/dev/null 2>&1; then
+	config_mkdirs "$named_options" "$named_zones"
+else
+	@SBINDIR@/resolvconf -D "$named_options" "$named_zones"
+fi
+
 # No point in changing files or reloading bind if the end result has not
 # changed
 changed=false

Copied: stable/10/contrib/openresolv/pdns_recursor.in (from r282434, head/contrib/openresolv/pdns_recursor.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/contrib/openresolv/pdns_recursor.in	Mon May 11 01:33:34 2015	(r282746, copy of r282434, head/contrib/openresolv/pdns_recursor.in)
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Copyright (c) 2009-2011 Roy Marples
+# All rights reserved
+
+# PowerDNS Recursor subscriber for resolvconf
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+[ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
+. "@SYSCONFDIR@/resolvconf.conf" || exit 1
+[ -z "$pdns_zones" ] && exit 0
+[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
+NL="
+"
+
+: ${pdns_service:=pdns_recursor}
+: ${pdns_restart:=@RESTARTCMD ${pdns_service}@}
+
+newzones=
+
+# pds_recursor does not present support global forward servers, which
+# does limit it's usefulness somewhat.
+# If it did, the below code can be enabled, or something like it.
+#for n in $NAMESERVERS; do
+#	newzones="$newzones${newzones:+,}$n"
+#done
+#[ -n "$newzones" ] && newzones=".=$newzones$NL"
+
+for d in $DOMAINS; do
+	newns=
+	ns="${d#*:}"
+	while [ -n "$ns" ]; do
+		newns="$newns${newns:+,}${ns%%,*}"
+		[ "$ns" = "${ns#*,}" ] && break
+		ns="${ns#*,}"
+	done
+	[ -n "$newns" ] && newzones="$newzones${d%%:*}=$newns$NL"
+done
+
+# Try to ensure that config dirs exist
+if type config_mkdirs >/dev/null 2>&1; then
+	config_mkdirs "$pdnsd_zones"
+else
+	@SBINDIR@/resolvconf -D "$pdnsd_zones"
+fi
+
+if [ ! -f "$pdns_zones" ] || \
+	[ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ]
+then
+	printf %s "$newzones" >"$pdns_zones"
+	eval $pdns_restart
+fi

Modified: stable/10/contrib/openresolv/pdnsd.in
==============================================================================
--- stable/10/contrib/openresolv/pdnsd.in	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/pdnsd.in	Mon May 11 01:33:34 2015	(r282746)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2010 Roy Marples
+# Copyright (c) 2010-2013 Roy Marples
 # All rights reserved
 
 # pdnsd subscriber for resolvconf
@@ -29,7 +29,9 @@
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0
-[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
+NL="
+"
 
 : ${pdnsd_restart:=pdnsd-ctl config $pdnsd_conf}
 signature="# Generated by resolvconf"
@@ -46,7 +48,7 @@ remove_markers()
 		sed "/^$m1/,/^$m2/d" $@
 	else
 		for x; do
-			while read line; do
+			while read -r line; do
 				case "$line" in
 				"$m1"*) in_marker=1;;
 				"$m2"*) in_marker=0;;
@@ -80,24 +82,32 @@ change_file()
 	return 0
 }
 
-newresolv="# Generated by resolvconf\n"
+newresolv="# Generated by resolvconf$NL"
 changed=false
 
+# Try to ensure that config dirs exist
+if type config_mkdirs >/dev/null 2>&1; then
+	config_mkdirs "$pdnsd_resolv" "$pdnsd_conf"
+else
+	@SBINDIR@/resolvconf -D "$pdnsd_resolv" "$pdnsd_conf"
+fi
+
 if [ -n "$pdnsd_resolv" ]; then
 	for n in $NAMESERVERS; do
-		newresolv="${newresolv}nameserver $n\n"
+		newresolv="${newresolv}nameserver $n$NL"
 	done
 fi
 
-if [ -n "$pdnsd_conf" ]; then
+# Only modify the configuration if it exists and we can write to it
+if [ -w "$pdnsd_conf" ]; then
 	cf="$pdnsd_conf.new"
 	newconf=
 
 	if [ -z "$pdnsd_resolv" ]; then
-		newconf="${newconf}server {\n"
-		newconf="${newconf}\tlabel=resolvconf;\n"
+		newconf="${newconf}server {$NL"
+		newconf="${newconf}	label=resolvconf;$NL"
 		if [ -n "$NAMESERVERS" ]; then
-			newconf="${newconf}\tip="
+			newconf="${newconf}	ip="
 			first=true
 			for n in $NAMESERVERS; do
 				if $first; then
@@ -107,16 +117,16 @@ if [ -n "$pdnsd_conf" ]; then
 				fi
 				newconf="$newconf$n"
 			done
-			newconf="${newconf};\n"
+			newconf="${newconf};$NL"
 		fi
-		newconf="${newconf}}\n"
+		newconf="${newconf}}$NL"
 	fi
 
 	for d in $DOMAINS; do
-		newconf="${newconf}server {\n"
-		newconf="${newconf}\tinclude=.${d%%:*}.;\n"
-		newconf="${newconf}\tpolicy=excluded;\n"
-		newconf="${newconf}\tip="
+		newconf="${newconf}server {$NL"
+		newconf="${newconf}	include=.${d%%:*}.;$NL"
+		newconf="${newconf}	policy=excluded;$NL"
+		newconf="${newconf}	ip="
 		ns="${d#*:}"
 		while [ -n "$ns" ]; do
 			newconf="${newconf}${ns%%,*}"
@@ -124,7 +134,7 @@ if [ -n "$pdnsd_conf" ]; then
 			ns="${ns#*,}"
 			newconf="${newconf},"
 		done
-		newconf="${newconf};\n}\n"
+		newconf="${newconf};$NL}$NL"
 	done
 
 	rm -f "$cf"
@@ -136,7 +146,7 @@ if [ -n "$pdnsd_conf" ]; then
 	fi
 	if change_file "$pdnsd_conf" "$cf"; then
 		changed=true
-	fi	
+	fi
 fi
 
 if [ -n "$pdnsd_resolv" ]; then

Modified: stable/10/contrib/openresolv/resolvconf.8.in
==============================================================================
--- stable/10/contrib/openresolv/resolvconf.8.in	Mon May 11 00:16:32 2015	(r282745)
+++ stable/10/contrib/openresolv/resolvconf.8.in	Mon May 11 01:33:34 2015	(r282746)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2009 Roy Marples
+.\" Copyright (c) 2007-2015 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,8 +22,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 3, 2009
-.Dt RESOLVCONF 8 SMM

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505110133.t4B1XYAr002878>