From e855d2dda462f8cff9a1dd2e5005aaa084d6f708 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Oct 2006 01:47:16 +0000 Subject: [PATCH] change the way resolv.conf is being created, so that it also works when dnsmasq is not started SVN-Revision: 5305 --- openwrt/package/base-files/Makefile | 2 ++ openwrt/package/base-files/default/bin/firstboot | 1 - openwrt/package/base-files/default/etc/functions.sh | 6 +++--- openwrt/package/base-files/default/etc/init.d/S40network | 2 ++ openwrt/package/base-files/default/etc/resolv.conf | 2 -- .../base-files/default/usr/share/udhcpc/default.script | 2 +- openwrt/package/dnsmasq/files/S50dnsmasq | 9 ++++++++- openwrt/package/dnsmasq/files/dnsmasq.conf | 2 +- openwrt/package/ppp/Makefile | 2 +- 9 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 openwrt/package/base-files/default/etc/resolv.conf diff --git a/openwrt/package/base-files/Makefile b/openwrt/package/base-files/Makefile index 30e6cfef23..babe50ae61 100644 --- a/openwrt/package/base-files/Makefile +++ b/openwrt/package/base-files/Makefile @@ -51,6 +51,8 @@ $(IPKG_BASE): mkdir -p $(IDIR_BASE)/usr/bin mkdir -p $(IDIR_BASE)/www rm -f $(IDIR_BASE)/var + rm -f $(IDIR_BASE)/etc/resolv.conf + ln -sf /tmp/resolv.conf $(IDIR_BASE)/etc/resolv.conf ln -sf /tmp $(IDIR_BASE)/var -find $(IDIR_BASE) -type d -name CVS | xargs rm -rf -find $(IDIR_BASE) -type d -name .svn | xargs rm -rf diff --git a/openwrt/package/base-files/default/bin/firstboot b/openwrt/package/base-files/default/bin/firstboot index 02d941fe98..148bc995de 100755 --- a/openwrt/package/base-files/default/bin/firstboot +++ b/openwrt/package/base-files/default/bin/firstboot @@ -21,7 +21,6 @@ dupe() { # case "$file" in ./rom/note) ;; #nothing ./etc/config*|\ - ./etc/resolv.conf|\ ./usr/lib/ipkg/info/*) cp -af $2/$file $file;; *) ln -sf /rom/${file#./*} $file;; esac diff --git a/openwrt/package/base-files/default/etc/functions.sh b/openwrt/package/base-files/default/etc/functions.sh index 7a3ab6f23e..9fecccf7d4 100755 --- a/openwrt/package/base-files/default/etc/functions.sh +++ b/openwrt/package/base-files/default/etc/functions.sh @@ -60,10 +60,10 @@ do_ifup() { } done } - [ -f /tmp/resolv.conf ] || { - debug "# --- creating /tmp/resolv.conf ---" + [ -f /tmp/resolv.conf.auto ] || { + debug "# --- creating /tmp/resolv.conf.auto ---" for dns in $(nvram get ${2}_dns); do - echo "nameserver $dns" >> /tmp/resolv.conf + echo "nameserver $dns" >> /tmp/resolv.conf.auto done } diff --git a/openwrt/package/base-files/default/etc/init.d/S40network b/openwrt/package/base-files/default/etc/init.d/S40network index 2cae726359..751dae7206 100755 --- a/openwrt/package/base-files/default/etc/init.d/S40network +++ b/openwrt/package/base-files/default/etc/init.d/S40network @@ -1,6 +1,8 @@ #!/bin/sh case "$1" in start|restart) + rm -f /tmp/resolv.conf + ln -s /tmp/resolv.conf.auto /tmp/resolv.conf ifup_interfaces=$(nvram get ifup_interfaces) ifup_interfaces=${ifup_interfaces:-"lan wan wifi"} for iface in $ifup_interfaces; do diff --git a/openwrt/package/base-files/default/etc/resolv.conf b/openwrt/package/base-files/default/etc/resolv.conf deleted file mode 100644 index 9617eacda7..0000000000 --- a/openwrt/package/base-files/default/etc/resolv.conf +++ /dev/null @@ -1,2 +0,0 @@ -nameserver 127.0.0.1 -search lan diff --git a/openwrt/package/base-files/default/usr/share/udhcpc/default.script b/openwrt/package/base-files/default/usr/share/udhcpc/default.script index 20d306de4b..cd45644a05 100755 --- a/openwrt/package/base-files/default/usr/share/udhcpc/default.script +++ b/openwrt/package/base-files/default/usr/share/udhcpc/default.script @@ -1,7 +1,7 @@ #!/bin/sh [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 -RESOLV_CONF="/tmp/resolv.conf" +RESOLV_CONF="/tmp/resolv.conf.auto" hotplug_event() { nvram show 2>&- | grep _proto=dhcp | { diff --git a/openwrt/package/dnsmasq/files/S50dnsmasq b/openwrt/package/dnsmasq/files/S50dnsmasq index 1c47011d05..1699659ea6 100755 --- a/openwrt/package/dnsmasq/files/S50dnsmasq +++ b/openwrt/package/dnsmasq/files/S50dnsmasq @@ -30,4 +30,11 @@ udhcpc -n -q -R -s /bin/true -i $ifname >&- || { wanproto=$(nvram get wan_proto) [ -z "$wanproto" -o "$wanproto" = "none" ] || args="${args} -I $(nvram get wan_ifname)" -dnsmasq ${args} +dnsmasq ${args} && { + # use dnsmasq for local dns requests + rm -f /tmp/resolv.conf + cat > /tmp/resolv.conf <