diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2019-09-09 05:29:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-09-09 05:29:43 +0000 |
commit | 29a4db4f00c86af1da59a66920741459125bc875 (patch) | |
tree | bc42d45e5a8396821f097a35edeec487d3f34305 /src | |
parent | f0cd428b88e9d8e4e42021ea35fc47c41e018899 (diff) | |
parent | fc48eef0ef72c8fd7ebd55f9692b6a83695ec405 (diff) |
Merge "modify source code"
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 { |