3 # check required parameters
4 SGW_REQ_VARS="SGW_PATH SGW_PORT_CFG SGW_WAIT_DEV"
5 for reqvar in ${SGW_REQ_VARS}
7 if [[ -z "${!reqvar}" ]]; then
8 echo "Required parameter ${reqvar} is empty"
13 # check if SGW_PATH point to an executable
14 if [[ ! -x ${SGW_PATH} ]]; then
15 echo "${SGW_PATH} is not executable"
20 SGW_LCORE=${SGW_LCORE:-0}
22 # setup config and output filenames
23 SGW_OUT_FILE=./ipsec-secgw.out1
24 SGW_CFG_FILE=$(mktemp)
26 # setup secgw parameters
27 SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4"
28 SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})"
29 SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\""
34 SGW_EXEC_FILE=$(mktemp)
35 cat <<EOF > ${SGW_EXEC_FILE}
36 stdbuf -o0 ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \
37 ${SGW_PORT_CFG} ${SGW_EAL_XPRM} \
38 -- ${SGW_CMD_PRM} ${SGW_CMD_XPRM} -f ${SGW_CFG_FILE} > \
39 ${SGW_OUT_FILE} 2>&1 &
46 SGW_PID=`/bin/bash -x ${SGW_EXEC_FILE}`
48 # wait till ipsec-secgw start properly
51 while [[ $i -ne 10 && $st -ne 0 ]]; do
53 ifconfig ${SGW_WAIT_DEV}
59 # stop ipsec-secgw and cleanup
63 rm -f ${SGW_EXEC_FILE}