aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-aliases
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-11-22 20:47:09 +0000
committerBill Nottingham <notting@redhat.com>1999-11-22 20:47:09 +0000
commitbac3ac51227d183c04bf1890af2319fb40534996 (patch)
treede79e23e65f3e3c636e775e7b3577c807dedc6e9 /sysconfig/network-scripts/ifup-aliases
parent1ad4742b29620f1a46a990cff40a4f06d5e3e5f4 (diff)
downloadinitscripts-bac3ac51227d183c04bf1890af2319fb40534996.tar
initscripts-bac3ac51227d183c04bf1890af2319fb40534996.tar.gz
initscripts-bac3ac51227d183c04bf1890af2319fb40534996.tar.bz2
initscripts-bac3ac51227d183c04bf1890af2319fb40534996.tar.xz
initscripts-bac3ac51227d183c04bf1890af2319fb40534996.zip
*** empty log message ***
Diffstat (limited to 'sysconfig/network-scripts/ifup-aliases')
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases79
1 files changed, 33 insertions, 46 deletions
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index 48680b2b..f65d5956 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -289,51 +289,38 @@ function new_interface ()
if [ "$BASH_VERSINFO" ]; then shopt -s nullglob; else allow_null_glob_expansion=foo; fi
-# This is for linuxconf-style alias files.
-aliasnum=0
+# Is there any linuxconf-style alias files.
+linuxconfstyle=0
for FILE in ifcfg-${parent_device}:* ; do
ini_env;
. $FILE;
if [ -z "$DEVICE" ]; then
- # Eek, it's a linuxconf file.
-
- for address in $IPADDR; do
- if echo $address | grep -q '-' ; then
- IPADDR_START=${address%-*}
- ipaddr_prefix=${IPADDR_START%.*}
- ipaddr_startnum=${IPADDR_START##*.}
- IPADDR_END="${ipaddr_prefix}.${address##*-}"
- ipaddr_endnum=${IPADDR_END##*.}
-
- if [ "${IPADDR_START%.*}" != "${IPADDR_END%.*}" ]; then
- echo "error in $FILE: IPADDR_START and IPADDR_END don't argree" >&2; exit 0
- fi
-
- if [ $ipaddr_startnum -gt $ipaddr_endnum ]; then
- echo "error in $FILE: IPADDR_START greater than IPADDR_END" >&2; exit 0
- fi
-
- ipaddr_num=$ipaddr_startnum
-
- while [ $ipaddr_num -le $ipaddr_endnum ]; do
- IPADDR="$ipaddr_prefix.$ipaddr_num"
- DEVICE="$parent_device:$aliasnum"
- new_interface;
- let 'ipaddr_num=ipaddr_num+1'
- let 'aliasnum=aliasnum+1'
- done
- else
- DEVICE="${parent_device}:${aliasnum}"
- IPADDR=$address
- new_interface;
- let 'aliasnum=aliasnum+1'
- fi
- done
+ # it's a linuxconf file.
+ # I don't think this script will handle both style correctly
+ # though. Well, those who knows about the other style don't know
+ # the other style and vice versa
+ linuxconfstyle=1
else
new_interface;
fi
done
+if [ "$linuxconfstyle" = "1" ] ; then
+ linuxconf --hint ipalias $device \
+ | while read command ali ip mask bcast
+ do
+ if [ "$command" = "del" ] ; then
+ /sbin/ifconfig $ali down
+ do_netreport=yes
+ elif [ "$command" = "add" ] ; then
+ /sbin/ifconfig $ali $ip netmask $mask broadcast $bcast
+ do_netreport=yes
+ else
+ echo Incomatible hinting: $command $rest >&2
+ fi
+ done
+fi
+
for FILE in ifcfg-${parent_device}-range* ; do
@@ -368,16 +355,16 @@ done
#
# Remove any devices that should not be around
#
-
-for DEVNUM in $rdev_LIST ; do
- eval " rdev_mark=\$rdev_${DEVNUM}_mark ";
- if [ -z "$rdev_mark" ]; then
-##echo "removing device $parent_device:${DEVNUM} (lingering)"
- /sbin/ifconfig $parent_device:${DEVNUM} down
- do_netreport=yes
- fi
-done
-
+if [ "$linuxconfstyle" = "0" ] ; then
+ for DEVNUM in $rdev_LIST ; do
+ eval " rdev_mark=\$rdev_${DEVNUM}_mark ";
+ if [ -z "$rdev_mark" ]; then
+ ##echo "removing device $parent_device:${DEVNUM} (lingering)"
+ /sbin/ifconfig $parent_device:${DEVNUM} down
+ do_netreport=yes
+ fi
+ done
+fi
#
# Notify of new device creation
#