aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/usr/share
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-05-30 18:23:43 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-05-30 18:23:43 +0000
commit261d41a906a8afa3d8167b091ac0b891217d8251 (patch)
treee2da46ae42921bccb65adebaf3569af27c2e93fc /package/base-files/files/usr/share
parent44062d09b444adeb4a481954efc43c22ebdbc65a (diff)
downloadupstream-261d41a906a8afa3d8167b091ac0b891217d8251.tar.gz
upstream-261d41a906a8afa3d8167b091ac0b891217d8251.tar.bz2
upstream-261d41a906a8afa3d8167b091ac0b891217d8251.zip
base-files: - use add_dns() and remove_dns() for when changing resolv.conf.auto for static or dhcp interfaces - force 0644 permissions when creating resolv.conf.auto, fixes dnsmasq permissions denied problem with pppd interfaces - revert dns servers in /sbin/ifdown - bump package revision
SVN-Revision: 21638
Diffstat (limited to 'package/base-files/files/usr/share')
-rwxr-xr-xpackage/base-files/files/usr/share/udhcpc/default.script22
1 files changed, 11 insertions, 11 deletions
diff --git a/package/base-files/files/usr/share/udhcpc/default.script b/package/base-files/files/usr/share/udhcpc/default.script
index ceabf4bf3a..39527778ad 100755
--- a/package/base-files/files/usr/share/udhcpc/default.script
+++ b/package/base-files/files/usr/share/udhcpc/default.script
@@ -139,21 +139,21 @@ setup_interface () {
}
# DNS
- config_get old_dns "$ifc" dns
+ old_dns=$(uci_get_state network "$ifc" dns)
+ old_domain=$(uci_get_state network "$ifc" dnsdomain)
user_dns=$(uci_get "network.$ifc.dns")
[ -n "$user_dns" ] && dns="$user_dns"
- [ -n "$dns" ] && [ ! -s "${RESOLV_CONF}" -o "$dns" != "$old_dns" ] && {
+ [ -n "$dns" ] && [ "$dns" != "$old_dns" -o -n "$user_dns" ] && {
echo "udhcpc: setting dns servers: $dns"
- echo -n > "${RESOLV_CONF}.tmp"
- for i in $dns ; do
- echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
- done
- ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
- mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
-
- change_state network "$ifc" dnsdomain "$domain"
- change_state network "$ifc" dns "$dns"
+ add_dns "$ifc" $dns
+
+ [ -n "$domain" ] && [ "$domain" != "$old_domain" ] && {
+ echo "udhcpc: setting dns domain: $domain"
+ sed -i -e "${old_domain:+/^search $old_domain$/d; }/^search $domain$/d" "${RESOLV_CONF}"
+ echo "search $domain" >> "${RESOLV_CONF}"
+ change_state network "$ifc" dnsdomain "$domain"
+ }
}
[ -n "$ifc" ] || return