Make resolvconf_passthrough NULL work a bit better.
authorRoy Marples <roy@marples.name>
Mon, 20 Oct 2014 08:35:22 +0000 (08:35 +0000)
committerRoy Marples <roy@marples.name>
Mon, 20 Oct 2014 08:35:22 +0000 (08:35 +0000)
libc.in
resolvconf.conf.5.in
resolvconf.in

diff --git a/libc.in b/libc.in
index c951285a42acd4e9467a8355fff4e3f9b4ff1c85..09c81baa49f2ab0db2ca35f6f7c41292cd6e2e44 100644 (file)
--- a/libc.in
+++ b/libc.in
@@ -72,6 +72,8 @@ keys_remove()
        done
 }
 
+local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1"
+
 # Support original resolvconf configuration layout
 # as well as the openresolv config file
 if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
@@ -93,12 +95,10 @@ elif [ -d "$SYSCONFDIR"/resolvconf ]; then
                resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.d/tail)"
        fi
 fi
-: ${domain:=$DOMAIN}
 : ${resolv_conf:=/etc/resolv.conf}
 : ${libc_service:=nscd}
 : ${libc_restart:=@RESTARTCMD ${libc_service}@}
 : ${list_resolv:=@SBINDIR@/resolvconf -l}
-: ${local_nameservers:=127.* 0.0.0.0 255.255.255.255 ::1}
 if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then
        resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"
 fi
@@ -131,7 +131,12 @@ case "${resolv_conf_passthrough:-NO}" in
        newconf="$(cat "$newest")$NL"
        ;;
 /dev/null|[Nn][Uu][Ll][Ll])
-       [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -V)"
+       : ${resolv_conf_local_only:=NO}
+       if [ "$local_nameservers" = "127.* 0.0.0.0 255.255.255.255 ::1" ]; then
+               local_nameservers=
+       fi
+       # Need to overwrite our variables.
+       eval "$(@SBINDIR@/resolvconf -V)"
        ;;
 
 *)
@@ -141,6 +146,7 @@ esac
 case "${resolv_conf_passthrough:-NO}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) ;;
 *)
+       : ${domain:=$DOMAIN}
        newsearch="$(uniqify $prepend_search $SEARCH)"
        NS="$LOCALNAMESERVERS $NAMESERVERS"
        newns=
index ec0a0f9326bcb46b723577e456d041deba0c1d00..d184e36099e5f95a41ae1b3a427ad72bda9cc858 100644 (file)
@@ -114,7 +114,11 @@ A list of libc resolver options, as specified in
 When set to YES the latest resolv.conf is written to
 .Sy resolv_conf
 without any alteration.
-When set to /dev/null or NULL only the information set in
+When set to /dev/null or NULL,
+.Sy resolv_conf_local_only
+is defaulted to NO,
+.Sy local_nameservers
+is unset unless overriden and only the information set in
 .Nm
 is written to
 .Sy resolv_conf .
index 7d5da4c0741efaa137c27289bbe5ea3bdd698629..1faf2b81f32954e671da8e7a74aaa81afbd3f1e1 100644 (file)
@@ -32,7 +32,9 @@ VARDIR=@VARDIR@
 # Disregard dhcpcd setting
 unset interface_order state_dir
 
+# If you change this, change the test in VFLAG and libc.in as well
 local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1"
+
 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"
@@ -422,7 +424,14 @@ while getopts a:Dd:fhIilm:puvV OPT; do
        h) usage;;
        m) IF_METRIC="$OPTARG";;
        p) IF_PRIVATE=1;;
-       V) VFLAG=1;;
+       V)
+               VFLAG=1
+               if [ "$local_nameservers" = \
+                   "127.* 0.0.0.0 255.255.255.255 ::1" ]
+               then
+                       local_nameservers=
+               fi
+               ;;
        '?') ;;
        *) cmd="$OPT"; iface="$OPTARG";;
        esac