aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2017-01-29 22:33:00 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2017-01-29 22:33:00 +0000
commitace5731aabbd00dd686dcf91ceff8f1be5ba0343 (patch)
tree13c2fbf1df210863d6573f33ba027a1302e70def
parent2a4f382499af9e58edf5d7ed1358912c45678b6f (diff)
downloadsrc-ace5731aabbd00dd686dcf91ceff8f1be5ba0343.tar.gz
src-ace5731aabbd00dd686dcf91ceff8f1be5ba0343.zip
Import openresolv 3.9.0vendor/openresolv/3.9.0
Notes
Notes: svn path=/vendor/openresolv/dist/; revision=312970 svn path=/vendor/openresolv/3.9.0/; revision=312971; tag=vendor/openresolv/3.9.0
-rw-r--r--Makefile15
-rw-r--r--configure23
-rw-r--r--libc.in2
-rw-r--r--pdns_recursor.in10
-rw-r--r--resolvconf.8.in17
-rw-r--r--resolvconf.conf.5.in12
-rw-r--r--resolvconf.in65
7 files changed, 108 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index dbc0673fd252..095779b95b04 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,11 @@ SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g'
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}
diff --git a/configure b/configure
index b430b20fc344..a890cf0dc634 100644
--- a/configure
+++ b/configure
@@ -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
diff --git a/libc.in b/libc.in
index aed7f7d0ff08..d49be65b67be 100644
--- a/libc.in
+++ b/libc.in
@@ -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"
diff --git a/pdns_recursor.in b/pdns_recursor.in
index 2919e7d0ff37..ad2d922dc4de 100644
--- a/pdns_recursor.in
+++ b/pdns_recursor.in
@@ -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
diff --git a/resolvconf.8.in b/resolvconf.8.in
index 4fa5b4bc5f06..fa00582976d8 100644
--- a/resolvconf.8.in
+++ b/resolvconf.8.in
@@ -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 use the latest exclusive interface.
.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 use for each
.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
diff --git a/resolvconf.conf.5.in b/resolvconf.conf.5.in
index 7b410abbe5e9..fcebd864e367 100644
--- a/resolvconf.conf.5.in
+++ b/resolvconf.conf.5.in
@@ -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 libc.
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:
diff --git a/resolvconf.in b/resolvconf.in
index 3ac72f349544..7353cfc348d1 100644
--- a/resolvconf.in
+++ b/resolvconf.in
@@ -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