aboutsummaryrefslogtreecommitdiff
path: root/example/ipsec_api
diff options
context:
space:
mode:
Diffstat (limited to 'example/ipsec_api')
-rw-r--r--example/ipsec_api/.gitignore1
-rw-r--r--example/ipsec_api/Makefile.am42
-rw-r--r--example/ipsec_api/odp_ipsec.c18
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_ah_in.sh39
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_ah_out.sh39
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh41
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh41
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_esp_in.sh40
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_esp_out.sh39
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh42
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh40
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_live.sh66
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_router.sh56
-rwxr-xr-xexample/ipsec_api/odp_ipsec_api_run_simple.sh34
14 files changed, 451 insertions, 87 deletions
diff --git a/example/ipsec_api/.gitignore b/example/ipsec_api/.gitignore
index 78ef1173c..77f399c54 100644
--- a/example/ipsec_api/.gitignore
+++ b/example/ipsec_api/.gitignore
@@ -1 +1,2 @@
odp_ipsec_api
+pktio_env
diff --git a/example/ipsec_api/Makefile.am b/example/ipsec_api/Makefile.am
index b3621fcd2..05471008d 100644
--- a/example/ipsec_api/Makefile.am
+++ b/example/ipsec_api/Makefile.am
@@ -2,18 +2,31 @@ include $(top_srcdir)/example/Makefile.inc
bin_PROGRAMS = odp_ipsec_api
-dist_check_SCRIPTS = \
- odp_ipsec_api_run_ah_in.sh \
- odp_ipsec_api_run_ah_out.sh \
- odp_ipsec_api_run_ah_tun_in.sh \
- odp_ipsec_api_run_ah_tun_out.sh \
- odp_ipsec_api_run_esp_in.sh \
- odp_ipsec_api_run_esp_out.sh \
- odp_ipsec_api_run_esp_tun_in.sh \
- odp_ipsec_api_run_esp_tun_out.sh \
- odp_ipsec_api_run_live.sh \
- odp_ipsec_api_run_router.sh \
- odp_ipsec_api_run_simple.sh
+if test_example
+TESTS = \
+ odp_ipsec_api_run_ah_in.sh \
+ odp_ipsec_api_run_ah_out.sh \
+ odp_ipsec_api_run_ah_tun_in.sh \
+ odp_ipsec_api_run_ah_tun_out.sh \
+ odp_ipsec_api_run_esp_in.sh \
+ odp_ipsec_api_run_esp_out.sh \
+ odp_ipsec_api_run_esp_tun_in.sh \
+ odp_ipsec_api_run_esp_tun_out.sh \
+ odp_ipsec_api_run_simple.sh
+endif
+
+EXTRA_DIST = \
+ odp_ipsec_api_run_ah_in.sh \
+ odp_ipsec_api_run_ah_out.sh \
+ odp_ipsec_api_run_ah_tun_in.sh \
+ odp_ipsec_api_run_ah_tun_out.sh \
+ odp_ipsec_api_run_esp_in.sh \
+ odp_ipsec_api_run_esp_out.sh \
+ odp_ipsec_api_run_esp_tun_in.sh \
+ odp_ipsec_api_run_esp_tun_out.sh \
+ odp_ipsec_api_run_live.sh \
+ odp_ipsec_api_run_router.sh \
+ odp_ipsec_api_run_simple.sh
odp_ipsec_api_SOURCES = \
odp_ipsec.c \
@@ -45,16 +58,17 @@ 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_api/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
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c
index 98e31d6ce..d23eeb2c6 100644
--- a/example/ipsec_api/odp_ipsec.c
+++ b/example/ipsec_api/odp_ipsec.c
@@ -640,11 +640,20 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t *ppkt)
return PKT_POSTED;
} else {
int out = 1;
+ odp_ipsec_packet_result_t result;
rc = odp_ipsec_in(ppkt, 1, ppkt, &out, &in_param);
if (rc <= 0)
return PKT_DROP;
+ if (odp_ipsec_result(&result, *ppkt) < 0) {
+ ODPH_DBG("odp_ipsec_result() failed\n");
+ return PKT_DROP;
+ }
+ if (result.status.error.all != 0) {
+ ODPH_DBG("Error in inbound IPsec processing\n");
+ return PKT_DROP;
+ }
return PKT_CONTINUE;
}
}
@@ -704,11 +713,20 @@ pkt_disposition_e do_ipsec_out_classify(odp_packet_t *ppkt, pkt_ctx_t *ctx)
return PKT_POSTED;
} else {
int out = 1;
+ odp_ipsec_packet_result_t result;
rc = odp_ipsec_out(ppkt, 1, ppkt, &out, &out_param);
if (rc <= 0)
return PKT_DROP;
+ if (odp_ipsec_result(&result, *ppkt) < 0) {
+ ODPH_DBG("odp_ipsec_result() failed\n");
+ return PKT_DROP;
+ }
+ if (result.status.error.all != 0) {
+ ODPH_DBG("Error in outbound IPsec processing\n");
+ return PKT_DROP;
+ }
return PKT_CONTINUE;
}
}
diff --git a/example/ipsec_api/odp_ipsec_api_run_ah_in.sh b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh
index 22a56f380..3aa8ea577 100755
--- a/example/ipsec_api/odp_ipsec_api_run_ah_in.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh
@@ -4,9 +4,36 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 "$@"
+
+# 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
+
+./odp_ipsec_api -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_api/odp_ipsec_api_run_ah_out.sh b/example/ipsec_api/odp_ipsec_api_run_ah_out.sh
index 8194485a4..2712da52a 100755
--- a/example/ipsec_api/odp_ipsec_api_run_ah_out.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_ah_out.sh
@@ -4,9 +4,36 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 "$@"
+
+# 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
+
+./odp_ipsec_api -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_api/odp_ipsec_api_run_ah_tun_in.sh b/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh
index 89331bbea..f6efc3869 100755
--- a/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh
@@ -4,10 +4,37 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 \
--t 192.168.222.2,192.168.111.2,10.0.222.2,10.0.111.2 \
--s 192.168.222.2,192.168.111.2,loop2,loop1,10,100 \
--c 2 "$@"
+
+# 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
+
+./odp_ipsec_api -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 \
+ -t 192.168.222.2,192.168.111.2,10.0.222.2,10.0.111.2 \
+ -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_api/odp_ipsec_api_run_ah_tun_out.sh b/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh
index bd15f5956..ec888d314 100755
--- a/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh
@@ -4,10 +4,37 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 \
--t 192.168.111.2,192.168.222.2,10.0.111.2,10.0.222.2 \
--s 192.168.111.2,192.168.222.2,loop1,loop2,10,100 \
--c 2 "$@"
+
+# 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
+
+./odp_ipsec_api -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 \
+ -t 192.168.111.2,192.168.222.2,10.0.111.2,10.0.222.2 \
+ -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_api/odp_ipsec_api_run_esp_in.sh b/example/ipsec_api/odp_ipsec_api_run_esp_in.sh
index 61873bf76..1c3414498 100755
--- a/example/ipsec_api/odp_ipsec_api_run_esp_in.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_esp_in.sh
@@ -4,10 +4,36 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 "$@"
+
+# 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
+
+./odp_ipsec_api -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_api/odp_ipsec_api_run_esp_out.sh b/example/ipsec_api/odp_ipsec_api_run_esp_out.sh
index 834daa4cc..c9809e8ac 100755
--- a/example/ipsec_api/odp_ipsec_api_run_esp_out.sh
+++ b/example/ipsec_api/odp_ipsec_api_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_api -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_api -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_api/odp_ipsec_api_run_esp_tun_in.sh b/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh
index 42be4559f..3b4f91e41 100755
--- a/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh
@@ -4,11 +4,37 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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 \
--t 192.168.222.2,192.168.111.2,10.0.222.2,10.0.111.2 \
--s 192.168.222.2,192.168.111.2,loop2,loop1,10,100 \
--c 2 "$@"
+
+# 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
+
+./odp_ipsec_api -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 \
+ -t 192.168.222.2,192.168.111.2,10.0.222.2,10.0.111.2 \
+ -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_api/odp_ipsec_api_run_esp_tun_out.sh b/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh
index 7b0c42bcb..a4c62e226 100755
--- a/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh
@@ -4,10 +4,36 @@
# - 2 loop interfaces
# - 10 packets
# - Specify API mode on command line
-./odp_ipsec_api -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_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
+
+./odp_ipsec_api -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_api/odp_ipsec_api_run_live.sh b/example/ipsec_api/odp_ipsec_api_run_live.sh
index 318e640fe..da8523485 100755
--- a/example/ipsec_api/odp_ipsec_api_run_live.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_live.sh
@@ -3,13 +3,59 @@
# Live router test
# - 2 interfaces interfaces
# - Specify API mode on command line
-sudo ./odp_ipsec_api -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,esp \
--e 192.168.111.2,192.168.222.2,\
-3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \
--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 \
--c 2 "$@"
+
+# 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_api_tmp.log
+PID=app_pid
+
+($STDBUF \
+ ./odp_ipsec_api -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,esp \
+ -e 192.168.111.2,192.168.222.2,3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \
+ -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 \
+ -c 2 "$@" & echo $! > $PID) | tee $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_api/odp_ipsec_api_run_router.sh b/example/ipsec_api/odp_ipsec_api_run_router.sh
index 2cdbd2272..79a0ef5c6 100755
--- a/example/ipsec_api/odp_ipsec_api_run_router.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_router.sh
@@ -3,7 +3,55 @@
# Live router test
# - 2 interfaces interfaces
# - Specify API mode on command line
-sudo ./odp_ipsec_api -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 "$@"
+
+# 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_api_tmp.log
+PID=app_pid
+
+($STDBUF \
+ ./odp_ipsec_api -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 stops
+tail --pid=$APP_PID -f /dev/null
+
+rm -f $PID
+rm -f $LOG
+
+cleanup_interfaces
+
+exit $ret
diff --git a/example/ipsec_api/odp_ipsec_api_run_simple.sh b/example/ipsec_api/odp_ipsec_api_run_simple.sh
index 56c022291..2921f978b 100755
--- a/example/ipsec_api/odp_ipsec_api_run_simple.sh
+++ b/example/ipsec_api/odp_ipsec_api_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_api -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_api -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