name_servers is stripped of local host and then passed to subcribers.
authorRoy Marples <roy@marples.name>
Fri, 4 Dec 2009 21:07:51 +0000 (21:07 +0000)
committerRoy Marples <roy@marples.name>
Fri, 4 Dec 2009 21:07:51 +0000 (21:07 +0000)
This allows global DNS to be set, fixes #7.

resolvconf.conf.5.in
resolvconf.in

index dc4f9ab152307714f43076bc3d58cb6bbbe097a7..d380471a9f50351546e9be6127f072e52f049280 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 20, 2009
+.Dd December 04, 2009
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
@@ -56,6 +56,12 @@ If unset, defaults to the following:-
 These interfaces will be processed next, unless they have a metric.
 If unset, defaults to the following:-
 .D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*
+.It Sy search_domains
+Prepend search domains to the dynamically generated list.
+.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 private_interfaces
 These interfaces name servers will only be queried for the domains listed
 in their resolv.conf.
@@ -82,12 +88,6 @@ if not set.
 .It Sy resolv_conf_options
 A list of libc resolver options, as specified in
 .Xr resolv.conf 5 .
-.It Sy search_domains
-Prepend search domains to the dynamically generated list.
-.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 resolv_conf_passthrough
 When set to YES the latest resolv.conf is written to
 .Sy resolv_conf
index c0298b47ae587286b0fc96167341b83ab980c6cc..3184d0d49f42a2b1a799fbe37c18bf6e0d06630d 100644 (file)
@@ -104,8 +104,16 @@ parse_resolv()
        local new=true iface= private=false p=
 
        echo "DOMAINS="
-       echo "SEARCH="
-       echo "NAMESERVERS="
+       echo "SEARCH=\"$search_domains\""
+       # let our subscribers know about global nameservers
+       for n in $name_servers; do
+               case "$n" in
+               127.*|0.0.0.0|255.255.255.255|::1) continue;;
+               *) newns="$newns${newns:+ }$n"
+               esac
+       done
+       echo "NAMESERVERS=\"$newns\""
+       newns=
 
        while read line; do
                case "$line" in
@@ -130,7 +138,7 @@ parse_resolv()
                        ;;
                "nameserver "*)
                        case "${line#* }" in
-                       127.*|0.0.0.0|255.255.255.255) continue;;
+                       127.*|0.0.0.0|255.255.255.255|::1) continue;;
                        esac
                        ns="$ns${line#* } "
                        ;;