aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions33
1 files changed, 33 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index d7915e31..9d6f9366 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -448,6 +448,10 @@ set_hostname ()
rsctmp=$(mktemp /tmp/XXXXXX);
cat /etc/resolv.conf > $rsctmp
echo "search $domain" >> $rsctmp
+
+ # Backup resolv.conf only if it doesn't exist already:
+ ! [ -f /etc/resolv.conf.save ] && cp -af /etc/resolv.conf /etc/resolv.conf.save
+
change_resolv_conf $rsctmp
/bin/rm -f $rsctmp
fi
@@ -697,3 +701,32 @@ net_log()
fi
return 0
}
+
+update_DNS_entries()
+{
+ # Remove duplicate values from DNS options if any:
+ if [ -n "${DNS3}" ] && [[ "${DNS3}" == "${DNS2}" || "${DNS3}" == "${DNS1}" ]]; then
+ unset DNS3
+ fi
+
+ if [ -n "${DNS2}" ] && [[ "${DNS2}" == "${DNS1}" ]]; then
+ unset DNS2
+ fi
+
+ # Shift the DNS options if necessary:
+ if [ -z "${DNS1}" ] && [ -n "${DNS2}" ]; then
+ DNS1="${DNS2}"
+ unset DNS2
+ fi
+
+ if [ -z "${DNS2}" ] && [ -n "${DNS3}" ]; then
+ DNS2="${DNS3}"
+ unset DNS3
+ fi
+
+ # We need to check DNS1 again in case only DNS3 was set at all:
+ if [ -z "${DNS1}" ] && [ -n "${DNS2}" ]; then
+ DNS1="${DNS2}"
+ unset DNS2
+ fi
+}