aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/net.hotplug
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-01-20 21:55:53 +0000
committerBill Nottingham <notting@redhat.com>2006-01-20 21:55:53 +0000
commitcbf94e7107655151dc138e3e22e05afe3234d959 (patch)
tree76c7b0389f9e9913982d8cd9d79e116c20cedfb4 /sysconfig/network-scripts/net.hotplug
parentb7e210969a9f0aedda2a7c1a29ec92618887d116 (diff)
downloadinitscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.gz
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.bz2
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.xz
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.zip
move hotplug handling here. add udev rules. obsolete hotplug.
Diffstat (limited to 'sysconfig/network-scripts/net.hotplug')
-rwxr-xr-xsysconfig/network-scripts/net.hotplug55
1 files changed, 55 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/net.hotplug b/sysconfig/network-scripts/net.hotplug
new file mode 100755
index 00000000..b59d87e4
--- /dev/null
+++ b/sysconfig/network-scripts/net.hotplug
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+. /etc/sysconfig/network-scripts/network-functions
+
+if [ "$INTERFACE" = "" ]; then
+ exit 1
+fi
+
+case $ACTION in
+add|register)
+ # Don't do anything if the network is stopped
+ if [ ! -f /var/lock/subsys/network ]; then
+ exit 0
+ fi
+
+ case $INTERFACE in
+ # interfaces that are registered after being "up" (?)
+ ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+ exit 0
+ ;;
+ # interfaces that are registered then brought up
+ *)
+ export IN_HOTPLUG=1
+ if [ -x /sbin/ifup ]; then
+ addr=$(get_hwaddr ${INTERFACE})
+ if [ -n "$addr" ]; then
+ nconfig=$(get_config_by_hwaddr ${addr})
+ [ -n "$nconfig" ] && INTERFACE=$nconfig
+ fi
+ exec /sbin/ifup $INTERFACE
+ fi
+ ;;
+ esac
+ ;;
+
+remove|unregister)
+ case $INTERFACE in
+ # interfaces that are unregistered after being "down" (?)
+ ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+ exit 0
+ ;;
+ *)
+ # RedHat and similar
+ export IN_HOTPLUG=1
+ if [ -x /sbin/ifdown ]; then
+ exec /sbin/ifdown $INTERFACE
+ fi
+ ;;
+ esac
+ ;;
+
+*)
+ exit 1 ;;
+
+esac