diff options
Diffstat (limited to 'recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup')
-rwxr-xr-x | recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup b/recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup new file mode 100755 index 0000000..9e6fa7f --- /dev/null +++ b/recipes-connectivity/ipsec-demo/ipsec-demo/test_setkey/setup | |||
@@ -0,0 +1,47 @@ | |||
1 | # setup - quick setup for left or right side of ipsec test | ||
2 | # see README for example use. | ||
3 | |||
4 | SCRIPT_HOME=/test_setkey/ | ||
5 | cd $SCRIPT_HOME | ||
6 | |||
7 | export PATH=$SCRIPT_HOME:$PATH | ||
8 | |||
9 | if [ "$1" != "left" -a "$1" != "right" ] ; then | ||
10 | echo "Usage: $0 side [config] [driver]" | ||
11 | echo " where side is either left or right." | ||
12 | echo " where config is either" | ||
13 | echo " aes-sha1-tunnel (default)" | ||
14 | echo " or 3des-sha1-tunnel" | ||
15 | echo " if driver is supplied, script does 'modprobe driver'" | ||
16 | exit 1 | ||
17 | fi | ||
18 | |||
19 | SIDE=$1 | ||
20 | POLICY_CFG=$SIDE.conf | ||
21 | DEFAULT_POLICY=aes-sha1-tunnel | ||
22 | |||
23 | if [ -n "$2" ] ; then | ||
24 | POLICY=$2 | ||
25 | else | ||
26 | POLICY=$DEFAULT_POLICY | ||
27 | fi | ||
28 | |||
29 | SETKEY_FILE=$POLICY_CFG-$POLICY | ||
30 | |||
31 | if [ ! -f $SETKEY_FILE ] ; then | ||
32 | echo "Missing setkey command file: $SETKEY_FILE" | ||
33 | exit 1 | ||
34 | fi | ||
35 | |||
36 | # modprobe any driver name given as last parameter | ||
37 | if [ -n "$3" ] ; then | ||
38 | modprobe $3 | ||
39 | fi | ||
40 | |||
41 | SETUP_CMD_FILE=./setup_$SIDE | ||
42 | . $SETUP_CMD_FILE | ||
43 | |||
44 | $SETKEY_FILE | ||
45 | |||
46 | setkey -D | ||
47 | setkey -D -P | ||