WO2020038399A1 - 数据包的分类方法、装置及计算机可读存储介质 - Google Patents

数据包的分类方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2020038399A1
WO2020038399A1 PCT/CN2019/101752 CN2019101752W WO2020038399A1 WO 2020038399 A1 WO2020038399 A1 WO 2020038399A1 CN 2019101752 W CN2019101752 W CN 2019101752W WO 2020038399 A1 WO2020038399 A1 WO 2020038399A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
prefix
matching
range
field
Prior art date
Application number
PCT/CN2019/101752
Other languages
English (en)
French (fr)
Inventor
王磊
刘明强
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2020038399A1 publication Critical patent/WO2020038399A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L27/00Modulated-carrier systems
    • H04L27/26Systems using multi-frequency codes
    • H04L27/2601Multicarrier modulation systems
    • H04L27/2602Signal structure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/74591Address table lookup; Address filtering using content-addressable memories [CAM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/748Address table lookup; Address filtering using longest matching prefix

Definitions

  • Embodiments of the present disclosure relate to the field of network communication technologies, and for example, to a method, an apparatus, and a computer-readable storage medium for classifying data packets.
  • a classification rule set is defined. They are composed of a series of rules. Each rule consists of multiple fields (also called domains) and corresponding actions. Among them, the fields in the rules and the data flow The fields are corresponding. After the data packet enters the router, the information corresponding to the fields in the rule set is extracted from the data packet. Based on these information, a matching rule is found in the rule set, and then the data packet is processed according to the actions defined in the rule.
  • the packet classification algorithm Hicuts is often used to classify data packets.
  • the classification method is to first find a rule that matches the field in the rule set according to a field, and then to find a new field that matches the new rule in the found rule according to another field. Until all fields are traversed, the action in the final rule is the result of packet classification, that is, the data packet is processed according to the action in the final rule.
  • the embodiments of the present disclosure provide a method, a device, and a computer-readable storage medium for classifying data packets, which can implement fast classification of data packets and improve classification efficiency of data packets.
  • An embodiment of the present disclosure provides a data packet classification method, including:
  • prefix information is information corresponding to a prefix basic information matching field in a prefix matching field of a preset rule set
  • precise information is the same as the Information corresponding to an exact match field in a preset rule set
  • range information is information corresponding to a range match field in the preset rule set
  • prefix information Use the prefix information, the prefix information and the precise information, and the range information as dimensions respectively to obtain a classification result of the data packet to be classified by using a pre-established prefix matching table and a rule set classification table.
  • An embodiment of the present disclosure further provides a data packet classification device, including:
  • the obtaining module is configured to obtain prefix information, precise information, and range information from a data packet to be classified, wherein the prefix information is information corresponding to a prefix basic information matching field in a prefix matching field of a preset rule set, and the precise The information is information corresponding to the exact match field in the preset rule set, and the range information is the information corresponding to the range match field in the preset rule set;
  • the processing module is configured to use the prefix information, the prefix information and the precise information, and the range information as dimensions, respectively, to obtain a data packet to be classified using a pre-established prefix matching table and a rule set classification table. Classification results.
  • An embodiment of the present disclosure further provides a hash conflict processing apparatus including a processor and a memory, where the memory stores the following instructions that can be executed by the processor:
  • prefix information is information corresponding to a prefix basic information matching field in a prefix matching field of a preset rule set
  • precise information is the same as the Information corresponding to an exact match field in a preset rule set
  • range information is information corresponding to a range match field in the preset rule set
  • prefix information Use the prefix information, the prefix information and the precise information, and the range information as dimensions respectively to obtain a classification result of the data packet to be classified by using a pre-established prefix matching table and a rule set classification table.
  • An embodiment of the present disclosure further provides a computer-readable storage medium, where the storage medium stores computer-executable instructions, and the computer-executable instructions are used to perform the following steps:
  • prefix information is information corresponding to a prefix basic information matching field in a prefix matching field of a preset rule set
  • precise information is the same as the Information corresponding to an exact match field in a preset rule set
  • range information is information corresponding to a range match field in the preset rule set
  • prefix information Use the prefix information, the prefix information and the precise information, and the range information as dimensions respectively to obtain a classification result of the data packet to be classified by using a pre-established prefix matching table and a rule set classification table.
  • FIG. 1 is a schematic flowchart of a data packet classification method according to an embodiment of the present disclosure
  • FIG. 2 is a schematic structural diagram of a data packet classification device according to an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of a regular structure according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic structural diagram of another data packet classification device according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of a rule set and storage table according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of another rule set and storage table according to an embodiment of the present disclosure.
  • stream classification algorithms include: exhaustive method, rule set partition method, and dimensional decomposition method.
  • exhaustive method includes: linear matching method and Ternary Content Addressable Memory (TCAM) ) Matching method
  • rule set division method includes: grid dictionary tree (Trie tree) matching method, Hicuts matching method and tuple space matching method
  • dimensional decomposition method includes: Bit vector (BV) matching method and recursive flow Classification (Recursive Flow Classification) (RFC) matching method.
  • the simplest linear data structure is used to store classification rules, which are generally arranged in descending order of priority or cost function. When doing a lookup, the packets are compared with the rules one by one until a matching rule is found. This algorithm is simple to implement and has high storage utilization, but the search performance is not good. In the worst case, all rules must be traversed to find a match.
  • the exhaustive classification algorithm implemented in hardware uses TCAM as the classification engine.
  • the packet matching can be completed once in one clock cycle.
  • the grid Trie tree algorithm introduces a turning pointer to delete duplicate subtrees in a child rule set. Only one subtree is retained. At the parent node of the deleted subtree, a pointer is added to point to the reserved subtree.
  • Hicuts matching method combines two classification methods of decision tree search and linear search. It uses multi-level spatial decomposition, each level of decomposition is performed in one dimension, and the rule set is divided into small rule sets within multiple leaf nodes. The starting point of the algorithm division is to automatically adjust the data structure according to the characteristics of the rule set itself, to maximize the use of the optimized data structure to reduce redundancy.
  • the tuple space algorithm calculates the number of significant bits in the prefix of each rule in each rule set to obtain a tuple.
  • the tuples of all rules form a set, called the tuple space. All rules in the rule set are divided into multiple sub-rule sets according to the tuple space, and each tuple corresponds to a sub-rule set. Inside each sub-rule set, a hash table is established according to the valid bits in the prefix of each dimension of the rule to store all the rules of the sub-rule set.
  • This algorithm constructs a one-dimensional Trie tree for each dimension, and formulates a bitmap for each node with a valid prefix in the Trie tree.
  • the bitmap is an n-bit feature vector (n is the number of rules), which is used to identify A rule that matches the prefix corresponding to the node. For example, if the prefix of a node matches the rule R (i), the i-th bit in the bitmap is set to 1, otherwise it is set to 0.
  • each dimension of the data packet is matched with the longest prefix in the corresponding Trie tree to obtain the corresponding bitmap.
  • the bitmap of each dimension is ANDed. The rule identified by the bit set to 1 in the bitmap This is the best match rule.
  • the algorithm uses the structural characteristics of the rule set to divide the entire domain into multiple segments. By calculating the equivalence classes and recursive operations in the segments, the distributed compression mapping of the space is achieved.
  • Measuring the performance of a traffic classification algorithm is performed in the following aspects: time complexity, space complexity, update complexity, scalability, and arbitrariness of rules. If d is the number of fields contained in the rule set, n is the algorithm input bit width, N is the number of rules, w is the bit width of a field in the rule set used by the algorithm, and W is the total bit width of a rule
  • P be the number of stages in the hierarchical implementation of the RFC algorithm, then the performance comparison of the above algorithms is shown in Table 1 below.
  • an embodiment of the present disclosure provides a data packet classification method. As shown in FIG. 1, the method includes:
  • Step 101 Obtain prefix information, precise information, and range information from a data packet to be classified.
  • the prefix information is information corresponding to the prefix basic information matching field in the prefix matching field of the preset rule set
  • the precise information is information corresponding to the exact matching field in the preset rule set
  • the range information is the field matching the range in the preset rule set. Corresponding information.
  • Step 102 Use the prefix information, the prefix information and the precise information, and the range information as the dimensions to obtain the classification result of the data packet to be classified by using a pre-established prefix matching table and a rule set classification table.
  • the method for classifying a data packet provided by the embodiment of the present disclosure, because the prefix information, range information, and precise information are obtained from the data packet to be classified, it is performed based on three dimensions: the prefix information, the prefix information and the precise information, and the range information.
  • the search results in classification results which enables fast classification of data packets and greatly improves classification efficiency.
  • using the prefix information, the prefix information and precise information, and the range information as the dimensions, respectively, using a pre-established prefix matching table and a rule set classification table to obtain the classification result of the data packet to be classified includes:
  • Step 102a Obtain prefix matching information corresponding to the prefix information from the prefix matching table as target prefix matching information.
  • Step 102b Obtain a data record corresponding to both the target prefix matching information and the precise information from the rule set classification table.
  • the data record includes prefix matching information, exact matching information, multiple range matching information, and multiple range matching information corresponding to the action matching information.
  • Step 102c Obtain range matching information including the range information from the obtained data record, and use the range matching information as target range matching information.
  • Step 102d Acquire the action matching information corresponding to the target range matching information as the classification result of the data packet to be classified.
  • the prefix matching table includes: multiple prefix matching information; the rule set classification table includes: multiple data records.
  • obtaining the prefix matching information corresponding to the prefix information from the prefix matching table includes:
  • Step 102a1 Generate a plurality of first key values according to the pieces of prefix information and the prefix matching lengths corresponding to the pieces of prefix information, respectively.
  • the number of the first key values is plural.
  • the method of generating the key value may be generated by performing a certain preset operation on the prefix information and the prefix matching length, or may be generated by intercepting the prefix information according to the prefix matching length.
  • Step 102a2 Perform a hash operation on the obtained multiple first key values by using a first preset hash function to obtain multiple first hash values.
  • using the first preset hash function to perform hash operations on the obtained plurality of first key values includes: using the first preset hash function; A hash operation is performed on each of the obtained first key values.
  • Step 102a3 Read the prefix matching table of the addresses by obtaining multiple first hash values respectively to obtain multiple pieces of prefix matching information.
  • reading the first prefix matching table with a plurality of first hash values obtained separately and obtaining a plurality of prefix matching information includes: each of the first hash values obtained obtains a prefix reading table with an address reading To get each prefix match.
  • step 102a4 among the obtained pieces of prefix matching information, the prefix matching information corresponding to each of the plurality of first key values is determined as the target prefix matching information.
  • obtaining a data record corresponding to both target prefix matching information and precise information from a rule set classification table includes:
  • Step 102b1 Generate a second key value according to the target prefix matching information and the exact matching information.
  • generating a second key value according to the target prefix matching information and the exact matching information means: matching according to each given target prefix.
  • the information and the exact matching information generate a second key value.
  • Step 102b2 Perform a hash operation on the second key value by using a second preset hash function to obtain a second hash value.
  • performing a hash operation on the second key value by using a second preset hash function means: using a second preset hash function to Key figures are hashed.
  • Step 102b3 The second hash value obtained is used to read the rule set classification table to obtain a data record.
  • the obtained second hash value is an address reading rule set classification table refers to: each second hash value obtained is an address read Take the rule set classification table.
  • Step 102b4 Determine a data record corresponding to both the target prefix matching information and the precise information in the obtained data record.
  • the number of prefix matching tables and the number of types of prefix matching length are the same.
  • the first hash value obtained to read the prefix matching table includes:
  • the prefix matching table read with any one of the first hash values is different from the prefix matching table read with any other first hash value. That is, the prefix matching tables read with different first hash values are different.
  • each first hash value obtained can greatly improve prefix matching when reading a prefix matching table. The speed at which information is read.
  • each of the obtained Reading a prefix matching table with a first hash value refers to: reading a first first hash value to obtain a first prefix matching table with an address to obtain a second first hash value Read the 2nd prefix matching table for the address ... to get the Nth first hash value for the address to read the Nth prefix matching table, where the 1st prefix matching table, the 2nd prefix matching table ...
  • the N prefix matching tables are not limited to the prefix matching table itself, but are only used to identify the prefix matching table.
  • determining the prefix matching information corresponding to each of the multiple first key values from the obtained pieces of prefix matching information includes:
  • Step 102a4a Determine whether each prefix matching information obtained corresponds to a first key value according to which the prefix matching information is read.
  • Step 102a4b Obtain prefix matching information corresponding to the first key value according to the first key value during the reading process, and use the prefix matching information as target prefix matching information.
  • determining a data record corresponding to both target prefix matching information and precise information in the obtained data record includes:
  • Step 102b4a Determine whether the prefix matching information in the obtained data record is the same as the target prefix matching information, and whether the exact matching information is the same as the accurate information.
  • determining whether the prefix matching information in the obtained data records is the same as the target prefix matching information, and whether the exact matching information is the same as the precise information means: determining whether each obtained Whether the prefix match information in a data record is the same as the target prefix match information, and whether the exact match information is the same as the exact information.
  • Step 102b4b Obtain a data record in which the prefix matching information is the same as the target prefix matching information, and the exact matching information is the same as the precise information, as a data record corresponding to both the target prefix matching information and the precise information.
  • the method before obtaining from the data packet to be classified the prefix information corresponding to the prefix information matching field in the prefix matching field of the preset rule set, the range information corresponding to the range matching field, and the precise information corresponding to the exact matching field, the method further includes: :
  • Step 103 Obtain prefix matching information, range matching information, exact matching information, and action information of a rule in a preset rule set.
  • the prefix matching information includes basic prefix matching information and a prefix matching length corresponding to the basic prefix matching information.
  • obtaining the prefix matching information, the range matching information, the exact matching information, and the action information of the rules in the preset rule set refers to: obtaining the prefix matching information, the range matching information, and the exact matching of each rule in the preset rule set. Information and action information.
  • Step 104 Fill a pre-established first empty table according to the obtained basic prefix matching information and the prefix matching length corresponding to the basic prefix matching information to obtain a prefix matching table.
  • the number of the first empty list may be one, or may be the same as the number of types of the prefix matching length.
  • the reading speed of subsequent prefix matching information can be effectively improved.
  • Step 105 Fill a pre-established second empty table according to the obtained prefix matching information, range matching information, precise information, and action information to obtain a rule set classification table.
  • filling the pre-established first empty table according to the obtained basic prefix matching information and the prefix matching length corresponding to the basic prefix matching information includes:
  • Step 104a Generate a third key value according to the prefix matching basic information and a prefix matching length corresponding to the prefix matching basic information.
  • Step 104b Perform a hash operation on the obtained third key value by using the first preset hash function to obtain a third hash value.
  • hashing the obtained third key value by using the first preset hash function means: Each third key value obtained is hashed.
  • Step 104c The third hash value obtained is used to write the third key value into the first empty table.
  • the obtained third hash value is an address.
  • Writing the third key value into the first empty table refers to: each obtained first The three hash values are written into the first empty table with the third key value.
  • filling the pre-established second empty table according to the obtained prefix matching information, range matching information, precise information, and action information includes:
  • Step 105a Generate a fourth key value according to the obtained prefix matching information and an exact matching length corresponding to the prefix matching information.
  • Step 105b Perform a hash operation on the obtained fourth key value by using a second preset hash function to obtain a fourth hash value.
  • hashing the obtained fourth key value by using the second preset hash function means: using the second preset hash function to obtain each fourth key The value is hashed.
  • Step 105c Read the second empty table by using the fourth hash value as the address to obtain a data record.
  • reading the second empty table with the fourth hash value refers to reading the second empty table with the address of each fourth hash value.
  • Step 105d Fill the second empty table according to the obtained data record, prefix matching information, range matching information, precise information, and action information.
  • filling the second empty table according to the obtained data record, prefix matching information, range matching information, precise information, and action information includes:
  • Step 105d1 Determine whether the prefix match field and the exact match field in the obtained data record are empty.
  • Step 105d2 If the prefix match field and exact match field in the obtained data record are both empty, fill the prefix match information, exact match information, range match information, and action information into the prefix match field, exact match field, and range of the data record, respectively. Match field and action field.
  • the prefix match field and the exact match field in the obtained data record are both empty, it means that no data has been written into the data record.
  • the prefix matching field and the exact matching field must not be empty.
  • the method further includes:
  • Step 105d3 Determine whether the information on the prefix match field in the obtained data record is the same as the prefix match information, and whether the information on the exact match field in the data record is the same as the exact match information.
  • Step 105d4 If the information on the prefix match field in the obtained data record is the same as the prefix match information, and the information on the exact match field in the data record is the same as the exact match information, determine whether there is an empty range in the obtained data record Match field and action field.
  • Step 105d5 If there are empty range matching fields and action fields in the obtained data record, fill the range matching fields and action fields into the empty range matching fields and action fields.
  • the data packet classification device 2 includes:
  • the obtaining module 21 is configured to obtain prefix information, precise information, and range information from a data packet to be classified.
  • the prefix information is information corresponding to a prefix basic information matching field in a prefix matching field of a preset rule set
  • the precise information is The information corresponding to the exact match field in the preset rule set
  • the range information is the information corresponding to the range match field in the preset rule set.
  • the processing module 22 is configured to obtain the classification result of the data packet to be classified by using the prefix matching table and the rule set classification table that are established in advance based on the dimensions of the prefix information, the prefix information and precise information, and the range information.
  • processing module 22 is configured to:
  • the data record includes prefix matching information, exact matching information, multiple range matching information, and multiple range matching information corresponding to the action matching information.
  • range matching information containing range information from the obtained data records as target range matching information.
  • processing module 22 is configured to:
  • a first preset hash function is used to perform hash operations on the obtained multiple first key values to obtain multiple first hash values.
  • the plurality of first hash values respectively obtained are used to read the prefix matching table to obtain multiple pieces of prefix matching information.
  • Prefix matching information corresponding to each of the plurality of first key values is determined from the obtained pieces of prefix matching information as target prefix matching information.
  • processing module 22 is configured to:
  • a second preset hash function is used to perform a hash operation on the obtained second key value to obtain a second hash value.
  • the second hash value obtained is used to read the rule set classification table to obtain a data record.
  • a data record corresponding to both the target prefix matching information and the precise information is determined in the obtained data record.
  • the number of prefix matching tables and the number of types of prefix matching length are the same.
  • the processing module 22 is configured to read a prefix matching table for each first hash value obtained to obtain the address.
  • the prefix matching table read with any one of the first hash values is different from the prefix matching table read with any other first hash value.
  • processing module 22 is configured to:
  • each prefix matching information obtained corresponds to a first key value according to which the prefix matching information is read.
  • processing module 22 is configured to:
  • processing module 22 is further configured to:
  • the prefix matching information includes basic prefix matching information and a prefix matching length corresponding to the basic prefix matching information.
  • the pre-established first empty table is filled according to the obtained basic prefix matching information and the prefix matching length corresponding to the basic prefix matching information to obtain a prefix matching table.
  • processing module 22 is configured to:
  • a hash operation is performed on the obtained third key value by using a first preset hash function to obtain a third hash value.
  • the third key value is written into the first empty table.
  • processing module 22 is configured to:
  • a fourth key value is generated according to the obtained prefix matching information and an exact matching length corresponding to the prefix matching information.
  • processing module 22 is configured to:
  • prefix match field and exact match field in the obtained data record are both empty, the prefix match information, exact match information, range match information, and action information are filled into the prefix match field, exact match field, and range match field of the data record, respectively. And action fields.
  • the processing module 22 is further set to:
  • the apparatus for classifying a data packet provided by the embodiment of the present disclosure, because the prefix information, range information, and precise information are obtained from the data packet to be classified, it is performed based on three dimensions: the prefix information, the prefix information and the precise information, and the range information.
  • the search results in classification results which enables fast classification of data packets and greatly improves classification efficiency.
  • the acquisition module 21 and processing module 22 may be a central processing unit (CPU), a microprocessor (Micro Processor Unit, MPU), and a digital signal processor (MPU) located in a data packet classification device.
  • CPU central processing unit
  • MPU Micro Processor Unit
  • MPU digital signal processor
  • DSP Digital Signal Processor
  • FPGA Field Programmable Gate Array
  • the present disclosure also provides a data packet classification device.
  • the structure of the rule is shown in Figure 3. It contains three fields: F1, F2, F3, and ACT fields. Among them, F1 is a prefix matching field, F2 is a range matching field, and F3 is an exact matching field. , F1 field, F2 field and F3 field are all expressed in binary.
  • the F1 field consists of a prefix matching basic information F1_info with a bit width of F1_info_len, and a prefix size F1_pre with a bit width of F1_pre_len.
  • the maximum value of F1_pre is F1_info_len
  • the total length of the F1 field F1_len F1_info_len + F1_pre_len.
  • the F3 field is represented as F3_info and the bit width is F3_len.
  • the data packet classification device includes a rule set pre-processing module 31, a prefix matching table storage module 32, a rule set merging module 33, a rule set query module 34, and a rule set matching selection module 35.
  • the rule set preprocessing module 31 is configured to extract information from the rule set R, perform hashing, and perform read and write operations on the prefix matching table storage module 32 and the rule set and storage module 33.
  • the prefix matching table storage module 32 is configured to store the prefix matching information in the rule set R.
  • the rule collection and storage module 33 is configured to store the rules in the rule set R.
  • the rule set query module 34 is configured to extract field information corresponding to the rule set R from the input data packet, and use the same hash function as the rule set preprocessing module 31 to hash the extracted information and read the prefix matching table storage.
  • the rule set matching selection module 35 is configured to compare the fields extracted from the data packet to be classified with the rule set and the fields returned by the storage module 33 to obtain an optimal matching result.
  • a specific embodiment is provided below to describe a data packet classification process performed by a data packet classification device provided by an embodiment of the present disclosure.
  • the process can be divided into two parts, which are a rule preprocessing process and a data packet classification process.
  • Hi1 hash1 (KEY_F1)
  • Hi1 is a binary number of 1 bit width
  • M F1_info_len) prefix matching tables at the same time.
  • the M prefix matching tables are: R_F1_table_1, R_F1_table_2 ... R_F1_table_M, M
  • Each prefix matching table is stored in a prefix matching storage module. Among them, their write address is Hi1.
  • the range information is written to the empty F2 field in R_table, and the action information is written to the corresponding ACT field. Otherwise, it is determined that the preprocessing fails.
  • the write address for this step is Hi2.
  • Step 1 The rule set query module 34 extracts the information of the corresponding fields of the rule set R from the data packet to be classified, which are: F1_P, F2_P, and F3_P.
  • Step 2 Use F1_P and 1, 2 ... M to generate a KEY value, which is recorded as: KEY_P_1, KEY_P_2 ... KEY_P_M.
  • the method for generating the KEY value is: the high F1_P_pre bit of the KEY value is the same as the high F1_P_pre bit of F1_P, and the other positions are 0.
  • Step 3 Use the hash function Hash1 to hash KEY_P_1, KEY_P_2 ... KEY_P_M at the same time to obtain M hash results Hi1_P_1, Hi1_P_2 ... Hi1_P_M.
  • Hi1_P_1, Hi1_P_2 ... Hi1_P_M are binary numbers with a bit width of 1 bit.
  • Step 4 Use Hi1_P_1, Hi1_P_2 ... Hi1_P_M to read the prefix matching tables R_F1_table_1, R_F1_table_2 ... R_F1_table_M.
  • Step 5 R_F1_table_1, R_F1_table_2 ... R_F1_table_M returns M results, and compares them with KEY_P_1, KEY_P_2 ... KEY_P_M, extracts the key values that are consistent with the comparison result, and marks them as KEY_P_1, KEY_P_2 ... KEY_P_J, J ⁇ M.
  • Step 7 Use the hash function Hash2 to hash KEY_R_1, KEY_R_2 ... KEY_R_J, and output hash values of Hi2_R_1, Hi2_R_2 ... Hi2_R_J.
  • Hi2_R_1, Hi2_R_2 ... Hi2_R_J are all binary numbers with a bit width of 1 bit.
  • Step 8 Use Hi2_R_1, Hi2_R_2 ... Hi2_R_J as addresses, and read R_table in turn.
  • Step 9 R_table returns J data records.
  • the format of each data record is shown in Figure 5. Compare KEY_R_1, KEY_R_2 ... KEY_R_J with the F1 and F3 fields in the J returned data records, leaving Compare the data records with consistent results, use F2_P to match in the range field in the remaining results, find out the range field that F2_P matches, determine the ACT field after determining the range field, and output the ACT field. If there is no match in the end, this Secondary flow classification failed.
  • IP Internet Protocol
  • the bit width of F1_info is 32 bits, and F1_pre is 6 bits
  • the F2 field is the source IP address prefix match field, the bit width of F2_info is 32 bits, and F2_pre is 6 bits
  • F3 is the destination port range field, and F3_min is 16
  • F4_max is 16 bits
  • F4 is the source port range field, F4_min is 16 bits
  • F4_max is 16 bits
  • F5 is the protocol field field (exact match), and the bit width is 8 bits.
  • L is set to 5 as shown in FIG. 6.
  • This process can be divided into two parts: rule pre-processing process and data packet classification process.
  • Step 2_1. Extract the destination IP address prefix information of R (1), that is, the information corresponding to the F1 field. Use the hash function Hash1 as the KEY value to hash to get the hash value Hi1_F1. Use the hash value Hi1_F1 as the address to extract The destination IP address prefix information is written into the F1 fields of the 32 prefix matching tables R_F1_table_1 to R_F1_table_32. Extract the source IP address prefix information of R (1), that is, the information corresponding to the F2 field. Use the hash function Hash1 as the KEY value to hash to get the hash value Hi1_F2. Use the hash value Hi1_F2 as the address to extract the source IP address.
  • the address prefix information is written into the F2 fields of the 32 prefix matching tables R_F2_table_1 to R_F2_table_32.
  • R_F1_table_1 to R_F1_table_32 and R_F2_table_1 to R_F2_table_32 are stored in the prefix matching table storage module 32.
  • Steps 2_2, (a) extract the destination IP address prefix information, source IP address prefix information, and protocol information of R (1), that is, the information corresponding to the F1, F2, and F5 fields, generate a KEY value, and use the hash function Hash2 to perform the Ha It is hoped that the hash value Hi2_R is obtained, and Hi2_R is used as an address to read the rule set and store the rule set in the module and store the table R_table.
  • the schematic diagram of the structure of the rule set and stored table is shown in FIG. 6.
  • the rule collection and storage module returns a beat data to determine whether the F1, F2, and F5 fields are empty.
  • F1, F2, and F5 fields are empty, write the destination IP address prefix information into the F1 field of R_table.
  • the source IP address prefix information is written into the F2 field of R_table, and the protocol information is written into the F5 field of R_table.
  • the F1, F2, and F5 fields are not empty, determine whether the information in the F1 field is the same as the destination IP address prefix information, whether the information in the F2 field is the same as the destination IP address prefix information, and whether the information in the F5 field is the same as the protocol. The information is the same. If they are the same, continue to determine whether there are empty F3, F4, and their corresponding ACT fields. If there are empty F3, F4, and their corresponding ACT fields, write the destination port range information. Enter the empty F3 field in R_table, write the source port range information into the empty F4 field in R_table, and write the action information into the corresponding ACT field. In other cases, it is determined that the preprocessing fails.
  • Step 1 The rule set query module 34 extracts information of the corresponding fields of the rule set R from the data packet to be classified, which are: F1_P, F2_P, F3_P, F4_P, and F5_P.
  • Steps 2_1, (a) use 1-32 as the prefix size, and generate KEY values with F1_P: KEY_P_F1_1, KEY_P_F1_2 ..., KEY_P_F1_32. (b) Use the hash function Hash1 to hash these 32 KEY values at the same time, and output 32 hash values: Hi1_P_F1_1, Hi1_P_F1_2 ... Hi1_P_F1_32, and use these 32 hash values to read R_F1_table_1, R_F1_table_2, respectively. ... R_F1_table_32 (only one table per hash value). (c) Compare the data returned by each table with the respective KEY value, and store the consistent KEY in R_F1_table_KEY (u). As can be seen from the foregoing, u ⁇ 5.
  • Steps 2_2, (a) use 1-32 as the prefix size, and respectively generate KEY values with F2_P: KEY_P_F2_1, KEY_P_F2_2 ... KEY_P_F2_32. (b) Use the hash function Hash1 to hash these 32 KEY values at the same time, and output 32 hash values: Hi1_P_F2_1, Hi1_P_F2_2 ... Hi1_P_F2_32, and use these 32 hash values to read R_F2_table_1, R_F2_table_2. ..R_F2_table_32 (only one table for each hash value). (c) Compare the data returned by each table with the respective KEY value, and store the consistent KEY in R_F2_table_KEY (v). As can be seen from the foregoing, v ⁇ 5.
  • Step 3 Generate a new KEY value according to R_F1_table_KEY (u), R_F2_table_KEY (v) and F5_P and store it in KEY_P.
  • Step 4 Use the hash function Hash2 to hash KEY_P, and use the hash address to read the rule set and store the rule set in the module and store the table. Data of up to 25 beats will be returned and sent to the rule matching selection module 35.
  • Step 5 The execution rule matching selection module 35 receives the rule set and stores the data output by the module 34.
  • Step 6 Compare the KEY_P with the F1, F2, and F5 fields in the returned data. In the consistent data, use F3_P and F4_P to match the range fields existing in the returned data, and select the best matching result. And output the corresponding ACT.
  • the data packet classification method and device provided by the present disclosure do not require complicated re-division of the rule set R, and are stored in the prefix matching table storage module and rule after hashing according to the corresponding field of the rule during preprocessing. Gather and store the modules.
  • An embodiment of the present disclosure further provides a data packet classification device including a memory and a processor, where the memory stores the following instructions that can be executed by the processor:
  • prefix information is information corresponding to the prefix basic information match field in the prefix match field of the preset rule set
  • precise information is an exact match with the preset rule set
  • the range information is information corresponding to the range matching field in the preset rule set.
  • the pre-established prefix matching table and rule set classification table are used to obtain the classification results of the data packets to be classified.
  • the memory specifically stores the following instructions that can be executed by the processor:
  • the data record includes prefix matching information, exact matching information, multiple range matching information, and action matching information corresponding to multiple range matching information.
  • range matching information containing range information from the obtained data records as target range matching information.
  • the memory specifically stores the following instructions that can be executed by the processor:
  • the first preset hash function is used to perform hash operations on the obtained multiple first key values to obtain multiple first hash values.
  • the plurality of first hash values respectively obtained are used to read the prefix matching table to obtain multiple pieces of prefix matching information.
  • Prefix matching information corresponding to each of the plurality of first key values is determined from the obtained pieces of prefix matching information as target prefix matching information.
  • the memory further stores the following instructions that can be executed by the processor:
  • a second preset hash function is used to perform a hash operation on the obtained second key value to obtain a second hash value.
  • the second hash value obtained is used to read the rule set classification table to obtain a data record.
  • a data record corresponding to both the target prefix matching information and the precise information is determined in the obtained data record.
  • the memory also specifically stores the following instructions that can be executed by the processor:
  • the prefix matching table read with any one of the first hash values is different from the prefix matching table read with any other first hash value.
  • the memory further stores the following instructions that can be executed by the processor:
  • each obtained prefix matching information corresponds to a first key value according to which the prefix matching information is read.
  • the memory further stores the following instructions that can be executed by the processor:
  • the prefix matching information includes basic prefix matching information and a prefix matching length corresponding to the basic prefix matching information.
  • the pre-established first empty table is filled according to the obtained basic prefix matching information and the prefix matching length corresponding to the basic prefix matching information to obtain a prefix matching table.
  • the memory further stores the following instructions that can be executed by the processor:
  • a third key value is generated according to the prefix matching basic information and a prefix matching length corresponding to the prefix matching basic information.
  • a hash operation is performed on the obtained third key value by using a first preset hash function to obtain a third hash value.
  • the third key value is written into the first empty table.
  • the memory further stores the following instructions that can be executed by the processor:
  • a fourth key value is generated according to the obtained prefix matching information and an exact matching length corresponding to the prefix matching information.
  • the memory further stores the following instructions that can be executed by the processor:
  • prefix match field and exact match field in the obtained data record are both empty, the prefix match information, exact match information, range match information, and action information are filled into the prefix match field, exact match field, and range match field of the data record, respectively. And action fields.
  • the memory further stores the following instructions that can be executed by the processor:
  • An embodiment of the present disclosure further provides a computer-readable storage medium, where computer-executable instructions are stored, and the computer-executable instructions are used to perform the following steps:
  • prefix information is information corresponding to the prefix basic information match field in the prefix match field of the preset rule set
  • precise information is an exact match with the preset rule set
  • the range information is information corresponding to the range matching field in the preset rule set.
  • the pre-established prefix matching table and rule set classification table are used to obtain the classification results of the packets to be classified.
  • the computer-executable instructions specifically perform the following steps:
  • the data record includes prefix matching information, exact matching information, multiple range matching information, and multiple range matching information corresponding to the action matching information.
  • range matching information containing range information from the obtained data records as target range matching information.
  • the computer-executable instructions specifically perform the following steps:
  • the first preset hash function is used to perform hash operations on the obtained multiple first key values to obtain multiple first hash values.
  • the plurality of first hash values respectively obtained are used to read the prefix matching table to obtain multiple pieces of prefix matching information.
  • Prefix matching information corresponding to each of the plurality of first key values is determined from the obtained pieces of prefix matching information as target prefix matching information.
  • the computer-executable instructions further perform the following steps:
  • a second preset hash function is used to perform a hash operation on the obtained second key value to obtain a second hash value.
  • the second hash value obtained is used to read the rule set classification table to obtain a data record.
  • a data record corresponding to both the target prefix matching information and the precise information is determined in the obtained data record.
  • the number of prefix matching tables and the number of types of prefix matching length are the same.
  • the computer-executable instructions further perform the following steps:
  • the prefix matching table read with any one of the first hash values is different from the prefix matching table read with any other first hash value.
  • the computer-executable instructions further perform the following steps:
  • each obtained prefix matching information corresponds to a first key value according to which the prefix matching information is read.
  • the computer-executable instructions further perform the following steps:
  • the computer-executable instructions further perform the following steps:
  • the prefix matching information includes basic prefix matching information and a prefix matching length corresponding to the basic prefix matching information.
  • the pre-established first empty table is filled according to the obtained basic prefix matching information and the prefix matching length corresponding to the basic prefix matching information to obtain a prefix matching table.
  • the computer-executable instructions further perform the following steps:
  • a third key value is generated according to the prefix matching basic information and a prefix matching length corresponding to the prefix matching basic information.
  • a hash operation is performed on the obtained third key value by using a first preset hash function to obtain a third hash value.
  • the third key value is written into the first empty table.
  • the computer-executable instructions further perform the following steps:
  • the computer-executable instructions further perform the following steps:
  • a fourth key value is generated according to the obtained prefix matching information and an exact matching length corresponding to the prefix matching information.
  • the computer-executable instructions further perform the following steps:
  • prefix match field and exact match field in the obtained data record are both empty, the prefix match information, exact match information, range match information, and action information are filled into the prefix match field, exact match field, and range match field of the data record, respectively. And action fields.
  • the computer-executable instructions further specifically perform the following steps:

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本文公开了一种数据包的分类方法、装置及计算机可读存储介质,包括:从待分类数据包中获取前缀信息、范围信息以及精确信息;分别以前缀信息、前缀信息和精确信息、以及范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果。

