aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-aliases
blob: bc62dbf0969549e99dc72defde9973ac5221ccb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

# removes aliases of device $1

device=$1
if [ "$device" = "" ]; then
       echo "usage: $0 <net-device>"
       exit 1
fi

parent_device=$device

. 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;

for DEVNUM in $rdev_LIST ; do
       ifconfig $parent_device:$DEVNUM down
       do_netreport=yes
done

# notify programs that have requested notification, if we changed anything
if [ -n "$do_netreport" ]; then
       do_netreport
fi