diff options
Diffstat (limited to 'example/ipsec_crypto/odp_ipsec_crypto_run_router.sh')
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_router.sh | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_router.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_router.sh index d08490946..675027b59 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_router.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_router.sh @@ -3,7 +3,55 @@ # Live router test # - 2 interfaces interfaces # - Specify API mode on command line -sudo ./odp_ipsec_crypto -i p7p1,p8p1 \ --r 192.168.111.2/32,p7p1,08:00:27:76:B5:E0 \ --r 192.168.222.2/32,p8p1,08:00:27:F5:8B:DB \ --c 1 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=2 + +if [ -f ./pktio_env ]; then + . ./pktio_env +else + echo "BUG: unable to find pktio_env!" + echo "pktio_env has to be in current directory" + exit 1 +fi + +setup_interfaces + +# this just turns off output buffering so that you still get periodic +# output while piping to tee, as long as stdbuf is available. +STDBUF="`which stdbuf 2>/dev/null` -o 0" || STDBUF= +LOG=odp_ipsec_crypto_tmp.log +PID=app_pid + +($STDBUF \ + ./odp_ipsec_crypto -i $IF0,$IF1 \ + -r 192.168.111.2/32,$IF0,$NEXT_HOP_MAC0 \ + -r 192.168.222.2/32,$IF1,$NEXT_HOP_MAC1 \ + -c 1 "$@" & echo $! > $PID) | tee -a $LOG & + +APP_PID=`cat $PID` + +# Wait till application thread starts. +APP_READY="Pktio thread \[..\] starts" + +until [ -f $LOG ] +do + sleep 1 +done + +tail -f $LOG | grep -qm 1 "$APP_READY" + +validate_result +ret=$? + +kill -2 ${APP_PID} + +# Wait till the application exits +tail --pid=$APP_PID -f /dev/null + +rm -f $PID +rm -f $LOG + +cleanup_interfaces + +exit $ret |