summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/vcl-ldpreload/README.md43
-rw-r--r--extras/vcl-ldpreload/env.sh4
-rw-r--r--extras/vcl-ldpreload/src/.gitignore17
-rw-r--r--extras/vcl-ldpreload/src/Makefile.am62
-rw-r--r--extras/vcl-ldpreload/src/configure.ac151
-rw-r--r--extras/vcl-ldpreload/src/libvcl-ldpreload.am31
-rw-r--r--extras/vcl-ldpreload/src/vcl-ldpreload.mk9
-rwxr-xr-xextras/vcl-ldpreload/test/common/nginx_test.sh13
-rwxr-xr-xextras/vcl-ldpreload/test/curl_test.sh10
-rwxr-xr-xextras/vcl-ldpreload/test/wget_test.sh10
-rw-r--r--src/Makefile.am1
-rw-r--r--src/uri.am40
-rw-r--r--src/vcl.am65
-rw-r--r--src/vcl/sock_test.h (renamed from src/uri/sock_test.h)0
-rw-r--r--src/vcl/sock_test_client.c (renamed from src/uri/sock_test_client.c)2
-rw-r--r--src/vcl/sock_test_server.c (renamed from src/uri/sock_test_server.c)2
-rw-r--r--src/vcl/vcl_test_client.c (renamed from src/uri/vcl_test_client.c)4
-rw-r--r--src/vcl/vcl_test_server.c (renamed from src/uri/vcl_test_server.c)4
-rw-r--r--src/vcl/vcom.c (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.c)15
-rw-r--r--src/vcl/vcom.h (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.h)2
-rw-r--r--src/vcl/vcom_glibc_socket.h (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h)0
-rw-r--r--src/vcl/vcom_socket.c (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c)74
-rw-r--r--src/vcl/vcom_socket.h (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.h)3
-rw-r--r--src/vcl/vcom_socket_wrapper.c (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.c)2
-rw-r--r--src/vcl/vcom_socket_wrapper.h (renamed from extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.h)0
-rw-r--r--src/vcl/vppcom.c (renamed from src/uri/vppcom.c)2
-rw-r--r--src/vcl/vppcom.h (renamed from src/uri/vppcom.h)0
-rw-r--r--src/vcl/vppcom_test.conf (renamed from src/uri/vppcom_test.conf)0
-rwxr-xr-xtest/scripts/socket_test.sh15
29 files changed, 157 insertions, 424 deletions
diff --git a/extras/vcl-ldpreload/README.md b/extras/vcl-ldpreload/README.md
index 0b5378e9b48..e9026c1aae5 100644
--- a/extras/vcl-ldpreload/README.md
+++ b/extras/vcl-ldpreload/README.md
@@ -1,52 +1,27 @@
# vcl-ldpreload a LD_PRELOAD library that uses the VPP Communications Library (VCL).
User can LD_PRELOAD any application that uses POSIX socket API.
-This library internally uses libvppcom.so library from VPP project.
+NOTE: The sources have been moved to .../vpp/src/vcl and libvcl_ldpreload.so
+ libvcl-ldpreload.so is built with VPP and can be found in
+ .../vpp/build-root/install-vpp[_debug]-native/vpp/lib64
## HowTo
-If VPP is not installed, but rather built in a separate directory, you can use the VPP_DIR 'configure' argument.
-```bash
-# 1. Set environment variables for source
-cd vpp/extras/vcl-ldpreload
-source ./env.sh
-
-# 2. Change to VPP source directory and build
-- Change director and modify uri.am to enable socket_test program
-
-cd $VPP_DIR
-perl -pi -e 's/noinst_PROGRAMS/bin_PROGRAMS/g' $VPP_DIR/src/uri.am
-
-- Build VPP release
-
-make install-dep wipe-release bootstrap dpdk-install-dev build-release
-
-# 2. Build LD_PRELOAD library against VPP build above
-## This does not install the LD_PRELOAD library in your system.
-## Instead it will be referenced from the build directory set in VCL_LDPRELOAD_LIB
-
-cd $LDP_DIR/vcl-ldpreload/src
-autoreconf -i -f
-./configure VPP_DIR=$VPP_DIR
-make
-```bash
-
-
-# 3. Running the demo
+# 1. Running the demo
## Run test script without parameters to see help menu:
-cd $VPP_DIR/test/scripts
-./socket_test.sh
+export WS_ROOT=<top level vpp git repo dir> (e.g. /scratch/my_name/vpp)
+$WS_ROOT/test/scripts/socket_test.sh
-# 4. Docker iPerf examples.
+# 2. Docker iPerf examples.
## These launch xterms. To quit, close xterms and run following docker kill cmd (WARNING: This will kill all docker containers!) 'docker kill $(docker ps -q)'
## Docker iPerf using default Linux Bridge
-./socket_test.sh -bi docker-kernel
+$WS_ROOT/test/scripts/socket_test.sh -bi docker-kernel
## Docker iPerf using VPP
-./socket_test.sh -bi docker-preload
+$WS_ROOT/test/scripts/socket_test.sh -bi docker-preload
diff --git a/extras/vcl-ldpreload/env.sh b/extras/vcl-ldpreload/env.sh
deleted file mode 100644
index eb8aab801b0..00000000000
--- a/extras/vcl-ldpreload/env.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-export VPP_DIR=$WS_ROOT
-export LDP_DIR=$WS_ROOT/extras/vcl-ldpreload
-export LDP_TEST_DIR=$LDP_DIR/test
-export VCL_LDPRELOAD_LIB_DIR=$LDP_DIR/src/.libs
diff --git a/extras/vcl-ldpreload/src/.gitignore b/extras/vcl-ldpreload/src/.gitignore
deleted file mode 100644
index 95781235ad5..00000000000
--- a/extras/vcl-ldpreload/src/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-*.m4
-autom4te.cache
-compile
-config.*
-configure
-depcomp
-install-sh
-ltmain.sh
-missing
-Makefile.in
-Makefile
-*.o
-*.l[oa]*
-*.Plo
-*.dirstamp
-*.so*
-libtool
diff --git a/extras/vcl-ldpreload/src/Makefile.am b/extras/vcl-ldpreload/src/Makefile.am
deleted file mode 100644
index a1317696678..00000000000
--- a/extras/vcl-ldpreload/src/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-###############################################################################
-# Global Defines
-###############################################################################
-
-AUTOMAKE_OPTIONS = foreign subdir-objects
-ACLOCAL_AMFLAGS = -I m4
-AM_LIBTOOLFLAGS = --quiet
-
-AM_CFLAGS = -Wall -fstack-protector -fPIC -Werror -g -DFORTIFY_SOURCE=2
-AM_LDFLAGS = -shared
-
-if VPP_DEBUG
-AM_CFLAGS += -O0 -DCLIB_DEBUG
-vpp_build = vpp_debug-native
-else
-AM_CFLAGS += -O2
-vpp_build = vpp-native
-endif
-
-if VCL_LDPRELOAD_DEBUG
-AM_CFLAGS += -ggdb '-DVCOM_DEBUG=1'
-else
-AM_CFLAGS += -Wall '-DVCOM_DEBUG=0'
-endif
-
-if VPP_DIR_SET
-vpp_install_dir = @VPP_DIR@/build-root/install-$(vpp_build)/vpp
-AM_CFLAGS += -I$(vpp_install_dir)/include/
-AM_LDFLAGS += -L$(vpp_install_dir)/lib64/
-endif
-
-
-AM_LDFLAGS += -lvppcom -lvppinfra
-
-SUBDIRS = .
-noinst_HEADERS =
-dist_bin_SCRIPTS =
-lib_LTLIBRARIES =
-BUILT_SOURCES =
-CLEANFILES =
-
-
-###############################################################################
-# Components
-###############################################################################
-
-include libvcl-ldpreload.am
-
-
diff --git a/extras/vcl-ldpreload/src/configure.ac b/extras/vcl-ldpreload/src/configure.ac
deleted file mode 100644
index cee7c95add0..00000000000
--- a/extras/vcl-ldpreload/src/configure.ac
+++ /dev/null
@@ -1,151 +0,0 @@
-AC_INIT([vcl-ldpreload], [1.0], [vpp-dev@fd.io])
-LT_INIT
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE([subdir-objects])
-AM_SILENT_RULES([yes])
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_MACRO_DIR([m4])
-
-AC_PROG_CC
-AM_PROG_AS
-AM_PROG_LIBTOOL
-AC_PROG_YACC
-AM_PATH_PYTHON
-
-AC_ARG_VAR(VPP_DIR,[ vpp build directory ])
-AM_CONDITIONAL([VPP_DIR_SET], [test ! -z "$VPP_DIR"])
-
-###############################################################################
-# Macros
-###############################################################################
-
-AC_DEFUN([ENABLE_ARG],
-[
- AC_ARG_ENABLE($1,
- AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
- [enable_$1=yes n_enable_$1=1],
- [enable_$1=no n_enable_$1=0])
- AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
- m4_append([list_of_enabled], [$1], [, ])
-])
-
-AC_DEFUN([DISABLE_ARG],
-[
- AC_ARG_ENABLE($1,
- AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
- [enable_$1=no n_enable_$1=0],
- [enable_$1=yes n_enable_$1=1])
- AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
- m4_append([list_of_enabled], [$1], [, ])
-])
-
-AC_DEFUN([WITH_ARG],
-[
- AC_ARG_WITH($1,
- AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
- [with_$1=yes n_with_$1=1],
- [with_$1=no n_with_$1=0])
- AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
- m4_append([list_of_with], [$1], [, ])
-])
-
-AC_DEFUN([WITHOUT_ARG],
-[
- AC_ARG_WITH($1,
- AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
- [with_$1=no n_with_$1=0],
- [with_$1=yes n_with_$1=1])
- AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
- m4_append([list_of_with], [$1], [, ])
-])
-
-
-AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
-
-
-###############################################################################
-# configure arguments
-###############################################################################
-
-# --enable-X
-
-AC_ARG_ENABLE([vpp-debug],
-[ --enable-vpp-debug Use vpp debug native build libraries],
- [if test x$enableval = xyes; then
- AC_DEFINE(VPP_DEBUG, 1, [Define this to use vpp debug native build libraries.])
- vpp_debug=true
- fi], [vpp_debug=false])
-AM_CONDITIONAL([VPP_DEBUG], [test x$vpp_debug = xtrue])
-
-AC_ARG_ENABLE([vcl-ldpreload-debug],
-[ --enable-vcl-ldpreload-debug Turn on vcl-ldpreload debugging],
- [if test x$enableval = xyes; then
- AC_DEFINE(VCL_LDPRELOAD_DEBUG, 1, [Define this to enable vcl-ldpreload debug.])
- vcl_ldpreload_debug=true
- fi], [vcl_ldpreload_debug=false])
-AM_CONDITIONAL([VCL_LDPRELOAD_DEBUG], [test x$vcl_ldpreload_debug = xtrue])
-
-# --disable-X
-
-# --with-X
-
-# --without-X
-
-AC_ARG_WITH(unix,
- AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
- [],
- [case $host_os in
- darwin* | linux*) with_unix=yes;;
- *) with_unix=no;;
- esac])
-
-AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
-
-
-###############################################################################
-# Substitutions and defines
-###############################################################################
-
-
-# Silence following noise:
-# ar: `u' modifier ignored since `D' is the default (see `U')
-AR_FLAGS=cr
-AC_SUBST(AR_FLAGS)
-
-
-###############################################################################
-# Dependency checks
-###############################################################################
-
-###############################################################################
-# Output
-###############################################################################
-
-AC_OUTPUT
-
-AC_MSG_RESULT([==============================================================================])
-PRINT_VAL([version], $PACKAGE $VERSION)
-PRINT_VAL([prefix], ${prefix})
-PRINT_VAL([exec_prefix], ${exec_prefix})
-PRINT_VAL([libdir], ${libdir})
-PRINT_VAL([includedir], ${includedir})
-PRINT_VAL([CFLAGS], ${CFLAGS})
-PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
-PRINT_VAL([LDFLAGS], ${LDFLAGS})
-
-AC_MSG_RESULT([])
-AC_MSG_RESULT([with:])
-m4_foreach([x], m4_dquote(list_of_with), [
- AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
-])
-
-AC_MSG_RESULT([])
-AC_MSG_RESULT([enabled:])
-m4_foreach([x], m4_dquote(list_of_enabled), [
- AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
-])
-
-AC_MSG_RESULT([])
-AC_MSG_RESULT([==============================================================================])
-
-
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload.am b/extras/vcl-ldpreload/src/libvcl-ldpreload.am
deleted file mode 100644
index 0d2fcb589b1..00000000000
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload.am
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-lib_LTLIBRARIES += libvcl_ldpreload.la
-
-libvcl_ldpreload_la_SOURCES =
-nobase_include_HEADERS =
-
-libvcl_ldpreload_la_LIBADD = -lvppinfra -lvppcom -lpthread
-
-libvcl_ldpreload_la_SOURCES += \
- libvcl-ldpreload/vcom_socket_wrapper.c \
- libvcl-ldpreload/vcom.c \
- libvcl-ldpreload/vcom_socket.c
-
-nobase_include_HEADERS += \
- libvcl-ldpreload/vcom_socket_wrapper.h \
- libvcl-ldpreload/vcom_glibc_socket.h \
- libvcl-ldpreload/vcom.h \
- libvcl-ldpreload/vcom_socket.h
-
diff --git a/extras/vcl-ldpreload/src/vcl-ldpreload.mk b/extras/vcl-ldpreload/src/vcl-ldpreload.mk
deleted file mode 100644
index 001308a6edd..00000000000
--- a/extras/vcl-ldpreload/src/vcl-ldpreload.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-vcl_ldpreload_configure_depend = vpp-install
-
-vcl_ldpreload_CPPFLAGS = $(call installed_includes_fn, \
- vppinfra \
- uri)
-
-vcl_ldpreload_LDFLAGS = $(call installed_libs_fn, \
- vppinfra \
- uri)
diff --git a/extras/vcl-ldpreload/test/common/nginx_test.sh b/extras/vcl-ldpreload/test/common/nginx_test.sh
index 3875d9f579a..6d43abf2d10 100755
--- a/extras/vcl-ldpreload/test/common/nginx_test.sh
+++ b/extras/vcl-ldpreload/test/common/nginx_test.sh
@@ -29,19 +29,22 @@ if [ -z "$WS_ROOT" ] ; then
echo " Please set WS_ROOT to VPP workspace root directory." >&2
exit 1
fi
-if [ -z "$LDP_DIR" ] ; then
- echo "WARNING: LDP_DIR environment variable is not set!"
- echo " Sourcing $WS_ROOT/extras/vcl-ldpreload/env.sh"
- source $WS_ROOT/extras/vcl-ldpreload/env.sh
+
+if [ -z "$VCL_LDPRELOAD_LIB_DIR" ] ; then
+ echo "ERROR: VCL_LDPRELOAD_LIB_DIR environment variable not set!" >&2
+ echo " Please set VCL_LDPRELOAD_LIB_DIR to " >&2
+ echo " $WS_ROOT/build-root/install-vpp[_debug]-native/vpp/lib64." >&2
+ exit 1
fi
TEST_APP="${TEST_APP:-curl}"
+LDP_DIR="${WS_ROOT}/extras/vcl-ldpreload"
LDP_TEST_DIR="${LDP_TEST_DIR:-${LDP_DIR}/test}"
LDP_LIB="${LDP_LIB:-${VCL_LDPRELOAD_LIB_DIR}/libvcl_ldpreload.so.0.0.0}"
if [ ! -f "$LDP_LIB" ] ; then
echo "ERROR: Missing VCL-LDPRELOAD Library: $LDP_LIB"
- echo " See $LDP_DIR/README.md for build instructions!"
+ echo " Run 'cd $WS_ROOT; make build[-release] ' !"
exit 1
fi
diff --git a/extras/vcl-ldpreload/test/curl_test.sh b/extras/vcl-ldpreload/test/curl_test.sh
index c0d88d7af4a..24b0c6e06d1 100755
--- a/extras/vcl-ldpreload/test/curl_test.sh
+++ b/extras/vcl-ldpreload/test/curl_test.sh
@@ -13,12 +13,10 @@ if [ -z "$WS_ROOT" ] ; then
echo " Please set WS_ROOT to VPP workspace root directory." >&2
exit 1
fi
-if [ -z "$LDP_DIR" ] ; then
- echo "WARNING: LDP_DIR environment variable is not set!"
- echo " Sourcing $WS_ROOT/extras/vcl-ldpreload/env.sh"
- source $WS_ROOT/extras/vcl-ldpreload/env.sh
-fi
-TEST_APP="${TEST_APP:-curl}"
+LDP_DIR="${WS_ROOT}/extras/vcl-ldpreload"
LDP_TEST_DIR="${LDP_TEST_DIR:-${LDP_DIR}/test}"
+VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-${WS_ROOT}/build-root/install-vpp_debug-native/vpp/lib64}"
+
+TEST_APP="${TEST_APP:-curl}"
source $LDP_TEST_DIR/common/nginx_test.sh
diff --git a/extras/vcl-ldpreload/test/wget_test.sh b/extras/vcl-ldpreload/test/wget_test.sh
index f85065b0d9b..a2663d71158 100755
--- a/extras/vcl-ldpreload/test/wget_test.sh
+++ b/extras/vcl-ldpreload/test/wget_test.sh
@@ -13,12 +13,10 @@ if [ -z "$WS_ROOT" ] ; then
echo " Please set WS_ROOT to VPP workspace root directory." >&2
exit 1
fi
-if [ -z "$LDP_DIR" ] ; then
- echo "WARNING: LDP_DIR environment variable is not set!"
- echo " Sourcing $WS_ROOT/extras/vcl-ldpreload/env.sh"
- source $WS_ROOT/extras/vcl-ldpreload/env.sh
-fi
-TEST_APP="${TEST_APP:-wget}"
+LDP_DIR="${WS_ROOT}/extras/vcl-ldpreload"
LDP_TEST_DIR="${LDP_TEST_DIR:-${LDP_DIR}/test}"
+VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-$WS_ROOT/build-root/install-vpp_debug-native/vpp/lib64}"
+
+TEST_APP="${TEST_APP:-wget}"
source $LDP_TEST_DIR/common/nginx_test.sh
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b35e50c37a..c1b6b0e9d89 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,6 +68,7 @@ include vnet.am
include vpp.am
include vpp-api-test.am
include uri.am
+include vcl.am
SUBDIRS += plugins
diff --git a/src/uri.am b/src/uri.am
index 660f897dd71..176eac88859 100644
--- a/src/uri.am
+++ b/src/uri.am
@@ -11,34 +11,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-lib_LTLIBRARIES += libvppcom.la
-
-libvppcom_la_SOURCES =
-libvppcom_la_DEPENDENCIES = \
- libvppinfra.la \
- libvlib.la \
- libsvmdb.la \
- libsvm.la \
- libvlibmemory.la \
- libvlibmemoryclient.la
-
-libvppcom_la_LIBADD = $(libvppcom_la_DEPENDENCIES) -lpthread
-
-libvppcom_la_SOURCES += \
- uri/vppcom.c
-
-nobase_include_HEADERS += \
- uri/vppcom.h
-
noinst_PROGRAMS += \
uri_udp_test \
uri_tcp_test \
uri_socket_test \
- uri_socket_server \
- vcl_test_server \
- vcl_test_client \
- sock_test_server \
- sock_test_client
+ uri_socket_server
uri_udp_test_SOURCES = uri/uri_udp_test.c
uri_udp_test_LDADD = libvlibmemoryclient.la libsvm.la \
@@ -49,19 +26,8 @@ uri_tcp_test_LDADD = libvlibmemoryclient.la libsvm.la \
libvppinfra.la -lpthread -lm -lrt
uri_socket_test_SOURCES = uri/uri_socket_test.c
-uri_socket_test_LDADD = libvppinfra.la -lpthread -lm -lrt
+uri_socket_test_LDADD = libvppinfra.la libvcl_ldpreload.la -lpthread -lm -lrt
uri_socket_server_SOURCES = uri/uri_socket_server.c
-uri_socket_server_LDADD = libvppinfra.la -lpthread -lm -lrt
-
-vcl_test_server_SOURCES = uri/vcl_test_server.c
-vcl_test_server_LDADD = libvppcom.la
-
-vcl_test_client_SOURCES = uri/vcl_test_client.c
-vcl_test_client_LDADD = libvppcom.la
-
-sock_test_server_SOURCES = uri/sock_test_server.c
-sock_test_client_SOURCES = uri/sock_test_client.c
+uri_socket_server_LDADD = libvppinfra.la libvcl_ldpreload.la -lpthread -lm -lrt
-nobase_include_HEADERS += \
- uri/sock_test.h
diff --git a/src/vcl.am b/src/vcl.am
new file mode 100644
index 00000000000..de8b4da7e27
--- /dev/null
+++ b/src/vcl.am
@@ -0,0 +1,65 @@
+# Copyright (c) 2017 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+lib_LTLIBRARIES += libvppcom.la libvcl_ldpreload.la
+
+libvppcom_la_SOURCES =
+libvcl_ldpreload_la_SOURCES =
+libvppcom_la_DEPENDENCIES = \
+ libvppinfra.la \
+ libvlib.la \
+ libsvmdb.la \
+ libsvm.la \
+ libvlibmemory.la \
+ libvlibmemoryclient.la
+
+libvcl_ldpreload_la_DEPENDENCIES = $(libvppcom_la_DEPENDENCIES)
+
+libvppcom_la_LIBADD = $(libvppcom_la_DEPENDENCIES) -lpthread
+libvcl_ldpreload_la_LIBADD = $(libvcl_ldpreload_la_DEPENDENCIES) -lpthread
+
+libvppcom_la_SOURCES += \
+ vcl/vppcom.c
+
+nobase_include_HEADERS += \
+ vcl/vppcom.h
+
+libvcl_ldpreload_la_SOURCES += \
+ vcl/vcom_socket_wrapper.c \
+ vcl/vcom.c \
+ vcl/vcom_socket.c \
+ vcl/vppcom.c
+
+nobase_include_HEADERS += \
+ vcl/vcom_socket_wrapper.h \
+ vcl/vcom_glibc_socket.h \
+ vcl/vcom.h \
+ vcl/vcom_socket.h
+
+noinst_PROGRAMS += \
+ vcl_test_server \
+ vcl_test_client \
+ sock_test_server \
+ sock_test_client
+
+vcl_test_server_SOURCES = vcl/vcl_test_server.c
+vcl_test_server_LDADD = libvppcom.la
+
+vcl_test_client_SOURCES = vcl/vcl_test_client.c
+vcl_test_client_LDADD = libvppcom.la
+
+sock_test_server_SOURCES = vcl/sock_test_server.c
+sock_test_client_SOURCES = vcl/sock_test_client.c
+
+nobase_include_HEADERS += \
+ vcl/sock_test.h
diff --git a/src/uri/sock_test.h b/src/vcl/sock_test.h
index 281ba6fd473..281ba6fd473 100644
--- a/src/uri/sock_test.h
+++ b/src/vcl/sock_test.h
diff --git a/src/uri/sock_test_client.c b/src/vcl/sock_test_client.c
index b53f8f2230f..40ba043adae 100644
--- a/src/uri/sock_test_client.c
+++ b/src/vcl/sock_test_client.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <time.h>
#include <arpa/inet.h>
-#include <uri/sock_test.h>
+#include <vcl/sock_test.h>
typedef struct
{
diff --git a/src/uri/sock_test_server.c b/src/vcl/sock_test_server.c
index 79e762def62..753a7da790c 100644
--- a/src/uri/sock_test_server.c
+++ b/src/vcl/sock_test_server.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <time.h>
#include <ctype.h>
-#include <uri/sock_test.h>
+#include <vcl/sock_test.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/src/uri/vcl_test_client.c b/src/vcl/vcl_test_client.c
index 7ab8824fb15..e1a4c6b74d4 100644
--- a/src/uri/vcl_test_client.c
+++ b/src/vcl/vcl_test_client.c
@@ -15,8 +15,8 @@
#define VCL_TEST
-#include <uri/vppcom.h>
-#include <uri/sock_test_client.c>
+#include <vcl/vppcom.h>
+#include <vcl/sock_test_client.c>
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/uri/vcl_test_server.c b/src/vcl/vcl_test_server.c
index 660d705e037..e91d2ecd7c8 100644
--- a/src/uri/vcl_test_server.c
+++ b/src/vcl/vcl_test_server.c
@@ -15,8 +15,8 @@
#define VCL_TEST
-#include <uri/vppcom.h>
-#include <uri/sock_test_server.c>
+#include <vcl/vppcom.h>
+#include <vcl/sock_test_server.c>
/*
* fd.io coding-style-patch-verification: ON
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.c b/src/vcl/vcom.c
index 6ddb245b421..6d98fdb75c0 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.c
+++ b/src/vcl/vcom.c
@@ -21,12 +21,12 @@
#include <stdarg.h>
#include <sys/resource.h>
-#include <libvcl-ldpreload/vcom_socket_wrapper.h>
-#include <libvcl-ldpreload/vcom.h>
+#include <vcl/vcom_socket_wrapper.h>
+#include <vcl/vcom.h>
#include <sys/time.h>
-#include <uri/vppcom.h>
-#include <libvcl-ldpreload/vcom_socket.h>
+#include <vcl/vppcom.h>
+#include <vcl/vcom_socket.h>
/* GCC have printf type attribute check. */
#ifdef HAVE_FUNCTION_ATTRIBUTE_FORMAT
@@ -889,11 +889,13 @@ typedef __u64 timeu64_t;
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
+#ifdef VCOM_USE_TIMESPEC_EQUAL
static inline int
timespec_equal (const struct timespec *a, const struct timespec *b)
{
return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
}
+#endif
/*
* lhs < rhs: return <0
@@ -910,6 +912,7 @@ timespec_compare (const struct timespec *lhs, const struct timespec *rhs)
return lhs->tv_nsec - rhs->tv_nsec;
}
+#ifdef VCOM_USE_TIMEVAL_COMPARE
static inline int
timeval_compare (const struct timeval *lhs, const struct timeval *rhs)
{
@@ -919,11 +922,11 @@ timeval_compare (const struct timeval *lhs, const struct timeval *rhs)
return 1;
return lhs->tv_usec - rhs->tv_usec;
}
+#endif
extern void set_normalized_timespec (struct timespec *ts, time_t sec,
s64 nsec);
-
static inline struct timespec
timespec_add (struct timespec lhs, struct timespec rhs)
{
@@ -3020,7 +3023,7 @@ vcom_poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
rv = -errno;
goto poll_done;
}
- if (__nfds >= nofile_limit.rlim_cur || __nfds < 0)
+ if (__nfds >= nofile_limit.rlim_cur)
{
rv = -EINVAL;
goto poll_done;
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.h b/src/vcl/vcom.h
index 5871b5205b0..da9dc5f7bf4 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom.h
+++ b/src/vcl/vcom.h
@@ -22,7 +22,7 @@
#define VCOM_DEBUG 0
#endif
-#include <libvcl-ldpreload/vcom_glibc_socket.h>
+#include <vcl/vcom_glibc_socket.h>
#define MAX_VCOM_APP_NAME 256
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h b/src/vcl/vcom_glibc_socket.h
index 4eb60fb65c7..4eb60fb65c7 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h
+++ b/src/vcl/vcom_glibc_socket.h
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c b/src/vcl/vcom_socket.c
index 7b5f6c84f83..8806ebd011a 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c
+++ b/src/vcl/vcom_socket.c
@@ -24,11 +24,11 @@
#include <vppinfra/hash.h>
#include <vppinfra/pool.h>
-#include <libvcl-ldpreload/vcom_socket.h>
-#include <libvcl-ldpreload/vcom_socket_wrapper.h>
-#include <libvcl-ldpreload/vcom.h>
+#include <vcl/vcom_socket.h>
+#include <vcl/vcom_socket_wrapper.h>
+#include <vcl/vcom.h>
-#include <uri/vppcom.h>
+#include <vcl/vppcom.h>
/*
@@ -446,7 +446,7 @@ vcom_socket_read (int __fd, void *__buf, size_t __nbytes)
if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
return -EINVAL;
- if (!__buf || __nbytes < 0)
+ if (!__buf)
{
return -EINVAL;
}
@@ -485,6 +485,7 @@ vcom_socket_readv (int __fd, const struct iovec * __iov, int __iovcnt)
uword *p;
vcom_socket_t *vsock;
ssize_t total = 0, len = 0;
+ int i;
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
@@ -501,7 +502,7 @@ vcom_socket_readv (int __fd, const struct iovec * __iov, int __iovcnt)
return -EINVAL;
/* Sanity check */
- for (int i = 0; i < __iovcnt; ++i)
+ for (i = 0; i < __iovcnt; ++i)
{
if (SSIZE_MAX - len < __iov[i].iov_len)
return -EINVAL;
@@ -519,7 +520,7 @@ vcom_socket_readv (int __fd, const struct iovec * __iov, int __iovcnt)
{
do
{
- for (int i = 0; i < __iovcnt; ++i)
+ for (i = 0; i < __iovcnt; ++i)
{
rv = vppcom_session_read (vsock->sid, __iov[i].iov_base,
__iov[i].iov_len);
@@ -539,7 +540,7 @@ vcom_socket_readv (int __fd, const struct iovec * __iov, int __iovcnt)
}
/* is non blocking */
- for (int i = 0; i < __iovcnt; ++i)
+ for (i = 0; i < __iovcnt; ++i)
{
rv = vppcom_session_read (vsock->sid, __iov[i].iov_base,
__iov[i].iov_len);
@@ -572,6 +573,11 @@ vcom_socket_write (int __fd, const void *__buf, size_t __n)
uword *p;
vcom_socket_t *vsock;
+ if (!__buf)
+ {
+ return -EINVAL;
+ }
+
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
return -EBADF;
@@ -583,11 +589,6 @@ vcom_socket_write (int __fd, const void *__buf, size_t __n)
if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
return -EINVAL;
- if (!__buf || __n < 0)
- {
- return -EINVAL;
- }
-
rv = vppcom_session_write (vsock->sid, (void *) __buf, __n);
return rv;
}
@@ -600,6 +601,7 @@ vcom_socket_writev (int __fd, const struct iovec * __iov, int __iovcnt)
vcom_socket_main_t *vsm = &vcom_socket_main;
uword *p;
vcom_socket_t *vsock;
+ int i;
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
@@ -615,7 +617,7 @@ vcom_socket_writev (int __fd, const struct iovec * __iov, int __iovcnt)
if (__iov == 0 || __iovcnt == 0 || __iovcnt > IOV_MAX)
return -EINVAL;
- for (int i = 0; i < __iovcnt; ++i)
+ for (i = 0; i < __iovcnt; ++i)
{
rv = vppcom_session_write (vsock->sid, __iov[i].iov_base,
__iov[i].iov_len);
@@ -1108,10 +1110,6 @@ vcom_socket_select (int vcom_nfds, fd_set * __restrict vcom_readfds,
{
return vcom_nsid;
}
- if (vcom_nsid_fds < 0)
- {
- return -EINVAL;
- }
rv = vppcom_select (vcom_nsid_fds,
vcom_readfds ? (unsigned long *) &vcom_rd_sid_fds :
@@ -1311,11 +1309,6 @@ vcom_socket_getsockname (int __fd, __SOCKADDR_ARG __addr,
if (!__addr || !__len)
return -EFAULT;
- if (*__len < 0)
- {
- return -EINVAL;
- }
-
vppcom_endpt_t ep;
ep.ip = (u8 *) & ((const struct sockaddr_in *) __addr)->sin_addr;
rv = vcom_session_getsockname (vsock->sid, &ep);
@@ -1423,11 +1416,6 @@ vcom_socket_getpeername (int __fd, __SOCKADDR_ARG __addr,
if (!__addr || !__len)
return -EFAULT;
- if (*__len < 0)
- {
- return -EINVAL;
- }
-
vppcom_endpt_t ep;
ep.ip = (u8 *) & ((const struct sockaddr_in *) __addr)->sin_addr;
rv = vcom_session_getpeername (vsock->sid, &ep);
@@ -1539,6 +1527,11 @@ vcom_socket_sendto (int __fd, const void *__buf, size_t __n,
uword *p;
vcom_socket_t *vsock;
+ if (!__buf)
+ {
+ return -EINVAL;
+ }
+
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
return -EBADF;
@@ -1547,7 +1540,7 @@ vcom_socket_sendto (int __fd, const void *__buf, size_t __n,
if (!vsock)
return -ENOTSOCK;
- if ((vsock->type != SOCKET_TYPE_VPPCOM_BOUND) || !__buf || __n < 0)
+ if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
{
return -EINVAL;
}
@@ -1563,7 +1556,7 @@ vcom_socket_sendto (int __fd, const void *__buf, size_t __n,
}
else
{
- if (!__addr || __addr_len < 0)
+ if (!__addr)
{
return -EDESTADDRREQ;
}
@@ -1601,6 +1594,11 @@ vcom_socket_recvfrom (int __fd, void *__restrict __buf, size_t __n,
uword *p;
vcom_socket_t *vsock;
+ if (!__buf || !__addr || !__addr_len)
+ {
+ return -EINVAL;
+ }
+
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
return -EBADF;
@@ -1609,8 +1607,7 @@ vcom_socket_recvfrom (int __fd, void *__restrict __buf, size_t __n,
if (!vsock)
return -ENOTSOCK;
- if ((vsock->type != SOCKET_TYPE_VPPCOM_BOUND) ||
- !__buf || __n < 0 || !__addr || !__addr_len || (__addr_len < 0))
+ if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
{
return -EINVAL;
}
@@ -1766,11 +1763,6 @@ vcom_socket_getsockopt (int __fd, int __level, int __optname,
if (!__optval && !__optlen)
return -EFAULT;
- if (*__optlen < 0)
- {
- return -EINVAL;
- }
-
switch (__level)
{
/* handle options at socket level */
@@ -1829,7 +1821,9 @@ vcom_socket_getsockopt (int __fd, int __level, int __optname,
case SO_BUSY_POLL:
#endif
case SO_MAX_PACING_RATE:
+#ifdef SO_INCOMING_CPU
case SO_INCOMING_CPU:
+#endif
rv = libc_getsockopt (__fd, __level, __optname, __optval, __optlen);
if (rv != 0)
{
@@ -1952,7 +1946,7 @@ vcom_socket_setsockopt (int __fd, int __level, int __optname,
if (!__optval)
return -EFAULT;
- if ((__optlen < 0) || (__optlen < sizeof (int)))
+ if (__optlen < sizeof (int))
return -EINVAL;
switch (__level)
@@ -2045,7 +2039,9 @@ vcom_socket_setsockopt (int __fd, int __level, int __optname,
case SO_BUSY_POLL:
#endif
case SO_MAX_PACING_RATE:
+#ifdef SO_INCOMING_CPU
case SO_INCOMING_CPU:
+#endif
rv = libc_setsockopt (__fd, __level, __optname, __optval, __optlen);
if (rv != 0)
{
@@ -3000,7 +2996,7 @@ vcom_socket_poll_select_impl (struct pollfd *__fds, nfds_t __nfds,
struct timeval tv = {.tv_sec = 0,.tv_usec = 0 };
/* validate __nfds from select perspective */
- if (__nfds < 0 || __nfds > FD_SETSIZE)
+ if (__nfds > FD_SETSIZE)
{
rv = -EINVAL;
goto poll_done;
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.h b/src/vcl/vcom_socket.h
index 9dc18f58af2..4f5e4abfb15 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.h
+++ b/src/vcl/vcom_socket.h
@@ -18,8 +18,9 @@
#include <string.h>
-#include <libvcl-ldpreload/vcom_glibc_socket.h>
+#include <vcl/vcom_glibc_socket.h>
#include <vppinfra/types.h>
+#include <sys/socket.h>
#define INVALID_SESSION_ID (~0)
#define INVALID_FD (~0)
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.c b/src/vcl/vcom_socket_wrapper.c
index 9b961af6bad..19a775de99e 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.c
+++ b/src/vcl/vcom_socket_wrapper.c
@@ -63,7 +63,7 @@
#include <unistd.h>
#include <pthread.h>
-#include <libvcl-ldpreload/vcom_socket_wrapper.h>
+#include <vcl/vcom_socket_wrapper.h>
enum swrap_dbglvl_e
diff --git a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.h b/src/vcl/vcom_socket_wrapper.h
index 9e85ecf2b6c..9e85ecf2b6c 100644
--- a/extras/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket_wrapper.h
+++ b/src/vcl/vcom_socket_wrapper.h
diff --git a/src/uri/vppcom.c b/src/vcl/vppcom.c
index 24475b46606..0f30c60c803 100644
--- a/src/uri/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -20,7 +20,7 @@
#include <vlibmemory/api.h>
#include <vpp/api/vpe_msg_enum.h>
#include <vnet/session/application_interface.h>
-#include <uri/vppcom.h>
+#include <vcl/vppcom.h>
#include <vlib/unix/unix.h>
#include <vppinfra/vec_bootstrap.h>
diff --git a/src/uri/vppcom.h b/src/vcl/vppcom.h
index dd72986ec53..dd72986ec53 100644
--- a/src/uri/vppcom.h
+++ b/src/vcl/vppcom.h
diff --git a/src/uri/vppcom_test.conf b/src/vcl/vppcom_test.conf
index e5ac46363f8..e5ac46363f8 100644
--- a/src/uri/vppcom_test.conf
+++ b/src/vcl/vppcom_test.conf
diff --git a/test/scripts/socket_test.sh b/test/scripts/socket_test.sh
index 84133cc903b..35e9c0be67c 100755
--- a/test/scripts/socket_test.sh
+++ b/test/scripts/socket_test.sh
@@ -49,7 +49,6 @@ trap_signals="SIGINT SIGTERM EXIT"
VPP_GDB_CMDFILE="${VPP_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vpp}"
VPPCOM_CLIENT_GDB_CMDFILE="${VPPCOM_CLIENT_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vppcom_client}"
VPPCOM_SERVER_GDB_CMDFILE="${VPPCOM_SERVER_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vppcom_server}"
-VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-$WS_ROOT/extras/vcl-ldpreload/src/.libs}"
usage() {
cat <<EOF
@@ -136,7 +135,6 @@ while getopts ":hitlbcd6n:m:e:g:p:E:I:N:P:R:S:T:UBVX" opt; do
c) VPPCOM_CONF="${vppcom_conf_dir}vppcom_test.conf"
;;
d) title_dbg="-DEBUG"
- _debug="_debug"
vpp_dir=$vpp_debug_dir
lib64_dir=$lib64_debug_dir
;;
@@ -248,6 +246,8 @@ while ! [[ $run_test ]] && (( $# > 0 )) ; do
shift
done
+VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-$lib64_dir}"
+
if [ -z "$WS_ROOT" ] ; then
echo "ERROR: WS_ROOT environment variable not set!" >&2
echo " Please set WS_ROOT to VPP workspace root directory." >&2
@@ -260,14 +260,14 @@ if [[ "$(grep bin_PROGRAMS $WS_ROOT/src/uri.am)" = "" ]] ; then
fi
if [ ! -d $vpp_dir ] ; then
- echo "ERROR: Missing VPP$DEBUG bin directory!" >&2
+ echo "ERROR: Missing VPP$title_dbg bin directory!" >&2
echo " $vpp_dir" >&2
env_test_failed="true"
fi
if [[ $run_test =~ .*"_preload" ]] ; then
if [ ! -d $lib64_dir ] ; then
- echo "ERROR: Missing VPP$DEBUG lib64 directory!" >&2
+ echo "ERROR: Missing VPP$title_dbg lib64 directory!" >&2
echo " $lib64_dir" >&2
elif [ ! -d $VCL_LDPRELOAD_LIB_DIR ] ; then
echo "ERROR: Missing VCL LD_PRELOAD Library directory!" >&2
@@ -281,19 +281,19 @@ if [[ $run_test =~ .*"_preload" ]] ; then
fi
if [ ! -f $vpp_dir$vpp_app ] ; then
- echo "ERROR: Missing VPP$DEBUG Application!" >&2
+ echo "ERROR: Missing VPP$title_dbg Application!" >&2
echo " $vpp_dir$vpp_app" >&2
env_test_failed="true"
fi
if [ ! -f $vpp_dir$sock_srvr_app ] && [ ! $iperf3 -eq 1 ] ; then
- echo "ERROR: Missing$DEBUG Socket Server Application!" >&2
+ echo "ERROR: Missing$title_dbg Socket Server Application!" >&2
echo " $vpp_dir$sock_srvr_app" >&2
env_test_failed="true"
fi
if [ ! -f $vpp_dir$sock_clnt_app ] && [ ! $iperf3 -eq 1 ] ; then
- echo "ERROR: Missing$DEBUG Socket Client Application!" >&2
+ echo "ERROR: Missing$title_dbg Socket Client Application!" >&2
echo " $vpp_dir$sock_clnt_app" >&2
env_test_failed="true"
fi
@@ -361,6 +361,7 @@ else
clnt_app="$sock_clnt_app${sock_clnt_options} \$srvr_addr $sock_srvr_port"
fi
+
verify_no_vpp() {
local grep_for_vpp="ps -eaf|grep -v grep|grep \"bin/vpp\""