Description

数据包的分类方法、装置及计算机可读存储介质
本申请要求在2018年8月24日提交中国专利局、申请号为201810972030.7的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开实施例涉及网络通信技术领域,例如涉及一种数据包的分类方法、装置及计算机可读存储介质。
背景技术
随着互联网(Internet)的发展,网络应用对网络的性能、安全和服务种类的需求也趋于多样化。当网络应用希望路由器提供防火墙(Firewalls)、虚拟专用网(Virtual Private Network,VPN)、服务质量(Quality of Service,QoS)、区分服务(Differentiated Services)、流量计费(Traffic billing)、基于策略的路由(Policy-base routing)等多种功能支持时,这就需要路由器对不同功能的数据包进行不同对待,也就是将数据包分类功能集成到路由器中。实现数据包分类时,都会定义一个分类规则集,他们由一系列的规则组成,每一条规则包括多个字段(或者称为域)和相应的行动组成,其中,规则中的字段和数据流中的字段是对应的,当数据包进入路由器后,提取数据包中与规则集的字段对应的信息,基于这些信息在规则集中找到匹配的规则,进而根据规则中定义的行动对数据包进行处理。
相关技术中,常常使用报文分类算法Hicuts对数据包进行分类,该分类方法是先根据一个字段在规则集中查找符合该字段的规则,再根据另一字段在查找到的规则中查找符合新字段的规则,直到所有字段都遍历完,最终得到的规则中的行动就是数据包分类的结果,即根据最终得到的规则中的行动对数据包进行处理。
然而,由于这种方法是在规则集中根据一个字段接一个字段地进行规则查找的,因此耗费的时间较长,从而造成数据包的分类效率低下。
发明内容
本公开实施例提供了一种数据包的分类方法、装置及计算机可读存储介质,能够实现数据包的快速分类,提高数据包的分类效率。
本公开实施例提供了一种数据包的分类方法,包括:
从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
本公开实施例还提供了一种数据包的分类装置,包括:
获取模块,设置为从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
处理模块,设置为分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
本公开实施例还提供了一种哈希冲突的处理装置,包括:处理器和存储器,其中,存储器中存储有以下可被处理器执行的指令:
从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
本公开实施例还提供了一种计算机可读存储介质,所述存储介质上存储有 计算机可执行指令,所述计算机可执行指令用于执行以下步骤:
从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
附图说明
附图用来提供对本公开技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本公开的技术方案,并不构成对本公开技术方案的限制。
图1为本公开实施例提供一种数据包的分类方法的流程示意图;
图2为本公开实施例提供一种数据包的分类装置的结构示意图;
图3为本公开实施例提供的一种规则结构示意图;
图4为本公开实施例提供另一种数据包的分类装置的结构示意图;
图5为本公开实施例提供的一种规则集合并存储表的结构示意图;
图6为本公开实施例提供的另一种规则集合并存储表的结构示意图。
具体实施方式
下文中将结合附图对本公开的实施例进行详细说明。在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
相关技术中,流分类算法包括:穷举法、规则集划分法和维度分解法这三类,其中,穷举法包括:线性匹配法和基于三态内容寻址存储器(Ternary Content  Addressable Memory,TCAM)的匹配法,规则集划分法包括:网格字典树(Trie树)匹配法、Hicuts匹配法和元组空间匹配法,维度分解法包括:位向量(Bit Vector,BV)匹配法和递归流分类(Recursive Flow Classification,RFC)匹配法。下面针对这些数据包分类方法依次进行说明:
1、穷举法
1.1、线性匹配法
采用的是最简单线性数据结构来存储分类规则,分类规则一般按照优先级或代价函数降序排列。进行查找时,数据包会逐个和规则进行比较,直到找到匹配的规则。这种算法实现简单并且存储利用率高,但是查找性能不好,在最坏情况下要遍历完所有规则,才能找到匹配项。
1.2、基于TCAM的匹配法
用硬件实现的穷举分类算法采用TCAM作为分类引擎。在一个时钟周期内即可完成一次数据包的匹配。
2、规则集划分法
2.1、网格Trie树匹配法(Grid of Trie)
网格Trie树算法引入了转向指针,将子规则集中的重复的子树删除,只保留一棵子树,在原来被删除子树的父节点处,增加一条指针指向保留子树。
2.2、Hicuts匹配法
Hicuts匹配法结合了决策树搜索和线性查找两种分类方式,采用多级空间分解,每级分解在一个维度上进行,把规则集划分为多个叶子节点内的小规则集。该算法划分的出发点是根据规则集本身的特征自动调节数据结构,最大限度的利用优化的数据结构来减少冗余。
2.3、元组空间匹配法
元组空间算法计算规则集中每条规则每一维的前缀中有效位的个数,得到一个元组(Tuple),所有规则的元组组成一个集合,称为元组空间。将规则集中所有规则按照元组空间划分成多个子规则集,每个元组对应一个子规则集。每个子规则集内部,根据规则每一维前缀中的有效位建立一个哈希表存储该子 规则集的所有规则。
3、维度分解法
3.1、BV匹配法
该算法为每一维构建一棵一维Trie树,并为Trie树中每个具有有效前缀的节点制定一个位图,位图是一个n位的特征向量(n为规则数目),用于标识与该节点对应的前缀相匹配的规则,例如某节点的前缀与规则R(i)匹配,则位图中的第i位置1,否则置0。在查找时,对数据包的每一维在相应的Trie树中进行最长前缀匹配,得到相应的位图,将每一维位图进行与操作,位图中置1的位所标识的规则即为最佳匹配规则。
3.2、RFC匹配法
该算法利用规则集的结构特性,将整个域划分为多段,通过计算分段中的等价类和递归操作,实现空间的分布压缩映射。
衡量一个流分类算法的性能通过如下几个方面去进行:时间复杂度、空间复杂度、更新复杂度、可扩展性和规则的任意性。如果以d表示规则集中包含的域数量,以n表示算法输入位宽,以N表示规则数量,以w表示算法使用的规则集中的一个域的位宽,以W表示一条规则的总位宽,以P表示RFC算法的分级实现时的级数,那么以上算法的性能比较如下表1所示,
表1
Figure PCTCN2019101752-appb-000001
Figure PCTCN2019101752-appb-000002
为此,本公开实施例提供一种数据包的分类方法,如图1所示,该方法包括:
步骤101、从待分类数据包中获取前缀信息、精确信息和范围信息。
其中,前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,精确信息为与预设规则集中精确匹配字段对应的信息,范围信息为与预设规则集中范围匹配字段对应的信息。
步骤102、分别以前缀信息、前缀信息和精确信息、以及范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果。
本公开实施例提供的数据包的分类方法,由于从待分类数据包中获取了前缀信息、范围信息以及精确信息,仅仅按照前缀信息、前缀信息和精确信息、以及范围信息这三个维度出发进行查找就得到了分类结果,从而实现了数据包的快速分类,极大程度地提高了分类效率。
可选地,分别以前缀信息、前缀信息和精确信息、以及范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果,包括:
步骤102a、从前缀匹配表中获取与前缀信息对应的前缀匹配信息,作为目标前缀匹配信息。
步骤102b、从规则集分类表中获取与目标前缀匹配信息和精确信息均对应 的数据记录。
其中,数据记录包括:前缀匹配信息、精确匹配信息、多个范围匹配信息以及多个范围匹配信息分别对应的动作匹配信息。
步骤102c、从获得的数据记录中获取包含该范围信息的范围匹配信息,作为目标范围匹配信息。
步骤102d、获取与目标范围匹配信息对应的动作匹配信息,作为待分类数据包的分类结果。
在一实施例中,前缀匹配表中包括:多个前缀匹配信息;规则集分类表中包括:多个数据记录。
可选地,从前缀匹配表中获取与前缀信息对应的前缀匹配信息,包括:
步骤102a1、根据多条前缀信息和多条前缀信息分别对应的前缀匹配长度生成多个第一关键值。
在一实施例中,第一关键值的个数是多个。
例如,生成关键值的方法可以是通过前缀信息和前缀匹配长度作某种预设运算而生成的,也可以是根据前缀匹配长度截取前缀信息而生成的。
步骤102a2、利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算,得到多个第一哈希值。
在一实施例中,由于第一关键值的个数是多个,利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算包括:利用第一预设哈希函数对获得的每一个第一关键值进行哈希运算。
步骤102a3、分别以获得的多个第一哈希值为地址读取前缀匹配表,得到多条前缀匹配信息。
在一实施例中,分别以获得的多个第一哈希值为地址读取前缀匹配表,得到多条前缀匹配信息包括:以获得的每一个第一哈希值为地址读取前缀匹配表,得到每条前缀匹配信息。
步骤102a4、在获得的多条前缀匹配信息中确定与多个第一关键值分别对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,从规则集分类表中获取与目标前缀匹配信息和精确信息均对应的数据记录,包括:
步骤102b1、根据目标前缀匹配信息和精确匹配信息生成第二关键值。
在一实施例中,目标前缀匹配信息可能有多个,当目标前缀匹配信息有多个时,根据目标前缀匹配信息和精确匹配信息生成第二关键值指的是:根据每一给目标前缀匹配信息和精确匹配信息生成第二关键值,相应的,第二关键值也有多个。
步骤102b2、利用第二预设哈希函数对第二关键值进行哈希运算,得到第二哈希值。
在一实施例中,当第二关键值为多个时,利用第二预设哈希函数对第二关键值进行哈希运算指的是:利用第二预设哈希函数对每一个第二关键值进行哈希运算。
步骤102b3、以获得的第二哈希值为地址读取规则集分类表,得到数据记录。
在一实施例中,当第二哈希值为多个时,以获得的第二哈希值为地址读取规则集分类表指的是:以获得的每一个第二哈希值为地址读取规则集分类表。
步骤102b4、在获得的数据记录中确定与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,前缀匹配表的数量和前缀匹配长度的种类个数相同。
以获得的第一哈希值为地址读取前缀匹配表,包括:
以获得的每一个第一哈希值为地址读取一个前缀匹配表。
其中,以任意一个第一哈希值为地址所读取的前缀匹配表与以其他任意一个第一哈希值为地址所读取的前缀匹配表不同。即,以不同的第一哈希值为地址所读取的前缀匹配表不同。
在一实施例中,在前缀匹配表的数量和前缀匹配长度的种类个数相同的情况下,以获得的每一个第一哈希值为地址读取一个前缀匹配表时可以大幅度提升前缀匹配信息的读取速度。
在一实施例中,假设前缀匹配长度的种类个数为N,那么获得的第一哈希 值的个数也为N,相应的前缀匹配表的个数也为N,则以获得的每一个第一哈希值为地址读取一个前缀匹配表指的是:以获得的第1个第一哈希值为地址读取第1个前缀匹配表,以获得的第2个第一哈希值为地址读取第2个前缀匹配表…以获得的第N个第一哈希值为地址读取第N个前缀匹配表,其中,第1个前缀匹配表、第2个前缀匹配表…第N个前缀匹配表并不是对于前缀匹配表本身的限定,而仅仅用于标识前缀匹配表。
可选地,在获得的多条前缀匹配信息中确定与多个第一关键值分别对应的前缀匹配信息,包括:
步骤102a4a、判断获得的每个前缀匹配信息是否与该前缀匹配信息在读取过程中所根据的第一关键值对应。
步骤102a4b、获取在读取过程中所根据的第一关键值与自身对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,在获得的数据记录中确定与目标前缀匹配信息和精确信息均对应的数据记录,包括:
步骤102b4a、判断获得的数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精确匹配信息是否与精确信息相同。
在一实施例中,如果获得的数据记录为多条,那么判断获得的数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精确匹配信息是否与精确信息相同指的是:判断获得的每一条数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精确匹配信息是否与精确信息相同。
步骤102b4b、获取前缀匹配信息与目标前缀匹配信息相同,且精确匹配信息与精确信息相同的数据记录,作为与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,在从待分类数据包中获取与预设规则集的前缀匹配字段中前缀信息匹配字段对应的前缀信息、范围匹配字段对应的范围信息以及精确匹配字段对应的精确信息之前,还包括:
步骤103、获取预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息。
其中,前缀匹配信息包括:前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度。
在一实施例中,获取预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息指的是:获取预设规则集中每一个规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息。
步骤104、根据获得的前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,得到前缀匹配表。
例如,第一空表的数量可以是一张,也可以是与前缀匹配长度的种类个数相同的张数。当第一空表的数量为与前缀匹配长度的种类个数相同的张数时,可以有效提高后续前缀匹配信息的读取速度。
步骤105、根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,得到规则集分类表。
可选地,根据获得的前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,包括:
步骤104a、根据前缀匹配基本信息以及与该前缀匹配基本信息对应的前缀匹配长度生成第三关键值。
步骤104b、利用第一预设哈希函数对获得的第三关键值进行哈希运算,得到第三哈希值。
在一实施例中,如果第三关键值的个数为多个,利用第一预设哈希函数对获得的第三关键值进行哈希运算指的是:利用第一预设哈希函数对获得的每一个第三关键值进行哈希运算。
步骤104c、以获得的第三哈希值为地址将第三关键值写入第一空表。
在一实施例中,如果第三哈希值的个数为多个,以获得的第三哈希值为地址将第三关键值写入第一空表指的是:以获得的每一个第三哈希值为地址将第三关键值写入第一空表。
可选地,根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,包括:
步骤105a、根据获得的前缀匹配信息和该前缀匹配信息对应的精确匹配长度生成第四关键值。
步骤105b、利用第二预设哈希函数对获得的第四关键值进行哈希运算,得到第四哈希值。
例如,如果第四关键值为多个,利用第二预设哈希函数对获得的第四关键值进行哈希运算指的是:利用第二预设哈希函数对获得的每一个第四关键值进行哈希运算。
步骤105c、以第四哈希值为地址读取第二空表,获得数据记录。
例如,如果第四哈希值为多个,以第四哈希值为地址读取第二空表指的是:以每一个第四哈希值为地址读取第二空表。
步骤105d、根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表。
可选地,根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表,包括:
步骤105d1、判断获得的数据记录中前缀匹配字段和精确匹配字段是否为空。
步骤105d2、如果获得的数据记录中前缀匹配字段和精确匹配字段均为空,将前缀匹配信息、精确匹配信息、范围匹配信息和动作信息分别填充至数据记录的前缀匹配字段、精确匹配字段、范围匹配字段和动作字段。
在一实施例中,如果获得的数据记录中前缀匹配字段和精确匹配字段均为空,说明该条数据记录还没有写入数据。相应的,一旦该条数据记录写入数据,即使范围匹配字段和动作字段为空,前缀匹配字段和精确匹配字段也必然不为空。
可选地,如果获得的数据记录中前缀匹配字段和精确匹配字段不为空,还包括:
步骤105d3、判断获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息是否相同,且数据记录中的精确匹配字段上的信息与精确匹配信息是否相同。
步骤105d4、如果获得的数据记录中的前缀匹配字段上的信息与前缀匹配信 息相同,且数据记录中的精确匹配字段上的信息与精确匹配信息相同,判断获得的数据记录中是否存在空的范围匹配字段和动作字段。
步骤105d5、如果获得的数据记录中存在空的范围匹配字段和动作字段,将范围匹配字段和动作字段填入空的范围匹配字段和动作字段。
本公开实施例提供一种数据包的分类装置,如图2所示,该数据包的分类装置2包括:
获取模块21,设置为从待分类数据包中获取前缀信息、精确信息和范围信息;其中,前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,精确信息为与预设规则集中精确匹配字段对应的信息,范围信息为与预设规则集中范围匹配字段对应的信息。
处理模块22,设置为分别以前缀信息、前缀信息和精确信息、以及范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果。
可选地,处理模块22是设置为:
从前缀匹配表中获取与前缀信息对应的前缀匹配信息,作为目标前缀匹配信息。
从规则集分类表中获取与目标前缀匹配信息和精确信息均对应的数据记录。其中,数据记录包括:前缀匹配信息、精确匹配信息、多个范围匹配信息以及多个范围匹配信息分别对应的动作匹配信息。
从获得的数据记录中获取包含范围信息的范围匹配信息,作为目标范围匹配信息。
获取与目标范围匹配信息对应的动作匹配信息,作为待分类数据包的分类结果。
可选地,处理模块22是设置为:
根据多条前缀信息和多条前缀信息分别对应的多种前缀匹配长度生成多个第一关键值。
利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算,得到 多个第一哈希值。
分别以获得的多个第一哈希值为地址读取前缀匹配表,得到多条前缀匹配信息。
在获得的多条前缀匹配信息中确定与多个第一关键值分别对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,处理模块22是设置为:
根据目标前缀匹配信息和精确匹配信息生成第二关键值。
利用第二预设哈希函数对获得的第二关键值进行哈希运算,得到第二哈希值。
以获得的第二哈希值为地址读取规则集分类表,得到数据记录。
在获得的数据记录中确定与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,前缀匹配表的数量和前缀匹配长度的种类个数相同。
处理模块22,是设置为以获得的每一个第一哈希值为地址读取一个前缀匹配表。其中,以任意一个第一哈希值为地址所读取的前缀匹配与以其他任意一个第一哈希值为地址所读取的前缀匹配表不同。
可选地,处理模块22是设置为:
判断获得的每个前缀匹配信息是否与该前缀匹配信息在读取过程中所根据的第一关键值相对应。
获取在读取过程中所根据的第一关键值与自身对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,处理模块22是设置为:
判断获得的数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精确匹配信息是否与精确信息相同。
获取前缀匹配信息与目标前缀匹配信息相同,且精确匹配信息与精确信息相同的数据记录,作为与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,处理模块22还设置为:
获取预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息。其中,前缀匹配信息包括:前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度。
根据获得的前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,得到前缀匹配表。
根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,得到规则集分类表。
可选地,处理模块22是设置为:
根据前缀匹配基本信息以及与该前缀匹配基本信息对应的前缀匹配长度生成作为第三关键值。
利用第一预设哈希函数对获得的第三关键值进行哈希运算,得到第三哈希值。
以获得的第三哈希值为地址将第三关键值写入第一空表。
可选地,处理模块22是设置为:
根据获得的前缀匹配信息和该前缀匹配信息对应的精确匹配长度生成第四关键值。
利用第二预设哈希函数对获得的第四关键值进行哈希运算,得到第四哈希值。
以第四哈希值为地址读取第二空表,获得数据记录。
根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表。
可选地,处理模块22是设置为:
判断获得的数据记录中的前缀匹配字段和精确匹配字段是否为空。
如果获得的数据记录中的前缀匹配字段和精确匹配字段均为空,将前缀匹配信息、精确匹配信息、范围匹配信息和动作信息分别填充至数据记录的前缀匹配字段、精确匹配字段、范围匹配字段和动作字段。
可选地,如果获得的数据记录中前缀匹配字段和精确匹配字段不为空,处理模块22还设置为:
判断获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息是否相同,且数据记录中的精确匹配字段上的信息与精确匹配信息是否相同。
如果获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息相同,且数据记录中的精确匹配字段上的信息与精确匹配信息相同,判断获得的数据记录中是否存在空的范围匹配字段和动作字段。
如果获得的数据记录中存在空的范围匹配字段和动作字段,将范围匹配字段和动作字段填入空的范围匹配字段和动作字段。
本公开实施例提供的数据包的分类装置,由于从待分类数据包中获取了前缀信息、范围信息以及精确信息,仅仅按照前缀信息、前缀信息和精确信息、以及范围信息这三个维度出发进行查找就得到了分类结果,从而实现了数据包的快速分类,极大程度地提高了分类效率。
在实际应用中,所述获取模块21和处理模块22可由位于数据包的分类装置中的中央处理器(Central Processing Unit,CPU)、微处理器(Micro Processor Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)或现场可编程门阵列(Field Programmable Gate Array,FPGA)等实现。
本公开还提供了一种数据包的分类装置,假设规则集R包含N(N=2 I,I为正整数)个规则,分别为:R(1),R(2),…,R(N)。规则的结构示意图如图3所示,包含3个字段:F1字段、F2字段、F3字段和动作ACT字段,其中,F1字段是前缀匹配字段,F2字段是范围匹配字段,F3字段是精确匹配字段,F1字段、F2字段和F3字段均以二进制表示。
F1字段由位宽为F1_info_len的前缀匹配基本信息F1_info,以及位宽为F1_pre_len的前缀大小F1_pre组成。其中,F1_pre最大值为F1_info_len,F1字段总长度F1_len=F1_info_len+F1_pre_len。
F2字段由位宽为F2_min_len的范围下限F2_min,以及位宽为F2_max_len的范围上限F2_max组成。其中,F2_len=F2_min_len+F2_max_len。
F3字段表示为F3_info,位宽为F3_len。
如图4所示,该数据包的分类装置包括:规则集预处理模块31、前缀匹配表存储模块32、规则集合并存储模块33、规则集查询模块34和规则集匹配选择模块35。
规则集预处理模块31,设置为从规则集R中提取信息,进行哈希,并对前缀匹配表存储模块32和规则集合并存储模块33进行读写操作。
前缀匹配表存储模块32,设置为存储规则集R中的前缀匹配信息。
规则集合并存储模块33,设置存储规则集R中的规则。
规则集查询模块34,设置为从输入的数据包中提取和规则集R对应的字段信息,通过使用和规则集预处理模块31相同的哈希函数对提取信息进行哈希后读前缀匹配表存储模块32和规则集合并存储模块33。
规则集匹配选择模块35,设置为从待分类数据包中提取的字段和规则集合并存储模块33返回的字段进行比较,得出最优匹配结果。
下面提供一个具体实施例说明本公开实施例提供的数据包的分类装置进行数据包的分类过程,该过程可以分为两个部分,分别是:规则预处理过程和数据包分类过程。
规则预处理过程:
步骤1、令i=1,同时执行步骤2_1和2_2。
步骤2_1、从R(1)中提取前缀匹配信息,即与F1字段对应的信息,记为F1_info和F1_pre,取键值KEY_F1={F1_info,F1_pre},使用哈希函数Hash1对KEY_F1进行哈希,Hi1=hash1(KEY_F1),Hi1是I比特位宽的二进制数,将KEY_F1同时写入M(M=F1_info_len)个前缀匹配表,M个前缀匹配表分别为:R_F1_table_1、R_F1_table_2...R_F1_table_M,M个前缀匹配表存储于前缀匹配存储模块中。其中,它们的写地址为Hi1。
步骤2_2、(a)从R(1)中提取前缀信息和精确信息,即与F1字段和F3字段对应的信息,记为:F1_info、F1_pre和F3_info,将他们组为键值KEY_R={F1_info,F1_pre,F3_info}。(b)使用哈希函数Hash2对KEY_R进行哈希,Hi2=hash2(KEY_R),Hi2是I比特位宽的二进制数。(c)以Hi2为地址读规则集合并存储模块中的规则集合并存储表R_table,规则集合并存储表的 结构示意图如图5所示。(d)判断F1字段和F3字段是否为空,如果F1字段和F3字段都为空,将前缀信息写入R_table的F1字段中,将精确信息写入R_table的F3字段中,并将范围信息写入R_table的第一个F2字段中,将动作信息写入R_table第一个F2字段对应的ACT字段中。如果F1字段和F3字段不为空,判断F1字段中的信息是否与前缀信息相同,F3字段中的信息是否与精确信息相同,如果都相同,则判断是否存在为空的F2字段及其相应的ACT字段,如果存在为空的F2字段及其相应的ACT字段,则将范围信息写入R_table中为空的F2字段,将动作信息写入相应的ACT字段,其他情况确定本次预处理失败。该步骤的写地址为Hi2。
步骤3、令i=2,再次同时执行步骤2_1和2_2,直到i=N,规则预处理过程结束。
数据包分类过程:
该过程由规则集查询模块34和规则集匹配选择模块35实现,具体步骤如下:
步骤1、规则集查询模块34从待分类的数据包中提取和规则集R相应字段的信息,分别为:F1_P、F2_P和F3_P。
步骤2、使用F1_P和1、2...M分别生成一个KEY值,记为:KEY_P_1、KEY_P_2...KEY_P_M。这里生成KEY值的方法为:KEY值的高F1_P_pre比特位同F1_P的高F1_P_pre比特位,其他位置为0。
步骤3、使用哈希函数Hash1对KEY_P_1、KEY_P_2...KEY_P_M同时进行哈希,得出M个哈希结果Hi1_P_1、Hi1_P_2...Hi1_P_M。其中,Hi1_P_1、Hi1_P_2...Hi1_P_M都是位宽为I比特的二进制数。
步骤4、使用Hi1_P_1、Hi1_P_2...Hi1_P_M去读前缀匹配表R_F1_table_1、R_F1_table_2...R_F1_table_M。
步骤5、R_F1_table_1、R_F1_table_2...R_F1_table_M返回M个结果,分别和KEY_P_1、KEY_P_2...KEY_P_M进行比较,提取比较结果一致的键值,标记为KEY_P_1、KEY_P_2...KEY_P_J,J≦M。
步骤6、将KEY_P_1、KEY_P_2...KEY_P_J分别和F3_P生成新的键值,标 记为KEY_R_1={KEY_P_1,F3_P}、KEY_R_2={KEY_P_2,F3_P}...KEY_R_J={KEY_P_J,F3_P}。
步骤7、使用哈希函数Hash2对分别对KEY_R_1、KEY_R_2...KEY_R_J进行哈希,输出哈希值为Hi2_R_1、Hi2_R_2...Hi2_R_J。其中,Hi2_R_1、Hi2_R_2...Hi2_R_J都是位宽为I比特的二进制数。
步骤8、使用Hi2_R_1、Hi2_R_2...Hi2_R_J为地址,依次去读R_table。
步骤9、R_table返回J个数据记录,每条数据记录的格式如图5所示,将KEY_R_1、KEY_R_2...KEY_R_J和这J个返回的数据记录中的F1字段以及F3字段进行比较,留下比较结果一致的数据记录,使用F2_P在留下的结果中的范围字段中去匹配,找出F2_P匹配的范围字段,确定范围字段后就确定了ACT字段,输出ACT字段,如果最终没有匹配的,本次流分类失败。
下面再提供一个具体实施例说明本公开实施例提供的数据包的分类装置进行数据包的分类过程。假设规则集R中包含16K个规则,即N=16K,I=14。且假设规则集中包含的是互联网协议(Internet Protocol,IP)的五元组信息,即规则中包含F1字段、F2字段、F3字段、F4字段和F5字段这5个字段,F1字段为目的IP地址前缀匹配字段,F1_info的位宽为32比特,F1_pre是6比特;F2字段为源IP地址前缀匹配字段,F2_info的位宽为32比特,F2_pre是6比特;F3是目的端口范围字段,F3_min为16比特,F3_max为16比特;F4是源端口范围字段,F4_min为16比特,F4_max为16比特;F5为协议字段字段(精确匹配),位宽为8比特。且如图6所示的L设置为5。
该过程可以分为两个部分,分别是:规则预处理过程和数据包分类过程。
规则预处理过程:
步骤1、令i=1,同时执行步骤2_1和2_2;
步骤2_1、提取R(1)的目的IP地址前缀信息,即与F1字段对应的信息,作为KEY值使用哈希函数Hash1进行哈希,得到哈希值Hi1_F1,以哈希值Hi1_F1为地址将提取的目的IP地址前缀信息写入32个前缀匹配表R_F1_table_1~R_F1_table_32的F1字段。提取R(1)的源IP地址前缀信息,即与F2字段对应的信息,作为KEY值使用哈希函数Hash1进行哈希,得到哈希值Hi1_F2,以哈希值Hi1_F2为地址将提取的源IP地址前缀信息写入32个前 缀匹配表R_F2_table_1~R_F2_table_32的F2字段。R_F1_table_1~R_F1_table_32和R_F2_table_1~R_F2_table_32都存储于前缀匹配表存储模块32。
步骤2_2、(a)提取R(1)的目的IP地址前缀信息、源IP地址前缀信息和协议信息,即与F1、F2和F5字段对应的信息,生成KEY值,使用哈希函数Hash2进行哈希,得出哈希值Hi2_R,并以Hi2_R为地址读规则集合并存储模块中的规则集合并存储表R_table,规则集合并存储表的结构示意图如图6所示。(b)规则集合并存储模块返回一拍数据,判断F1字段、F2字段和F5字段是否为空,如果F1字段、F2字段和F5字段为空,将目的IP地址前缀信息写入R_table的F1字段中,将源IP地址前缀信息写入R_table的F2字段中,将协议信息写入R_table的F5字段中。如果F1字段、F2字段和F5字段不为空,判断F1字段中的信息是否与目的IP地址前缀信息相同,F2字段中的信息是否与目的IP地址前缀信息相同,F5字段中的信息是否与协议信息相同,如果都相同,继续判断是否存在为空的F3字段、F4字段及其相应的ACT字段,如果存在为空的F3字段、F4字段及其相应的ACT字段,则将目的端口范围信息写入R_table中为空的F3字段,将源端口范围信息写入R_table中为空的F4字段,将动作信息写入相应的ACT字段,其他情况确定本次预处理失败。
步骤3、令i=2,再次同时执行步骤2_1和2_2,直到i=N,规则预处理过程结束。
数据包分类过程:
该过程由规则集查询模块34和规则集匹配选择模块35实现,具体步骤如下:
步骤1、规则集查询模块34从待分类的数据包中提取和规则集R相应字段的信息,分别为:F1_P、F2_P、F3_P、F4_P和F5_P。
步骤2_1、(a)以1-32为前缀大小,分别和F1_P生成KEY值:KEY_P_F1_1、KEY_P_F1_2...、KEY_P_F1_32。(b)使用哈希函数Hash1同时对这32个KEY值进行哈希,输出32个哈希值:Hi1_P_F1_1、Hi1_P_F1_2...Hi1_P_F1_32,并以这32个哈希值为地址分别去读R_F1_table_1、R_F1_table_2...R_F1_table_32(每个哈希值只读一个表)。(c)将每个表返回的数据和各自的KEY值进行比较,将一致的KEY存储于R_F1_table_KEY(u)中,由前述可知,u≦5。
步骤2_2、(a)以1-32为前缀大小,分别和F2_P生成KEY值:KEY_P_F2_1、KEY_P_F2_2...KEY_P_F2_32。(b)使用哈希函数Hash1同时对这32个KEY值进行哈希,输出32个哈希值:Hi1_P_F2_1、Hi1_P_F2_2...Hi1_P_F2_32,并以这32个哈希值为地址去读R_F2_table_1、R_F2_table_2...R_F2_table_32(每个哈希值只读一个表)。(c)将每个表返回的数据和各自的KEY值进行比较,将一致的KEY存储于R_F2_table_KEY(v)中,由前述可知,v≦5。
步骤3、根据R_F1_table_KEY(u)、R_F2_table_KEY(v)以及F5_P生成新的KEY值存储于KEY_P,KEY_P一共有u*v*1≦5*5*1=25种组合。
步骤4、使用哈希函数Hash2对KEY_P进行哈希,并以哈希地址去读规则集合并存储模块中的规则集合并存储表,会返回至多25拍的数据,送往规则匹配选择模块35。
步骤5、执行规则匹配选择模块35接收规则集合并存储模块34输出的数据。
步骤6、将KEY_P和返回的数据中的F1字段、F2字段和F5字段比较,在一致的数据中,在使用F3_P和F4_P和返回数据中存在的范围字段进行匹配,选择出最优匹配的结果,并将对应的ACT输出。
需要说明的是,本公开提供的数据包的分类方法及装置,不需要对规则集R进行复杂的重新划分,预处理时按照规则的相应字段进行哈希后存储于前缀匹配表存储模块和规则集合并存储模块即可。对待分类数据包进行分类时,也只要从包中提取需要的字段,进行哈希计算,使用哈希结果去读前缀匹配表存储表和规则集合并存储表,根据读结果和数据包中提取字段进行匹配。由上述描述可知,从前缀匹配表存储模块读回最多可以有M个匹配,也就是说最多从规则集合并存储表读出M个规则进行最终的比较,相关技术中的流分类的规则中(除了对第六版互联网协议(Internet Protocol Version 6,IPV6)的地址进行分类),M最大为32,实际使用时M会小于32。由统计可知,对于给定的IP地址,在规则集中以不同的前缀出现的数量不会大于5,所以M不会大于5。所以本专利的时间复杂度是O(M+1),空间复杂度是O(2*N),N为规则集中的规则数量。当需要对规则进行更新时,包括增加或删除规则,把待增加或删除的规则的输入到规则集预处理模块,进行哈希处理,对前缀匹配表存储模块和规则集合并存储模块进行增加和删减即可,简化了规则表更新过程。其他算法 在更新规则集是会对已有规则有影响,最严重的是要重新编排整个规则集,耗费时间,过程复杂。当规则集需要扩展时,修改前缀匹配表存储模块和规则集合并存储模块的深度以及使用的哈希函数的输出位宽即可,对规则扩展很容易适应。
本公开实施例还提供一种数据包的分类装置,包括存储器和处理器,其中,存储器中存储有以下可被处理器执行的指令:
从待分类数据包中获取前缀信息、精确信息和范围信息;其中,前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,精确信息为与预设规则集中精确匹配字段对应的信息,范围信息为与预设规则集中范围匹配字段对应的信息。
分别以前缀信息、前缀信息和精确信息、以及范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果。
可选地,存储器中具体存储有以下可被处理器执行的指令:
从前缀匹配表中获取与前缀信息对应的前缀匹配信息,作为目标前缀匹配信息。
从规则集分类表中获取与目标前缀匹配信息和精确信息均对应的数据记录。其中,数据记录包括:前缀匹配信息、精确匹配信息、多个范围匹配信息以及多个范围匹配信息对应的动作匹配信息。
从获得的数据记录中获取包含范围信息的范围匹配信息,作为目标范围匹配信息。
获取与目标范围匹配信息对应的动作匹配信息,作为待分类数据包的分类结果。
可选地,存储器中具体存储有以下可被处理器执行的指令:
根据多条前缀信息和多条前缀信息分别对应的多种前缀匹配长度生成多个第一关键值。
利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算,得到多个第一哈希值。
分别以获得的多个第一哈希值为地址读取前缀匹配表,得到多条前缀匹配信息。
在获得的多条前缀匹配信息中确定与多个第一关键值分别对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
根据目标前缀匹配信息和精确匹配信息生成第二关键值。
利用第二预设哈希函数对获得的第二关键值进行哈希运算,得到第二哈希值。
以获得的第二哈希值为地址读取规则集分类表,得到数据记录。
在获得的数据记录中确定与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,前缀匹配表的数量和前缀匹配长度的种类个数相同。存储器中还具体存储有以下可被处理器执行的指令:
以获得的第一哈希值为地址读取一个前缀匹配表。其中,以任意一个第一哈希值为地址所读取的前缀匹配与以其他任意一个第一哈希值为地址所读取的前缀匹配表不同。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
判断获得的每个前缀匹配信息是否与该前缀匹配信息在读取过程中所根据的第一关键值对应。
获取在读取过程中所根据的第一关键值与自身对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
判断获得的数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精确匹配信息是否与精确信息相同。
获取前缀匹配信息与目标前缀匹配信息相同,且精确匹配信息与精确信息相同的数据记录,作为与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,存储器中还存储有以下可被处理器执行的指令:
获取预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息。其中,前缀匹配信息包括:前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度。
根据获得的前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,得到前缀匹配表。
根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,得到规则集分类表。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
根据前缀匹配基本信息以及与该前缀匹配基本信息对应的前缀匹配长度生成第三关键值。
利用第一预设哈希函数对获得的第三关键值进行哈希运算,得到第三哈希值。
以获得的第三哈希值为地址将第三关键值写入第一空表。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
根据获得的前缀匹配信息和该前缀匹配信息对应的精确匹配长度生成第四关键值。
利用第二预设哈希函数对获得的第四关键值进行哈希运算,得到第四哈希值。
以第四哈希值为地址读取第二空表,获得数据记录。
根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表。
可选地,存储器中还具体存储有以下可被处理器执行的指令:
判断获得的数据记录中的前缀匹配字段和精确匹配字段是否为空。
如果获得的数据记录中的前缀匹配字段和精确匹配字段均为空,将前缀匹配信息、精确匹配信息、范围匹配信息和动作信息分别填充至数据记录的前缀匹配字段、精确匹配字段、范围匹配字段和动作字段。
可选地,如果获得的数据记录中前缀匹配字段和精确匹配字段不为空,存 储器中还具体存储有以下可被处理器执行的指令:
判断获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息是否相同,且数据记录中的精确匹配字段上的信息与精确匹配信息是否相同。
如果获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息相同,且数据记录中的精确匹配字段上的信息与精确匹配信息相同,判断获得的数据记录中是否存在空的范围匹配字段和动作字段。
如果获得的数据记录中存在空的范围匹配字段和动作字段,将范围匹配字段和动作字段填入空的范围匹配字段和动作字段。
本公开实施例还提供一种计算机可读存储介质,存储介质上存储有计算机可执行指令,计算机可执行指令用于执行以下步骤:
从待分类数据包中获取前缀信息、精确信息和范围信息;其中,前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,精确信息为与预设规则集中精确匹配字段对应的信息,范围信息为与预设规则集中范围匹配字段对应的信息。
分别以前缀信息、前缀信息和精确信息、范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取待分类数据包的分类结果。
可选地,计算机可执行指令具体执行以下步骤:
从前缀匹配表中获取与前缀信息对应的前缀匹配信息,作为目标前缀匹配信息。
从规则集分类表中获取与目标前缀匹配信息和精确信息均对应的数据记录。其中,数据记录包括:前缀匹配信息、精确匹配信息、多个范围匹配信息以及多个范围匹配信息分别对应的动作匹配信息。
从获得的数据记录中获取包含范围信息的范围匹配信息,作为目标范围匹配信息。
获取与目标范围匹配信息对应的动作匹配信息,作为待分类数据包的分类结果。
可选地,计算机可执行指令具体执行以下步骤:
根据多条前缀信息和多条前缀信息分别对应的多种前缀匹配长度生成多个第一关键值。
利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算,得到多个第一哈希值。
分别以获得的多个第一哈希值为地址读取前缀匹配表,得到多条前缀匹配信息。
在获得的多条前缀匹配信息中确定与多个第一关键值分别对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,计算机可执行指令还具体执行以下步骤:
根据目标前缀匹配信息和精确匹配信息生成第二关键值。
利用第二预设哈希函数对获得的第二关键值进行哈希运算,得到第二哈希值。
以获得的第二哈希值为地址读取规则集分类表,得到数据记录。
在获得的数据记录中确定与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,前缀匹配表的数量和前缀匹配长度的种类个数相同。计算机可执行指令还具体执行以下步骤:
以获得的第一哈希值为地址读取一个前缀匹配表。其中,以任意一个第一哈希值为地址所读取的前缀匹配与以其他任意一个第一哈希值为地址所读取的前缀匹配表不同。
可选地,计算机可执行指令还具体执行以下步骤:
判断获得的每个前缀匹配信息是否与该前缀匹配信息在读取过程中所根据的第一关键值对应。
获取在读取过程中所根据的第一关键值与自身对应的前缀匹配信息,作为目标前缀匹配信息。
可选地,计算机可执行指令还具体执行以下步骤:
判断获得的数据记录中的前缀匹配信息是否与目标前缀匹配信息相同,精 确匹配信息是否与精确信息相同。
获取前缀匹配信息与目标前缀匹配信息相同,且精确匹配信息与精确信息相同的数据记录,作为与目标前缀匹配信息和精确信息均对应的数据记录。
可选地,计算机可执行指令还执行以下步骤:
获取预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息。其中,前缀匹配信息包括:前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度。
根据获得的前缀基本匹配信息以及与前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,得到前缀匹配表。
根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,得到规则集分类表。
可选地,计算机可执行指令还具体执行以下步骤:
根据前缀匹配基本信息以及与该前缀匹配基本信息对应的前缀匹配长度生成第三关键值。
利用第一预设哈希函数对获得的第三关键值进行哈希运算,得到第三哈希值。
以获得的第三哈希值为地址将第三关键值写入第一空表。
可选地,计算机可执行指令还具体执行以下步骤:
可选地,计算机可执行指令还具体执行以下步骤:
根据获得的前缀匹配信息和该前缀匹配信息对应的精确匹配长度生成第四关键值。
利用第二预设哈希函数对获得的第四关键值进行哈希运算,得到第四哈希值。
以第四哈希值为地址读取第二空表,获得数据记录。
根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表。
可选地,计算机可执行指令还具体执行以下步骤:
判断获得的数据记录中的前缀匹配字段和精确匹配字段是否为空。
如果获得的数据记录中的前缀匹配字段和精确匹配字段均为空,将前缀匹配信息、精确匹配信息、范围匹配信息和动作信息分别填充至数据记录的前缀匹配字段、精确匹配字段、范围匹配字段和动作字段。
可选地,如果获得的数据记录中前缀匹配字段和精确匹配字段不为空,计算机可执行指令还具体执行以下步骤:
判断获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息是否相同,且数据记录中的精确匹配字段上的信息与精确匹配信息是否相同。
如果获得的数据记录中的前缀匹配字段上的信息与前缀匹配信息相同,且数据记录中的精确匹配字段上的信息与精确匹配信息相同,判断获得的数据记录中是否存在空的范围匹配字段和动作字段。
如果获得的数据记录中存在空的范围匹配字段和动作字段,将范围匹配字段和动作字段填入空的范围匹配字段和动作字段。

