aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2000-01-31 22:24:10 +0000
committerNalin Dahyabhai <nalin@redhat.com>2000-01-31 22:24:10 +0000
commita84618ee572933ecd2958963a4e1e3ff1fc41082 (patch)
tree93a27de64b2837c8e9a813383353ee20b42d89d7 /sysconfig/network-scripts
parentd1eccdf7232e954803c3b5379f3a3a6eca5f3b01 (diff)
downloadinitscripts-a84618ee572933ecd2958963a4e1e3ff1fc41082.tar
initscripts-a84618ee572933ecd2958963a4e1e3ff1fc41082.tar.gz
initscripts-a84618ee572933ecd2958963a4e1e3ff1fc41082.tar.bz2
initscripts-a84618ee572933ecd2958963a4e1e3ff1fc41082.tar.xz
initscripts-a84618ee572933ecd2958963a4e1e3ff1fc41082.zip
* sysconfig/network-scripts/ifdown-post:
attempt to reset the default route in case we dropped it for PPP * src/ipcalc.1: document the "--silent" option * src/shvar.c: strtok() and other cleanups * rc.d/rc.sysinit: make symlinks for System.map and module-info automatically
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-xsysconfig/network-scripts/ifdown-post5
-rw-r--r--sysconfig/network-scripts/network-functions31
2 files changed, 36 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index 460b072c..49dfa5b4 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -8,6 +8,11 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
source_config
+# Reset the default route if this interface had a special one
+if ! check_default_route ; then
+ add_default_route
+fi
+
# Notify programs that have requested notification
do_netreport
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index feea9922..93ef3b40 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -59,3 +59,34 @@ check_device_down ()
return $retcode
}
+check_default_route ()
+{
+ return `/sbin/route -n|gawk 'BEGIN{r=1} $3=="0.0.0.1" && $4=="UG" {r=0} END{print r}'`
+}
+
+find_gateway_dev ()
+{
+ . /etc/sysconfig/network
+ if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ] ; then
+ export GATEWAY
+ networks=`/sbin/route -n|awk '{print $1, ENVIRON["GATEWAY"],$3,$8}'|awk '{system("ipcalc --silent --network "$2" "$3" 2>/dev/null")}'|sed s^NETWORK=^^g`
+ for net in $networks; do
+ dev=`/sbin/route -n|grep ^$net|awk '{print $NF}'`
+ if [ "$dev" != "" ] ; then
+ GATEWAYDEV=$dev
+ fi
+ done
+ fi
+}
+
+add_default_route ()
+{
+ . /etc/sysconfig/network
+ find_gateway_dev
+ if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" -a "${GATEWAYDEV}" != "" ] ; then
+ DEVICE=$GATEWAYDEV
+ if ! check_device_down ; then
+ /sbin/route add default gw ${GATEWAY} ${GATEWAYDEV}
+ fi
+ fi
+}