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.0 with th...



details:   https://anonhg.NetBSD.org/src/rev/238397bfae55
branches:  trunk
changeset: 778437:238397bfae55
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Mar 26 14:41:33 2012 +0000

description:
Import openresolv-3.5.0 with the following changes:
* Added resolv_conf_local_only which defaults to true.
  This means that if you configure a local nameserver we don't add
  any other nameservers to resolv.conf to avoid duplicate queries.
* Add domain_blacklist and name_server_blacklist variables.
  We default name_server_blacklist to 0.0.0.0 to handle some faulty
  routers.
* Add .Lk macro to URLs.
* Fix IPv6 parsing on domains which include an IPv4 server for dnsmasq.

diffstat:

 external/bsd/openresolv/dist/dnsmasq.in      |  10 +++--
 external/bsd/openresolv/dist/libc.in         |   8 +++-
 external/bsd/openresolv/dist/resolvconf.8.in |   7 ++-
 external/bsd/openresolv/dist/resolvconf.in   |  55 +++++++++++++++++++++++----
 4 files changed, 63 insertions(+), 17 deletions(-)

diffs (195 lines):

diff -r f93e53b286c3 -r 238397bfae55 external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in   Mon Mar 26 14:31:12 2012 +0000
+++ b/external/bsd/openresolv/dist/dnsmasq.in   Mon Mar 26 14:41:33 2012 +0000
@@ -71,12 +71,13 @@
 for d in $DOMAINS; do
        dn="${d%%:*}"
        ns="${d#*:}"
+       n="${ns%%,*}"
        while [ -n "$ns" ]; do
-               case "$ns" in
+               case "$n" in
                *.*.*.*)
                        SIFS=${IFS-y} OIFS=$IFS
                        IFS=.
-                       set -- ${ns%%,*}
+                       set -- $n
                        num="0x$(printf %02x $1 $2 $3 $4)"
                        if [ "$SIFS" = y ]; then
                                unset IFS
@@ -89,7 +90,7 @@
                *:*:*:*:*:*:*:*)
                        SIFS=${IFS-y} OIFS=$IFS bytes=
                        IFS=:
-                       set -- ${ns%%,*}
+                       set -- $n
                        while [ -n "$1" ]; do
                                addr="$1"
                                shift
@@ -111,11 +112,12 @@
                        dbus=false
                        ;;
                esac
-               conf="${conf}server=/$dn/${ns%%,*}$NL"
+               conf="${conf}server=/$dn/$n$NL"
                [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
        done
 done
+
 if $dbus; then
        newconf="$newconf$NL# Domain specific servers will"
        newconf="$newconf be sent over dbus${NL}enable-dbus$NL"
diff -r f93e53b286c3 -r 238397bfae55 external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in      Mon Mar 26 14:31:12 2012 +0000
+++ b/external/bsd/openresolv/dist/libc.in      Mon Mar 26 14:41:33 2012 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2011 Roy Marples
+# Copyright (c) 2007-2012 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -132,7 +132,11 @@
 *)
        [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
        newsearch="$(uniqify $search_domains $SEARCH $search_domains_append)"
-       NS="$LOCALNAMESERVERS $NAMESERVERS"
+       NS="$LOCALNAMESERVERS"
+       case "${resolv_conf_local_only:-1}" in
+       [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) ;;
+       *) NS="$NS $NAMESERVERS";;
+       esac
        newns="$(uniqify $name_servers $NS $name_servers_append)"
 
        # Hold our new resolv.conf in a variable to save on temporary files
diff -r f93e53b286c3 -r 238397bfae55 external/bsd/openresolv/dist/resolvconf.8.in
--- a/external/bsd/openresolv/dist/resolvconf.8.in      Mon Mar 26 14:31:12 2012 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.8.in      Mon Mar 26 14:41:33 2012 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2011 Roy Marples
+.\" Copyright (c) 2007-2012 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 May 13, 2011
+.Dd March 19, 2012
 .Dt RESOLVCONF 8 SMM
 .Os
 .Sh NAME
