aboutsummaryrefslogtreecommitdiffstats
path: root/src/dpi_app_match.h
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2019-09-09 19:03:46 +0800
committerHongjun Ni <hongjun.ni@intel.com>2019-09-09 19:03:46 +0800
commit2234c30a625ec2c38f7fb9d0c7e7ddd02a0f038f (patch)
tree087fbe5a528d96cdc548f36dd576c61d317b4a58 /src/dpi_app_match.h
parent3b09645d2b0259962d7f1e8a0adf76ab4b00fc1c (diff)
Add initial code
The inital code is from this patch: https://gerrit.fd.io/r/#/c/vpp/+/16580/ It is contributed by Intel and Travelping. Jerome Tollet, Ed Warnicke, Dave Barach, Damjan Marion from Cisco and other guys have gave lots of useful comments on it. The initial code is used for identifying layer-7 applications for HTTPS/TLS traffic - Below is the brief design info. - Provides a default APPID database for scan. - Dynamically create new SW mapping has been supported now. - Support TCP connection state tracking. - Support TCP segments reassembly on the fly, which handles out-of-order tcp segments and overlapping segments. It means that we do not need to reassembly segments first, then dedect applicaion, and then fragment segments again, which helps to improve performance. - Support Hyperscan Stream mode, which can scan rules straddling into different tcp segments. It means that if there is a rule "abcde", then "abc" can be in packet 1, and "de" can be in packet 2. - Configure static dpi flows with 5-tuple and VRF-aware, and supports both ipv4 and ipv6 flows. These flows will first try to HW offload to NIC based on DPDK rte_flow mechanism and vpp/vnet/flow infrastructure. If failed, then will create static SW flow mappings. Each flow configuration will create two HW or SW flow mappings, i.e. for forward and reverse traffic. And both flow mappings will be mapped to the same dpi flow. SW entry aging out mechanism will be added later. "dpi flow [add | del] " "[src-ip <ip-addr>] [dst-ip <ip-addr>] " "[src-port <port>] [dst-port <port>] " "[protocol <protocol>] [vrf-id <nn>]", "dpi set flow-offload hw <interface-name> rx <flow-id> [del]", "dpi set ip4 flow-bypass <interface> [del]", - When HW flow offload matched, packets will be redirected to DPI plugin with dpi flow_id in packet descriptor. If not, packets will be bypassed to DPI plugin from ip-input, and then lookup SW flow mapping table. - Then will detect layer 7 applications. This first patch only detect sub protocls within SSL/TLS. 1). Identify SSL/TLS certificate message and subsequent segments. 2). Scan SSL/TLS certificate message through hyperscan, and get application id if matched. 3). If maximum packets for this flow are checked and not found matched application, the detection will end up. Ticket: Type: feature Signed-off-by: Hongjun Ni <hongjun.ni@intel.com> Signed-off-by: Andreas Schultz <andreas.schultz@travelping.com> Signed-off-by: Mathias Gumz <mathias.gumz@travelping.com> Change-Id: I839cc70ddc80ea594d22a04e2cabf92a7b9c74e7
Diffstat (limited to 'src/dpi_app_match.h')
-rw-r--r--src/dpi_app_match.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/dpi_app_match.h b/src/dpi_app_match.h
new file mode 100644
index 0000000..dde4857
--- /dev/null
+++ b/src/dpi_app_match.h
@@ -0,0 +1,124 @@
+/*
+ *------------------------------------------------------------------
+ * Copyright (c) 2019 Intel, Travelping 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.
+ *------------------------------------------------------------------
+ */
+
+/*
+#*************************************************************
+# Copyright (c) 2003-2017, Emerging Threats
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+# disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
+# following disclaimer in the documentation and/or other materials provided with the distribution.
+# * Neither the name of the nor the names of its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#*************************************************************
+*/
+
+#ifndef dpi_app_match_h
+#define dpi_app_match_h
+
+typedef enum
+{
+ DPI_APP_CISCO = 1,
+ DPI_APP_GOOGLE = 2,
+ DPI_APP_BING = 3,
+ DPI_APP_MSN = 4,
+ DPI_APP_YAHOO = 5,
+ DPI_APP_YAHOOMAIL = 6,
+ DPI_APP_INTEL = 7,
+ DPI_APP_AMAZON = 8,
+ DPI_APP_AMD = 9,
+ DPI_APP_BAIDU = 10,
+ DPI_APP_APPLE = 11,
+ DPI_APP_FACEBOOK = 12,
+ DPI_APP_EBAY = 13,
+ DPI_APP_GITHUB = 14,
+ DPI_APP_GMAIL = 15,
+ DPI_APP_QQ = 16,
+ DPI_APP_WECHAT = 17,
+ DPI_APP_PINTEREST = 18,
+ DPI_APP_LENOVO = 19,
+ DPI_APP_LINKEDIN = 20,
+ DPI_APP_SKYPE = 21,
+ DPI_APP_MICROSOFT = 22,
+ DPI_APP_NETFLIX = 23,
+ DPI_APP_NOKIA = 24,
+ DPI_APP_NVIDIA = 25,
+ DPI_APP_OFFICE = 26,
+ DPI_APP_ORACLE = 27,
+ DPI_APP_OUTLOOK = 28,
+ DPI_APP_PANDORA = 29,
+ DPI_APP_PAYPAL = 30,
+ DPI_APP_SINA = 31,
+ DPI_APP_SOGOU = 32,
+ DPI_APP_SYMANTEC = 33,
+ DPI_APP_TAOBAO = 34,
+ DPI_APP_TWITTER = 35,
+ DPI_APP_UPS = 36,
+ DPI_APP_VISA = 37,
+ DPI_APP_MCAFEE = 38,
+ DPI_APP_VMWARE = 39,
+ DPI_APP_WORDPRESS = 40,
+ DPI_APP_ADOBE = 41,
+ DPI_APP_AKAMAI = 42,
+ DPI_APP_ALIENVAULT = 43,
+ DPI_APP_BITCOMET = 44,
+ DPI_APP_CHECKPOINT = 45,
+ DPI_APP_BLOOMBERG = 46,
+ DPI_APP_DELL = 47,
+ DPI_APP_F5 = 48,
+ DPI_APP_FIREEYE = 49,
+ DPI_APP_DROPBOX = 50,
+
+ /* last app ID */
+ DPI_N_APPLICATIONS = 51,
+} dpi_application_id_t;
+
+typedef struct dpi_app_match_rule_
+{
+ char *host;
+ char *pattern;
+ char *app_name;
+ u32 app_id;
+} dpi_app_match_rule;
+
+#define DPI_MAX_APP_NUM DPI_N_APPLICATIONS
+extern dpi_app_match_rule app_match_rules[];
+
+
+#endif /* dpi_app_match_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */