5
cat >tests/testcase.1 <<EOF
17
run-parts --verbose /etc/network/if-pre-up.d
18
Configuring interface eth0=eth0 (inet)
19
run-parts --verbose /etc/network/if-pre-up.d
21
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
25
run-parts --verbose /etc/network/if-up.d
26
run-parts --verbose /etc/network/if-up.d
29
cat >tests/testcase.2 <<EOF
34
iface eth0 inet static
37
iface eth1 inet static
40
iface eth2 inet static
43
iface eth3 inet static
46
iface eth4 inet static
49
iface eth5 inet static
52
iface eth6 inet static
55
iface eth7 inet static
62
run-parts --verbose /etc/network/if-pre-up.d
63
Configuring interface eth0=eth0 (inet)
64
run-parts --verbose /etc/network/if-pre-up.d
66
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
68
run-parts --verbose /etc/network/if-up.d
69
Configuring interface eth1=eth1 (inet)
70
run-parts --verbose /etc/network/if-pre-up.d
72
inetutils-ifconfig --interface eth1 --address 1.3.4.5 --netmask 255.255.255.0 --up
74
run-parts --verbose /etc/network/if-up.d
75
Configuring interface eth2=eth2 (inet)
76
run-parts --verbose /etc/network/if-pre-up.d
78
inetutils-ifconfig --interface eth2 --address 1.4.5.6 --netmask 255.255.255.0 --up
80
run-parts --verbose /etc/network/if-up.d
81
Configuring interface eth3=eth3 (inet)
82
run-parts --verbose /etc/network/if-pre-up.d
84
inetutils-ifconfig --interface eth3 --address 1.5.6.7 --netmask 255.255.255.0 --up
86
run-parts --verbose /etc/network/if-up.d
87
Configuring interface eth4=eth4 (inet)
88
run-parts --verbose /etc/network/if-pre-up.d
90
inetutils-ifconfig --interface eth4 --address 1.7.8.9 --netmask 255.255.255.0 --up
92
run-parts --verbose /etc/network/if-up.d
93
Configuring interface eth5=eth5 (inet)
94
run-parts --verbose /etc/network/if-pre-up.d
96
inetutils-ifconfig --interface eth5 --address 1.8.9.10 --netmask 255.255.255.0 --up
98
run-parts --verbose /etc/network/if-up.d
99
run-parts --verbose /etc/network/if-up.d
102
cat >tests/testcase.3 <<EOF
105
iface eth0 inet static
107
netmask 255.255.255.0
108
iface eth0 inet6 static
109
address 3ffe:ffff:100:f101::1
112
cat >tests/up.3 <<EOF
115
run-parts --verbose /etc/network/if-pre-up.d
116
Configuring interface eth0=eth0 (inet)
117
run-parts --verbose /etc/network/if-pre-up.d
119
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
121
run-parts --verbose /etc/network/if-up.d
122
Configuring interface eth0=eth0 (inet6)
123
run-parts --verbose /etc/network/if-pre-up.d
124
FIXME: Add proper commands here for ipv6
127
run-parts --verbose /etc/network/if-up.d
128
run-parts --verbose /etc/network/if-up.d
131
cat >tests/testcase.4 <<EOF
134
script tests/map.eth0.work
135
iface work inet static
137
netmask 255.255.255.0
141
cat >tests/up.4 <<EOF
144
Configuring interface eth0=work (inet)
145
run-parts --verbose /etc/network/if-pre-up.d
147
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
151
run-parts --verbose /etc/network/if-up.d
154
cat >tests/testcase.5 <<EOF
157
iface eth0 inet static
159
netmask 255.255.255.0
160
hwaddress ether 00:DE:AD:00:BE:AF
162
cat >tests/up.5 <<EOF
165
run-parts --verbose /etc/network/if-pre-up.d
166
Configuring interface eth0=eth0 (inet)
167
run-parts --verbose /etc/network/if-pre-up.d
168
Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported
169
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
171
run-parts --verbose /etc/network/if-up.d
172
run-parts --verbose /etc/network/if-up.d
175
cat >tests/testcase.6 <<EOF
178
iface eth0 inet static
180
netmask 255.255.255.0
181
hwaddress 00:DE:AD:00:BE:AF
183
cat >tests/up.6 <<EOF
186
run-parts --verbose /etc/network/if-pre-up.d
187
Configuring interface eth0=eth0 (inet)
188
run-parts --verbose /etc/network/if-pre-up.d
189
Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported
190
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0 --up
192
run-parts --verbose /etc/network/if-up.d
193
run-parts --verbose /etc/network/if-up.d
196
cat >tests/testcase.7 <<EOF
198
auto eth0 eth0.1 tunnel
199
iface eth0 inet static
201
netmask 255.255.255.0
202
iface eth0 inet6 static
203
address 3ffe:ffff:100:f101::1
207
iface eth0.1 inet6 static
208
address 3ffe:ffff:120:f101::1
210
iface tunnel inet6 6to4
213
cat >tests/up.7 <<EOF
216
Configuring interface eth0=eth0 (inet)
217
run-parts --verbose /etc/network/if-pre-up.d
218
ip addr add 1.2.3.4/255.255.255.0 dev eth0
219
ip link set dev eth0 up
221
run-parts --verbose /etc/network/if-up.d
222
Configuring interface eth0=eth0 (inet6)
223
run-parts --verbose /etc/network/if-pre-up.d
224
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
225
sysctl net.ipv6.conf.eth0.use_tempaddr=2
226
sysctl net.ipv6.conf.eth0.accept_ra=0
227
sysctl net.ipv6.conf.eth0.autoconf=0
229
ip link set dev eth0 up
230
ip -6 addr add 3ffe:ffff:100:f101::1/64 dev eth0
232
run-parts --verbose /etc/network/if-up.d
233
Configuring interface eth0.1=eth0.1 (inet6)
234
run-parts --verbose /etc/network/if-pre-up.d
235
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
238
sysctl net.ipv6.conf.eth0/1.autoconf=0
240
ip link set dev eth0.1 up
241
ip -6 addr add 3ffe:ffff:120:f101::1/64 dev eth0.1
243
run-parts --verbose /etc/network/if-up.d
244
Configuring interface tunnel=tunnel (inet6)
245
run-parts --verbose /etc/network/if-pre-up.d
246
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
247
ip tunnel add tunnel mode sit remote any local 1.2.3.4
248
ip link set tunnel up
249
ip addr add 2002:0102:0304::1/16 dev tunnel
250
ip route add 2000::/3 via ::192.88.99.1 dev tunnel
251
run-parts --verbose /etc/network/if-up.d
254
# Note: Testcase 7 is not run on GNU/Hurd, tunnel is not yet implemented.
256
for test in 1 2 3 4 5 6; do
257
args="$(cat tests/testcase.$test | sed -n 's/^# RUN: //p')"
258
./ifup -nv --force -i tests/testcase.$test $args \
259
>tests/up-res-out.$test 2>tests/up-res-err.$test ||
261
(echo "====stdout===="; cat tests/up-res-out.$test
262
echo "====stderr===="; cat tests/up-res-err.$test) > tests/up-res.$test
264
echo "Testcase $test: $args"
266
if diff -ub tests/up.$test tests/up-res.$test; then
276
echo "(okay overall)"
279
echo "(failed overall)"