@@ -226,7 +226,8 @@
 .Sh AUTHORS
 .An Roy Marples Aq roy%marples.name@localhost
 .Sh BUGS
-Please report them to http://roy.marples.name/projects/openresolv
+Please report them to
+.Lk http://roy.marples.name/projects/openresolv
 .Pp
 .Nm
 does not validate any of the files given to it.
diff -r f93e53b286c3 -r 238397bfae55 external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in        Mon Mar 26 14:31:12 2012 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.in        Mon Mar 26 14:41:33 2012 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2011 Roy Marples
+# Copyright (c) 2007-2012 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,7 @@
 
 : ${dynamic_order:=tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*}
 : ${interface_order:=lo lo[0-9]*}
+: ${name_server_blacklist:=0.0.0.0}
 
 error_exit()
 {
@@ -289,18 +290,45 @@
        return $retval
 }
 
+list_remove() {
+       local list= e= l= result= found= retval=0
+
+       [ -z "$2" ] && return 0
+       eval list=\"\$$1\"
+       shift
+
+       set -f
+       for e; do
+               found=false
+               for l in $list; do
+                       case "$e" in
+                       $l) found=true;;
+                       esac
+                       $found && break
+               done
+               if $found; then
+                       retval=$(($retval + 1))
+               else
+                       result="$result $e"
+               fi
+       done
+       set +f
+       echo "${result# *}"
+       return $retval
+}
+
 make_vars()
 {
+       local newdomains= d= dn= newns= ns=
        eval "$(list_resolv -l "$@" | parse_resolv)"
 
        # Ensure that we only list each domain once
-       newdomains=
        for d in $DOMAINS; do
                dn="${d%%:*}"
+               list_remove domain_blacklist "$dn" >/dev/null || continue
                case " $newdomains" in
                *" ${dn}:"*) continue;;
                esac
-               newdomains="$newdomains${newdomains:+ }$dn:"
                newns=
                for nd in $DOMAINS; do
                        if [ "$dn" = "${nd%%:*}" ]; then
@@ -308,19 +336,30 @@
                                while [ -n "$ns" ]; do
                                        case ",$newns," in
                                        *,${ns%%,*},*) ;;
-                                       *) newns="$newns${newns:+,}${ns%%,*}";;
+                                       *) list_remove name_server_blacklist \
+                                               "$ns" >/dev/null \
+                                       && newns="$newns${newns:+,}${ns%%,*}";;
                                        esac
                                        [ "$ns" = "${ns#*,}" ] && break
                                        ns="${ns#*,}"
                                done
                        fi
                done
-               newdomains="$newdomains$newns"
+               if [ -n "$newns" ]; then
+                       newdomains="$newdomains${newdomains:+ }$dn:$newns"
+               fi
        done
+       DOMAIN="$(list_remove domain_blacklist $DOMAIN)"
+       SEARCH="$(uniqify $SEARCH)"
+       SEARCH="$(list_remove domain_blacklist $SEARCH)"
+       NAMESERVERS="$(uniqify $NAMESERVERS)"
+       NAMESERVERS="$(list_remove name_server_blacklist $NAMESERVERS)"
+       LOCALNAMESERVERS="$(uniqify $LOCALNAMESERVERS)"
+       LOCALNAMESERVERS="$(list_remove name_server_blacklist $LOCALNAMESERVERS)"
        echo "DOMAIN='$DOMAIN'"
-       echo "SEARCH='$(uniqify $SEARCH)'"
-       echo "NAMESERVERS='$(uniqify $NAMESERVERS)'"
-       echo "LOCALNAMESERVERS='$(uniqify $LOCALNAMESERVERS)'"
+       echo "SEARCH='$SEARCH'"
+       echo "NAMESERVERS='$NAMESERVERS'"
+       echo "LOCALNAMESERVERS='$LOCALNAMESERVERS'"
        echo "DOMAINS='$newdomains'"
 }
 



Home | Main Index | Thread Index | Old Index