#
# probe: true
-# $Id: network,v 1.34.2.5 2000/11/06 16:26:04 baggins Exp $
+# $Id: network,v 1.34.2.6 2001/09/30 10:19:38 misiek Exp $
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# Source function library.
. /etc/rc.d/init.d/functions
-. /etc/sysconfig/network-scripts/.functions
+. /etc/sysconfig/network-scripts/functions.network
if [ ! -f /etc/sysconfig/network ]; then
nls "%s is missing. Can't continue." "/etc/sysconfig/network"
network_init()
{
# Kernel network parameters
-run_cmd "Setting network parameters" sysctl -p /etc/sysctl.conf
+run_cmd "Setting kernel network parameters" sysctl -p /etc/sysctl.conf
# Set UP loopback interface
set_up_loopback
network_postinit()
{
+# Set static RARP table
+static_rarp
+
# Set static ARP table
static_arp
-
}
######
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
interfaces=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
- egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
- awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
+ egrep -v '(ifcfg-lo|:)' | \
+ LANG=C LC_ALL=C egrep 'ifcfg-[a-z0-9]+(\.[0-9]+|)$' | \
+ awk ' { gsub(/ifcfg-/,NIL); print $0 } ' | xargs ) 2> /dev/null)
interfaces_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
- egrep -v '(ifcfg-lo|ifcfg-sit|ifcfg-atm|ifcfg-lec|:)' | egrep 'ifcfg-[a-z0-9]+$' | \
+ egrep -v '(ifcfg-lo|ifcfg-sit|ifcfg-atm|ifcfg-lec|:)' | \
+ LANG=C LC_ALL=C egrep 'ifcfg-[a-z0-9]+$' | \
+ xargs egrep -l "ONBOOT=[^n][^o]" | \
+ awk ' { gsub(/ifcfg-/,NIL); print $0 } ' | xargs ) 2> /dev/null)
+interfaces_vlan_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg-*.* | \
+ LANG=C LC_ALL=C egrep 'ifcfg-[a-z0-9]+\.[0-9]+$' | \
xargs egrep -l "ONBOOT=[^n][^o]" | \
- awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
+ awk ' { gsub(/ifcfg-/,NIL); print $0 } ' | xargs ) 2> /dev/null)
interfaces_sit_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg-sit* | \
- egrep 'ifcfg-[a-z0-9]+$' | xargs egrep -l "ONBOOT=[^n][^o]" | \
- awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
+ LANG=C LC_ALL=C egrep 'ifcfg-[a-z0-9]+$' | \
+ xargs egrep -l "ONBOOT=[^n][^o]" | \
+ awk ' { gsub(/ifcfg-/,NIL); print $0 } ' | xargs ) 2> /dev/null)
tunnels=$((cd /etc/sysconfig/interfaces && ls -1 tnlcfg-* | \
xargs egrep -l "ONBOOT=[^n][^o]" | \
- awk ' { gsub(/tnlcfg-/,NIL); print $0 } ') 2> /dev/null)
+ awk ' { gsub(/tnlcfg-/,NIL); print $0 } ' | xargs) 2> /dev/null)
# See how we were called.
case "$1" in
start)
network_init
- for i in $interfaces_boot $interfaces_sit_boot ; do
+ for i in $interfaces_boot $interfaces_vlan_boot $interfaces_sit_boot ; do
run_cmd -a "$(nls "Bringing up interface") $i" /sbin/ifup $i boot
done
stop)
# If we go to runlevel 0, 1 or 6 then umount all network fs
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
- if [ -x /etc/rc.d/init.d/netfs -a -f /var/lock/subsys/netfs ];
- then
- /etc/rc.d/init.d/netfs stop
- else
- netmtab=$(awk '{ if ($3 ~ /^(nfs|smbfs|ncpfs)$/ ) print $3}' /proc/mounts)
- if (echo "$netmtab" | grep -q nfs); then
- run_cmd "Unmounting NFS filesystems" umount -fat nfs
- fi
- if (echo "$netmtab" | grep -q smbfs); then
- run_cmd "Unmounting SMB filesystems" umount -at smbfs
- fi
- if (echo "$netmtab" | grep -q ncpfs); then
- run_cmd "Unmounting NCP filesystems" umount -at ncpfs
- fi
+ netmtab=$(awk '{ if ($3 ~ /^(nfs|smbfs|ncpfs)$/ ) print $3}' /proc/mounts)
+ if (echo "$netmtab" | grep -q nfs); then
+ run_cmd "Unmounting NFS filesystems" umount -fat nfs
+ fi
+ if (echo "$netmtab" | grep -q smbfs); then
+ run_cmd "Unmounting SMB filesystems" umount -at smbfs
+ fi
+ if (echo "$netmtab" | grep -q ncpfs); then
+ run_cmd "Unmounting NCP filesystems" umount -at ncpfs
fi
fi
run_cmd -a "$(nls "Shutting down interface from LDAP") $i" /sbin/ifdown $i boot
done
- for i in $interfaces_sit_boot $interfaces_boot ; do
+ for i in $interfaces_sit_boot $interfaces_vlan_boot $interfaces_boot ; do
run_cmd -a "$(nls "Shutting down interface") $i" /sbin/ifdown $i boot
done
- for i in $(ip link show | awk -F":" ' (/UP/) && ($2 !~ "lo") { gsub(/@.*/,NIL); print $2; } ') ; do
- show "Shutting down unconfigured interface %s" "$i"
- ip addr flush dev $i 2>&1 | grep -v "Nothing to flush"
- if (ip link set $i down); then ok; else fail; fi
- done
-
network_deinit
rm -f /var/lock/subsys/network