Claims (15)

  1. 一种数据包的分类方法,包括:
    从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
    分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
  2. 根据权利要求1所述的方法,其中,所述分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果,包括:
    从所述前缀匹配表中获取与所述前缀信息对应的前缀匹配信息,作为目标前缀匹配信息;
    从所述规则集分类表中获取与所述目标前缀匹配信息和所述精确信息均对应的数据记录;其中,所述数据记录包括:前缀匹配信息、精确匹配信息、多个范围匹配信息以及所述多个范围匹配信息分别对应的动作匹配信息;
    从获得的数据记录中获取包含所述范围信息的范围匹配信息,作为目标范围匹配信息;
    获取与所述目标范围匹配信息对应的动作匹配信息,作为所述待分类数据包的分类结果。
  3. 根据权利要求2所述的方法,其中,所述从所述前缀匹配表中获取与所述前缀信息对应的前缀匹配信息,包括:
    根据多条所述前缀信息和所述多条前缀信息分别对应的多种前缀匹配长度生成多个第一关键值;
    利用第一预设哈希函数分别对获得的多个第一关键值进行哈希运算,得到多个第一哈希值;
    分别以获得的多个第一哈希值为地址读取所述前缀匹配表,得到多条前缀 匹配信息;
    在获得的多条前缀匹配信息中确定与所述多个第一关键值分别对应的前缀匹配信息,作为所述目标前缀匹配信息。
  4. 根据权利要求3所述的方法,其中,所述从所述规则集分类表中获取与所述目标前缀匹配信息和所述精确信息均对应的数据记录,包括:
    根据所述目标前缀匹配信息和所述精确匹配信息生成第二关键值;
    利用第二预设哈希函数对获得的第二关键值进行哈希运算,得到第二哈希值;
    以获得的第二哈希值为地址读取所述规则集分类表,得到数据记录;
    在获得的数据记录中确定所述与所述目标前缀匹配信息和所述精确信息均对应的数据记录。
  5. 根据权利要求3所述的方法,其中,所述前缀匹配表的数量和所述前缀匹配长度的种类个数相同;
    所述以获得的第一哈希值为地址读取前缀匹配表,包括:
    以获得的每一个第一哈希值为地址读取一个前缀匹配表;其中,以不同的第一哈希值为地址所读取的前缀匹配表不同。
  6. 根据权利要求3所述的方法,其中,所述在获得的多条前缀匹配信息中确定与所述多个第一关键值分别对应的前缀匹配信息,包括:
    判断获得的每个前缀匹配信息是否与所述前缀匹配信息在读取过程中所根据的第一关键值对应;
    获取在读取过程中所根据的第一关键值与自身对应的前缀匹配信息,作为所述目标前缀匹配信息。
  7. 根据权利要求4所述的方法,其中,所述在获得的数据记录中确定与所述目标前缀匹配信息和所述精确信息均对应的数据记录,包括:
    判断获得的数据记录中的前缀匹配信息是否与所述目标前缀匹配信息相同,精确匹配信息是否与所述精确信息相同;
    获取前缀匹配信息与所述目标前缀匹配信息相同,且精确匹配信息与所述 精确信息相同的数据记录,作为所述与所述目标前缀匹配信息和所述精确信息均对应的数据记录。
  8. 根据权利要求4所述的方法,在从待分类数据包中获取与预设规则集的前缀匹配字段中前缀信息匹配字段对应的前缀信息、范围匹配字段对应的范围信息以及精确匹配字段对应的精确信息之前,还包括:
    获取所述预设规则集中规则的前缀匹配信息、范围匹配信息、精确匹配信息和动作信息;其中,所述前缀匹配信息包括:前缀基本匹配信息以及与所述前缀基本匹配信息对应的前缀匹配长度;
    根据获得的前缀基本匹配信息以及与所述前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,得到所述前缀匹配表;
    根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,得到所述规则集分类表。
  9. 根据权利要求8所述的方法,其中,所述根据获得的前缀基本匹配信息以及与所述前缀基本匹配信息对应的前缀匹配长度填充预先建立的第一空表,包括:
    根据所述前缀匹配基本信息以及与所述前缀匹配基本信息对应的前缀匹配长度生成第三关键值;
    利用所述第一预设哈希函数对获得的第三关键值进行哈希运算,得到第三哈希值;
    以获得的第三哈希值为地址将所述第三关键值写入所述第一空表。
  10. 根据权利要求8所述的方法,其中,所述根据获得的前缀匹配信息、范围匹配信息、精确信息和动作信息填充预先建立的第二空表,包括:
    根据获得的前缀匹配信息和所述前缀匹配信息对应的精确匹配长度生成第四关键值;
    利用所述第二预设哈希函数对获得的第四关键值进行哈希运算,得到第四哈希值;
    以第四哈希值为地址读取所述第二空表,获得数据记录;
    根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充所述第二空表。
  11. 根据权利要求10所述的方法,其中,所述根据获得的数据记录、前缀匹配信息、范围匹配信息、精确信息和动作信息填充第二空表,包括:
    判断获得的数据记录中的前缀匹配字段和精确匹配字段是否为空;
    响应于获得的数据记录中的前缀匹配字段和精确匹配字段均为空,将所述前缀匹配信息、所述精确匹配信息、所述范围匹配信息和所述动作信息分别填充至所述数据记录的前缀匹配字段、精确匹配字段、范围匹配字段和动作字段。
  12. 根据权利要求11所述的方法,在获得的数据记录中前缀匹配字段和精确匹配字段不为空的情况下,还包括:
    判断获得的数据记录中的前缀匹配字段上的信息与所述前缀匹配信息是否相同,且所述数据记录中的精确匹配字段上的信息与所述精确匹配信息是否相同;
    响应于获得的数据记录中的前缀匹配字段上的信息与所述前缀匹配信息相同,且所述数据记录中的精确匹配字段上的信息与所述精确匹配信息相同,判断获得的数据记录中是否存在空的范围匹配字段和动作字段;
    响应于获得的数据记录中存在空的范围匹配字段和动作字段,将所述范围匹配字段和动作字段填入所述空的范围匹配字段和动作字段。
  13. 一种数据包的分类装置,包括:
    获取模块,设置为从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
    处理模块,设置为分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
  14. 一种数据包的分类装置,包括:处理器和存储器,其中,存储器中存储有以下可被处理器执行的指令:
    从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
    分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
  15. 一种计算机可读存储介质,所述存储介质上存储有计算机可执行指令,所述计算机可执行指令用于执行以下步骤:
    从待分类数据包中获取前缀信息、精确信息和范围信息;其中,所述前缀信息为与预设规则集的前缀匹配字段中前缀基本信息匹配字段对应的信息,所述精确信息为与所述预设规则集中精确匹配字段对应的信息,所述范围信息为与所述预设规则集中范围匹配字段对应的信息;
    分别以所述前缀信息、所述前缀信息和所述精确信息、以及所述范围信息为维度,利用预先建立的前缀匹配表和规则集分类表获取所述待分类数据包的分类结果。
