Source-Changes-HG archive

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

[src/ROY]: src/external/bsd/openresolv/dist Import openresolv-3.7.0 with the ...



details:   https://anonhg.NetBSD.org/src/rev/9e258da0a1bb
branches:  ROY
changeset: 454315:9e258da0a1bb
user:      roy <roy%NetBSD.org@localhost>
date:      Fri May 01 18:21:17 2015 +0000

description:
Import openresolv-3.7.0 with the following change:
  *  -x marks the resolv.conf as exclusive.
     Only the latest resolv.conf will be processed, if none then
     as normal.

diffstat:

 external/bsd/openresolv/dist/resolvconf.8.in      |   63 +++++-
 external/bsd/openresolv/dist/resolvconf.conf.5.in |    8 +-
 external/bsd/openresolv/dist/resolvconf.in        |  216 ++++++++++++++-------
 3 files changed, 199 insertions(+), 88 deletions(-)

diffs (truncated from 524 to 300 lines):

diff -r 81c79a043c93 -r 9e258da0a1bb external/bsd/openresolv/dist/resolvconf.8.in
--- a/external/bsd/openresolv/dist/resolvconf.8.in      Tue Oct 28 22:37:59 2014 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.8.in      Fri May 01 18:21:17 2015 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2014 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 October 26, 2014
-.Dt RESOLVCONF 8 SMM
+.Dd April 27, 2014
+.Dt RESOLVCONF 8
 .Os
 .Sh NAME
 .Nm resolvconf
@@ -34,11 +34,14 @@
 .Nm
 .Op Fl m Ar metric
 .Op Fl p
-.Fl a Ar interface No < Ns Pa file
+.Op Fl x
+.Fl a Ar interface Ns Op Ar .protocol
+.No < Ns Pa file
 .Nm
 .Op Fl f
-.Fl d Ar interface
+.Fl d Ar interface Ns Op Ar .protocol
 .Nm
+.Op Fl x
 .Fl il Ar pattern
 .Nm
 .Fl u
@@ -63,7 +66,7 @@
 via
 .Xr stdin 3
 with the argument
-.Fl a Ar interface
+.Fl a Ar interface Ns Op Ar .protocol
 instead of the filesystem.
 .Nm
 then updates
@@ -105,13 +108,21 @@
 .Nm
 to use a local name server.
 .Pp
+.Nm
+can mark an interfaces
+.Pa resolv.conf
+as exclusive.
+Only the latest exclusive interface is used for processing, otherwise all are.
+.Pp
 When an interface goes down, it should then call
 .Nm
 with
-.Fl d Ar interface
+.Fl d Ar interface.*
 arguments to delete the
 .Pa resolv.conf
-file for the
+file(s) for all the
+.Ar protocols
+on the
 .Ar interface .
 .Pp
 Here are some more options that
@@ -133,7 +144,7 @@
 Ignore non existant interfaces.
 Only really useful for deleting interfaces.
 .It Fl i Ar pattern
-List the interfaces, optionally matching
+List the interfaces and protocols, optionally matching
 .Ar pattern ,
 we have
 .Pa resolv.conf
@@ -144,7 +155,8 @@
 files we have.
 If
 .Ar pattern
-is specified then we list the files for the interfaces that match it.
+is specified then we list the files for the interfaces and protocols
+that match it.
 .It Fl m Ar metric
 Set the metric of the interface when adding it, default of 0.
 Lower metrics take precedence.
@@ -160,6 +172,10 @@
 .Nm
 does not update the subscribers when adding a resolv.conf that matches
 what it already has for that interface.
+.It Fl x
+Mark the interface
+.Pa resolv.conf
+as exclusive when adding, otherwise only use the latest exclusive interface.
 .El
 .Pp
 .Nm
@@ -190,6 +206,29 @@
 See
 .Xr resolvconf.conf 5
 for details on these lists.
+.Sh PROTOCOLS
+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
+.It dhcp
+Dynamic Host Configuration Protocol.
+Initial versions of
+.Nm
+did not recommend a
+.Ar protocol
+tag be appended to the
+.Ar interface
+name.
+When the protocol is absent, it is assumed to be the DHCP protocol.
+.It ppp
+Point-to-Point Protocol.
+.It ra
+IPv6 Router Advertisement.
+.It dhcp6
+Dynamic Host Configuration Protocol, version 6.
+.El
 .Sh IMPLEMENTATION NOTES
 If a subscriber has the executable bit then it is executed otherwise it is
 assumed to be a shell script and sourced into the current environment in a
@@ -217,6 +256,10 @@
 Marks the interface
 .Pa resolv.conf
 as private.
+.It Va IF_EXCLUSIVE
+Marks the interface
+.Pa resolv.conf
+as exclusive.
 .El
 .Sh FILES
 .Bl -ohang
