diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-23 08:35:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-23 08:35:50 +0000 |
commit | 41838f4585e366aefad4323e73278a4c0418a9e6 (patch) | |
tree | 7758a39cc6b69246ee0098d0c4dfe880a1ed131b /package/base-files/files/lib | |
parent | 896847d18c86fe4217ce83d103d51750e606c087 (diff) | |
download | mtk-20170518-41838f4585e366aefad4323e73278a4c0418a9e6.zip mtk-20170518-41838f4585e366aefad4323e73278a4c0418a9e6.tar.gz mtk-20170518-41838f4585e366aefad4323e73278a4c0418a9e6.tar.bz2 |
base-files: make ip matching in dns add/remove functions more explicit, avoids overmatching pairs like 1.2.3.35 and 1.2.3.3
SVN-Revision: 28291
Diffstat (limited to 'package/base-files/files/lib')
-rwxr-xr-x | package/base-files/files/lib/network/config.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh index 5b349a7..00e372a 100755 --- a/package/base-files/files/lib/network/config.sh +++ b/package/base-files/files/lib/network/config.sh @@ -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 } |