aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-post
diff options
context:
space:
mode:
authorMichael K. Johnson <johnsonm@redhat.com>1999-08-04 23:52:11 +0000
committerMichael K. Johnson <johnsonm@redhat.com>1999-08-04 23:52:11 +0000
commitbc662c04ae3f3a7d441a22bb5ca57c14dd57e81e (patch)
treeb3b55fc4e4262f34f9ce4578df2291bfb80c359d /sysconfig/network-scripts/ifup-post
parentda1e21b54543316fb1e9e83fb6049762f0d4c611 (diff)
downloadinitscripts-bc662c04ae3f3a7d441a22bb5ca57c14dd57e81e.tar
initscripts-bc662c04ae3f3a7d441a22bb5ca57c14dd57e81e.tar.gz
initscripts-bc662c04ae3f3a7d441a22bb5ca57c14dd57e81e.tar.bz2
initscripts-bc662c04ae3f3a7d441a22bb5ca57c14dd57e81e.tar.xz
initscripts-bc662c04ae3f3a7d441a22bb5ca57c14dd57e81e.zip
take advantage of userpeerdns
Diffstat (limited to 'sysconfig/network-scripts/ifup-post')
-rwxr-xr-xsysconfig/network-scripts/ifup-post31
1 files changed, 31 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 6ddf2167..cd5b0267 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -28,6 +28,37 @@ if [ -n "$NEEDHOSTNAME" -a "${DEVICE}" != lo -a "${DEVICETYPE}" != "ppp" -a "${D
eval `/bin/ipcalc --silent --hostname ${IPADDR}` && set_hostname $HOSTNAME
fi
+if [ "$DEVICETYPE" = ppp -a "$PEERDNS" = yes -a -n "$DNS1" ] &&
+ tr=`mktemp /tmp/resolv.XXXXXX` ; then
+ # replace only the first two nameserver lines; cannot count on awk
+ # and do not know if sed is capable of this...
+ current_replacement="$DNS1"
+ next_replacement="$DNS2"
+ while read answer < /etc/resolv.conf ; do
+ case $answer in
+ nameserver*)
+ if [ -n "$current_replacement" ] ; then
+ echo "nameserver $current_replacement" >> $tr
+ if [ -n "$next_replacement" ] ; then
+ current_replacement="$next_replacement"
+ next_replacement=
+ else
+ current_replacement=
+ fi
+ else
+ echo "$answer" >> $tr
+ fi
+ ;;
+ *)
+ echo "$answer" >> $tr
+ ;;
+ esac
+ done
+ # maintain permissions
+ cat $tr > /etc/resolv.conf
+ rm -f $tr
+fi
+
# Notify programs that have requested notification
do_netreport