Network packet processing method and device, electronic equipment and storage medium
By using a real-time processing method of preset judgment groups and change rules in network packet processing, the problem of network packet processing delay is solved and the processing speed and efficiency are improved.
Patent Information
- Application Number
- CN202510121456.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-01-24
AI Technical Summary
The existing network packet processing method results in reduced processing performance due to the data storage and processing time in memory and the queuing delay during network transmission.
Through pre-set judgment groups and pre-set change rules, network packet data is judged and changed in real time, avoiding caching the entire packet data before processing, and using hardware devices such as FPGA for accelerated processing.
It reduces the delay in network packet processing, reduces cache space requirements, improves the processing speed and efficiency of packet data, and avoids congestion.
Smart Images

Figure CN119946094B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of network, and in particular, to a network packet processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] With the increasing trend of network speed and the number of connections, network packet processing has always been an important issue, such as packet filtering, load balancing, and network firewall functions. The current mainstream network packet processing method is Data Plane Development Kit (DPDK) and eXpress Data Path (XDP) to achieve high-speed network packet processing.
[0003] The network packet processing method in the prior art is to first store the network packet in the memory, then move the pointer, such as grabbing the packet data of the network packet from a specific location in the memory, performing the required comparison or processing, or changing the packet data and then writing it into the memory. After the overall process is completed, the packet data is read from the memory and transmitted to the network port or the host computer.
[0004] Therefore, the existing network packet processing method will cause a large delay in network packet processing due to the time of storing and processing data in the memory and the queuing delay that may occur during network transmission, further causing a decline in the processing performance of network packets. SUMMARY
[0005] The present disclosure provides a network packet processing method and device, electronic equipment and storage medium. The main purpose is to solve the problem that the time of storing and processing data in the memory and the queuing delay that may occur during network transmission will cause a large delay in network packet processing, further causing a decline in the processing performance of network packets.
[0006] According to a first aspect of the present disclosure, a network packet processing method is provided, comprising:
[0007] The obtained plurality of network packet data is subjected to packet judgment processing by a respective corresponding preset judgment group to obtain a first judgment result corresponding to each of the plurality of network packet data. The first judgment result is used to determine whether the corresponding network packet data passes the judgment.
[0008] According to the first judgment result and a preset change rule corresponding to each data segment, the plurality of network packet data is subjected to data change processing to obtain a plurality of target packet data. Each network packet data includes a plurality of data segments.
[0009] transmit the target packet data to a corresponding packet receiving end according to the first judgment result and receiving end information, wherein the receiving end information is used to determine the packet receiving end corresponding to the target packet data.
[0010] Optionally, the packet judgment processing of the obtained multiple network packet data through respective corresponding preset judgment groups to obtain the first judgment result corresponding to each of the multiple network packet data comprises:
[0011] determining first data in the first network packet data according to position data of the first judgment condition in the first preset judgment group; wherein the first preset judgment group comprises at least multiple judgment conditions, each judgment condition comprises at least position data, judgment length, comparison data, comparison rule and mark data, the multiple judgment conditions comprise the first judgment condition, the first network packet data is any network packet data in the multiple network packet data, and the first preset judgment group is a preset judgment group corresponding to the first network packet data;
[0012] determining a data segment to be judged in the first network packet data according to the first data and the judgment length of the first judgment condition; wherein the multiple data segments comprise the data segment to be judged;
[0013] comparing the comparison data of the first judgment condition with the data segment to be judged according to the comparison rule of the first judgment condition to obtain a first result corresponding to the first judgment condition;
[0014] performing packet judgment processing on the first network packet data according to the multiple judgment conditions one by one until determining that the judgment is completed according to the mark data of a target judgment condition to obtain the first judgment result, wherein the target judgment condition is any judgment condition after the first judgment condition in the multiple judgment conditions.
[0015] Optionally, the data change processing of the multiple network packet data according to the first judgment result and the preset change rule corresponding to each data segment respectively to obtain multiple target packet data comprises:
[0016] determining network packet data corresponding to each of the preset change rules from the multiple network packet data according to first preset corresponding information; wherein each of the preset change rules corresponds to one or more network packet data;
[0017] determining the first judgment result of the network packet data corresponding to each of the preset change rules as a reference result corresponding to each of the preset change rules;
[0018] In a case where it is determined according to the reference result that the corresponding network packet data passes the judgment, performing data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data.
[0019] In a case where it is determined according to the reference result that the corresponding network packet data passes the judgment, performing data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data.
[0020] Optionally, in a case where it is determined according to the reference result that the corresponding network packet data passes the judgment, performing data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data includes:
[0021] determining a change action in the preset change rule; wherein the change action at least includes deletion, replacement, addition and inaction;
[0022] in a case where it is determined that the change action is deletion, performing deletion processing on the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result;
[0023] in a case where it is determined that the change action is addition / replacement, determining addition / replacement data in the preset change rule, and performing addition / replacement processing on the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result according to the addition / replacement data;
[0024] in a case where it is determined that the change action is inaction, not performing data change processing on the network packet data corresponding to the reference result.
[0025] Optionally, the transmitting the target packet data to the corresponding packet receiving end according to the first judgment result and the receiving end information includes:
[0026] determining the first judgment result corresponding to each of the packet receiving ends according to the receiving end information; wherein each of the packet receiving ends corresponds to one or more of the first judgment results;
[0027] in a case where it is determined according to the first judgment result that the corresponding network packet data fails the judgment, canceling data transmission of the packet receiving end corresponding to the first judgment result;
[0028] in a case where it is determined according to the first judgment result that the corresponding network packet data passes the judgment, transmitting the target packet data corresponding to the first judgment result to the packet receiving end corresponding to the first judgment result.
[0029] Optionally, before the acquired plurality of network packet data is processed by the respective corresponding preset judgment group to obtain the first judgment result corresponding to each of the plurality of network packet data, the method further comprises:
[0030] The preset host machine is used to perform judgment group setting processing to obtain a plurality of preset judgment groups.
[0031] The preset host machine is used to perform judgment group setting processing to obtain a plurality of preset judgment groups.
[0032] The preset host machine is used to perform judgment condition setting processing to obtain a plurality of judgment conditions. The judgment condition setting processing performed by the preset host machine at least includes setting position data, setting judgment length, setting comparison data, setting comparison rule, and setting marker data.
[0033] The plurality of judgment conditions are classified according to the network packet data to obtain the plurality of preset judgment groups.
[0034] Optionally, before the acquired plurality of network packet data is processed by the respective corresponding preset judgment group to obtain the first judgment result corresponding to each of the plurality of network packet data, the method further comprises:
[0035] The preset host machine is used to perform preset change rule setting processing to obtain the preset change rule.
[0036] The preset host machine is used to perform preset change rule setting processing to obtain the preset change rule.
[0037] The preset host machine is used to set the network packet data corresponding to each of the preset change rules respectively to obtain the first preset corresponding information.
[0038] The preset host machine is used to set the change action of each of the preset change rules respectively to obtain the change action.
[0039] The preset host machine is used to set the increase / replace data of each of the preset change rules respectively to obtain the increase / replace data.
[0040] The first preset corresponding information, the change action, and the increase / replace data are used to perform data merging processing to obtain the preset change rule.
[0041] According to a second aspect of the present disclosure, a network packet processing device is provided, comprising:
[0042] A judging unit is configured to perform packet judging processing on the obtained network packet data through respective corresponding preset judging groups to obtain respective first judging results of the network packet data;
[0043] A changing unit is configured to perform data changing processing on the network packet data according to the first judging results and respective preset changing rules of each data segment to obtain target packet data; each network packet data includes a plurality of data segments;
[0044] A transmitting unit is configured to transmit the target packet data to a corresponding packet receiving end according to the first judging results and receiving end information, wherein the receiving end information is used to determine the packet receiving end corresponding to the target packet data.
[0045] Optionally, the judging unit includes:
[0046] A determining module is configured to determine first data in first network packet data according to position data of a first judging condition in a first preset judging group; the first preset judging group includes at least a plurality of judging conditions, each judging condition includes at least position data, judging length, comparison data, comparison rule and marking data, the plurality of judging conditions include the first judging condition, the first network packet data is any network packet data in the plurality of network packet data, and the first preset judging group is a preset judging group corresponding to the first network packet data;
[0047] The determining module is further configured to determine a data segment to be judged in the first network packet data according to the first data and the judging length of the first judging condition; the plurality of data segments include the data segment to be judged;
[0048] A comparison module is configured to perform comparison processing on the comparison data of the first judging condition and the data segment to be judged according to the comparison rule of the first judging condition to obtain a first result corresponding to the first judging condition;
[0049] A judging module is configured to perform packet judging processing on the first network packet data according to the plurality of judging conditions one by one until judging is ended according to marking data of a target judging condition to obtain the first judging result, wherein the target judging condition is any judging condition after the first judging condition in the plurality of judging conditions.
[0050] Optionally, the changing unit includes:
[0051] determining, by a determining module, each network packet data corresponding to each preset change rule from the plurality of network packet data according to the first preset corresponding information, wherein each preset change rule corresponds to one or more network packet data;
[0052] The determining module is further configured to determine a first judgment result of each network packet data corresponding to each preset change rule as a reference result corresponding to each preset change rule;
[0053] canceling, by a canceling module, data change processing of the network packet data corresponding to the reference result in a case where it is determined that the network packet data corresponding to the reference result fails the judgment;
[0054] changing, by a changing module, the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result to obtain the plurality of target packet data in a case where it is determined that the network packet data corresponding to the reference result passes the judgment.
[0055] Optionally, the changing module is further configured to:
[0056] changing, by a changing module, the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result to obtain the plurality of target packet data in a case where it is determined that the network packet data corresponding to the reference result passes the judgment.
[0057] determining a change action in the preset change rule, wherein the change action at least includes deletion, replacement, addition, and inaction;
[0058] deleting, in a case where the change action is determined to be deletion, a data segment corresponding to the preset change rule in the network packet data corresponding to the reference result;
[0059] determining, in a case where the change action is determined to be addition / replacement, addition / replacement data in the preset change rule, and performing addition / replacement processing on the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result according to the addition / replacement data;
[0060] in a case where the change action is determined to be inaction, not performing data change processing on the network packet data corresponding to the reference result.
[0061] Optionally, the transmission unit includes:
[0062] determining module, configured to determine the first determination result corresponding to each of the packet receiving end according to the receiving end information; wherein each of the packet receiving end corresponds to one or more of the first determination result;
[0063] canceling module, configured to cancel the data transmission of the packet receiving end corresponding to the first determination result in a case that the corresponding network packet data is determined not to pass the judgment according to the first determination result;
[0064] transmitting module, configured to transmit the target packet data corresponding to the first determination result to the packet receiving end corresponding to the first determination result in a case that the corresponding network packet data is determined to pass the judgment according to the first determination result.
[0065] Optionally, the apparatus further comprises:
[0066] a setting unit, configured to perform judgment group setting processing through a preset host computer to obtain a plurality of preset judgment groups;
[0067] The setting unit is further configured to:
[0068] perform judgment condition setting processing through the preset host computer to obtain a plurality of judgment conditions; wherein the judgment condition setting processing through the preset host computer at least includes setting position data, setting judgment length, setting comparison data, setting comparison rule and setting mark data;
[0069] classify a plurality of the judgment conditions according to the network packet data to obtain the plurality of preset judgment groups.
[0070] Optionally, the setting unit is further configured to:
[0071] perform preset change rule setting processing through a preset host computer to obtain the preset change rule;
[0072] The setting unit is further configured to:
[0073] set the network packet data corresponding to each of the preset change rule respectively through the preset host computer to obtain the first preset corresponding information;
[0074] set the change action of each of the preset change rule respectively through the preset host computer to obtain the change action;
[0075] set the increase / replace data of each of the preset change rule respectively through the preset host computer to obtain the increase / replace data;
[0076] According to the first preset corresponding information, the change action, and the added / replaced data, data merging processing is performed to obtain the preset change rule.
[0077] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0078] at least one processor; and
[0079] a memory in communication with the at least one processor; wherein
[0080] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the first aspect.
[0081] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method of the first aspect.
[0082] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of the first aspect.
[0083] The network packet processing method and device, electronic device, and storage medium provided by the present disclosure perform packet judgment processing on the obtained multiple network packet data through a respective corresponding preset judgment group to obtain a first judgment result corresponding to each of the multiple network packet data. The first judgment result is used at least to determine whether the corresponding network packet data passes the judgment. Data change processing is performed on the multiple network packet data according to the first judgment result and a preset change rule corresponding to each data segment to obtain multiple target packet data. Each network packet data includes multiple data segments. The target packet data is transmitted to a corresponding packet receiving end according to the first judgment result and receiving end information. The receiving end information is used at least to determine the packet receiving end corresponding to the target packet data. Compared with related technologies, the preset judgment group, the preset change rule, and the receiving end information are set in advance, so that the network packet data can be processed in real time without the need to cache the entire network packet data before processing the packet data. The network packet data can be processed in time to reduce the delay and avoid the need for a large amount of cache space. Furthermore, multiple network packet data can be processed simultaneously to avoid congestion and improve the processing speed of the packet data.
[0084] It is to be understood that the details set forth herein do not limit the scope of the application. Other embodiments of the application will be readily apparent to those skilled in the art from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0085] The accompanying drawings are included to provide a further understanding of the application, and are incorporated in and constitute a part of this specification. In the drawings:
[0086] Figure 1 A flowchart of a network packet processing method provided by an embodiment of the present disclosure;
[0087] Figure 2 A network packet processing architecture provided by an embodiment of the present disclosure;
[0088] Figure 3 A structure diagram of a packet judgment module provided by an embodiment of the present disclosure;
[0089] Figure 4 A structure diagram of a packet changing module provided by an embodiment of the present disclosure;
[0090] Figure 5 A structure diagram of a packet path switching module provided by an embodiment of the present disclosure;
[0091] Figure 6 A flowchart of a packet judgment processing provided by an embodiment of the present disclosure;
[0092] Figure 7 A network packet data provided by an embodiment of the present disclosure;
[0093] Figure 8 An example diagram of a packet judgment module provided by an embodiment of the present disclosure;
[0094] Figure 9 An example diagram of a packet changing module provided by an embodiment of the present disclosure;
[0095] Figure 10 An example diagram of a packet path switching module provided by an embodiment of the present disclosure;
[0096] Figure 11 A structure diagram of a network packet processing apparatus provided by an embodiment of the present disclosure;
[0097] Figure 12 A structure diagram of another network packet processing apparatus provided by an embodiment of the present disclosure;
[0098] Figure 13 A schematic block diagram of an example electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0099] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are provided to help understand various details of the embodiments of the present disclosure and should not be construed as limiting the present disclosure. It will be understood by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, descriptions of known functions and constructions are omitted herein for clarity and conciseness.
[0100] The processing method and apparatus of network packets, the electronic device and the storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0101] Figure 1 A flowchart of a processing method of network packets provided by the embodiments of the present disclosure is shown in FIG. 1.
[0102] As shown in FIG. 1, the method is applied to a server, and the method includes the following steps: Figure 1
[0103] In step 101, the obtained network packet data is processed by a respective pre-set judgment group to obtain a first judgment result corresponding to each of the network packet data. The first judgment result is used to determine whether the corresponding network packet data passes the judgment.
[0104] In the embodiments of the present disclosure, the network packet data can be processed by using the architecture of a hardware pipeline and the ability of parallel processing. That is, when the processing method of network packets is executed, the hardware device selected by the user can be used for acceleration processing. The hardware device includes, but is not limited to, an application-specific integrated circuit (ASIC) and a field-programmable gate array (FPGA). The selection of the hardware device is not limited in the embodiments of the present disclosure.
[0105] Further, for convenience of description, in the subsequent examples, the hardware device is taken as an example of an FPGA. When the processing method of network packets is executed, the network packet data can be processed and judged by three modules in the FPGA. As shown in FIG. 2, Figure 2 Figure 2 A diagram of a network packet processing architecture provided in an embodiment of the present disclosure includes a packet judgment module, a packet change module, and a packet path switching module. Network packet data enters the FPGA via a network channel port, first passing through the packet judgment module, then the packet change module, and finally the packet path switching module.
[0106] It should be noted that Figure 2 The packet judgment module is the module including the preset judgment group, the packet change module is the module including the preset change rule, and the packet path switching module is the module including the receiving end information.
[0107] For the above-mentioned preset judgment group and packet judgment processing of network packet data, please refer to Figure 3 To explain, Figure 3 This is a schematic diagram of the structure of a packet judgment module provided in an embodiment of the present disclosure. The packet judgment module includes multiple preset judgment groups (e.g., Group 1, Group 2, etc.). Each preset judgment group contains a random access memory (RAM) space. The RAM space includes multiple judgment conditions, such as the three judgment conditions included in Group 1. The contents of the RAM space, i.e., the judgment conditions, can be determined by, but not limited to, a preset host computer setting the judgment conditions in the RAM. The judgment conditions of the preset judgment groups can be used to perform packet judgment on the contents of different regions of a single network packet data, for example, to determine whether the contents of the network packet data are equal to comparison data, or whether the contents of the network packet data are less than the comparison data. The comparison data is pre-set data used to judge the contents of the network packet data.
[0108] The first judgment result is the judgment result of the network packet data obtained after the network packet data passes the judgment of the corresponding preset judgment group, for example: result1, result2, etc. It should be noted that if all the judgment conditions in a preset judgment group are met, the judgment result of the network packet data corresponding to this preset judgment group is passed. If any judgment condition in a preset judgment group is not met, the judgment result of the network packet data corresponding to this preset judgment group is failed.
[0109] Step 102 , performing data modification processing on the plurality of network packet data according to the first judgment result and the preset modification rule corresponding to each data segment, to obtain a plurality of target packet data; wherein each network packet data includes a plurality of the data segments.
[0110] In the embodiment of the present disclosure, the corresponding data segment in the network packet data can be changed by presetting the change rule to obtain the target packet data. For details, see Figure 4 In the description, Figure 4 A schematic diagram of the structure of a packet change module provided in an embodiment of the present disclosure is provided, wherein the packet change module includes multiple groups of registers, each group of registers representing the content of each packet data segment that needs to be changed, namely the preset change rule.
[0111] like Figure 4 As shown, after the packet judgment module completes the comparison of network packet data, the network packet data is modified according to the action of the register. Each register group (preset modification rule) includes action (indicating the modification action, for example: 0 = delete, 1 = replace, 2 = add, 3 = do nothing); content is the content replaced or added to the network packet data when performing the replacement or addition action; en_mask indicates which groups of the packet judgment module's results are to be referenced, with each bit representing each judgment group. For example, if the network packet data corresponds to three preset judgment groups and en_mask indicates that reference is needed for result1, then only result1 (the first judgment result corresponding to the first preset judgment group (group 1)) needs to be considered. If result1 is a pass, the network packet data can be modified according to the preset modification rule even if the first judgment results corresponding to other groups are a fail. If result1 is a fail, the network packet data cannot be modified even if the first judgment results corresponding to other groups are a pass.
[0112] It should be noted that each network packet data corresponds to one or more preset judgment groups. Furthermore, each network packet data corresponds to one or more first judgment results.
[0113] Step 103: Transmit the target packet data to the corresponding packet receiving end according to the first judgment result and the receiving end information, wherein the receiving end information is at least used to determine the packet receiving end corresponding to the target packet data.
[0114] In the embodiment of the present disclosure, for ease of understanding, the embodiment of the present disclosure provides a structural diagram of a packet path switching module, such as Figure 5As shown in FIG. 1, the packet path switching module includes receiving end information to determine whether the target packet data flows to the network interface or to the host computer through the Peripheral Component Interconnect Express (PCIe). The packet path switching module includes two en_mask, which respectively represent whether the packet flows to the network interface or to the host computer. Each bit represents each judgment group.
[0115] For example, when the target packet data corresponds to three first judgment results, and the en_mask of the network interface indicates that result1 needs to be referred to, only result1 (the first judgment result corresponding to the first preset judgment group (group 1)) needs to be focused on when the target packet data is transmitted to the network interface. When result1 is a pass judgment, even if the first judgment results corresponding to other groups are fail judgments, the target packet data can be transmitted to the network interface. When result1 is a fail judgment, even if the first judgment results corresponding to other groups are pass judgments, the target packet data cannot be transmitted to the network interface.
[0116] The processing method for network packets provided by the present disclosure includes the following steps: performing packet judgment processing on a plurality of obtained network packet data through a respective corresponding preset judgment group to obtain a first judgment result corresponding to each of the plurality of network packet data. The first judgment result is used to determine whether the corresponding network packet data passes the judgment. According to the first judgment result and a preset change rule corresponding to each data segment, data change processing is performed on the plurality of network packet data to obtain a plurality of target packet data. Each network packet data includes a plurality of data segments. According to the first judgment result and receiving end information, the target packet data is transmitted to a corresponding packet receiving end. The receiving end information is used to determine the packet receiving end corresponding to the target packet data. Compared with related technologies, the preset judgment group, the preset change rule, and the receiving end information can be used to process network packet data in real time, without the need to cache the entire network packet data before processing the packet data. The network packet data can be processed in a timely manner, the delay is reduced, the demand for a large amount of cache space is avoided, further, a plurality of network packet data can be processed simultaneously, congestion is avoided, and the processing speed of the packet data is improved.
[0117] In one implementation manner of the present disclosure, as a refinement of the above step 101, when performing packet judgment processing on a plurality of network packet data, the present disclosure provides a flowchart of packet judgment processing, as shown in FIG. 2, which includes the following steps. Figure 6
[0118] Step 601, determining first data in the first network packet data according to position data of a first judging condition in a first preset judging group; wherein the first preset judging group comprises at least a plurality of judging conditions, each judging condition comprises at least position data, judging length, comparison data, comparison rule and marking data, the plurality of judging conditions comprises the first judging condition, the first network packet data is any one of the plurality of network packet data, and the first preset judging group is a preset judging group corresponding to the first network packet data.
[0119] In the embodiment of the present disclosure, referring to FIG. 3, the content to be judged is indicated by the pkt_ptr position in the RAM, the position in the network packet data (i.e. position data), in Byte, for example: the position of pkt_ptr=0 Byte represents the first data in the network packet data, and the position of pkt_ptr=6 Byte represents the seventh data in the network packet data; the length in the RAM indicates the length of the content to be judged (i.e. judging length), in Byte, for example: length=6 Byte, indicating that 6 Byte of data needs to be judged continuously; the value in the RAM indicates the value to be judged; the compare in the RAM indicates the comparison to be judged (i.e. comparison rule, for example: 0=greater than, 1=less than, 2=equal to, 3=not equal to); and the end in the RAM is used to determine the last judging condition of the judging group (i.e. marking data, for example: 0=the judging condition is not the last one, and 1=the judging condition is the last one). When the last judging condition ends, each group in the packet judging module outputs the respective judging result (result). All the judging conditions in a group are established, and the judging result of the group is passed through the judgment, otherwise, the judging result is not passed through the judgment.
[0120] Specifically, determining the first data in the first network packet data, i.e. determining the data to be judged in the first network packet data according to the pkt_ptr of the first judging condition.
[0121] Step 602, determining a data segment to be judged in the first network packet data according to the first data and the judging length of the first judging condition; wherein the plurality of data segments comprises the data segment to be judged.
[0122] In the embodiment of the present disclosure, for determining the data segment to be judged according to the judging length, for example: when the judging length is length=6 Byte, it indicates that 6 data (including the first data) starting from the first data need to be judged, and at this time, the 6 data starting from the first data are the data segment to be judged.
[0123] Step 603, according to the comparison rule of the first judgment condition, the comparison data of the first judgment condition is compared with the data segment to be judged to obtain the first result corresponding to the first judgment condition.
[0124] In the embodiment of the present disclosure, the comparison data is data for comparison, for example, the comparison rule of the first judgment condition is equal, and the comparison data is 01 02 03 04 05 06. At this time, when the data segment to be judged is also 01 02 03 04 05 06, the first result is a pass judgment, and when the data segment to be judged is different from 01 02 03 04 05 06, the first result is a fail judgment.
[0125] Step 604, according to the plurality of judgment conditions, the first network packet data is judged packet by packet until the judgment is determined to end according to the identification data of the target judgment condition, and the first judgment result is obtained, wherein the target judgment condition is any judgment condition after the first judgment condition in the plurality of judgment conditions.
[0126] In the embodiment of the present disclosure, since each preset judgment group includes a plurality of judgment conditions, only when the judgment conditions in this preset judgment group are all judged, the first judgment result can be determined.
[0127] The embodiment of the present disclosure can flexibly filter any network packet data and decide how to process the network packet data by judging the network packet data according to the plurality of judgment conditions and the preset judgment group.
[0128] Further, the process of determining the judgment end according to the identification data of the target judgment condition and obtaining the first judgment result can be implemented by, but not limited to, the following manner: in the case of determining the judgment end according to the identification data of the target judgment condition, the initial judgment result corresponding to each judgment condition is obtained; in the case that all the initial judgment results are pass judgments, the first judgment result is a pass judgment; in the case that there is any initial judgment result that is a fail judgment in all the initial judgment results, the first judgment result is a fail judgment.
[0129] The embodiment of the present disclosure can accurately filter the network packet data and improve the accuracy of judging the network packet data by determining the final first judgment result according to the judgment results of the plurality of judgment conditions.
[0130] In an implementable manner of the embodiment of the present disclosure, as a refinement of the above step 102, when performing the data change processing, the following manner can be adopted, but is not limited thereto: determining, according to the first preset corresponding information, network packet data corresponding to each of the preset change rules from the plurality of network packet data; wherein each of the preset change rules corresponds to one or more of the network packet data; determining a first judgment result of each of the network packet data corresponding to each of the preset change rules as a reference result corresponding to each of the preset change rules; in a case where it is determined according to the reference result that the corresponding network packet data fails the judgment, canceling the data change processing on the network packet data corresponding to the reference result; in a case where it is determined according to the reference result that the corresponding network packet data passes the judgment, performing the data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data.
[0131] In the embodiment of the present disclosure, the preset change rule indicates which group of results of the packet judgment module is to be referred to, and the first judgment result of the packet judgment module to be referred to is taken as the reference result. At this time, only in a case where the reference result is a pass judgment, the data change processing is performed on the network packet data corresponding to the reference result.
[0132] By determining the reference result and determining whether the data change is needed according to the reference result, the data change can be accurately performed on the network packet data that passes the judgment, and the accuracy of the network packet processing is improved.
[0133] Further, in an implementable manner of the embodiment of the present disclosure, when performing the data change processing on the network packet data corresponding to the reference result to obtain the plurality of target packet data, the following manner can be adopted, but is not limited thereto: in a case where it is determined according to the reference result that the corresponding network packet data passes the judgment, performing the data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data, including: determining a change action in the preset change rule; wherein the change action at least includes deletion, replacement, addition, and no action; in a case where it is determined that the change action is deletion, performing deletion processing on a data segment corresponding to the preset change rule in the network packet data corresponding to the reference result; in a case where it is determined that the change action is addition / replacement, determining addition / replacement data in the preset change rule, and performing addition / replacement processing on the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result according to the addition / replacement data; in a case where it is determined that the change action is no action, not performing the data change processing on the network packet data corresponding to the reference result.
[0134] In the embodiments of the present disclosure, the network packet data can be accurately processed according to the change action in the preset change rule. The data in the network packet data that needs to be processed is the data segment corresponding to the preset change rule. For example, the data segment corresponding to the preset change rule is the destination MAC address (DA) data segment, and the change action of the preset change rule is replacement. In the network packet data, the original destination MAC address is replaced with the replacement data in the preset change rule, and the target network packet data is obtained.
[0135] Through the data replacement processing of the network packet data, different network environments can be adapted, security can be ensured, transmission efficiency can be optimized, and service availability can be improved, so as to ensure the correct transmission, security, efficiency and reliability of the network packet data.
[0136] In one implementation manner of the embodiments of the present disclosure, when the target packet data is transmitted, the following manner can be used, but is not limited to: determining the first judgment result corresponding to each packet receiving end according to the receiving end information; wherein each packet receiving end corresponds to one or more first judgment results; in the case where it is determined according to the first judgment result that the corresponding network packet data does not pass the judgment, canceling the data transmission of the packet receiving end corresponding to the first judgment result; in the case where it is determined according to the first judgment result that the corresponding network packet data passes the judgment, transmitting the target packet data corresponding to the first judgment result to the packet receiving end corresponding to the first judgment result.
[0137] In the embodiments of the present disclosure, in the case where the first judgment result is pass, the target packet data can be transmitted to the corresponding data receiving end, and the data receiving end includes but is not limited to a network port, a host computer and the like.
[0138] By transmitting the target packet data to the corresponding data receiving end according to the judgment result, the target data packet can be determined according to the first judgment result in the processing process of the network packet, so that only the data passing the judgment can be transmitted to the destination, thereby maintaining the efficiency and security of network communication.
[0139] In an implementation of the embodiment of the present disclosure, in order to successfully complete the network packet processing, the following method can also be used, but is not limited to: a preset host is used to perform group setting processing to obtain a plurality of preset judgment groups; wherein the preset host is used to perform group setting processing to obtain a plurality of preset judgment groups, including: the preset host is used to perform judgment condition setting processing to obtain a plurality of judgment conditions; wherein the preset host is used to perform judgment condition setting processing, including setting position data, setting judgment length, setting comparison data, setting comparison rules, and setting mark data; the network packet data is classified according to the plurality of judgment conditions to obtain the plurality of preset judgment groups.
[0140] In the embodiment of the present disclosure, the preset judgment group is set by the host, any network packet can be flexibly filtered, and how to process the packet is decided.
[0141] In an implementation of the embodiment of the present disclosure, in order to successfully complete the network packet processing, the following method can also be used, but is not limited to: a preset host is used to perform preset change rule setting processing to obtain the preset change rule; wherein the preset host is used to perform preset change rule setting processing to obtain the preset change rule, including: the preset host is used to set the network packet data corresponding to each of the preset change rules respectively to obtain the first preset corresponding information; the preset host is used to set the change action of each of the preset change rules respectively to obtain the change action; the preset host is used to set the increase / replace data of each of the preset change rules respectively to obtain the increase / replace data; the first preset corresponding information, the change action, and the increase / replace data are used for data merging processing to obtain the preset change rule.
[0142] In the embodiment of the present disclosure, the preset change rule is set by the host, any network packet can be flexibly changed, and how to process the packet is decided.
[0143] Further, in order to facilitate understanding of the implementation process of the embodiment of the present disclosure, the embodiment of the present disclosure provides an example for illustration: as shown in Figure 7 Figure 7 A schematic diagram of network packet data provided by the embodiment of the present disclosure, wherein the network packet data is a TCP message, and the message indicates the starting position and data length of several important data. In the TCP message: Destination MAC Address (C8:09:a8:c9:7b:a6): located at Byte 0, with a length of 6 bytes; Source MAC Address (00:f8:2c:e8:12:5c): located at Byte 6, with a length of 6 bytes; Type (0x0800, IPv4): located at Byte 12, with a length of 2 bytes; Protocol (0x6, TCP): located at Byte 23, with a length of 1 byte; Source IP Address (0xac.0x10.0x7a.0x52): located at Byte 26, with a length of 4 bytes; Destination IP Address (0xac.0x10.0xa2.0x36): located at Byte 30, with a length of 4 bytes; Source Port (0x9967): located at Byte 34, with a length of 2 bytes; Destination Port (0x04d2): located at Byte 36, with a length of 2 bytes.
[0144] The requirements for processing network packet data are: 1. Packets from IP 192.168.1.10, only receive TCP messages, transmit to the host computer, and discard other messages; 2. Packets from IP 192.168.1.x, UDP messages are forwarded to MAC_ADR=11:22:33:44:55:66, IP_ADR=192.168.11.123.
[0145] At this time, the flow of the network packet processing method of the present disclosure is:
[0146] 1. The host computer fills in the RAM content of the packet judgment module (i.e., fills in the judgment condition), as shown in Figure 8 Figure 8 An example diagram of a packet judgment module provided by the embodiment of the present disclosure, wherein group one: compares Protocol (starting position pkt_ptr=23) equal to TCP (6), and source IP Address (starting position pkt_ptr=26) equal to 192.168.1.10; group two: compares Protocol (starting position pkt_ptr=23) equal to UDP (17), and source IP Address (starting position pkt_ptr=26) equal to 192.168.1.x;
[0147] 2. The host computer fills in the register of the packet changing module (i.e. fills in the preset changing rule), as shown in Figure 9 Figure 9 An example diagram of the packet changing module provided by the embodiment of the present disclosure is shown in the figure, in which the Destination MAC is changed to 11:22:33:44:55:66, and the Destination IP is changed to 192.168.11.123.
[0148] 3. The host computer fills in the register of the packet path switching module (i.e. fills in the receiving end information), as shown in Figure 10 Figure 10 An example diagram of the packet path switching module provided by the embodiment of the present disclosure is shown in the figure, in which the result of the judgment group one is 1 (PASS), and the target packet data is transmitted to the host computer via PCIe; the result of the judgment group two is 1 (PASS), and the target packet data is transmitted to the network port.
[0149] 4. Then the input of the network packet data is started (i.e. a plurality of network packet data are acquired), and when the first Byte (the first data) of the network packet data is received, the result of all the groups is reset to 1 (PASS) first.
[0150] 5. If the network packet data received at this time is a UDP packet from IP 192.168.1.22; the UDP packet enters the packet changing module directly after passing through the packet judgment module; first, after the 23rd Byte of the UDP packet enters, the comparison value of the group one is not 6 (UDP = 17), so the result of the group one is set to 0 (FAIL); at the same time, the comparison value of the group two is equal, so the result of the group two remains unchanged (PASS).
[0151] 6. When the 26th, 27th and 28th Bytes of the UDP packet enter, the comparison values of the group one and the group two are the same, so the two results remain unchanged.
[0152] 7. When the group two compares to the 28th Byte, the end of the RAM shows 1, indicating the last judgment condition of the comparison, at this time the result 2 (1, PASS) is output to the packet changing module and the packet path switching module.
[0153] 8. When the group one compares to the 29th Byte, the end of the RAM shows 1, indicating the last judgment condition of the comparison, at this time the result 1 (0, FAIL) is output to the packet changing module and the packet path switching module.
[0154] 9. When receiving the results of result1 and result2, the UDP packet is output to the packet path switching module by the packet changing module. In the output process, the data is changed according to the register in the packet changing module. The en_mask of the DA is b10, indicating that only the result of result2 is referred to. At this time, the result of result2 is 1, and the DA is replaced into 11:22:33:44:55:66 according to the action (1=replace) of the DA. The Destination IP is also replaced into the content value 192.168.11.123 according to the register;
[0155] 10. The en_mask of the SA is b00, indicating that neither the result of result1 nor the result of result2 is referred to, so no change is made to the data of the SA, and no change is made to other data according to the register;
[0156] 11. Then the UDP packet enters the packet path switching module. The en_mask value of the network port is b10, indicating that the packet will be output to the network port only when result2 is true. In this example, result2=1, so the packet will be output to the network port;
[0157] 12. The en_mask value of the host computer is b01, indicating that the packet will be transmitted to the host computer only when result1 is true. In this example, result1=0, so the packet will not be transmitted to the host computer;
[0158] 13. Finally, in this example, the UDP packet from IP 192.168.1.22 will be output to the device with MAC_ADR=11:22:33:44:55:66 and IP_ADR=192.168.11.123 via the network port.
[0159] In summary, the embodiments of the present disclosure can achieve the following effects:
[0160] 1. The embodiments of the present disclosure can process network packet data in real time by pre-setting the preset judgment group, the preset changing rule, and the receiving end information, without needing to cache the entire network packet data before processing the packet data. The network packet data can be timely judged and processed, the delay is reduced, the need for a large amount of cache space is avoided, further, multiple network packet data can be processed at the same time, congestion is avoided, and the processing speed of the packet data is improved.
[0161] 2. The embodiments of the present disclosure allow users to fill in the RAM and the register to flexibly filter any network packet and decide how to process the packet.
[0162] 3. The embodiment of the present disclosure only processes the packet through RAM and register, and does not need to place a processor to run an instruction set in the hardware, nor need to place an additional memory to the instruction set.
[0163] 4. The embodiment of the present disclosure does not need to cache the entire packet to process the packet content, can timely judge and process the packet according to the pipeline concept, reduce the delay, and avoid the need for a large amount of cache space.
[0164] 5. The embodiment of the present disclosure simultaneously processes multiple packets through the parallel processing capability of the hardware, avoids congestion, and speeds up the packet processing speed.
[0165] Corresponding to the network packet processing method described above, the present application also provides a network packet processing device. Since the device embodiment of the present application corresponds to the method embodiment described above, the details not disclosed in the device embodiment can refer to the method embodiment described above, and the present application will not be described in detail.
[0166] Figure 11 A structural schematic diagram of a network packet processing device provided by the embodiment of the present disclosure, the device is applied to a server, as shown in Figure 11 , comprising:
[0167] A judgment unit 1101 is configured to perform packet judgment processing on the obtained multiple network packet data through respective corresponding preset judgment groups, to obtain respective first judgment results of the multiple network packet data; wherein the first judgment result is used at least to determine whether the corresponding network packet data passes the judgment;
[0168] A changing unit 1102 is configured to perform data changing processing on the multiple network packet data according to the first judgment result and a preset changing rule corresponding to each data segment, to obtain multiple target packet data; wherein each network packet data comprises multiple data segments;
[0169] A transmission unit 1103 is configured to transmit the target packet data to a corresponding packet receiving end according to the first judgment result and receiving end information, wherein the receiving end information is used at least to determine the packet receiving end corresponding to the target packet data.
[0170] The present disclosure provides a network packet processing device that processes multiple acquired network packet data using corresponding preset judgment groups to obtain first judgment results corresponding to each of the multiple network packet data. The first judgment results are used to determine whether the corresponding network packet data passes the judgment. The device then performs data modification processing on the multiple network packet data based on the first judgment results and preset modification rules corresponding to each data segment to obtain multiple target packet data. Each network packet data includes multiple data segments. The device then transmits the target packet data to a corresponding packet receiving end based on the first judgment results and receiving end information. The receiving end information is used to determine the packet receiving end corresponding to the target packet data. Compared to related art, the present disclosure utilizes pre-set preset judgment groups, preset modification rules, and receiving end information to process network packet data in real time. This eliminates the need to cache the entire network packet data before processing the packet data. This allows for timely judgment and processing of network packet data, reduces latency, and avoids the need for large amounts of cache space. Furthermore, the device can process multiple network packet data simultaneously, avoiding congestion and increasing packet data processing speed.
[0171] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 12 As shown, the judging unit 1101 includes:
[0172] Determining module 11011, configured to determine first data in first network packet data based on location data of a first judgment condition in a first preset judgment group; wherein the first preset judgment group includes at least a plurality of judgment conditions, each judgment condition including at least location data, a judgment length, comparison data, a comparison rule, and marking data; the plurality of judgment conditions includes the first judgment condition; the first network packet data is any one of the plurality of network packet data; and the first preset judgment group is a preset judgment group corresponding to the first network packet data;
[0173] The determining module 11011 is further configured to determine a data segment to be determined in the first network packet data according to the first data and the determination length of the first determination condition; wherein the plurality of data segments includes the data segment to be determined;
[0174] a comparison module 11012, configured to compare the comparison data of the first judgment condition with the data segment to be judged according to the comparison rule of the first judgment condition, to obtain a first result corresponding to the first judgment condition;
[0175] A determination module 11021 is configured to determine, according to first preset correspondence information, network packet data corresponding to each preset change rule from the plurality of network packet data; wherein each preset change rule corresponds to one or more network packet data.
[0176] Further, in a possible implementation of the embodiment of the present disclosure, as shown in Figure 12 The change unit 1102 includes:
[0177] The determination module 11021 is configured to determine, according to first preset correspondence information, network packet data corresponding to each preset change rule from the plurality of network packet data; wherein each preset change rule corresponds to one or more network packet data.
[0178] The determination module 11021 is further configured to determine, as a reference result corresponding to each preset change rule, a first determination result of the network packet data corresponding to each preset change rule.
[0179] The cancel module 11022 is configured to, in a case where it is determined according to the reference result that the corresponding network packet data fails the determination, cancel data change processing of the network packet data corresponding to the reference result.
[0180] The change module 11023 is configured to, in a case where it is determined according to the reference result that the corresponding network packet data passes the determination, perform data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data.
[0181] Further, in a possible implementation of the embodiment of the present disclosure, the change module 11023 is further configured to:
[0182] In a case where it is determined according to the reference result that the corresponding network packet data passes the determination, performing data change processing on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result, to obtain the plurality of target packet data includes:
[0183] Determining a change action in the preset change rule; wherein the change action at least includes deletion, replacement, addition, and inaction;
[0184] In a case where it is determined that the change action is deletion, performing deletion processing on a data segment corresponding to the preset change rule in the network packet data corresponding to the reference result;
[0185] In a case where it is determined that the change action is addition / replacement, addition / replacement data in the preset change rule is determined, and data segments corresponding to the preset change rule in the network packet data corresponding to the reference result are added / replaced according to the addition / replacement data;
[0186] In a case where it is determined that the change action is no action, no data change processing is performed on the network packet data corresponding to the reference result.
[0187] Further, in a possible implementation manner of the embodiment of the present disclosure, as shown in the figure, Figure 12 The transmission unit 1103 includes:
[0188] The determination module 11031 is configured to determine the first judgment result corresponding to each packet receiving end according to the receiving end information; each packet receiving end corresponds to one or more first judgment results;
[0189] The cancellation module 11032 is configured to cancel data transmission of the packet receiving end corresponding to the first judgment result in a case where it is determined that the network packet data corresponding to the first judgment result fails the judgment according to the first judgment result.
[0190] The transmission module 11033 is configured to transmit the target packet data corresponding to the first judgment result to the packet receiving end corresponding to the first judgment result in a case where it is determined that the network packet data corresponding to the first judgment result passes the judgment according to the first judgment result.
[0191] Further, in a possible implementation manner of the embodiment of the present disclosure, as shown in the figure, Figure 12 The device further includes:
[0192] The setting unit 1104 is configured to perform judgment group setting processing through a preset host computer to obtain a plurality of preset judgment groups.
[0193] The setting unit 1104 is further configured to:
[0194] perform judgment condition setting processing through the preset host computer to obtain a plurality of judgment conditions; the judgment condition setting processing through the preset host computer at least includes setting position data, setting judgment length, setting comparison data, setting comparison rule, and setting marker data.
[0195] Classify a plurality of judgment conditions according to the network packet data to obtain the plurality of preset judgment groups.
[0196] Further, in a possible implementation manner of the embodiment of the present disclosure, the setting unit 1104 is further configured to:
[0197] The preset change rule is obtained by presetting a change rule setting process by a preset host computer.
[0198] The setting unit 1104 is further configured to:
[0199] The first preset corresponding information is obtained by setting, by the preset host computer, the network packet data corresponding to each of the preset change rules respectively.
[0200] The change action is obtained by setting, by the preset host computer, a change action for each of the preset change rules respectively.
[0201] The addition / replacement data is obtained by setting, by the preset host computer, addition / replacement data for each of the preset change rules respectively.
[0202] The preset change rule is obtained by performing data merging processing according to the first preset corresponding information, the change action, and the addition / replacement data.
[0203] It should be noted that the foregoing explanation and description of the method embodiments are also applicable to the device embodiments of the present disclosure, and the principles are the same, and the device embodiments of the present disclosure are not limited herein.
[0204] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device and a readable storage medium.
[0205] Figure 13 A schematic block diagram of an example electronic device 1300 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.
[0206] As Figure 13As shown, the device 1300 includes a computing unit 1301 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 1302 or a computer program loaded into a RAM (Random Access Memory) 1303 from the storage unit 1308. Various programs and data required for the operation of the device 1300 can also be stored in the RAM 1303. The computing unit 1301, the ROM 1302, and the RAM 1303 are connected to each other through a bus 1304. An I / O (Input / Output) interface 1305 is also connected to the bus 1304.
[0207] Various components in the device 1300 are connected to the I / O interface 1305, including an input unit 1306 such as a keyboard, a mouse, and the like; an output unit 1307 such as various types of displays, speakers, and the like; a storage unit 1308 such as a magnetic disk, a magneto-optical disk, and the like; and a communication unit 1309 such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 1309 allows the device 1300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0208] The computing unit 1301 can be various general and / or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 1301 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, and the like. The computing unit 1301 performs various methods and processes described above, such as the processing method of network packets. For example, in some embodiments, the processing method of network packets can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1308. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 1300 via the ROM 1302 and / or the communication unit 1309. When the computer program is loaded into the RAM 1303 and executed by the computing unit 1301, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 1301 can be configured to perform the aforementioned processing method of network packets by any other appropriate means, such as by means of firmware.
[0209] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0210] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as part of a separate software package, and partially on a remote machine or server.
[0211] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a linearly-programmed electrical connection, a portable computer diskette, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory), or flash memory, an optical fiber, a CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0212] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0213] The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a LAN (Local Area Network), a WAN (Wide Area Network), the Internet, and a blockchain network.
[0214] The computer system can include clients and servers. This relationship can be between a client and a server that are typically remote from each other and typically interact through a communication network. The relationship between client and server exists by virtue of computer programs running on the respective computer systems and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS (Virtual Private Server, or VPS for short) services. The server can also be a server of a distributed system, or a server combined with a blockchain.
[0215] It should be noted that artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of people (such as learning, reasoning, thinking, planning, etc.), both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc.; artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc. several major directions.
[0216] It should be understood that the various forms of the flow shown above can be used to reorder, add or delete steps. For example, each step described in the present disclosure can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.
[0217] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for processing network packets, characterized in that: include: Performing packet determination processing on the acquired plurality of network packet data through the corresponding preset determination groups to obtain first determination results corresponding to the plurality of network packet data; wherein the first determination results are used to at least determine whether the corresponding network packet data passes the determination; Performing data modification processing on the plurality of network packet data according to the first judgment result and the preset modification rule corresponding to each data segment to obtain a plurality of target packet data; wherein each network packet data includes a plurality of the data segments; Transmitting the target packet data to a corresponding packet receiving end according to the first judgment result and receiving end information, wherein the receiving end information is at least used to determine the packet receiving end corresponding to the target packet data; The obtained plurality of network packet data are subjected to packet determination processing by using respective corresponding preset determination groups to obtain first determination results corresponding to respective ones of the plurality of network packet data, including: determining first data in the first network packet data based on location data of a first judgment condition in a first preset judgment group; wherein the first preset judgment group includes at least a plurality of judgment conditions, each judgment condition including at least location data, a judgment length, comparison data, a comparison rule, and marking data, the plurality of judgment conditions including the first judgment condition, the first network packet data being any one of the plurality of network packet data, and the first preset judgment group being a preset judgment group corresponding to the first network packet data; Determining a data segment to be determined in the first network packet data according to the first data and the determination length of the first determination condition; wherein the plurality of data segments includes the data segment to be determined; Comparing the comparison data of the first judgment condition with the data segment to be judged according to the comparison rule of the first judgment condition to obtain a first result corresponding to the first judgment condition; The first network packet data is subjected to packet judgment processing one by one according to the multiple judgment conditions until the judgment is completed according to the identification data of the target judgment condition, thereby obtaining the first judgment result, wherein the target judgment condition is any judgment condition among the multiple judgment conditions that is after the first judgment condition.
2. The method according to claim 1, characterized in that The data change processing is performed on the plurality of network packet data according to the first judgment result and the preset change rule corresponding to each data segment to obtain a plurality of target packet data, including: Determining, from the plurality of network packet data, network packet data corresponding to each of the preset change rules according to the first preset corresponding information; wherein each of the preset change rules corresponds to one or more of the network packet data; Determining the first judgment result of the network packet data corresponding to each of the preset change rules as a reference result corresponding to each of the preset change rules; In the case where it is determined according to the reference result that the corresponding network packet data fails the judgment, canceling the data change processing of the network packet data corresponding to the reference result; When it is determined that the corresponding network packet data passes the judgment according to the reference result, data change processing is performed on the network packet data corresponding to the reference result according to the preset change rule corresponding to the reference result to obtain the multiple target packet data.
3. The method according to claim 2, characterized in that When it is determined that the corresponding network packet data passes the judgment according to the reference result, data modification processing is performed on the network packet data corresponding to the reference result according to the preset modification rule corresponding to the reference result, and the plurality of target packet data obtained include: Determining a change action in the preset change rule; wherein the change action includes at least deletion, replacement, addition, and no action; When it is determined that the change action is deletion, deleting the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result; When the change action is determined to be add / replace, determining add / replace data in the preset change rule, and performing add / replace processing on the data segment corresponding to the preset change rule in the network packet data corresponding to the reference result according to the add / replace data; When it is determined that the change action is no action, no data change processing is performed on the network packet data corresponding to the reference result.
4. The method according to claim 1, wherein The transmitting the target packet data to the corresponding packet receiving end according to the first judgment result and the receiving end information includes: Determining the first judgment result corresponding to each of the packet receiving ends according to the receiving end information; wherein each of the packet receiving ends corresponds to one or more of the first judgment results; If it is determined according to the first judgment result that the corresponding network packet data fails to pass the judgment, canceling the data transmission of the packet receiving end corresponding to the first judgment result; When it is determined according to the first judgment result that the corresponding network packet data passes the judgment, the target packet data corresponding to the first judgment result is transmitted to the packet receiving end corresponding to the first judgment result.
5. The method according to claim 1, wherein Before performing packet determination processing on the acquired plurality of network packet data through the corresponding preset determination groups to obtain first determination results corresponding to the plurality of network packet data, the method further includes: Performing judgment group setting processing by a preset host computer to obtain a plurality of preset judgment groups; The preset host computer performs the judgment group setting process to obtain a plurality of preset judgment groups including: The judgment condition setting process is performed by the preset host computer to obtain a plurality of the judgment conditions; wherein the judgment condition setting process performed by the preset host computer at least includes setting position data, setting judgment length, setting comparison data, setting comparison rules, and setting mark data; The plurality of judgment conditions are classified and processed according to the network packet data to obtain the plurality of preset judgment groups.
6. The method according to claim 3, characterized in that Before performing packet determination processing on the acquired plurality of network packet data through the corresponding preset determination groups to obtain first determination results corresponding to the plurality of network packet data, the method further includes: Performing preset change rule setting processing by a preset host computer to obtain the preset change rule; The preset change rule setting process is performed by the preset host computer to obtain the preset change rule, which includes: The preset host computer sets the network packet data corresponding to each of the preset change rules respectively to obtain the first preset corresponding information; Setting a change action for each of the preset change rules respectively by the preset host computer to obtain the change action; The preset host computer performs adding / replacing data setting for each of the preset change rules to obtain the adding / replacing data; Data merging processing is performed according to the first preset corresponding information, the change action, and the added / replaced data to obtain the preset change rule.
7. A network packet processing device, characterized in that: include: a judgment unit configured to perform packet judgment processing on the acquired plurality of network packet data through the corresponding preset judgment groups to obtain a first judgment result corresponding to each of the plurality of network packet data; wherein the first judgment result is used to at least determine whether the corresponding network packet data passes the judgment; a changing unit, configured to perform data changing processing on the plurality of network packet data according to the first judgment result and a preset changing rule corresponding to each data segment, to obtain a plurality of target packet data; wherein each network packet data includes a plurality of the data segments; a transmission unit, configured to transmit the target packet data to a corresponding packet receiving end according to the first determination result and receiving end information, wherein the receiving end information is at least used to determine the packet receiving end corresponding to the target packet data; The judging unit includes: a determination module, configured to determine first data in the first network packet data based on location data of a first judgment condition in a first preset judgment group; wherein the first preset judgment group includes at least a plurality of judgment conditions, each judgment condition including at least location data, a judgment length, comparison data, a comparison rule, and marking data; the plurality of judgment conditions includes the first judgment condition; the first network packet data is any one of the plurality of network packet data; and the first preset judgment group is a preset judgment group corresponding to the first network packet data; The determining module is further configured to determine a data segment to be determined in the first network packet data according to the first data and a determination length of the first determination condition; wherein the plurality of data segments includes the data segment to be determined; a comparison module, configured to compare the comparison data of the first judgment condition with the data segment to be judged according to the comparison rule of the first judgment condition, to obtain a first result corresponding to the first judgment condition; A judgment module is used to perform packet judgment processing on the first network packet data one by one according to the multiple judgment conditions until the judgment is completed according to the identification data of the target judgment condition, thereby obtaining the first judgment result, wherein the target judgment condition is any judgment condition among the multiple judgment conditions that is after the first judgment condition.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Network address translation device and packet processing method thereof
CN101616072A
Media file decapsulation method and device, media file decapsulation method and device, media and electronic equipment
CN117376329A