base-files: make ip matching in dns add/remove functions more explicit, avoids overma...
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 23 Sep 2011 08:35:50 +0000 (08:35 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 23 Sep 2011 08:35:50 +0000 (08:35 +0000)
SVN-Revision: 28291

package/base-files/Makefile
package/base-files/files/lib/network/config.sh

index bae3c79e250627c830ac3cda3ce85b1ae3adc687..775126aa5315d463051fdd89f8fa75c6caafbd44 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=79
+PKG_RELEASE:=80
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host
index 5b349a7387b6f4295caccad57f58d098f90a87f0..00e372a1f3a0c8052e529da237fc5b4fe4665e0c 100755 (executable)
@@ -106,7 +106,7 @@ add_dns() {
        local dns
        local add
        for dns in "$@"; do
-               grep -qsF "nameserver $dns" /tmp/resolv.conf.auto || {
+               grep -qsE "^nameserver ${dns//./\\.}$" /tmp/resolv.conf.auto || {
                        add="${add:+$add }$dns"
                        echo "nameserver $dns" >> /tmp/resolv.conf.auto
                }
@@ -126,7 +126,7 @@ remove_dns() {
                [ -f /tmp/resolv.conf.auto ] && {
                        local dns=$(uci_get_state network "$cfg" resolv_dns)
                        for dns in $dns; do
-                               sed -i -e "/^nameserver $dns$/d" /tmp/resolv.conf.auto
+                               sed -i -e "/^nameserver ${dns//./\\.}$/d" /tmp/resolv.conf.auto
                        done
                }