diff options
author | Junfeng Wang <drenfong.wang@intel.com> | 2019-09-09 08:13:54 -0400 |
---|---|---|
committer | Junfeng Wang <drenfong.wang@intel.com> | 2019-09-09 08:43:57 -0400 |
commit | fc48eef0ef72c8fd7ebd55f9692b6a83695ec405 (patch) | |
tree | 8ee3aa96cdb90d7507cf4f42b740dc09142009fb /src | |
parent | 2234c30a625ec2c38f7fb9d0c7e7ddd02a0f038f (diff) |
modify source codev0.0
1. add CMakeList for udpi
2. modify code to make it can be compiled without vpp source code
Change-Id: Iabb7337a0db95d981f4ecc4e3e0cc3a3545dd5cf
Signed-off-by: Junfeng Wang <drenfong.wang@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 44 | ||||
-rw-r--r-- | src/dpi.c | 8 | ||||
-rw-r--r-- | src/dpi_api.c | 14 | ||||
-rw-r--r-- | src/dpi_cli.c | 4 | ||||
-rw-r--r-- | src/dpi_node.c | 10 | ||||
-rw-r--r-- | src/protocols/dpi_ssl.c | 2 |
6 files changed, 16 insertions, 66 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 5eb40d3..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2018 Intel 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. - -message(STATUS "Looking for Hyperscan") -find_path(HYPERSCAN_INCLUDE_DIR NAMES hs/hs.h) -find_library(HYPERSCAN_LIB1 NAMES hs) -find_library(HYPERSCAN_LIB2 NAMES hs_runtime) -set (HYPERSCAN_LIB ${HYPERSCAN_LIB1} ${HYPERSCAN_LIB2}) - -if(HYPERSCAN_INCLUDE_DIR AND HYPERSCAN_LIB) - include_directories(${HYPERSCAN_INCLUDE_DIR}) - add_vpp_plugin(dpi - SOURCES - dpi.c - dpi_api.c - dpi_cli.c - dpi_node.c - protocols/dpi_ssl.c - - API_FILES - dpi.api - - INSTALL_HEADERS - dpi_app_match.h - dpi.h - - LINK_LIBRARIES - ${HYPERSCAN_LIB} - ) - message(STATUS "Found Hyperscan in ${HYPERSCAN_INCLUDE_DIR}") -else() - message(WARNING "-- Hyperscan not found - dpi_plugin disabled") -endif() - @@ -27,13 +27,13 @@ #include <vnet/fib/fib_entry.h> #include <vnet/fib/fib_table.h> #include <vnet/mfib/mfib_table.h> -#include <vnet/adj/adj_mcast.h> +//#include <vnet/adj/adj_mcast.h> #include <vnet/dpo/dpo.h> #include <vnet/plugin/plugin.h> -#include <vpp/app/version.h> +//#include <vpp/app/version.h> #include <vnet/flow/flow.h> -#include <dpi/dpi.h> +#include "dpi.h" dpi_main_t dpi_main; dpi_entry_t *dpi_dbs = NULL; @@ -709,7 +709,7 @@ VLIB_INIT_FUNCTION (dpi_init); /* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { - .version = VPP_BUILD_VER, +// .version = VPP_BUILD_VER, .description = "Deep Packet Inspection", }; /* *INDENT-ON* */ diff --git a/src/dpi_api.c b/src/dpi_api.c index 540d1a2..d8fa690 100644 --- a/src/dpi_api.c +++ b/src/dpi_api.c @@ -24,13 +24,13 @@ #include <vppinfra/byte_order.h> #include <vlibmemory/api.h> -#include <dpi/dpi.h> +#include "dpi.h" #define vl_msg_id(n,h) n, typedef enum { -#include <dpi/dpi.api.h> +#include "dpi.api.h" /* We'll want to know how many messages IDs we need... */ VL_MSG_FIRST_AVAILABLE, } vl_msg_id_t; @@ -38,27 +38,27 @@ typedef enum /* define message structures */ #define vl_typedefs -#include <dpi/dpi.api.h> +#include "dpi.api.h" #undef vl_typedefs /* define generated endian-swappers */ #define vl_endianfun -#include <dpi/dpi.api.h> +#include "dpi.api.h" #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) #define vl_printfun -#include <dpi/dpi.api.h> +#include "dpi.api.h" #undef vl_printfun /* Get the API version number */ #define vl_api_version(n,v) static u32 api_version=(v); -#include <dpi/dpi.api.h> +#include "dpi.api.h" #undef vl_api_version #define vl_msg_name_crc_list -#include <dpi/dpi.api.h> +#include "dpi.api.h" #undef vl_msg_name_crc_list #define REPLY_MSG_ID_BASE dm->msg_id_base diff --git a/src/dpi_cli.c b/src/dpi_cli.c index 6b3afc7..4fbc760 100644 --- a/src/dpi_cli.c +++ b/src/dpi_cli.c @@ -26,8 +26,8 @@ #include <vnet/plugin/plugin.h> #include <vnet/fib/fib_entry.h> #include <vnet/fib/fib_table.h> -#include <vpp/app/version.h> -#include <dpi/dpi.h> +//#include <vpp/app/version.h> +#include "dpi.h" extern dpi_main_t dpi_main; diff --git a/src/dpi_node.c b/src/dpi_node.c index 2e86c65..33774e9 100644 --- a/src/dpi_node.c +++ b/src/dpi_node.c @@ -22,11 +22,11 @@ #include <vppinfra/pool.h> #include <vppinfra/vec.h> #include <vnet/plugin/plugin.h> -#include <vpp/app/version.h> +//#include <vpp/app/version.h> #include <vnet/flow/flow.h> #include <vnet/tcp/tcp_packet.h> -#include <dpi/dpi.h> +#include "dpi.h" vlib_node_registration_t dpi4_input_node; vlib_node_registration_t dpi6_input_node; @@ -535,7 +535,6 @@ dpi_input_inline (vlib_main_t * vm, u16 dst_port = 0; segment *seg = 0; segment *prev_seg = 0; - int rv; bi0 = to_next[0] = from[0]; b0 = vlib_get_buffer (vm, bi0); @@ -547,7 +546,6 @@ dpi_input_inline (vlib_main_t * vm, ip4_main_t *im4 = &ip4_main; fib_index0 = vec_elt (im4->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - rv = parse_ip4_packet_and_lookup(ip40, fib_index0, &key40, ¬_found0, &flow_id0); } @@ -557,14 +555,10 @@ dpi_input_inline (vlib_main_t * vm, ip6_main_t *im6 = &ip6_main; fib_index0 = vec_elt (im6->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - rv = parse_ip6_packet_and_lookup(ip60, fib_index0, &key60, ¬_found0, &flow_id0); } - if (!rv) - goto enqueue0; - is_reverse0 = (u8)((flow_id0 >> 63) & 0x1); flow_index0 = (u32)(flow_id0 & (u32)(~0)); flow0 = pool_elt_at_index (dm->dpi_flows, flow_index0); diff --git a/src/protocols/dpi_ssl.c b/src/protocols/dpi_ssl.c index 7257ca5..f15a19c 100644 --- a/src/protocols/dpi_ssl.c +++ b/src/protocols/dpi_ssl.c @@ -22,7 +22,7 @@ #include <vlib/vlib.h> #include <vlib/unix/unix.h> -#include <dpi/dpi.h> +#include "../dpi.h" typedef enum { |