Import openresolv 3.9.0

Obtained from:	http://roy.marples.name/projects/openresolv
This commit is contained in:
Pedro F. Giffuni 2017-01-29 22:33:00 +00:00
parent 2a4f382499
commit ace5731aab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/openresolv/dist/; revision=312970
svn path=/vendor/openresolv/3.9.0/; revision=312971; tag=vendor/openresolv/3.9.0
7 changed files with 108 additions and 36 deletions

View File

@ -37,6 +37,11 @@ SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g'
DISTPREFIX?= ${PKG}-${VERSION} DISTPREFIX?= ${PKG}-${VERSION}
DISTFILEGZ?= ${DISTPREFIX}.tar.gz DISTFILEGZ?= ${DISTPREFIX}.tar.gz
DISTFILE?= ${DISTPREFIX}.tar.xz DISTFILE?= ${DISTPREFIX}.tar.xz
DISTINFO= ${DISTFILE}.distinfo
DISTINFOSIGN= ${DISTINFO}.asc
CKSUM?= cksum -a SHA256
PGP?= netpgp
FOSSILID?= current FOSSILID?= current
.SUFFIXES: .in .SUFFIXES: .in
@ -53,7 +58,7 @@ clean:
rm -f ${TARGET} rm -f ${TARGET}
distclean: clean distclean: clean
rm -f config.mk ${DISTFILE} rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
installdirs: installdirs:
@ -83,3 +88,11 @@ dist:
fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
rm ${DISTFILEGZ} 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}

23
configure vendored
View File

@ -120,14 +120,21 @@ echo "Configuring openresolv for ... $OS"
rm -rf $CONFIG_MK rm -rf $CONFIG_MK
echo "# $OS" >$CONFIG_MK echo "# $OS" >$CONFIG_MK
# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled case "$OS" in
# regardless of if it's not running. freebsd*)
# So we force onestatus to work around this silly bug. # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
if [ -z "$STATUSARG" ]; then # regardless of if it's not running.
case "$OS" in # So we force onestatus to work around this silly bug.
freebsd*) STATUSARG="onestatus";; if [ -z "$STATUSARG" ]; then
esac STATUSARG="onestatus"
fi 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 for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
do do

View File

@ -216,7 +216,7 @@ fi
if $backup; then if $backup; then
if [ "$newconf" = "$signature$NL" ]; then if [ "$newconf" = "$signature$NL" ]; then
if [ -e "$resolv_conf.bak" ]; then if [ -e "$resolv_conf.bak" ]; then
newconf="$(cat "$resolv_conf.bak")" newconf="$(cat "$resolv_conf.bak")$NL"
fi fi
elif [ -e "$resolv_conf" ]; then elif [ -e "$resolv_conf" ]; then
read line <"$resolv_conf" read line <"$resolv_conf"

View File

@ -34,7 +34,6 @@ NL="
" "
: ${pdns_service:=pdns_recursor} : ${pdns_service:=pdns_recursor}
: ${pdns_restart:=@RESTARTCMD ${pdns_service}@}
newzones= newzones=
@ -68,5 +67,12 @@ if [ ! -f "$pdns_zones" ] || \
[ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ] [ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ]
then then
printf %s "$newzones" >"$pdns_zones" 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 fi

View File

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

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd April 28, 2016 .Dd December 29, 2016
.Dt RESOLVCONF.CONF 5 .Dt RESOLVCONF.CONF 5
.Os .Os
.Sh NAME .Sh NAME
@ -69,6 +69,11 @@ If unset, defaults to the following:-
These interfaces will be processed next, unless they have a metric. These interfaces will be processed next, unless they have a metric.
If unset, defaults to the following:- If unset, defaults to the following:-
.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* .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 .It Sy local_nameservers
If unset, defaults to the following:- If unset, defaults to the following:-
.D1 127.* 0.0.0.0 255.255.255.255 ::1 .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 This is equivalent to the
.Nm resolvconf -p .Nm resolvconf -p
option. 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 .It Sy replace
Is a space separated list of replacement keywords. Is a space separated list of replacement keywords.
The syntax is this: The syntax is this:

View File

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