summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--0001-build-package-for-hyperscan.patch20
-rw-r--r--CMakeLists.txt14
-rw-r--r--Makefile25
-rw-r--r--src/dpi.c7
-rw-r--r--src/dpi_api.c11
5 files changed, 34 insertions, 43 deletions
diff --git a/0001-build-package-for-hyperscan.patch b/0001-build-package-for-hyperscan.patch
index 19b173a..f3ec4b2 100644
--- a/0001-build-package-for-hyperscan.patch
+++ b/0001-build-package-for-hyperscan.patch
@@ -92,12 +92,12 @@ index 0000000..2582990
+#Dependencies to build
+RPM_DEPENDS = curl autoconf automake ccache cmake3 wget gcc gcc-c++ git gtest gtest-devel ragel python-sphinx boost169-devel
+
-+.PHONY: help install-dep build build-package clean distclean
++.PHONY: help install-dep build build-install-package clean distclean
+
+help:
+ @echo "Make Targets:"
+ @echo " install-dep - install software dependencies"
-+ @echo " build-package - build rpm or deb package"
++ @echo " build-install-package - build rpm or deb package"
+ @echo " clean - clean all build"
+ @echo " distclean - remove all build directory"
+
@@ -115,19 +115,19 @@ index 0000000..2582990
+endif
+
+
-+build-package:
++build-install-package:
+ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
+ @mkdir -p $(BR)/build-package/; cd $(BR)/build-package/;\
-+ $(cmake) -DCMAKE_BUILD_TYPE=ReleaseĀ \
-+ -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/ -DBUILD_STATIC_AND_SHARED=ON;\
-+ make package -j30;
++ $(cmake) -DCMAKE_BUILD_TYPE=ReleaseĀ \
++ -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/ -DBUILD_STATIC_AND_SHARED=ON;\
++ make package; yes|dpkg -i hyperscan*.deb
+else ifeq ($(OS_ID),centos)
+ @rm -rf $(BR)/../include/boost;\
-+ ln -vs /usr/include/boost169/boost $(BR)/../include/boost
++ ln -vs /usr/include/boost169/boost $(BR)/../include/boost
+ @mkdir -p $(BR)/build-package/; cd $(BR)/build-package/;\
-+ $(cmake) -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_AND_SHARED=ON \
-+ -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/;\
-+ make package -j$(nproc);
++ $(cmake) -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_AND_SHARED=ON \
++ -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/;\
++ make package; yes|rpm -i hyperscan*.rpm
+endif
+ @# NEW INSTRUCTIONS TO BUILD-PACKAGE MUST BE DECLARED ON A NEW LINE WITH
+ @# '@' NOT WITH ';' ELSE BUILD-PACKAGE WILL NOT RETURN THE CORRECT
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c0704b..cb70d38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,22 +99,22 @@ execute_process(
)
# These files are missing from vpp binary distribution
execute_process(
- COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_json_parser.py?h=stable/1908 -o ${CMAKE_BINARY_DIR}/vapi_json_parser.py
- COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_c_gen.py?h=stable/1908 -o ${CMAKE_BINARY_DIR}/vapi_c_gen.py
- COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_cpp_gen.py?h=stable/1908 -o ${CMAKE_BINARY_DIR}/vapi_cpp_gen.py
+ COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_json_parser.py?h=stable/2001 -o ${CMAKE_BINARY_DIR}/vapi_json_parser.py
+ COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_c_gen.py?h=stable/2001 -o ${CMAKE_BINARY_DIR}/vapi_c_gen.py
+ COMMAND curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_cpp_gen.py?h=stable/2001 -o ${CMAKE_BINARY_DIR}/vapi_cpp_gen.py
)
add_custom_command(
COMMAND chmod +x ${CMAKE_BINARY_DIR}/vapi_json_parser.py ${CMAKE_BINARY_DIR}/vapi_c_gen.py ${CMAKE_BINARY_DIR}/vapi_cpp_gen.py
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.h
- COMMAND ${VPP_HOME}/bin/vppapigen --input ${CMAKE_CURRENT_SOURCE_DIR}/src/dpi.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.h
+ COMMAND ${VPP_HOME}/bin/vppapigen ARGS --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/src/dpi.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.h --outputdir ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/dpi.api
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
- COMMAND ${VPP_HOME}/bin/vppapigen JSON --input ${CMAKE_CURRENT_SOURCE_DIR}/src/dpi.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
+ COMMAND ${VPP_HOME}/bin/vppapigen ARGS JSON --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/src/dpi.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json --outputdir ${CMAKE_CURRENT_BINARY_DIR}/vapi/
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.vapi.h
- COMMAND ${CMAKE_BINARY_DIR}/vapi_c_gen.py ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
+ COMMAND ${CMAKE_BINARY_DIR}/vapi_c_gen.py ARGS ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.vapi.hpp
- COMMAND ${CMAKE_BINARY_DIR}/vapi_cpp_gen.py ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
+ COMMAND ${CMAKE_BINARY_DIR}/vapi_cpp_gen.py ARGS ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/udpi/dpi.api.json
)
include_directories(SYSTEM)
diff --git a/Makefile b/Makefile
index 119f493..8cae070 100644
--- a/Makefile
+++ b/Makefile
@@ -36,23 +36,24 @@ endif
#DEB#
#####
#Dependencies to build
-DEB_DEPENDS = curl build-essential autoconf automake ccache git cmake wget coreutils ragel libboost-dev
+DEB_DEPENDS = curl build-essential autoconf automake ccache git cmake wget coreutils ragel
+DEB_DEPENDS += libboost-dev vpp vpp-dev python*-ply
#####
#RPM#
#####
#Dependencies to build
RPM_DEPENDS = curl autoconf automake ccache cmake3 wget gcc gcc-c++ git gtest gtest-devel
-RPM_DEPENDS += ragel python-sphinx boost169-devel
+RPM_DEPENDS += ragel python-sphinx boost169-devel vpp vpp-devel python*-ply
-.PHONY: help install-dep build build-package build-package-hyperscan checkstyle distclean
+.PHONY: help install-dep build build-package build-install-package-hyperscan checkstyle distclean
help:
@echo "Make Targets:"
- @echo " install-dep - install software dependencies"
- @echo " build-package - build rpm or deb package"
- @echo " build-package-hyperscan - build rpm or deb package for hyperscan"
- @echo " checkstyle - checkstyle"
- @echo " distclean - remove all build directory"
+ @echo " install-dep - install software dependencies"
+ @echo " build-package - build rpm or deb package"
+ @echo " build-install-package-hyperscan - build rpm or deb package for hyperscan"
+ @echo " checkstyle - checkstyle"
+ @echo " distclean - remove all build directory"
install-dep:
ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
@@ -60,23 +61,25 @@ ifeq ($(OS_VERSION_ID),14.04)
@sudo -E apt-get -y --force-yes install software-properties-common
endif
@sudo -E apt-get update
+ @curl -s https://packagecloud.io/install/repositories/fdio/2001/script.deb.sh | sudo bash
@sudo -E apt-get $(APT_ARGS) -y --force-yes install $(DEB_DEPENDS)
else ifeq ($(OS_ID),centos)
+ @curl -s https://packagecloud.io/install/repositories/fdio/2001/script.rpm.sh | sudo bash
@sudo -E yum install -y $(RPM_DEPENDS) epel-release centos-release-scl devtoolset-7
else
$(error "This option currently works only on Ubuntu, Debian, Centos or openSUSE systems")
endif
-build-package-hyperscan:
+build-install-package-hyperscan:
@rm -rf $(BR)/build-package-hyperscan/;
@mkdir -p $(BR)/build-package-hyperscan/; cd $(BR)/build-package-hyperscan/;\
git clone https://github.com/intel/hyperscan.git; cd hyperscan; \
- git apply $(BR)/../0001-build-package-for-hyperscan.patch; make build-package;\
+ git apply $(BR)/../0001-build-package-for-hyperscan.patch; make build-install-package;
build-package:
ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
@mkdir -p $(BR)/build-package/; cd $(BR)/build-package/;\
- $(cmake) -DCMAK_BUILD_TYPE=Release\
+ $(cmake) -DCMAKE_BUILD_TYPE=Release\
-DCMAKE_INSTALL_PREFIX=/usr $(WS_ROOT)/;\
make package -j$(nproc);
else ifeq ($(OS_ID),centos)
diff --git a/src/dpi.c b/src/dpi.c
index aabd763..6df713a 100644
--- a/src/dpi.c
+++ b/src/dpi.c
@@ -259,7 +259,7 @@ dpi_flow_add_del (dpi_add_del_flow_args_t * a, u32 * flow_idp)
vnet_main_t *vnm = dm->vnet_main;
dpi4_flow_key_t key4;
dpi6_flow_key_t key6;
- dpi_flow_entry_t *p;
+ u32 *p;
u32 is_ip6 = a->is_ipv6;
u32 flow_id;
dpi_flow_entry_t *flow;
@@ -395,9 +395,9 @@ dpi_reverse_flow_add_del (dpi_add_del_flow_args_t * a, u32 flow_id)
vnet_main_t *vnm = dm->vnet_main;
dpi4_flow_key_t key4;
dpi6_flow_key_t key6;
- dpi_flow_entry_t *p;
u32 is_ip6 = a->is_ipv6;
dpi_flow_entry_t *flow;
+ u32 *p;
int not_found;
if (!is_ip6)
@@ -463,7 +463,6 @@ dpi_reverse_flow_add_del (dpi_add_del_flow_args_t * a, u32 flow_id)
if (!p)
return VNET_API_ERROR_NO_SUCH_ENTRY;
- flow_id = is_ip6 ? key6.value : key4.value;
flow = pool_elt_at_index (dm->dpi_flows, flow_id);
if (!is_ip6)
@@ -473,8 +472,6 @@ dpi_reverse_flow_add_del (dpi_add_del_flow_args_t * a, u32 flow_id)
if (flow->flow_index != ~0)
vnet_flow_del (vnm, flow->flow_index);
-
- pool_put (dm->dpi_flows, flow);
}
return 0;
diff --git a/src/dpi_api.c b/src/dpi_api.c
index d8fa690..cfb5262 100644
--- a/src/dpi_api.c
+++ b/src/dpi_api.c
@@ -64,15 +64,6 @@ typedef enum
#define REPLY_MSG_ID_BASE dm->msg_id_base
#include <vlibapi/api_helper_macros.h>
-static void
-setup_message_id_table (dpi_main_t * dm, api_main_t * am)
-{
-#define _(id,n,crc) \
- vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + dm->msg_id_base);
- foreach_vl_msg_name_crc_dpi;
-#undef _
-}
-
#define foreach_dpi_plugin_api_msg \
_(DPI_FLOW_ADD_DEL, dpi_flow_add_del)
@@ -144,7 +135,7 @@ dpi_api_hookup (vlib_main_t * vm)
#undef _
/* Add our API messages to the global name_crc hash table */
- setup_message_id_table (dm, &api_main);
+ dm->msg_id_base = setup_message_id_table ();
return 0;
}