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.exp76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/network/net_ip.exp b/test/network/net_ip.exp
new file mode 100755
index 000000000..0fa84243a
--- /dev/null
+++ b/test/network/net_ip.exp
@@ -0,0 +1,76 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10# check ip address
11send -- "firejail --net=br0 --ip=10.10.20.5\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "eth0"
15}
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "10.10.20.5"
19}
20expect {
21 timeout {puts "TESTING ERROR 2\n";exit}
22 "255.255.255.248"
23}
24expect {
25 timeout {puts "TESTING ERROR 3\n";exit}
26 "UP"
27}
28expect {
29 timeout {puts "TESTING ERROR 4\n";exit}
30 "Child process initialized"
31}
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 {
39 timeout {puts "TESTING ERROR 5\n";exit}
40 "lo"
41}
42expect {
43 timeout {puts "TESTING ERROR 6\n";exit}
44 "127.0.0.1"
45}
46expect {
47 timeout {puts "TESTING ERROR 7\n";exit}
48 "255.0.0.0"
49}
50expect {
51 timeout {puts "TESTING ERROR 8\n";exit}
52 "UP"
53}
54expect {
55 timeout {puts "TESTING ERROR 9\n";exit}
56 "Child process initialized"
57}
58sleep 1
59
60# check default gateway
61send -- "ip route show\r"
62expect {
63 timeout {puts "TESTING ERROR 10.1\n";exit}
64 "default via 10.10.20.1 dev eth0"
65}
66
67send -- "ip route show\r"
68expect {
69 timeout {puts "TESTING ERROR 10\n";exit}
70 "10.10.20.0/29 dev eth0 proto kernel scope link"
71}
72send -- "exit\r"
73after 100
74
75puts "\n"
76