aboutsummaryrefslogtreecommitdiffstats
path: root/test/network/net_ip.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/network/net_ip.exp')
-rwxr-xr-xtest/network/net_ip.exp77
1 files changed, 51 insertions, 26 deletions
diff --git a/test/network/net_ip.exp b/test/network/net_ip.exp
index 48d8a75fb..304b71814 100755
--- a/test/network/net_ip.exp
+++ b/test/network/net_ip.exp
@@ -7,70 +7,95 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10# check ip address 10send -- "firejail --net=br0 cat /proc/1/net/dev\r"
11send -- "firejail --net=br0 --ip=10.10.20.5\r"
12expect { 11expect {
13 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 0\n";exit}
14 "eth0" 13 "eth0"
15} 14}
16expect { 15expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 16 timeout {puts "TESTING ERROR 1\n";exit}
18 "10.10.20.5" 17 "10.10.20."
19} 18}
20expect { 19expect {
21 timeout {puts "TESTING ERROR 2\n";exit} 20 timeout {puts "TESTING ERROR 2\n";exit}
22 "255.255.255.248" 21 "255.255.255.0"
23} 22}
24expect { 23expect {
25 timeout {puts "TESTING ERROR 3\n";exit} 24 timeout {puts "TESTING ERROR 3\n";exit}
26 "UP" 25 "UP"
27} 26}
28expect { 27expect {
28 timeout {puts "TESTING ERROR 3\n";exit}
29 "Default gateway 10.10.20.1"
30}
31expect {
29 timeout {puts "TESTING ERROR 4\n";exit} 32 timeout {puts "TESTING ERROR 4\n";exit}
30 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" 33 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
31} 34}
32sleep 1
33send -- "exit\r"
34sleep 1
35
36# check loopback
37send -- "firejail --net=br0 --ip=10.10.20.5 --protocol=unix,inet,netlink\r"
38expect { 35expect {
39 timeout {puts "TESTING ERROR 5\n";exit} 36 timeout {puts "TESTING ERROR 5\n";exit}
40 "lo" 37 "lo:"
41} 38}
42expect { 39expect {
43 timeout {puts "TESTING ERROR 6\n";exit} 40 timeout {puts "TESTING ERROR 6\n";exit}
44 "127.0.0.1" 41 "eth0:"
45} 42}
43after 500
44
45send -- "firejail --net=br0 --ip=10.10.20.5 cat /proc/1/net/dev\r"
46expect { 46expect {
47 timeout {puts "TESTING ERROR 7\n";exit} 47 timeout {puts "TESTING ERROR 7\n";exit}
48 "255.0.0.0" 48 "eth0"
49} 49}
50expect { 50expect {
51 timeout {puts "TESTING ERROR 8\n";exit} 51 timeout {puts "TESTING ERROR 8\n";exit}
52 "UP" 52 "10.10.20.5"
53} 53}
54expect { 54expect {
55 timeout {puts "TESTING ERROR 9\n";exit} 55 timeout {puts "TESTING ERROR 9\n";exit}
56 "255.255.255.0"
57}
58expect {
59 timeout {puts "TESTING ERROR 10\n";exit}
60 "UP"
61}
62expect {
63 timeout {puts "TESTING ERROR 11\n";exit}
64 "Default gateway 10.10.20.1"
65}
66expect {
67 timeout {puts "TESTING ERROR 12\n";exit}
56 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" 68 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
57} 69}
58sleep 1 70after 500
59 71
60# check default gateway 72send -- "firejail --net=br0 --ip=10.10.50.5 cat /proc/1/net/dev\r"
61send -- "ip route show\r"
62expect { 73expect {
63 timeout {puts "TESTING ERROR 10.1\n";exit} 74 timeout {puts "TESTING ERROR 13\n";exit}
64 "default via 10.10.20.1 dev eth0" 75 "the IP address is not in the interface range"
65} 76}
77after 500
66 78
67send -- "ip route show\r" 79send -- "firejail --net=br0 --defaultgw=10.10.20.2 cat /proc/1/net/dev\r"
68expect { 80expect {
69 timeout {puts "TESTING ERROR 10\n";exit} 81 timeout {puts "TESTING ERROR 14\n";exit}
70 "10.10.20.0/29 dev eth0 proto kernel scope link" {puts "old iproute2\n";} 82 "Default gateway 10.10.20.2"
71 "10.10.20.0/29 dev eth0 proto kernel scope link" {puts "new iproute2\n";}
72} 83}
73send -- "exit\r" 84expect {
74after 100 85 timeout {puts "TESTING ERROR 14\n";exit}
86 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
87}
88after 500
75 89
76puts "\n" 90send -- "firejail --net=br0 --defaultgw=10.110.210.2 cat /proc/1/net/dev\r"
91expect {
92 timeout {puts "TESTING ERROR 16\n";exit}
93 "default gateway 10.110.210.2 is not in the range of any network"
94}
95after 500
96
97
98
99
100after 100
101puts "\nall done\n"