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.0 with the ...
details: https://anonhg.NetBSD.org/src/rev/d3063471b9a8
branches: ROY
changeset: 454308:d3063471b9a8
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.conf.5.in | 21 +++++++-
external/bsd/openresolv/dist/resolvconf.in | 55 +++++++++++++++++++---
5 files changed, 81 insertions(+), 20 deletions(-)
diffs (254 lines):
diff -r 06adf7ef7a85 -r d3063471b9a8 external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in Tue Jan 31 09:19:58 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 06adf7ef7a85 -r d3063471b9a8 external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in Tue Jan 31 09:19:58 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 06adf7ef7a85 -r d3063471b9a8 external/bsd/openresolv/dist/resolvconf.8.in
--- a/external/bsd/openresolv/dist/resolvconf.8.in Tue Jan 31 09:19:58 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 06adf7ef7a85 -r d3063471b9a8 external/bsd/openresolv/dist/resolvconf.conf.5.in
--- a/external/bsd/openresolv/dist/resolvconf.conf.5.in Tue Jan 31 09:19:58 2012 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.conf.5.in Mon Mar 26 14:41:33 2012 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2011 Roy Marples
+.\" Copyright (c) 2009-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 August 11, 2011
+.Dd March 19, 2012
.Dt RESOLVCONF.CONF 5 SMM
.Os
.Sh NAME
@@ -60,12 +60,20 @@
Prepend search domains to the dynamically generated list.
.It Sy search_domains_append
Append search domains to the dynamically generated list.
+.It Sy domain_blacklist
+A list of domains to be removed from consideration.
+To remove a domain, you can use foo.*
+To remove a sub domain, you can use *.bar
.It Sy name_servers
Prepend name servers to the dynamically generated list.
You should set this to 127.0.0.1 if you use a local name server other than
libc.
.It Sy name_servers_append
Append name servers to the dynamically generated list.
+.It Sy name_server_blacklist
+A list of name servers to be removed from consideration.
+The default is 0.0.0.0 as some faulty routers send it via DHCP.
+To remove a block, you can use 192.168.*
.It Sy private_interfaces
These interfaces name servers will only be queried for the domains listed
in their resolv.conf.
@@ -99,6 +107,12 @@
.It Sy resolv_conf_sortlist
A libc resolver sortlist, as specified in
.Xr resolv.conf 5 .
+.It Sy resolv_conf_local_only
+If a local nameserver is configured then the default is just to specify that
+and ignore all other entries as they will be configured for the local
+nameserver.
+Set this to YES to list them instead, if you need working DNS and the local
+nameserver stops functioning at the expense of duplicated server queries.
.El
.Sh SUBSCRIBER OPTIONS
openresolv ships with subscribers for the name servers
@@ -187,4 +201,5 @@
.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
diff -r 06adf7ef7a85 -r d3063471b9a8 external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in Tue Jan 31 09:19:58 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