Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/openresolv/dist Import openresolv-3.5.3 with th...



details:   https://anonhg.NetBSD.org/src/rev/b3b6511cb760
branches:  trunk
changeset: 783116:b3b6511cb760
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.in |   15 ++-
 3 files changed, 96 insertions(+), 47 deletions(-)

diffs (230 lines):

diff -r 59384ef61358 -r b3b6511cb760 external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in   Thu Dec 06 11:18:58 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 59384ef61358 -r b3b6511cb760 external/bsd/openresolv/dist/named.in
--- a/external/bsd/openresolv/dist/named.in     Thu Dec 06 11:18:58 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 59384ef61358 -r b3b6511cb760 external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in        Thu Dec 06 11:18:58 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