-improve indentation, reduce duplication of PIDs in core's neighbour map
[oweals/gnunet.git] / src / vpn / tests / test-helper-ifaddr.sh
1 #!/bin/bash
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