summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xextras/vcl-ldpreload/test/common/nginx_test.sh67
-rw-r--r--src/vcl/vppcom.c39
2 files changed, 61 insertions, 45 deletions
diff --git a/extras/vcl-ldpreload/test/common/nginx_test.sh b/extras/vcl-ldpreload/test/common/nginx_test.sh
index 6d43abf2d10..ea771038658 100755
--- a/extras/vcl-ldpreload/test/common/nginx_test.sh
+++ b/extras/vcl-ldpreload/test/common/nginx_test.sh
@@ -13,7 +13,7 @@
# Configuration variables.
#
-vpp_dk_name="VPP-TEST-NGINX"
+vpp_dk_name="NGINX"
# Comment out the next line to run the VPP release version
debug="_debug"
vpp_app="$WS_ROOT/build-root/install-vpp${debug}-native/vpp/bin/vpp"
@@ -48,42 +48,47 @@ if [ ! -f "$LDP_LIB" ] ; then
exit 1
fi
-if [ -z "$(docker ps -qf name=$vpp_dk_name)" ] ; then
- echo "Starting NGINX in docker container ($vpp_dk_name)"
- docker run --rm --name $vpp_dk_name -v $LDP_TEST_DIR/common/nginx_welcome.html:/usr/share/nginx/html/index.html:ro -d nginx
-
- echo "Configuring network interfaces"
- sudo ip link del dev vpp_dk
- sudo ip link add name vpp_dk type veth peer name vpp1
- sudo ip link set dev vpp_dk up
- sudo ethtool --offload vpp_dk rx off tx off
- sudo ip link set dev vpp1 up
- sudo ethtool --offload vpp1 rx off tx off
- sudo ip link set dev lo up
- sudo brctl addif docker0 vpp_dk
-fi
-
-export LD_LIBRARY_PATH="$WS_ROOT/build-root/install-vpp${debug}-native/vpp/lib64/:$LDP_DIR/src/.libs:"
-
-# Extract nginx IPv4 address from docker bridge
-#
-nginx_addr=$(docker network inspect bridge | grep IPv4Address | awk -e '{print $2}' | sed -e 's,/16,,' -e 's,",,g' -e 's/,//')
-
-if [ -z "$nginx_addr" ] ; then
- echo "ERROR: Unable to determine docker container address!"
- exit 1
-fi
-
if [ -n "$STRACE_ONLY" ] ; then
echo "Running strace -tt $TEST_APP http://$nginx_addr"
strace -tt $TEST_APP http://$nginx_addr
else
check_for_vpp
if [ -z "$running_vpp" ] ; then
- echo "Starting VPP ('telnet 0 5002' to connect to cli)"
- sudo $vpp_app unix { cli-listen localhost:5002 exec $LDP_TEST_DIR/common/vpp_docker.conf } api-segment { gid $(id -g) }
- sleep 2
+ echo -e "\nConfiguring network interfaces"
+ sudo ip link del dev vpp_dk
+ sudo ip link add name vpp_dk type veth peer name vpp1
+ sudo ip link set dev vpp_dk up
+ sudo ethtool --offload vpp_dk rx off tx off
+ sudo ip link set dev vpp1 up
+ sudo ethtool --offload vpp1 rx off tx off
+ sudo ip link set dev lo up
+ sudo brctl addif docker0 vpp_dk
+
+ echo "Starting VPP "
+ sudo rm -f /dev/shm/*
+ sudo xfce4-terminal --title VPP --command "$vpp_app unix { interactive exec $LDP_TEST_DIR/common/vpp_docker.conf full-coredump coredump-size unlimited } api-segment { gid $(id -g) }" &
+# sudo $vpp_app unix { cli-listen localhost:5002 exec $LDP_TEST_DIR/common/vpp_docker.conf } api-segment { gid $(id -g) }
+ sleep 4
+ fi
+
+ if [ -z "$(docker ps -qf name=$vpp_dk_name)" ] ; then
+ echo -e "\nStarting NGINX in docker container ($vpp_dk_name)"
+ echo "docker run --rm --name $vpp_dk_name -v $LDP_TEST_DIR/common/nginx_welcome.html:/usr/share/nginx/html/index.html:ro -d nginx"
+ docker run --rm --name $vpp_dk_name -v $LDP_TEST_DIR/common/nginx_welcome.html:/usr/share/nginx/html/index.html:ro -d nginx
+
+ export LD_LIBRARY_PATH="$WS_ROOT/build-root/install-vpp${debug}-native/vpp/lib64/:$LDP_DIR/src/.libs:"
+
+ # Extract nginx IPv4 address from docker bridge
+ #
+ nginx_addr=$(docker network inspect bridge | grep IPv4Address | awk -e '{print $2}' | sed -e 's,/16,,' -e 's,",,g' -e 's/,//')
+
+ if [ -z "$nginx_addr" ] ; then
+ echo "ERROR: Unable to determine docker container address!"
+ exit 1
+ fi
fi
- echo "Running LD_PRELOAD=$LDP_LIB $TEST_APP http://$nginx_addr"
+
+ echo -e "\nRunning wget"
+ echo -e "LD_PRELOAD=$LDP_LIB $TEST_APP http://$nginx_addr\n"
LD_PRELOAD=$LDP_LIB $TEST_APP http://$nginx_addr
fi
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index a46bfe2d8db..09ebe26813f 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -599,33 +599,44 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
mp)
{
uword *p;
+ u32 session_index = ~0;
p = hash_get (vcm->session_index_by_vpp_handles, mp->handle);
if (p)
{
session_t *session = 0;
int rv;
+
+ session_index = p[0];
+ hash_unset (vcm->session_index_by_vpp_handles, mp->handle);
clib_spinlock_lock (&vcm->sessions_lockp);
- rv = vppcom_session_at_index (p[0], &session);
+ rv = vppcom_session_at_index (session_index, &session);
if (PREDICT_FALSE (rv))
{
if (VPPCOM_DEBUG > 1)
- clib_warning ("[%d] invalid session, sid (%u) has been closed!",
- getpid (), p[0]);
+ clib_warning ("[%d] invalid session, sid %u has been closed!",
+ getpid (), session_index);
+ }
+ else
+ {
+ if (VPPCOM_DEBUG > 1)
+ clib_warning ("[%d] vpp handle 0x%llx, sid %u disconnected!",
+ getpid (), mp->handle, session_index);
+
+ session->state = STATE_DISCONNECT;
}
- hash_unset (vcm->session_index_by_vpp_handles, mp->handle);
- session->state = STATE_DISCONNECT;
clib_spinlock_unlock (&vcm->sessions_lockp);
}
else
{
if (VPPCOM_DEBUG > 1)
- clib_warning ("[%d] couldn't find session key %llx", getpid (),
- mp->handle);
+ clib_warning ("[%d] couldn't find session: unknown vpp handle 0x%llx",
+ getpid (), mp->handle);
}
if (mp->retval)
- clib_warning ("[%d] disconnect_session failed: %U", getpid (),
+ clib_warning ("[%d] disconnect_session vpp handle 0x%llx, sid %u "
+ "failed: %U", getpid (), mp->handle, session_index,
format_api_error, ntohl (mp->retval));
}
@@ -680,8 +691,8 @@ vl_api_disconnect_session_t_handler (vl_api_disconnect_session_t * mp)
}
else
{
- clib_warning ("[%d] couldn't find session key %llx", getpid (),
- mp->handle);
+ clib_warning ("[%d] couldn't find session: unknonwn vpp handle 0x%llx",
+ getpid (), mp->handle);
rv = -11;
}
@@ -721,8 +732,8 @@ vl_api_reset_session_t_handler (vl_api_reset_session_t * mp)
}
else
{
- clib_warning ("[%d] couldn't find session key %llx", getpid (),
- mp->handle);
+ clib_warning ("[%d] couldn't find session: unknown vpp handle 0x%llx",
+ getpid (), mp->handle);
rv = -11;
}
@@ -811,10 +822,10 @@ vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
hash_set (vcm->session_index_by_vpp_handles, mp->handle, session_index);
if (VPPCOM_DEBUG > 1)
- clib_warning ("[%d] client sid %d\n"
+ clib_warning ("[%d] client sid %d, vpp handle 0x%llx\n"
" session_rx_fifo %p, refcnt %d\n"
" session_tx_fifo %p, refcnt %d",
- getpid (), session_index,
+ getpid (), session_index, mp->handle,
session->server_rx_fifo,
session->server_rx_fifo->refcnt,
session->server_tx_fifo, session->server_tx_fifo->refcnt);