aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup
blob: 9e6fa7fa91e048aeeec8b30ab5c58ee2989d4669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# setup - quick setup for left or right side of ipsec test
# see README for example use.

SCRIPT_HOME=/test_setkey/
cd $SCRIPT_HOME

export PATH=$SCRIPT_HOME:$PATH

if [ "$1" != "left" -a "$1" != "right" ] ; then
	echo "Usage:	$0 side [config] [driver]"
	echo "		where side is either left or right."
	echo "		where config is either"
	echo "			aes-sha1-tunnel (default)"
	echo "		     or 3des-sha1-tunnel"
	echo "		if driver is supplied, script does 'modprobe driver'"
	exit 1
fi

SIDE=$1
POLICY_CFG=$SIDE.conf
DEFAULT_POLICY=aes-sha1-tunnel

if [ -n "$2" ] ; then
	POLICY=$2
else
	POLICY=$DEFAULT_POLICY
fi

SETKEY_FILE=$POLICY_CFG-$POLICY

if [ ! -f $SETKEY_FILE ] ; then
	echo "Missing setkey command file: $SETKEY_FILE"
	exit 1
fi

# modprobe any driver name given as last parameter
if [ -n "$3" ] ; then
	modprobe $3
fi

SETUP_CMD_FILE=./setup_$SIDE
. $SETUP_CMD_FILE

$SETKEY_FILE

setkey -D
setkey -D -P