diff options
Diffstat (limited to 'example/ipsec_crypto')
-rw-r--r-- | example/ipsec_crypto/.gitignore | 1 | ||||
-rw-r--r-- | example/ipsec_crypto/Makefile.am | 38 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_ah_in.sh | 43 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_ah_out.sh | 43 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_both_in.sh | 46 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_both_out.sh | 46 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_esp_in.sh | 44 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_esp_out.sh | 39 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_live.sh | 72 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_router.sh | 56 | ||||
-rwxr-xr-x | example/ipsec_crypto/odp_ipsec_crypto_run_simple.sh | 34 | ||||
-rw-r--r-- | example/ipsec_crypto/odp_ipsec_stream.c | 8 |
12 files changed, 394 insertions, 76 deletions
diff --git a/example/ipsec_crypto/.gitignore b/example/ipsec_crypto/.gitignore index 2467edfd4..e8b9e69a1 100644 --- a/example/ipsec_crypto/.gitignore +++ b/example/ipsec_crypto/.gitignore @@ -1 +1,2 @@ odp_ipsec_crypto +pktio_env diff --git a/example/ipsec_crypto/Makefile.am b/example/ipsec_crypto/Makefile.am index 2e3652252..1db0d72d0 100644 --- a/example/ipsec_crypto/Makefile.am +++ b/example/ipsec_crypto/Makefile.am @@ -2,16 +2,28 @@ include $(top_srcdir)/example/Makefile.inc bin_PROGRAMS = odp_ipsec_crypto -dist_check_SCRIPTS = \ - odp_ipsec_crypto_run_ah_in.sh \ - odp_ipsec_crypto_run_ah_out.sh \ - odp_ipsec_crypto_run_both_in.sh \ - odp_ipsec_crypto_run_both_out.sh \ - odp_ipsec_crypto_run_esp_in.sh \ - odp_ipsec_crypto_run_esp_out.sh \ - odp_ipsec_crypto_run_live.sh \ - odp_ipsec_crypto_run_router.sh \ - odp_ipsec_crypto_run_simple.sh +if test_example +TESTS = \ + odp_ipsec_crypto_run_ah_in.sh \ + odp_ipsec_crypto_run_ah_out.sh \ + odp_ipsec_crypto_run_both_in.sh \ + odp_ipsec_crypto_run_both_out.sh \ + odp_ipsec_crypto_run_esp_in.sh \ + odp_ipsec_crypto_run_esp_out.sh \ + odp_ipsec_crypto_run_live.sh \ + odp_ipsec_crypto_run_router.sh \ + odp_ipsec_crypto_run_simple.sh +endif +EXTRA_DIST = \ + odp_ipsec_crypto_run_ah_in.sh \ + odp_ipsec_crypto_run_ah_out.sh \ + odp_ipsec_crypto_run_both_in.sh \ + odp_ipsec_crypto_run_both_out.sh \ + odp_ipsec_crypto_run_esp_in.sh \ + odp_ipsec_crypto_run_esp_out.sh \ + odp_ipsec_crypto_run_live.sh \ + odp_ipsec_crypto_run_router.sh \ + odp_ipsec_crypto_run_simple.sh odp_ipsec_crypto_SOURCES = \ odp_ipsec.c \ @@ -43,16 +55,18 @@ endif # So copy all script and data files explicitly here. all-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ - for f in $(dist_check_SCRIPTS); do \ + for f in $(EXTRA_DIST); do \ if [ -e $(srcdir)/$$f ]; then \ mkdir -p $(builddir)/$$(dirname $$f); \ cp -f $(srcdir)/$$f $(builddir)/$$f; \ fi \ done \ fi + ln -f -s ../../platform/$(with_platform)/test/example/ipsec_crypto/pktio_env pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ - for f in $(dist_check_SCRIPTS); do \ + for f in $(EXTRA_DIST); do \ rm -f $(builddir)/$$f; \ done \ fi + rm -f pktio_env diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_ah_in.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_ah_in.sh index b64fd7d2d..0c8112306 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_ah_in.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_ah_in.sh @@ -4,9 +4,40 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.111.2/32,loop1,08:00:27:76:B5:E0 \ --p 192.168.222.0/24,192.168.111.0/24,in,ah \ --a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ --s 192.168.222.2,192.168.111.2,loop2,loop1,10,100 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.111.2/32,$ROUTE_IF_INB,08:00:27:76:B5:E0 \ + -p 192.168.222.0/24,192.168.111.0/24,in,ah \ + -a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ + -s 192.168.222.2,192.168.111.2,$OUT_IF,$IN_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_ah_out.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_ah_out.sh index 0ff42289c..b0bb210f5 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_ah_out.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_ah_out.sh @@ -4,9 +4,40 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.222.2/32,loop2,08:00:27:F5:8B:DB \ --p 192.168.111.0/24,192.168.222.0/24,out,ah \ --a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ --s 192.168.111.2,192.168.222.2,loop1,loop2,10,100 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.222.2/32,$ROUTE_IF_OUTB,08:00:27:F5:8B:DB \ + -p 192.168.111.0/24,192.168.222.0/24,out,ah \ + -a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ + -s 192.168.111.2,192.168.222.2,$IN_IF,$OUT_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_both_in.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_both_in.sh index a986b713e..4b8c6ab63 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_both_in.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_both_in.sh @@ -4,11 +4,41 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.111.2/32,loop1,08:00:27:76:B5:E0 \ --p 192.168.222.0/24,192.168.111.0/24,in,both \ --a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ --e 192.168.222.2,192.168.111.2,\ -3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ --s 192.168.222.2,192.168.111.2,loop2,loop1,10,100 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.111.2/32,$ROUTE_IF_INB,08:00:27:76:B5:E0 \ + -p 192.168.222.0/24,192.168.111.0/24,in,both \ + -a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ + -e 192.168.222.2,192.168.111.2,3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ + -s 192.168.222.2,192.168.111.2,$OUT_IF,$IN_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_both_out.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_both_out.sh index ebbcde071..665534d98 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_both_out.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_both_out.sh @@ -4,11 +4,41 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.222.2/32,loop2,08:00:27:F5:8B:DB \ --p 192.168.111.0/24,192.168.222.0/24,out,both \ --e 192.168.111.2,192.168.222.2,\ -3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ --a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ --s 192.168.111.2,192.168.222.2,loop1,loop2,10,100 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.222.2/32,$ROUTE_IF_OUTB,08:00:27:F5:8B:DB \ + -p 192.168.111.0/24,192.168.222.0/24,out,both \ + -e 192.168.111.2,192.168.222.2,3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ + -a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ + -s 192.168.111.2,192.168.222.2,$IN_IF,$OUT_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_esp_in.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_esp_in.sh index cdf84c517..6e6ff5769 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_esp_in.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_esp_in.sh @@ -4,10 +4,40 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.111.2/32,loop1,08:00:27:76:B5:E0 \ --p 192.168.222.0/24,192.168.111.0/24,in,esp \ --e 192.168.222.2,192.168.111.2,\ -3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ --s 192.168.222.2,192.168.111.2,loop2,loop1,10,100 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.111.2/32,$ROUTE_IF_INB,08:00:27:76:B5:E0 \ + -p 192.168.222.0/24,192.168.111.0/24,in,esp \ + -e 192.168.222.2,192.168.111.2,3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ + -s 192.168.222.2,192.168.111.2,$OUT_IF,$IN_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_esp_out.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_esp_out.sh index ae257be4f..2b7107f80 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_esp_out.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_esp_out.sh @@ -5,14 +5,39 @@ # - 10 packets # - Specify API mode on command line +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + if [ -z "$IPSEC_EXAMPLE_PATH" ]; then IPSEC_EXAMPLE_PATH=. fi -${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.222.2/32,loop2,08:00:27:F5:8B:DB \ --p 192.168.111.0/24,192.168.222.0/24,out,esp \ --e 192.168.111.2,192.168.222.2,\ -3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ --s 192.168.111.2,192.168.222.2,loop1,loop2,10,100 \ --c 2 "$@" +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.222.2/32,$ROUTE_IF_OUTB,08:00:27:F5:8B:DB \ + -p 192.168.111.0/24,192.168.222.0/24,out,esp \ + -e 192.168.111.2,192.168.222.2,3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ + -s 192.168.111.2,192.168.222.2,$IN_IF,$OUT_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_live.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_live.sh index c212097e0..90dda11ec 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_live.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_live.sh @@ -3,15 +3,63 @@ # 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 \ --p 192.168.111.0/24,192.168.222.0/24,out,both \ --e 192.168.111.2,192.168.222.2,\ -3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ --a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ --p 192.168.222.0/24,192.168.111.0/24,in,both \ --e 192.168.222.2,192.168.111.2,\ -3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ --a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ --c 2 -m $1 + +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=1 + +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 \ + -p 192.168.111.0/24,192.168.222.0/24,out,both \ + -e 192.168.111.2,192.168.222.2,\ + 3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ + -a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \ + -p 192.168.222.0/24,192.168.111.0/24,in,both \ + -e 192.168.222.2,192.168.111.2,\ + 3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \ + -a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \ + -c 2 "$@" & 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 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 diff --git a/example/ipsec_crypto/odp_ipsec_crypto_run_simple.sh b/example/ipsec_crypto/odp_ipsec_crypto_run_simple.sh index 5d3abcd51..00b176b36 100755 --- a/example/ipsec_crypto/odp_ipsec_crypto_run_simple.sh +++ b/example/ipsec_crypto/odp_ipsec_crypto_run_simple.sh @@ -5,11 +5,37 @@ # - 10 packets # - Specify API mode on command line +# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER +IPSEC_APP_MODE=0 + +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 + if [ -z "$IPSEC_EXAMPLE_PATH" ]; then IPSEC_EXAMPLE_PATH=. fi -${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i loop1,loop2 \ --r 192.168.222.2/32,loop2,08:00:27:F5:8B:DB \ --s 192.168.111.2,192.168.222.2,loop1,loop2,10,100 \ --c 2 "$@" +${IPSEC_EXAMPLE_PATH}/odp_ipsec_crypto -i $IF_LIST \ + -r 192.168.222.2/32,$ROUTE_IF_OUTB,08:00:27:F5:8B:DB \ + -s 192.168.111.2,192.168.222.2,$IN_IF,$OUT_IF,10,100 \ + -c 2 "$@" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/ipsec_crypto/odp_ipsec_stream.c b/example/ipsec_crypto/odp_ipsec_stream.c index e53dbce0d..0ca5138bc 100644 --- a/example/ipsec_crypto/odp_ipsec_stream.c +++ b/example/ipsec_crypto/odp_ipsec_stream.c @@ -272,6 +272,10 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, inner_ip = (odph_ipv4hdr_t *)data; memset((char *)inner_ip, 0, sizeof(*inner_ip)); inner_ip->ver_ihl = 0x45; + inner_ip->tot_len = odp_cpu_to_be_16(sizeof(odph_ipv4hdr_t) + + sizeof(odph_icmphdr_t) + + sizeof(stream_pkt_hdr_t) + + stream->length); inner_ip->proto = ODPH_IPPROTO_ICMPV4; inner_ip->id = odp_cpu_to_be_16(stream->id); inner_ip->ttl = 64; @@ -322,8 +326,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, encrypt_len = ESP_ENCODE_LEN(payload_len + sizeof(*esp_t), entry->esp.block_len); - memset(data, 0, encrypt_len - payload_len); - data += encrypt_len - payload_len; + for (int n = 0; n < encrypt_len - payload_len; n++) + *data++ = n + 1; esp_t = (odph_esptrl_t *)(data) - 1; esp_t->pad_len = encrypt_len - payload_len - sizeof(*esp_t); |