Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/external/bsd/openresolv/dist Pull up the import of versio...



details:   https://anonhg.NetBSD.org/src/rev/8f9e523c07c2
branches:  netbsd-7
changeset: 798546:8f9e523c07c2
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Nov 12 13:36:40 2014 +0000

description:
Pull up the import of version 3.6.1 of openresolv, via patch,
requested by roy in ticket #208.

diffstat:

 external/bsd/openresolv/dist/dnsmasq.in           |    5 +-
 external/bsd/openresolv/dist/libc.in              |   58 +++++-
 external/bsd/openresolv/dist/resolvconf.8.in      |   30 ++-
 external/bsd/openresolv/dist/resolvconf.conf.5.in |   72 +++++++-
 external/bsd/openresolv/dist/resolvconf.in        |  212 +++++++++++++++++----
 external/bsd/openresolv/dist/unbound.in           |    9 +-
 6 files changed, 328 insertions(+), 58 deletions(-)

diffs (truncated from 752 to 300 lines):

diff -r c5a3241a5c73 -r 8f9e523c07c2 external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in   Tue Nov 11 12:53:54 2014 +0000
+++ b/external/bsd/openresolv/dist/dnsmasq.in   Wed Nov 12 13:36:40 2014 +0000
@@ -35,6 +35,7 @@
 
 : ${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"
@@ -182,7 +183,9 @@
        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
diff -r c5a3241a5c73 -r 8f9e523c07c2 external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in      Tue Nov 11 12:53:54 2014 +0000
+++ b/external/bsd/openresolv/dist/libc.in      Wed Nov 12 13:36:40 2014 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2012 Roy Marples
+# Copyright (c) 2007-2014 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -72,6 +72,8 @@
        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
@@ -93,7 +95,6 @@
                resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.d/tail)"
        fi
 fi
-: ${domain:=$DOMAIN}
 : ${resolv_conf:=/etc/resolv.conf}
 : ${libc_service:=nscd}
 : ${libc_restart:=@RESTARTCMD ${libc_service}@}
@@ -105,6 +106,9 @@
        resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)"
 fi
 
+backup=true
+signature="# Generated by resolvconf"
+ 
 uniqify()
 {
        local result=
@@ -120,6 +124,7 @@
 
 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
@@ -129,27 +134,46 @@
        [ -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)"
-       newsearch="$(uniqify $prepend_search $SEARCH)"
+       ;;
+esac
+case "${resolv_conf_passthrough:-NO}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) ;;
+*)
+       : ${domain:=$DOMAIN}
+       newsearch="$(uniqify $prepend_search $SEARCH $append_search)"
        NS="$LOCALNAMESERVERS $NAMESERVERS"
        newns=
        gotlocal=false
-       for n in $(uniqify $prepend_nameservers $NS); do
+       for n in $(uniqify $prepend_nameservers $NS $append_nameservers); do
                add=true
-               case "$n" in
-               127.*|0.0.0.0|255.255.255.255|::1) gotlocal=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
-               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
@@ -187,6 +211,22 @@
        [ "$(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; printf %s "$newconf" >"$resolv_conf")
 eval $libc_restart
diff -r c5a3241a5c73 -r 8f9e523c07c2 external/bsd/openresolv/dist/resolvconf.8.in
--- a/external/bsd/openresolv/dist/resolvconf.8.in      Tue Nov 11 12:53:54 2014 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.8.in      Wed Nov 12 13:36:40 2014 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2012 Roy Marples
+.\" Copyright (c) 2007-2014 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 March 19, 2012
+.Dd October 26, 2014
 .Dt RESOLVCONF 8 SMM
 .Os
 .Sh NAME
@@ -78,6 +78,20 @@
 will supply files that the resolver should be configured to include.
 .Pp
 .Nm
+assumes it has a job to do.
+In some situations
+.Nm
+needs to act as a deterrent to writing to
+.Pa /etc/resolv.conf .
+Where this file cannot be made immutable or you just need to toggle this
+behaviour,
+.Nm
+can be disabled by adding
+.Sy resolvconf Ns = Ns NO
+to
+.Xr resolvconf.conf 5 .
+.Pp
+.Nm
 can mark an interfaces
 .Pa resolv.conf
 as private.
@@ -142,18 +156,24 @@
 .It Fl u
 Force
 .Nm
-to update all it's subscribers.
+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.
 .El
 .Pp
 .Nm
-also has some options designed to be used by it's subscribers:-
+also has some options designed to be used by its subscribers:-
 .Bl -tag -width indent
 .It Fl v
 Echo variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can
 configure the resolver easily.
+.It Fl V
+Same as
+.Fl v
+except that only the information configured in
+.Xr resolvconf.conf 5
+is set.
 .El
 .Sh INTERFACE ORDERING
 For
@@ -200,6 +220,8 @@
 .El
 .Sh FILES
 .Bl -ohang
+.It Pa /etc/resolv.conf.bak
+Backup file of the original resolv.conf.
 .It Pa @SYSCONFDIR@/resolvconf.conf
 Configuration file for
 .Nm .
diff -r c5a3241a5c73 -r 8f9e523c07c2 external/bsd/openresolv/dist/resolvconf.conf.5.in
--- a/external/bsd/openresolv/dist/resolvconf.conf.5.in Tue Nov 11 12:53:54 2014 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.conf.5.in Wed Nov 12 13:36:40 2014 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2013 Roy Marples
+.\" Copyright (c) 2009-2014 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 April 27, 2013
+.Dd October 28, 2014
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
@@ -42,12 +42,22 @@
 Listed below are the standard
 .Nm
 variables that may be set.
+If the values contain white space for special shell characters,
+ensure they are quoted and escaped correctly.
 .Pp
 After updating this file, you may wish to run
 .Nm resolvconf -u
 to apply the new configuration.
+.Pp
+When a dynmically generated list is appended or prepended to, the whole
+is made unique where left-most wins.
 .Sh RESOLVCONF OPTIONS
 .Bl -tag -width indent
+.It Sy resolvconf
+Set to NO to disable
+.Nm resolvconf
+from running any subscribers.
+Defaults to YES.
 .It Sy interface_order
 These interfaces will always be processed first.
 If unset, defaults to the following:-
@@ -56,6 +66,9 @@
 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 local_nameservers
+If unset, defaults to the following:-
+.D1 127.* 0.0.0.0 255.255.255.255 ::1
 .It Sy search_domains
 Prepend search domains to the dynamically generated list.
 .It Sy search_domains_append
@@ -81,6 +94,34 @@
 This is equivalent to the
 .Nm resolvconf -p
 option.
+.It Sy replace
+Is a space separated list of replacement keywords. The syntax is this:
+.Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement
+.Pp
+Example, given this resolv.conf:
+.D1 domain foo.org
+.D1 search foo.org dead.beef
+.D1 nameserver 1.2.3.4
+.D1 nameserver 2.3.4.5
+and this configuaration:
+.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/"
+you would get this resolv.conf instead:
+.D1 domain foo.org
+.D1 search bar.com
+.D1 nameserver 5.6.7.8
+.It Sy replace_sub
+Works the same way as
+.Sy replace
+except it works on each space separated value rather than the whole line,
+so it's useful for the replacing a single domain within the search directive.
+Using the same example resolv.conf and changing
+.Sy replace
+to
+.Sy replace_sub ,
+you would get this resolv.conf instead:
+.D1 domain foo.org



Home | Main Index | Thread Index | Old Index