summaryrefslogtreecommitdiff
path: root/scripts/vyatta-system-nameservers
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-02-14 10:36:55 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-02-14 10:36:55 +0000
commit24c99255b867e48ae3369a23f866951e8607fbbe (patch)
tree0f934bcc88f33214b269df8a440eb92ea8374b6e /scripts/vyatta-system-nameservers
parent93a49639c983e8f61ca942efe68ede46053ea03a (diff)
downloadvyatta-cfg-system-24c99255b867e48ae3369a23f866951e8607fbbe.tar.gz
vyatta-cfg-system-24c99255b867e48ae3369a23f866951e8607fbbe.zip
vyatta-cfg-system: redesign the layout and updating of /etc/resolv.conf
Following the documentation, /etc/resolv.conf should only have comments inserted that start with # at the beginning of a line, comments in other locations are not supported. The exisiting method of tracking changes in this file (done by both vyatta-system-nameservers and vyatta_update_resolv.pl) relies on this unsupported feature. This commit restructures the updates so they use comments on the preceding line to track changes, along with updating the old style comments to the new ones when the relevant scripts are called. This also fixes a previous issue (which was reverted) where IPv6 nameservers worked incorrectly when the /etc/resolv.conf line ended with a comment. Bug #486 http://bugzilla.vyos.net/show_bug.cgi?id=486
Diffstat (limited to 'scripts/vyatta-system-nameservers')
-rwxr-xr-xscripts/vyatta-system-nameservers2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/vyatta-system-nameservers b/scripts/vyatta-system-nameservers
index 74f2c8b6..7b66cf77 100755
--- a/scripts/vyatta-system-nameservers
+++ b/scripts/vyatta-system-nameservers
@@ -53,7 +53,7 @@ update_system_nameservers () {
# find last instance of cli inserted nameserver
# insert currently received nameserver immediately after that
# this is done to keep system set nameservers priority over dhcp received nameservers
- cli_ns_array=($(awk '{if (!$3) print $2}' /etc/resolv.conf))
+ cli_ns_array=($(awk '{if (/(dhcp)/) exit 0; if (!$3) print $2}' /etc/resolv.conf))
cli_ns_array_len=${#cli_ns_array[*]}
line_num=0
if [ $cli_ns_array_len -gt 0 ]; then