aboutsummaryrefslogtreecommitdiffstats
path: root/test/network/net_interface.exp
blob: 2e6619938d31f88830cad361b144274db2ee4585 (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "ip link add link eth0 name eth0.100 type vlan id 100\r"
sleep 1
send -- "ip link add link eth0 name eth0.101 type vlan id 101\r"
sleep 1
send -- "ip link add link eth0 name eth0.102 type vlan id 102\r"
sleep 1
send -- "ip link add link eth0 name eth0.103 type vlan id 103\r"
sleep 1
send -- "ip link add link eth0 name eth0.104 type vlan id 104\r"
sleep 1
puts "\n"

send -- "/sbin/ifconfig eth0.100 10.200.0.1/24\r"
sleep 1
send -- "/sbin/ifconfig eth0.101 10.200.1.1/24\r"
sleep 1
send -- "/sbin/ifconfig eth0.102 10.200.2.1/24\r"
sleep 1
send -- "/sbin/ifconfig eth0.103 10.200.3.1/24\r"
sleep 1
send -- "/sbin/ifconfig eth0.104 10.200.4.1/24\r"
sleep 1
puts "\n"



send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103 --interface=eth0.104\r"
expect {
	timeout {puts "TESTING ERROR 0\n";exit}
	"maximum 4 interfaces are allowed"
}
sleep 1

send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103\r"
expect {
	timeout {puts "TESTING ERROR 1\n";exit}
	"eth0.100"
}
expect {
	timeout {puts "TESTING ERROR 1.1\n";exit}
	"UP"
}
expect {
	timeout {puts "TESTING ERROR 2\n";exit}
	"eth0.101"
}
expect {
	timeout {puts "TESTING ERROR 2.2\n";exit}
	"UP"
}
expect {
	timeout {puts "TESTING ERROR 3\n";exit}
	"eth0.102"
}
expect {
	timeout {puts "TESTING ERROR 3.1\n";exit}
	"UP"
}
expect {
	timeout {puts "TESTING ERROR 4\n";exit}
	"eth0.103"
}
expect {
	timeout {puts "TESTING ERROR 4.1\n";exit}
	"UP"
}
sleep 1
send -- "exit\r"
sleep 1

send -- "firejail --noprofile --interface=eth0.104\r"
expect {
	timeout {puts "TESTING ERROR 5\n";exit}
	"eth0.104"
}
expect {
	timeout {puts "TESTING ERROR 5.1\n";exit}
	"UP"
}

puts "all done\n"