PCT/CN2019/101752 2018-08-24 2019-08-21 数据包的分类方法、装置及计算机可读存储介质 WO2020038399A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810972030.7A CN110858823B (zh) 2018-08-24 2018-08-24 一种数据包的分类方法、装置及计算机可读存储介质
CN201810972030.7 2018-08-24

Publications (1)

Publication Number Publication Date
WO2020038399A1 true WO2020038399A1 (zh) 2020-02-27

Family

ID=69592852

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/101752 WO2020038399A1 (zh) 2018-08-24 2019-08-21 数据包的分类方法、装置及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110858823B (zh)
WO (1) WO2020038399A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076137B (zh) * 2021-03-11 2022-02-22 中国电子科技集团公司第五十四研究所 一种基于指令集的可编程流处理装置及方法
CN112948646B (zh) * 2021-04-01 2022-12-13 支付宝(杭州)信息技术有限公司 数据识别方法和装置
CN112994983B (zh) * 2021-04-01 2023-01-13 杭州迪普信息技术有限公司 流量统计方法、装置和电子设备
CN114827030B (zh) * 2022-03-26 2023-04-07 西安电子科技大学 一种基于折叠sram的流分类装置及表项压缩方法
CN114666169B (zh) * 2022-05-24 2022-08-12 杭州安恒信息技术股份有限公司 一种扫描探测类型的识别方法、装置、设备及介质
CN115001994B (zh) * 2022-07-27 2022-11-15 北京天融信网络安全技术有限公司 流量数据包分类方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905523A (zh) * 2006-08-02 2007-01-31 华为技术有限公司 一种多域流分类的实现方法
WO2013168053A1 (en) * 2012-05-08 2013-11-14 Telefonaktiebolaget L M Ericsson (Publ) A method and apparatus for packet classification
CN104468381A (zh) * 2014-12-01 2015-03-25 国家计算机网络与信息安全管理中心 一种多域流规则匹配的实现方法
CN104579941A (zh) * 2015-01-05 2015-04-29 北京邮电大学 一种OpenFlow交换机中的报文分类方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105515997B (zh) * 2015-12-07 2018-07-06 刘航天 基于bf_tcam实现零范围扩张的高效范围匹配方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905523A (zh) * 2006-08-02 2007-01-31 华为技术有限公司 一种多域流分类的实现方法
WO2013168053A1 (en) * 2012-05-08 2013-11-14 Telefonaktiebolaget L M Ericsson (Publ) A method and apparatus for packet classification
CN104468381A (zh) * 2014-12-01 2015-03-25 国家计算机网络与信息安全管理中心 一种多域流规则匹配的实现方法
CN104579941A (zh) * 2015-01-05 2015-04-29 北京邮电大学 一种OpenFlow交换机中的报文分类方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
FANG, YUNKAI ET AL.: "A Flow Adaptive Multi-Dimensional Packet Classification Algorithm", CHINESE JOURNAL OF COMPUTERS, vol. 40, no. 7, 31 July 2017 (2017-07-31) *