diff -r 81c79a043c93 -r 9e258da0a1bb external/bsd/openresolv/dist/resolvconf.conf.5.in
--- a/external/bsd/openresolv/dist/resolvconf.conf.5.in Tue Oct 28 22:37:59 2014 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.conf.5.in Fri May 01 18:21:17 2015 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2014 Roy Marples
+.\" Copyright (c) 2009-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 October 28, 2014
-.Dt RESOLVCONF.CONF 5 SMM
+.Dd March 20, 2015
+.Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
 .Nm resolvconf.conf
@@ -49,7 +49,7 @@
 .Nm resolvconf -u
 to apply the new configuration.
 .Pp
-When a dynmically generated list is appended or prepended to, the whole
+When a dynamically generated list is appended or prepended to, the whole
 is made unique where left-most wins.
 .Sh RESOLVCONF OPTIONS
 .Bl -tag -width indent
diff -r 81c79a043c93 -r 9e258da0a1bb external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in        Tue Oct 28 22:37:59 2014 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.in        Fri May 01 18:21:17 2015 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2014 Roy Marples
+# Copyright (c) 2007-2015 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,7 @@
 IFACEDIR="$VARDIR/interfaces"
 METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"
+EXCLUSIVEDIR="$VARDIR/exclusive"
 LOCKDIR="$VARDIR/lock"
 
 warn()
@@ -79,6 +80,7 @@
                           (DNS supplied via stdin in resolv.conf format)
          -m metric        Give the added DNS information a metric
          -p               Mark the interface as private
+         -x               Mark the interface as exclusive
          -d \$INTERFACE    Delete DNS information from the specified interface
          -f               Ignore non existant interfaces
          -I               Init the state dir
@@ -101,7 +103,7 @@
 {
        local line= OIFS="$IFS"
 
-       [ -n "$1" -a -e "$IFACEDIR/$1" ] || return 1
+       [ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1
        echo "# resolv.conf from $1"
        # Our variable maker works of the fact each resolv.conf per interface
        # is separated by blank lines.
@@ -247,28 +249,46 @@
 {
        [ -d "$IFACEDIR" ] || return 0
 
-       local report=false list= retval=0 cmd="$1"
+       local report=false list= retval=0 cmd="$1" excl=
        shift
 
+       case "$IF_EXCLUSIVE" in
+       [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+               if [ -d "$EXCLUSIVEDIR" ]; then
+                       cd "$EXCLUSIVEDIR"
+                       for i in *; do
+                               if [ -f "$i" ]; then
+                                       list="${i#* }"
+                                       break
+                               fi
+                       done
+               fi
+               excl=true
+               ;;
+       *)
+               excl=false
+               ;;
+       esac
+
        # If we have an interface ordering list, then use that.
        # It works by just using pathname expansion in the interface directory.
        if [ -n "$1" ]; then
                list="$*"
                $force || report=true
-       else
+       elif ! $excl; then
                cd "$IFACEDIR"
                for i in $interface_order; do
-                       [ -e "$i" ] && list="$list $i"
-                       for ii in "$i":*; do
-                               [ -e "$ii" ] && list="$list $ii"
+                       [ -f "$i" ] && list="$list $i"
+                       for ii in "$i":* "$i".*; do
+                               [ -f "$ii" ] && list="$list $ii"
                        done
                done
                for i in $dynamic_order; do
                        if [ -e "$i" -a ! -e "$METRICDIR/"*" $i" ]; then
                                list="$list $i"
                        fi
-                       for ii in "$i":*; do
-                               if [ -e "$ii" -a ! -e "$METRICDIR/"*" $ii" ]; then
+                       for ii in "$i":* "$i".*; do
+                               if [ -f "$ii" -a ! -e "$METRICDIR/"*" $ii" ]; then
                                        list="$list $ii"
                                fi
                        done
@@ -276,19 +296,20 @@
                if [ -d "$METRICDIR" ]; then
                        cd "$METRICDIR"
                        for i in *; do
-                               list="$list ${i#* }"
+                               [ -f "$i" ] && list="$list ${i#* }"
                        done
                fi
                list="$list *"
        fi
 
        cd "$IFACEDIR"
+       retval=1
        for i in $(uniqify $list); do
                # Only list interfaces which we really have
-               if ! [ -e "$i" ]; then
+               if ! [ -f "$i" ]; then
                        if $report; then
                                echo "No resolv.conf for interface $i" >&2
-                               retval=$(($retval + 1))
+                               retval=2
                        fi
                        continue
                fi
@@ -298,6 +319,7 @@
                else
                        echo_resolv "$i"
                fi
+               [ $? = 0 -a "$retval" = 1 ] && retval=0
        done
        [ "$cmd" = i -o "$cmd" = "-i" ] && echo
        return $retval
@@ -405,11 +427,13 @@
        SEARCH=
        NAMESERVERS=
        LOCALNAMESERVERS=
-
+       
        if [ -n "$name_servers" -o -n "$search_domains" ]; then
                eval "$(echo_prepend | parse_resolv)"
        fi



Home | Main Index | Thread Index | Old Index