6 echo "Ethernet Bridge functional test"
8 echo -n "Testing kernel: " ; uname
-a
9 echo -n "Utilities: " ; brctl
-V
11 # fetch ip of working $ETH
12 IP
=`/sbin/ifconfig $ETH | sed -n -e 's/^.*inet addr:\([0-9][0-9\.]*\).*$/\1/p'`
13 echo "Using IP address $IP"
15 # All commands in this part must succeed
18 echo "0. Creating $maxports dummy devices"
19 modprobe dummy numdummies
=$maxports
21 echo "1. Creating bridge $BR"
29 echo "3. Bring up bridge"
32 echo "4 Bring up another bridge"
36 echo "5 Bring down bridge"
40 echo -n "6. Add " $maxports " ports:"
41 for (( i
=1; i
< $maxports; i
++))
43 brctl addif
$BR dummy
$i
44 if [[ $
(( $i % 10 )) -eq 10 ]]
50 echo -n "7. Delete those ports:"
51 for (( i
=1; i
< $maxports; i
++))
53 brctl delif
$BR dummy
$i
54 if [[ $
(( $i % 10 )) -eq 10 ]]
60 echo "8. Notififer cases"
61 brctl addif
$BR dummy0
66 echo "8b Change device address"
67 ifconfig dummy0 hw ether
00:0d
:02:03:04:05
72 echo "8d Unregister device (slow)"
76 modprobe dummy numdummies
=2
81 echo -n " duplicate bridge - "
84 echo -n " bridge to bridge - "
88 echo -n " already in other bridge - "
89 brctl addif brTmp
$ETH
91 echo -n " already in this bridge - "
94 echo -n " remove from wrong bridge - "
95 brctl delif brTmp
$ETH
98 echo -n " remove bridge $ETH - "
101 echo -n " remove bridge bogus - "
104 echo -n " remove still active bridge - "
107 echo -n " zero hw address - "
108 ifconfig dummy0 hw ether
00:00:00:00:00:00
109 brctl addif
$BR dummy0
111 echo -n " duplicate hw address - "
112 ifconfig dummy0 hw ether
00:0d
:01:00:00:00
113 ifconfig dummy1 hw ether
00:0d
:01:00:00:00
114 brctl addif
$BR dummy0
115 brctl addif
$BR dummy1
116 # leave dummy0 for next test.
122 brctl setageing
$BR 4000
123 brctl setbridgeprio
$BR 1
125 brctl sethello
$BR 20
126 brctl setmaxage
$BR 1000
127 brctl setpathcost
$BR dummy0
50
128 brctl setportprio
$BR dummy0
2
144 echo "31 Remove bridge module"
149 echo "32 Check for dead bridge cleanup"
155 echo "33 Remove module with race"
159 rmmod
--wait bridge
&
162 if ifconfig brXX
1.1.1.1 ; then
163 echo "?? ifconfig succeeded"