~ubuntu-branches/ubuntu/raring/openvpn/raring-proposed

« back to all changes in this revision

Viewing changes to t_cltsrv.sh

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Gonzalez Iniesta
  • Date: 2006-04-05 12:17:26 UTC
  • mto: (1.3.3 upstream) (10.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20060405121726-btck979dumiwfrte
Tags: upstream-2.0.6
ImportĀ upstreamĀ versionĀ 2.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
#
3
3
# t_cltsrv.sh - script to test OpenVPN's crypto loopback
4
 
# Copyright (C) 2005  Matthias Andree
 
4
# Copyright (C) 2005,2006  Matthias Andree
5
5
#
6
6
# This program is free software; you can redistribute it and/or
7
7
# modify it under the terms of the GNU General Public License
19
19
# 02110-1301, USA.
20
20
 
21
21
set -e
22
 
echo "the following test will run about two minutes..." >&2
23
 
trap "rm -f log.$$ ; false" 1 2 3 15
 
22
trap "rm -f log.$$ log.$$.signal ; trap 0 ; exit 77" 1 2 15
 
23
trap "rm -f log.$$ log.$$.signal ; exit 1" 0 3
 
24
addopts=
 
25
case `uname -s` in
 
26
    FreeBSD)
 
27
    # FreeBSD jails map the outgoing IP to the jail IP - we need to
 
28
    # allow the real IP unless we want the test to run forever.
 
29
    if test "`sysctl 2>/dev/null -n security.jail.jailed`" = 1 \
 
30
    || ps -ostate= -p $$ | grep -q J; then
 
31
        addopts="--float"
 
32
        if test "x`ifconfig | grep inet`" = x ; then
 
33
            echo "###"
 
34
            echo "### To run the test in a FreeBSD jail, you MUST add an IP alias for the jail's IP."
 
35
            echo "###"
 
36
            exit 1
 
37
        fi
 
38
    fi
 
39
    ;;
 
40
esac
 
41
echo "the following test will take about two minutes..." >&2
24
42
set +e
25
43
(
26
 
./openvpn --cd "${srcdir}" --config sample-config-files/loopback-server &
27
 
./openvpn --cd "${srcdir}" --config sample-config-files/loopback-client
28
 
) >log.$$ 2>&1
 
44
./openvpn --cd "${srcdir}" ${addopts} --down 'echo "srv:${signal}" >&3 ; : #' --tls-exit --ping-exit 180 --config sample-config-files/loopback-server &
 
45
./openvpn --cd "${srcdir}" ${addopts} --down 'echo "clt:${signal}" >&3 ; : #' --tls-exit --ping-exit 180 --config sample-config-files/loopback-client
 
46
) 3>log.$$.signal >log.$$ 2>&1
29
47
e1=$?
30
48
wait $!
31
49
e2=$?
 
50
grep -v ":inactive$" log.$$.signal >/dev/null && { cat log.$$.signal ; echo ; cat log.$$ ; exit 1 ; }
 
51
 
32
52
set -e
33
53
 
34
54
if [ $e1 != 0 ] || [ $e2 != 0 ] ; then
35
55
    cat log.$$
36
56
    exit 1
37
57
fi
38
 
rm log.$$
 
58
rm log.$$ log.$$.signal
 
59
trap 0