resolv_conf_passthrough makes the latest interface resolv.conf the real resolv.conf
authorRoy Marples <roy@marples.name>
Thu, 26 Mar 2009 00:58:12 +0000 (00:58 +0000)
committerRoy Marples <roy@marples.name>
Thu, 26 Mar 2009 00:58:12 +0000 (00:58 +0000)
libc.in
resolvconf.conf.5.in

diff --git a/libc.in b/libc.in
index efa8d940a483450cc883079852a5227ca658453e..db5d2a13243e74f8b8508429d7ef2d63cc782857 100644 (file)
--- a/libc.in
+++ b/libc.in
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="${RESOLVCONF:-resolvconf}"
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="${RESOLVCONF:-resolvconf}"
-eval "$(${RESOLVCONF} -v)"
-
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
+VARBASE=@VARBASE@
+IFACEDIR="${VARBASE}/run/resolvconf/interfaces"
 
 # sed may not be available, and this is faster on small files
 key_get_value()
 
 # sed may not be available, and this is faster on small files
 key_get_value()
@@ -92,33 +92,48 @@ done
 echo "${result# *}"
 }
 
 echo "${result# *}"
 }
 
-newsearch="$(uniqify ${search_domains} ${SEARCH})"
-newns="$(uniqify ${name_servers} ${NAMESERVERS})"
-
-# Hold our new resolv.conf in a variable to save on temporary files
-newconf="# Generated by resolvconf\n"
-if [ -n "${resolv_conf_head}" ]; then
-       newconf="${newconf}${resolv_conf_head}\n"
-fi
-[ -n "${newsearch}" ] && newconf="${newconf}search ${newsearch}\n"
-for n in ${newns}; do
-       newconf="${newconf}nameserver ${n}\n"
-done
-
-# Now get any configured options
-opts="${resolv_conf_options}${resolv_conf_options:+ }"
-opts="${opts}$(${RESOLVCONF} -l | key_get_value "options ")"
-if [ -n "${opts}" ]; then
-       newconf="${newconf}options"
-       for opt in $(uniqify ${opts}); do
-               newconf="${newconf} ${opt}"
+case "${resolv_conf_passthrough:-NO}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+       newest=
+       for conf in "${IFACEDIR}"/*; do
+               if [ -z "${newest}" -o "${conf}" -nt "${newest}" ]; then
+                       newest="${conf}"
+               fi
+       done
+       [ -z "${newest}" ] && exit 0
+       newconf="$(cat "${newest}")\n"
+       ;;
+*)
+       eval "$(${RESOLVCONF} -v)"
+       newsearch="$(uniqify ${search_domains} ${SEARCH})"
+       newns="$(uniqify ${name_servers} ${NAMESERVERS})"
+
+       # Hold our new resolv.conf in a variable to save on temporary files
+       newconf="# Generated by resolvconf\n"
+       if [ -n "${resolv_conf_head}" ]; then
+               newconf="${newconf}${resolv_conf_head}\n"
+       fi
+       [ -n "${newsearch}" ] && newconf="${newconf}search ${newsearch}\n"
+       for n in ${newns}; do
+               newconf="${newconf}nameserver ${n}\n"
        done
        done
-       newconf="${newconf}\n"
-fi
 
 
-if [ -n "{resolv_conf_tail}" ]; then
-       newconf="${newconf}${resolv_conf_tail}\n"
-fi
+       # Now get any configured options
+       opts="${resolv_conf_options}${resolv_conf_options:+ }"
+       opts="${opts}$(${RESOLVCONF} -l | key_get_value "options ")"
+       if [ -n "${opts}" ]; then
+               newconf="${newconf}options"
+               for opt in $(uniqify ${opts}); do
+                       newconf="${newconf} ${opt}"
+               done
+               newconf="${newconf}\n"
+       fi
+
+       if [ -n "{resolv_conf_tail}" ]; then
+               newconf="${newconf}${resolv_conf_tail}\n"
+       fi
+       ;;
+esac
 
 # Check if the file has actually changed or not
 if [ -e "${resolv_conf}" ]; then
 
 # Check if the file has actually changed or not
 if [ -e "${resolv_conf}" ]; then
@@ -128,7 +143,7 @@ fi
 # Create our resolv.conf now
 (umask 022; printf "${newconf}" > "${resolv_conf}")
 
 # Create our resolv.conf now
 (umask 022; printf "${newconf}" > "${resolv_conf}")
 
-resolvconf -s nscd restart
+${RESOLVCONF} -s nscd restart
 retval=$?
 
 # Notify users of the resolver
 retval=$?
 
 # Notify users of the resolver
index fc4bde5295dedb5e12841cdfc185ea78df927104..f26a58bdc94a540b1a40c894fc3c3c5eb320acfa 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 19, 2009
+.Dd March 26, 2009
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
@@ -68,6 +68,10 @@ Prepend search domains to the dynamically generated list.
 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.
 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
+without any alteration.
 .El
 .Sh SUBSCRIBER OPTIONS
 openresolv ships with subscribers for the name servers
 .El
 .Sh SUBSCRIBER OPTIONS
 openresolv ships with subscribers for the name servers