diff options
Diffstat (limited to 'test/network/net_ip.exp')
-rwxr-xr-x | test/network/net_ip.exp | 77 |
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 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | # check ip address | 10 | send -- "firejail --net=br0 cat /proc/1/net/dev\r" |
11 | send -- "firejail --net=br0 --ip=10.10.20.5\r" | ||
12 | expect { | 11 | expect { |
13 | timeout {puts "TESTING ERROR 0\n";exit} | 12 | timeout {puts "TESTING ERROR 0\n";exit} |
14 | "eth0" | 13 | "eth0" |
15 | } | 14 | } |
16 | expect { | 15 | expect { |
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 | } |
20 | expect { | 19 | expect { |
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 | } |
24 | expect { | 23 | expect { |
25 | timeout {puts "TESTING ERROR 3\n";exit} | 24 | timeout {puts "TESTING ERROR 3\n";exit} |
26 | "UP" | 25 | "UP" |
27 | } | 26 | } |
28 | expect { | 27 | expect { |
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "Default gateway 10.10.20.1" | ||
30 | } | ||
31 | expect { | ||
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 | } |
32 | sleep 1 | ||
33 | send -- "exit\r" | ||
34 | sleep 1 | ||
35 | |||
36 | # check loopback | ||
37 | send -- "firejail --net=br0 --ip=10.10.20.5 --protocol=unix,inet,netlink\r" | ||
38 | expect { | 35 | expect { |
39 | timeout {puts "TESTING ERROR 5\n";exit} | 36 | timeout {puts "TESTING ERROR 5\n";exit} |
40 | "lo" | 37 | "lo:" |
41 | } | 38 | } |
42 | expect { | 39 | expect { |
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 | } |
43 | after 500 | ||
44 | |||
45 | send -- "firejail --net=br0 --ip=10.10.20.5 cat /proc/1/net/dev\r" | ||
46 | expect { | 46 | expect { |
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 | } |
50 | expect { | 50 | expect { |
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 | } |
54 | expect { | 54 | expect { |
55 | timeout {puts "TESTING ERROR 9\n";exit} | 55 | timeout {puts "TESTING ERROR 9\n";exit} |
56 | "255.255.255.0" | ||
57 | } | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 10\n";exit} | ||
60 | "UP" | ||
61 | } | ||
62 | expect { | ||
63 | timeout {puts "TESTING ERROR 11\n";exit} | ||
64 | "Default gateway 10.10.20.1" | ||
65 | } | ||
66 | expect { | ||
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 | } |
58 | sleep 1 | 70 | after 500 |
59 | 71 | ||
60 | # check default gateway | 72 | send -- "firejail --net=br0 --ip=10.10.50.5 cat /proc/1/net/dev\r" |
61 | send -- "ip route show\r" | ||
62 | expect { | 73 | expect { |
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 | } |
77 | after 500 | ||
66 | 78 | ||
67 | send -- "ip route show\r" | 79 | send -- "firejail --net=br0 --defaultgw=10.10.20.2 cat /proc/1/net/dev\r" |
68 | expect { | 80 | expect { |
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 | } |
73 | send -- "exit\r" | 84 | expect { |
74 | after 100 | 85 | timeout {puts "TESTING ERROR 14\n";exit} |
86 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
87 | } | ||
88 | after 500 | ||
75 | 89 | ||
76 | puts "\n" | 90 | send -- "firejail --net=br0 --defaultgw=10.110.210.2 cat /proc/1/net/dev\r" |
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 16\n";exit} | ||
93 | "default gateway 10.110.210.2 is not in the range of any network" | ||
94 | } | ||
95 | after 500 | ||
96 | |||
97 | |||
98 | |||
99 | |||
100 | after 100 | ||
101 | puts "\nall done\n" | ||