aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-aliases
diff options
context:
space:
mode:
authorMiloslav Trmac <mitr@volny.cz>2006-02-10 01:45:34 +0000
committerMiloslav Trmac <mitr@volny.cz>2006-02-10 01:45:34 +0000
commit858506a7cab3cfc3cc98072ef75ec80ada55bcc2 (patch)
tree9852ef2ad79e783d1af2c5e58c34bebca786e25e /sysconfig/network-scripts/ifdown-aliases
parent24d9e8bb5fbc56104873174b5c13095954fc6eb1 (diff)
downloadinitscripts-858506a7cab3cfc3cc98072ef75ec80ada55bcc2.tar
initscripts-858506a7cab3cfc3cc98072ef75ec80ada55bcc2.tar.gz
initscripts-858506a7cab3cfc3cc98072ef75ec80ada55bcc2.tar.bz2
initscripts-858506a7cab3cfc3cc98072ef75ec80ada55bcc2.tar.xz
initscripts-858506a7cab3cfc3cc98072ef75ec80ada55bcc2.zip
ifup-aliases:
- Revert the previous commit - Reformat the eval of doom, add comments - Add support for non-numeric IP aliases ifdown-aliases: - Copy the updated eval of doom
Diffstat (limited to 'sysconfig/network-scripts/ifdown-aliases')
-rwxr-xr-xsysconfig/network-scripts/ifdown-aliases24
1 files changed, 23 insertions, 1 deletions
diff --git a/sysconfig/network-scripts/ifdown-aliases b/sysconfig/network-scripts/ifdown-aliases
index 34d70f1f..6a310cc7 100755
--- a/sysconfig/network-scripts/ifdown-aliases
+++ b/sysconfig/network-scripts/ifdown-aliases
@@ -15,7 +15,29 @@ cd /etc/sysconfig/network-scripts
. network-functions
# This is the same messy sed script as in the ifup-aliases script.
-eval `LC_ALL= LANG= ifconfig | sed -e ' /^[^[:space:]]*:[0-9]*/ { s|^\([^:]*\):\([0-9]*\).*$|X=x; TMP="\2"; [ "$device" != "\1" ] \|\| |g; b; }; /^[^[:space:]]/ { s|.*|X=x; [ 0 = 0 ] \|\| |g; b; }; /inet addr:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]* *Bcast:[0-9.]* *Mask:[0-9.]*/ { s|^.*inet addr:\(\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\) *Bcast:\([0-9.]*\) *Mask:\([0-9.]*\).*$|eval " rdev_${TMP}_addr=\1; rdev_${TMP}_mb=\7_\6; rdevip_\2_\3_\4_\5=${TMP}; rdev_LIST=\\\\"\\\\$rdev_LIST \\\\${TMP}\\\\"; " \|\| |g; b; }; s|^.*$||g; ' ` X=x;
+# Update also ifup-aliases!
+eval $(LC_ALL= LANG= /sbin/ifconfig | LC_ALL=C sed -n '
+# Alias name: store the number in TMP, ignore the following address if the
+# device name does not match. This may leave a hanging ||, so dummy X=x
+# comands are used to ignore a possible previous condition.
+/^[^[:space:]]*:[0-9A-Za-z_]*/ {
+ s|^\([^:]*\):\([0-9A-Za-z_]*\).*$|X=x; TMP="\2"; [ "$device" != "\1" ] \|\| |p
+ b
+}
+# Non-alias device: always ignore the following address
+/^[^[:space:]]/ {
+ s|^.*$|X=x; true \|\| |p
+ b
+}
+# Address: Preceded by a device name, which was converted into
+# condition ||
+# So this triggers only for $device.
+# Add a trailing || (which will be swallowed by X=x) to keep the syntax
+# correct.
+/inet addr:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]* *Bcast:[0-9.]* *Mask:[0-9.]*/ {
+ s|^.*inet addr:\(\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\) *Bcast:\([0-9.]*\) *Mask:\([0-9.]*\).*$|eval "rdev_${TMP}_addr=\1; rdev_${TMP}_mb=\7_\6; rdevip_\2_\3_\4_\5=${TMP}; rdev_LIST=\\"\\$rdev_LIST \\${TMP}\\"; " \|\| |p
+ b
+}') X=x
for DEVNUM in $rdev_LIST ; do
ifconfig $parent_device:$DEVNUM down