# 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
+++ /dev/null
-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
+++ /dev/null
-*.m4
-autom4te.cache
-compile
-config.*
-configure
-depcomp
-install-sh
-ltmain.sh
-missing
-Makefile.in
-Makefile
-*.o
-*.l[oa]*
-*.Plo
-*.dirstamp
-*.so*
-libtool
+++ /dev/null
-# 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
-
-
+++ /dev/null
-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([==============================================================================])
-
-
+++ /dev/null
-# 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
-
+++ /dev/null
-vcl_ldpreload_configure_depend = vpp-install
-
-vcl_ldpreload_CPPFLAGS = $(call installed_includes_fn, \
- vppinfra \
- uri)
-
-vcl_ldpreload_LDFLAGS = $(call installed_libs_fn, \
- vppinfra \
- uri)
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
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
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
include vpp.am
include vpp-api-test.am
include uri.am
+include vcl.am
SUBDIRS += plugins
# 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 \
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
--- /dev/null
+# 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
#include <stdio.h>
#include <time.h>
#include <arpa/inet.h>
-#include <uri/sock_test.h>
+#include <vcl/sock_test.h>
typedef struct
{
#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>
#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
#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
#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
#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
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)
{
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)
{
rv = -errno;
goto poll_done;
}
- if (__nfds >= nofile_limit.rlim_cur || __nfds < 0)
+ if (__nfds >= nofile_limit.rlim_cur)
{
rv = -EINVAL;
goto poll_done;
#define VCOM_DEBUG 0
#endif
-#include <libvcl-ldpreload/vcom_glibc_socket.h>
+#include <vcl/vcom_glibc_socket.h>
#define MAX_VCOM_APP_NAME 256
#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>
/*
if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
return -EINVAL;
- if (!__buf || __nbytes < 0)
+ if (!__buf)
{
return -EINVAL;
}
uword *p;
vcom_socket_t *vsock;
ssize_t total = 0, len = 0;
+ int i;
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
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;
{
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);
}
/* 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);
uword *p;
vcom_socket_t *vsock;
+ if (!__buf)
+ {
+ return -EINVAL;
+ }
+
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
return -EBADF;
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;
}
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)
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);
{
return vcom_nsid;
}
- if (vcom_nsid_fds < 0)
- {
- return -EINVAL;
- }
rv = vppcom_select (vcom_nsid_fds,
vcom_readfds ? (unsigned long *) &vcom_rd_sid_fds :
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);
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);
uword *p;
vcom_socket_t *vsock;
+ if (!__buf)
+ {
+ return -EINVAL;
+ }
+
p = hash_get (vsm->sockidx_by_fd, __fd);
if (!p)
return -EBADF;
if (!vsock)
return -ENOTSOCK;
- if ((vsock->type != SOCKET_TYPE_VPPCOM_BOUND) || !__buf || __n < 0)
+ if (vsock->type != SOCKET_TYPE_VPPCOM_BOUND)
{
return -EINVAL;
}
}
else
{
- if (!__addr || __addr_len < 0)
+ if (!__addr)
{
return -EDESTADDRREQ;
}
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;
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;
}
if (!__optval && !__optlen)
return -EFAULT;
- if (*__optlen < 0)
- {
- return -EINVAL;
- }
-
switch (__level)
{
/* handle options at socket level */
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)
{
if (!__optval)
return -EFAULT;
- if ((__optlen < 0) || (__optlen < sizeof (int)))
+ if (__optlen < sizeof (int))
return -EINVAL;
switch (__level)
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)
{
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;
#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)
#include <unistd.h>
#include <pthread.h>
-#include <libvcl-ldpreload/vcom_socket_wrapper.h>
+#include <vcl/vcom_socket_wrapper.h>
enum swrap_dbglvl_e
#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>
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
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
;;
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
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
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
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\""