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.5.3 with the ...



details:   https://anonhg.NetBSD.org/src/rev/ed3f6bb6687b
branches:  ROY
changeset: 454310:ed3f6bb6687b
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Dec 06 11:38:17 2012 +0000

description:
Import openresolv-3.5.3 with the following changes:
* man page improvements
* dnsmasq + dbus + IPv6 linklocal support (requires dnsmasq-2.64)
* sort interface protocols as well as interface (bge0, bge0:ra, bge0:dhcp6)

diffstat:

 external/bsd/openresolv/dist/dnsmasq.in           |  123 ++++++++++++++-------
 external/bsd/openresolv/dist/named.in             |    5 +-
 external/bsd/openresolv/dist/resolvconf.conf.5.in |   43 +++++++-
 external/bsd/openresolv/dist/resolvconf.in        |   15 +-
 4 files changed, 138 insertions(+), 48 deletions(-)

diffs (296 lines):

diff -r a9cadd34df3d -r ed3f6bb6687b external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in   Tue Mar 27 21:21:24 2012 +0000
+++ b/external/bsd/openresolv/dist/dnsmasq.in   Thu Dec 06 11:38:17 2012 +0000
@@ -46,6 +46,7 @@
 # so we need to validate a few things first.
 # Check for DBus support in the binary
 dbus=false
+dbus_ex=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
@@ -58,6 +59,10 @@
                        kill -0 $(cat "$dnsmasq_pid") 2>/dev/null
                then
                        dbus=true
+                       if dbus-send --print-reply --system --dest=uk.org.thekelleys.dnsmasq /uk/org/thekelleys/dnsmasq org.freedesktop.DBus.Introspectable.Introspect | grep -q '<method 
name="SetDomainServers">'
+                       then
+                               dbus_ex=true
+                       fi
                fi
        fi
 fi
@@ -67,51 +72,77 @@
 done
 
 dbusdest=
+dbusdest_ex=
 conf=
 for d in $DOMAINS; do
        dn="${d%%:*}"
        ns="${d#*:}"
-       n="${ns%%,*}"
        while [ -n "$ns" ]; do
-               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"
-                       ;;
-               *:*:*:*:*:*:*:*)
-                       SIFS=${IFS-y} OIFS=$IFS bytes=
-                       IFS=:
-                       set -- $n
-                       while [ -n "$1" ]; do
-                               addr="$1"
-                               shift
-                               while [ ${#addr} -lt 4 ]; do
-                                       addr="0${addr}"
+               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
-                               byte1="$(printf %d 0x${addr%??})"
-                               byte2="$(printf %d 0x${addr#??})"
-                               dbusdest="$dbusdest byte:$byte1 byte:$byte2"
-                       done
-                       if [ "$SIFS" = y ]; then
-                               unset IFS
-                       else
-                               IFS=$OIFS
-                       fi
-                       dbusdest="$dbusdest string:$dn"
-                       ;;
-               *)
-                       dbus=false
-                       ;;
-               esac
+                               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#*,}"
@@ -142,14 +173,13 @@
        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
@@ -160,7 +190,16 @@
 if $dbus; then
        $changed || kill -HUP $(cat "$dnsmasq_pid")
        # 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
diff -r a9cadd34df3d -r ed3f6bb6687b external/bsd/openresolv/dist/named.in
--- a/external/bsd/openresolv/dist/named.in     Tue Mar 27 21:21:24 2012 +0000
+++ b/external/bsd/openresolv/dist/named.in     Thu Dec 06 11:38:17 2012 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2011 Roy Marples
+# Copyright (c) 2007-2012 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
@@ -40,6 +40,9 @@
        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}
diff -r a9cadd34df3d -r ed3f6bb6687b external/bsd/openresolv/dist/resolvconf.conf.5.in
--- a/external/bsd/openresolv/dist/resolvconf.conf.5.in Tue Mar 27 21:21:24 2012 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.conf.5.in Thu Dec 06 11:38:17 2012 +0000
@@ -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 2, 2012
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
@@ -194,6 +194,44 @@
 Example unbound.conf:
 .D1 include: /etc/unbound-resolvconf.conf
 .El
+.Sh SUBSCRIBER INTEGRATION
+Not all distributions store the files the subscribers need in the same
+locations.
+For example, named service scripts have been called named, bind and rc.bind
+and they could be located in a directory called /etc/rc.d, /etc/init.d or
+similar.
+Each subscriber attempts to automatically configure itself, but not every
+distribution has been catered for.
+Also, users could equally want to use a different version from the one
+installed by default, such as bind8 and bind9.
+To accomodate this, the subscribers have these files in configurable
+variables, documented below.
+.Pp
+.Bl -tag -width indent
+.It Sy dbus_pid
+Locaiton of the dbus pidfile.
+.It Sy dnsmasq_service
+Location of the dnsmasq service.
+.It Sy dnsmasq_restart
+Command to restart the dnsmasq service.
+.It Sy dnsmasq_pid
+Location of the dnsmasq pidfile.
+.It Sy libc_service
+Location of the libc service.
+.It Sy libc_restart
+Command to restart the libc service.
+.It Sy named_service
+Location of the named service.
+.It Sy named_restart
+Command to restart the named service.
+.It Sy pdnsd_restart
+Command to restart the pdnsd service.
+.It Sy unbound_service
+Location of the unbound service.
+.It Sy unbound_restart
+Command to restart the unbound service.
+.It Sy unbound_pid
+Location of the unbound pidfile.
 .Sh SEE ALSO
 .Xr resolv.conf 5
 and
@@ -201,5 +239,8 @@
 .Sh AUTHORS
 .An Roy Marples Aq roy%marples.name@localhost
 .Sh BUGS
+Each distribution is a special snowflake and likes to name the same thing
+differently, namely the named service script and the dbus pidfile location.
+.Pp
 Please report them to
 .Lk http://roy.marples.name/projects/openresolv
diff -r a9cadd34df3d -r ed3f6bb6687b external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in        Tue Mar 27 21:21:24 2012 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.in        Thu Dec 06 11:38:17 2012 +0000
@@ -138,10 +138,9 @@
                                        cd "$IFACEDIR"
                                        private=false
                                        for p in $private_interfaces; do
-                                               if [ "$p" = "$iface" ]; then
-                                                       private=true
-                                                       break
-                                               fi
+                                               case "$iface" in
+                                               "$p"|"$p":*) private=true; break;;
+                                               esac
                                        done
                                fi
                        fi
@@ -254,11 +253,19 @@
                cd "$IFACEDIR"
                for i in $interface_order; do
                        [ -e "$i" ] && list="$list $i"
+                       for ii in "$i":*; do
+                               [ -e "$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
+                                       list="$list $ii"
+                               fi
+                       done
                done
                if [ -d "$METRICDIR" ]; then
                        cd "$METRICDIR"



Home | Main Index | Thread Index | Old Index