Also Published As

Publication number Publication date
CN110858823B (zh) 2023-03-07
CN110858823A (zh) 2020-03-03

Similar Documents

Publication Publication Date Title
WO2020038399A1 (zh) 数据包的分类方法、装置及计算机可读存储介质
Quan et al. TB2F: Tree-bitmap and bloom-filter for a scalable and efficient name lookup in content-centric networking
US11184279B2 (en) Building decision tree for packet classification
Warkhede et al. Multiway range trees: scalable IP lookup with fast updates
WO2020207248A1 (zh) 一种流分类方法及装置
US10630588B2 (en) System and method for range matching
US9485179B2 (en) Apparatus and method for scalable and flexible table search in a network switch
US20170222937A1 (en) A memory efficient packet classification method
Nikitakis et al. A memory-efficient FPGA-based classification engine
Pao et al. A multi-pipeline architecture for high-speed packet classification
CN106487769B (zh) 一种访问控制列表acl的实现方法及装置
Li et al. Stateful Inspection firewall session table processing
US20150032732A1 (en) Classification engine for data packet classification
Lim et al. Two-dimensional packet classification algorithm using a quad-tree
US20050114393A1 (en) Dynamic forwarding method using binary search
CN117435912A (zh) 基于网络数据包属性值长短特征的数据包索引与检索方法
Kekely et al. Packet classification with limited memory resources
Lo et al. Flow entry conflict detection scheme for software-defined network
Erdem et al. Hierarchical hybrid search structure for high performance packet classification
Li et al. Scalable packet classification using bit vector aggregating and folding
Lim et al. High-speed packet classification using binary search on length
Chang Efficient multidimensional packet classification with fast updates
WO2021218854A1 (zh) 报文分类方法及装置、电子设备、可读介质
Lee et al. Hybrid memory-efficient multimatch packet classification for NIDS
Kekely et al. Mapping of P4 match action tables to FPGA

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19851902

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC ( EPO FORM 1205A DATED 24/06/2021 )

122 Ep: pct application non-entry in european phase

Ref document number: 19851902

Country of ref document: EP

Kind code of ref document: A1