diff options
Diffstat (limited to 'src/service/vpn/tests/test-helper-ifaddr.sh')
-rwxr-xr-x | src/service/vpn/tests/test-helper-ifaddr.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/service/vpn/tests/test-helper-ifaddr.sh b/src/service/vpn/tests/test-helper-ifaddr.sh new file mode 100755 index 000000000..b8fde999d --- /dev/null +++ b/src/service/vpn/tests/test-helper-ifaddr.sh | |||
@@ -0,0 +1,41 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | FIFO=$(mktemp) | ||
4 | |||
5 | rm $FIFO | ||
6 | |||
7 | mkfifo $FIFO | ||
8 | |||
9 | /opt/gnunet/bin/gnunet-helper-vpn > $FIFO 2>&1 & | ||
10 | |||
11 | PID=$! | ||
12 | |||
13 | sleep 1 | ||
14 | |||
15 | IF="" | ||
16 | while read line < $FIFO; do | ||
17 | IF=$(echo $line | grep interface | sed -e 's/.*interface \([^ ]*\).*/\1/') | ||
18 | if [ "$IF" != "" ]; then | ||
19 | break | ||
20 | fi | ||
21 | done | ||
22 | |||
23 | r=0 | ||
24 | if /sbin/ifconfig $IF | grep inet6 | grep -q '1234::1/16'; then | ||
25 | echo OK | ||
26 | else | ||
27 | echo FAILED: Interface-Address not set for IPv6! | ||
28 | r=1 | ||
29 | fi | ||
30 | |||
31 | if /sbin/ifconfig $IF | grep "inet " | grep -q '10.10.10.1'; then | ||
32 | echo OK | ||
33 | else | ||
34 | echo FAILED: Interface-Address not set for IPv4! | ||
35 | r=1 | ||
36 | fi | ||
37 | |||
38 | rm $FIFO | ||
39 | kill $PID | ||
40 | |||
41 | exit $r | ||