File: alloc_dealloc.sh

package info (click to toggle)
openswan 1%3A2.4.6%2Bdfsg.2-1.1%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 25,000 kB
  • ctags: 16,877
  • sloc: ansic: 121,112; sh: 19,782; xml: 9,699; asm: 4,422; perl: 4,087; makefile: 3,367; tcl: 713; exp: 657; yacc: 396; pascal: 328; lex: 289; sed: 265; awk: 124; lisp: 3
file content (47 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (12)
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
#!/bin/sh

# This script allocates a number of SPIs, then deallocates them in a 
# different order. It is driven by an input file which contains some
# generated SPI data.

def_enckey=0x4043434545464649494a4a4c4c4f4f515152525454575758
def_authkey=0x87658765876587658765876587658765

# input file is in the format:
#   {alloc,free}  edst spi proto src algo enckey authkey
#
# if algo="", then algo="3des-md5-96"
# if enckey="", then enckey=above, ditto for authkey.
# keys are not relevant for dealloc.
#
# note, proto must be = esp at present.

# the goal is to make something like:n
# ipsec spi --saref --af inet --edst 192.1.2.45 --spi 0x12345678 --proto esp --src 192.1.2.23 --esp 3des-md5-96 --enckey $enckey --authkey $authkey
#
#


# ROOT is "" in the UML testing environment, and /testing is mounted.

line=0

cat $ROOT/testing/klips/saref-alloc-01/allocfile1.txt | while read op edst spi proto src algo enckey authkey
do
    # set up defaults
    if [ -z "$algo" ]; then algo="3des-md5-96"; fi
    if [ -z "$enckey" ]; then enckey=$def_enckey;  fi
    if [ -z "$authkey"]; then authkey=$def_authkey; fi

    line=`expr $line + 1`
    #echo Input Line: $line

    case $op in
    \#*) ;;
    alloc) echo ipsec spi --saref --af inet --edst $edst --spi $spi --proto $proto --src $src --esp $algo --enckey $enckey --authkey $authkey;;
    free)  echo ipsec spi --saref --af inet --edst $edst --spi $spi --proto $proto --del;;
    esac
done