Algorithm card scheduling method, device, storage medium and electronic device

By performing quintuple matching and packet assembly processing on data packets, the problem of poor network data transmission performance caused by low algorithm card performance is solved. By reducing the number of API calls and interruptions, the network transmission performance is improved.

CN118175205BActive Publication Date: 2024-10-18JIANGSU NEW QUALITY INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410281746.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2024-10-18
Estimated Expiration
2044-03-12

AI Technical Summary

Technical Problem

In the existing technology, the low performance of the algorithm card leads to poor network data transmission performance, especially low efficiency when transmitting small bytes, and the traditional usage method in the IPSEC protocol stack involves many IO port operations, memory copying and data exchange, etc. Time-consuming operations lead to reduced network data transmission performance.

Method used

By performing five-tuple matching and assembly processing on the data packets, data packets with consistent five-tuple groups are spliced ​​into the HASH linked list in order, and the preset cumulative length is used to determine whether the assembly is completed, and is used in the encryption and decryption process. Packaging and unpacking processing reduce the number of calls to the algorithm card API and the number of interruptions in network card reception and transmission.

Benefits of technology

By splicing network data packets into large packets, the number of calls to the algorithm card API is reduced, the number of interruptions in network card reception and transmission is reduced, and network transmission performance is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118175205B_ABST
    Figure CN118175205B_ABST
Patent Text Reader

Abstract

An algorithm card scheduling method, device, storage medium and electronic device, the method splices the data packets with consistent quintuples into the corresponding HASH linked list in order, judges whether the packet splicing is completed by the preset cumulative length, submits the data packets spliced ​​into the cumulative length under the HASH linked list to the IPSEC network protocol stack, performs IPSEC encryption processing through the encryption card and sends it to the opposite end; the data packets processed by IPSEC encryption received by the opposite end are processed by the IPSEC network and decrypted by the encryption card, and the newly added spliced ​​data packet IP header is parsed and verified, and the length of the spliced ​​data packet is obtained after determining that the data packet is correct, and the first several bytes are used as the first IP packet header of the splicing, and the data packet length specified by the first IP packet header is used as the offset of the second IP packet of the splicing. The present invention reduces the number of interruptions of receiving and sending of the network card, and finally improves the network transmission performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer network communication, and in particular relates to an algorithm card scheduling method, device, storage medium and electronic equipment. Background Art

[0002] At present, the reliability and non-tamperability of network data transmission are achieved by the IPSEC (Internet Protocol Security) protocol, which encrypts and authenticates the data stream. In view of the high CPU consumption of the encryption algorithm, an external algorithm card is usually used to encrypt and decrypt the data.

[0003] In the prior art, encryption and decryption functions are implemented by calling the API interface provided by the algorithm card. In the process of calling the API interface, there are many time-consuming operations such as IO port operations, memory copying, and data exchange, especially small byte transmission, which is more time-consuming and less efficient. The traditional algorithm card usage method in the IPSEC protocol stack is to serially encrypt and decrypt each data packet. When the algorithm card performance is low, the network data transmission performance is greatly reduced. Summary of the invention

[0004] To this end, the present invention provides an algorithm card scheduling method, device, storage medium and electronic device to solve the problem of poor network data transmission performance when the algorithm card performance is low.

[0005] In order to achieve the above object, the present invention provides the following technical solutions: In a first aspect, an algorithm card scheduling method is provided, comprising:

[0006] Before encrypting the data packets received by the local network card, the data packets are spliced ​​together, and the five-tuple matching is performed on the data packets in the process of splicing before encryption. The data packets with the same five-tuple are spliced ​​into the corresponding HASH linked list in order. It is judged whether the splicing is completed by the preset cumulative length. If the data packet is spliced ​​together, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to the IPSEC network protocol stack, and is sent to the opposite end after being subjected to IPSEC encryption processing by the encryption card;

[0007] The IPSEC encrypted data packet received by the other end is processed by the IPSEC network and decrypted by the encryption card. The newly added spliced ​​data packet IP header is parsed and verified. After confirming that the data packet is correct, the spliced ​​data packet length is obtained. The spliced ​​data packet length is the sum of the lengths of all spliced ​​IP packets. The first several bytes are used as the header of the first spliced ​​IP packet, and the data packet length specified by the first IP packet header is used as the offset of the second spliced ​​IP packet. All spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until they are sent.

[0008] As a preferred solution of the algorithm card scheduling method, the five-tuple matching items of the data packet in the packet assembly process before encryption include: source IP address, destination IP address, source port number, destination port number and transmission protocol.

[0009] As a preferred solution of the algorithm card scheduling method, in the process of packet assembly before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet;

[0010] During the packet splicing process before encryption, the time wheel mechanism is started when the first data packet is inserted, and the timeout threshold is set according to business needs. If the packet splicing length is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

[0011] As a preferred solution of the algorithm card scheduling method, after receiving the IPSEC encrypted data packet ESP message, the other end directly uses the encryption card to decrypt the packet message and the normal message without distinguishing between them;

[0012] The message after decryption by the encryption card is marked and judged by the first 8 bytes of the packet. If it is a reassembled message, it is unpacked. If it is not a reassembled message, it is directly handed over to the IPSEC network protocol stack for processing, and the disassembled message is polled and sent to the IPSEC network protocol stack.

[0013] As a preferred solution for the algorithm card scheduling method, before encrypting the data packets received by the local network card and before splicing the packets, it also includes packet splicing condition judgment. During the packet splicing condition judgment process, the encryption policy is issued through the IPSEC network protocol stack, and the encryption policy is obtained by adding a protocol stack hook function to determine whether to splice the packets. If the encryption policy is satisfied, the data packets are matched with five-tuples, and the data packets with consistent five-tuples are sequentially spliced ​​into the corresponding HASH linked list.

[0014] In a second aspect, an algorithm card scheduling device is provided, comprising:

[0015] The packet splicing processing module before encryption is used to perform packet splicing processing on the data packets received by the local network card before encryption. In the packet splicing processing before encryption, the data packets are matched with five tuples, and the data packets with the same five tuples are spliced ​​into the corresponding HASH linked list in sequence. It is judged whether the packet splicing is completed by the preset cumulative length. If the data packet is completed, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to the IPSEC network protocol stack, and is sent to the opposite end after IPSEC encryption processing by the encryption card;

[0016] The decryption and unpacking module is used to parse and verify the newly added spliced ​​data packet IP header after the IPSEC encrypted data packet received by the other end is processed by the IPSEC network and decrypted by the encryption card. After determining that the data packet is correct, the length of the spliced ​​data packet is obtained. The length of the spliced ​​data packet is the sum of the lengths of all spliced ​​IP packets. The first several bytes are used as the header of the first spliced ​​IP packet, and the data packet length specified by the first IP packet header is used as the offset of the second spliced ​​IP packet. All spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed.

[0017] As a preferred solution of the algorithm card scheduling device, in the packet assembly processing module before encryption, the items for five-tuple matching of the data packet include: source IP address, destination IP address, source port number, destination port number and transmission protocol;

[0018] In the packet assembly processing module before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet;

[0019] In the packet splicing processing module before encryption, the time wheel mechanism is started when the first data packet is inserted, and the timeout threshold is set according to business requirements. If the packet splicing length is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

[0020] As a preferred solution of the algorithm card scheduling device, in the decryption and unpacking module, after receiving the data packet ESP message encrypted by IPSEC, the other end directly uses the encryption card to decrypt the assembled message and the normal message without distinguishing them;

[0021] The message after decryption by the encryption card is marked and judged by the first 8 bytes of the packet. If it is a reassembled message, it will be unpacked. If it is not a reassembled message, it will be directly handed over to the IPSEC network protocol stack for processing, and the disassembled message will be polled and sent to the IPSEC network protocol stack;

[0022] It also includes a packet splicing condition judgment module, which is used to issue encryption policies through the IPSEC network protocol stack, and obtain the encryption policies by adding protocol stack hook functions to determine whether to splice packets. If the encryption policies are met, the data packets are matched with five-tuples, and the data packets with consistent five-tuples are spliced ​​into the corresponding HASH linked list in sequence.

[0023] In a third aspect, a storage medium is provided, in which a program code of an algorithm card scheduling method is stored, and the program code includes instructions for executing an algorithm card scheduling method of the first aspect or any possible implementation thereof.

[0024] In a fourth aspect, an electronic device is provided, comprising: a memory and a processor; the processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute an algorithm card scheduling method of the first aspect or any possible implementation thereof.

[0025] The invention has the following beneficial effects: before encrypting a data packet received by a local network card, a packet splicing process is performed on the data packet; before encryption, a five-tuple matching is performed on the data packet; the data packets with the same five-tuple are sequentially spliced ​​into a corresponding HASH linked list; whether the splicing is completed is judged by a preset cumulative length; if the data packet splicing is completed, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to an IPSEC network protocol stack, and is sent to an opposite end after being subjected to IPSEC encryption processing by an encryption card; after the data packet processed by IPSEC encryption received by the opposite end is processed by the IPSEC network and decrypted by the encryption card, a newly added spliced ​​data packet IP header is parsed and verified; after determining that the data packet is correct, the spliced ​​data packet length is obtained; the spliced ​​data packet length is the sum of the lengths of all spliced ​​IP packets; the first several bytes are used as the header of the first spliced ​​IP packet; the data packet length specified by the header of the first IP packet is used as the offset of the second spliced ​​IP packet; all spliced ​​IP messages are gradually split; the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed. The present invention splices network data packets into large packets, reduces the number of calls to the algorithm card API, reduces the number of interruptions of network card reception and transmission, and ultimately improves network transmission performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the drawings required for the implementation methods or the prior art descriptions are briefly introduced below. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0027] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0028] Figure 1 A schematic diagram of a flow chart of an algorithm card scheduling method provided by an embodiment of the present invention;

[0029] Figure 2 A logical schematic diagram of the algorithm card scheduling method provided by an embodiment of the present invention;

[0030] Figure 3 A schematic diagram of an application of the algorithm card scheduling method provided by an embodiment of the present invention;

[0031] Figure 4 A schematic diagram of the architecture of an algorithm card scheduling device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] Example 1

[0034] See also Figure 1 and Figure 2 , an algorithm card scheduling method provided by embodiment 1 of the present invention comprises the following steps:

[0035] S1, before encrypting the data packets received by the local network card, the data packets are matched with five tuples in the packet splicing process before encryption, and the data packets with the same five tuples are spliced ​​into the corresponding HASH linked list in order, and whether the packet splicing is completed is judged by the preset cumulative length. If the data packet is completed, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to the IPSEC network protocol stack, and is sent to the opposite end after being encrypted by the encryption card through IPSEC;

[0036] S2. After the IPSEC encrypted data packet received by the other end is processed by the IPSEC network and decrypted by the encryption card, the newly added spliced ​​data packet IP header is parsed and verified. After confirming that the data packet is correct, the spliced ​​data packet length is obtained. The spliced ​​data packet length is the sum of the lengths of all spliced ​​IP packets. The first several bytes are used as the first spliced ​​IP packet header, and the data packet length specified by the first IP packet header is used as the offset of the second spliced ​​IP packet. All spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed.

[0037] In this embodiment, in step S1, the five-tuple matching items of the data packet in the packet assembly process before encryption include: source IP address, destination IP address, source port number, destination port number and transmission protocol. In the packet assembly process before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet; in the packet assembly process before encryption, a time wheel mechanism is started when the first data packet is inserted, and a timeout threshold is set according to business requirements. If the length of the data packet assembly is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

[0038] Specifically, before encrypting the data packets received by the local network card, it is necessary to match the five-tuple source IP address, destination IP address, source port number, destination port number and transmission protocol of the data received by the network card, and splice the data packets with consistent five-tuples into the corresponding HASH linked list in sequence, and determine whether the data packets are spliced ​​by accumulating the length.

[0039] Among them, in addition to the cumulative length, a timeout mechanism needs to be added to determine whether it is the last packet of the packet assembly through the timeout mechanism, so as to prevent the unlimited waiting caused by the packet assembly data length not reaching the set threshold but the last packet has been sent, which causes abnormal network transmission. In addition, there is a time wheel mechanism under the HASH linked list corresponding to each quintuple. Within the preset time, if the data packet of the same quintuple is not received, the timeout processing mechanism will be entered, and the existing data packets under the HASH linked list will be spliced ​​into a data packet of the cumulative length, and then submitted to the IPSEC network protocol stack for IPSEC encryption processing.

[0040] In this embodiment, in step S2, after the other end receives the IPSEC encrypted data packet ESP message, it directly uses the encryption card to decrypt it without distinguishing between the assembled message and the normal message; the message after decryption by the encryption card is marked and judged by the first 8 bytes of the assembled message. If it is a reassembled message, the unpacking operation is performed. If it is not a reassembled message, it is directly handed over to the IPSEC network protocol stack for processing, and the disassembled message polling is sent to the IPSEC network protocol stack.

[0041] Specifically, the other end receives the data packet from the local end, and after being processed by the IPSEC network protocol stack and decrypted by the encryption card, the newly added IP header of the packet is parsed, and the Check verification is performed to determine whether the data packet is correct, and the total length of the packet is obtained. Among them, the total length of the packet is the sum of the lengths of all spliced ​​IP packets, and the first 20 bytes of PayLoad are the header of the first spliced ​​IP packet, and the data packet length specified by the first IP header is used as the offset of the second spliced ​​IP packet, thereby gradually splitting all spliced ​​IP packets, and then polling the split IP packets and sending them to the network protocol stack until they are sent.

[0042] In a possible embodiment, before encrypting the data packets received by the local network card and before the packet splicing processing, it also includes step S0, packet splicing condition judgment. During the packet splicing condition judgment process, the encryption policy is issued through the IPSEC network protocol stack, and the encryption policy is obtained by adding a protocol stack hook function to determine whether to perform packet splicing. If the encryption policy is satisfied, the data packets are matched with five tuples, and the data packets with consistent five tuples are sequentially spliced ​​into the corresponding HASH linked list, thereby improving the network transmission performance of the ESP message.

[0043] See also Figure 3 In the application process of this embodiment, the use of the encryption card is divided into package encryption and decryption and unpacking, and the package assembly and unpacking are respectively deployed in the paired local and opposite end devices. The specific workflow is as follows:

[0044] 1) First, deploy packet encryption and decryption strategies on the local and remote ends where the IPSEC tunnel needs to be established.

[0045] 2) The xfrm negotiation software negotiates the encryption SP and encryption SA. After the negotiation is successful, the SP and SA are sent to the encryption machine. The encryption SP will be notified of the encryption package by the kernel IPSEC protocol stack hook function during the sending process. The encryption package process converts the SP policy into package conditions and saves them in the HASH table.

[0046] 3) When the internal network port receives a data packet, the packet splicing condition determines whether to perform the packet splicing. If the encryption policy is met, the received data packet is inserted into the HASH linked list indexed by the five-tuple, and the data packets with the same five-tuple are inserted subsequently. When the first data packet is inserted, the time wheel mechanism is started, and the timeout threshold is set according to business needs. If the length is about to exceed the MTU value or the time interval is greater than the timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

[0047] 4) After receiving the ESP message, the external network port does not distinguish between the assembled message and the normal message, and directly uses the encryption card to decrypt it. The decrypted message is specially marked by the first 8 bytes of the assembled payload. If it is a reassembled message, it is unpacked. Otherwise, it is directly handled by the protocol stack and the disassembled message is polled and sent to the protocol stack.

[0048] In summary, the embodiment of the present invention performs packet splicing processing on the data packets received by the local network card before encryption, performs quintuple matching on the data packets in the packet splicing processing process before encryption, splices the data packets with the same quintuples into the corresponding HASH linked list in sequence, judges whether the packet splicing is completed by the preset cumulative length, and if the packet splicing is completed, submits the data packets spliced ​​into the cumulative length under the HASH linked list to the IPSEC network protocol stack, performs IPSEC encryption processing through the encryption card and then sends it to the opposite end; after the IPSEC encrypted data packets received by the opposite end are processed by the IPSEC network and decrypted by the encryption card, the newly added spliced ​​data packet IP header is parsed and verified, and the spliced ​​data packet length is obtained after determining that the data packet is correct, and the spliced ​​data packet length is the sum of the lengths of all spliced ​​IP packets, the first several bytes are used as the first IP packet header of the splicing, the data packet length specified by the first IP packet header is used as the offset of the second IP packet of the splicing, all the spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed. The present invention splices network data packets into large packets, reduces the number of calls to the algorithm card API, reduces the number of interruptions of network card reception and transmission, and ultimately improves network transmission performance.

[0049] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.

[0050] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0051] Example 2

[0052] See also Figure 4 Embodiment 2 of the present invention provides an algorithm card scheduling device, comprising:

[0053] The packet splicing processing module 001 before encryption is used to perform packet splicing processing on the data packets received by the local network card before encryption. The packet splicing processing process before encryption performs quintuple matching on the data packets, splices the data packets with consistent quintuples into the corresponding HASH linked list in sequence, and judges whether the packet splicing is completed by the preset cumulative length. If the packet splicing is completed, the data packets spliced ​​into the cumulative length under the HASH linked list are submitted to the IPSEC network protocol stack, and are sent to the opposite end after IPSEC encryption processing by the encryption card;

[0054] The decrypted unpacking module 002 is used to parse and verify the newly added spliced ​​data packet IP header after the IPSEC encrypted data packet received by the other end is processed by the IPSEC network and decrypted by the encryption card. After determining that the data packet is correct, the length of the spliced ​​data packet is obtained. The length of the spliced ​​data packet is the sum of the lengths of all spliced ​​IP packets. The first several bytes are used as the header of the first spliced ​​IP packet, and the data packet length specified by the first IP packet header is used as the offset of the second spliced ​​IP packet. All spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed.

[0055] In this embodiment, in the packet assembly processing module 001 before encryption, the items for five-tuple matching of the data packet include: source IP address, destination IP address, source port number, destination port number and transmission protocol;

[0056] In the packet assembly processing module 001 before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet;

[0057] In the packet splicing processing module 001 before encryption, the time wheel mechanism is started when the first data packet is inserted, and the timeout threshold is set according to business requirements. If the packet splicing length is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

[0058] In this embodiment, in the decryption and unpacking module 002, after receiving the data packet ESP message encrypted by IPSEC, the peer end directly uses the encryption card to decrypt the assembled message and the normal message without distinguishing them;

[0059] The message after decryption by the encryption card is marked and judged by the first 8 bytes of the packet. If it is a reassembled message, it will be unpacked. If it is not a reassembled message, it will be directly handed over to the IPSEC network protocol stack for processing, and the disassembled message will be polled and sent to the IPSEC network protocol stack;

[0060] It also includes a packet splicing condition judgment module 003, which is used to issue encryption policies through the IPSEC network protocol stack, and obtain the encryption policies by adding a protocol stack hook function to determine whether to splice packets. If the encryption policies are met, the data packets are matched with five-tuples, and the data packets with consistent five-tuples are sequentially spliced ​​into the corresponding HASH linked list.

[0061] It should be noted that the information interaction, execution process and other contents between the modules of the above-mentioned device are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown in the previous part of the present application, and will not be repeated here.

[0062] Example 3

[0063] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which a program code of an algorithm card scheduling method is stored. The program code includes instructions for executing the algorithm card scheduling method of embodiment 1 or any possible implementation thereof.

[0064] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0065] Example 4

[0066] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;

[0067] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the algorithm card scheduling method of embodiment 1 or any possible implementation thereof.

[0068] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.

[0069] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.

[0070] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0071] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. An algorithm card scheduling method, characterized in that: include: Before encrypting the data packets received by the local network card, the data packets are spliced ​​together, and the five-tuple matching is performed on the data packets in the process of splicing before encryption. The data packets with the same five-tuple are spliced ​​into the corresponding HASH linked list in order. It is judged whether the splicing is completed by the preset cumulative length. If the data packet is spliced ​​together, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to the IPSEC network protocol stack, and is sent to the opposite end after being subjected to IPSEC encryption processing by the encryption card; After the IPSEC encrypted data packet received by the other end is processed by the IPSEC network and decrypted by the encryption card, the newly added spliced ​​data packet IP header is parsed and verified, and the length of the spliced ​​data packet is obtained after confirming that the data packet is correct. The length of the spliced ​​data packet is the sum of the lengths of all the spliced ​​IP packets. The first several bytes are used as the header of the first spliced ​​IP packet, and the data packet length specified by the first IP packet header is used as the offset of the second spliced ​​IP packet. All the spliced ​​IP messages are gradually split, and the split IP messages are polled and sent to the IPSEC network protocol stack until the sending is completed; After receiving the ESP message of the data packet encrypted by IPSEC, the peer end directly decrypts it using the encryption card without distinguishing between the assembled message and the normal message; The message after decryption by the encryption card is marked and judged by the first 8 bytes of the packet. If it is a reassembled message, it will be unpacked. If it is not a reassembled message, it will be directly handed over to the IPSEC network protocol stack for processing, and the disassembled message will be polled and sent to the IPSEC network protocol stack; Before encrypting the data packets received by the local network card and before the packet splicing processing, it also includes the packet splicing condition judgment. During the packet splicing condition judgment process, the encryption policy is issued through the IPSEC network protocol stack, and the encryption policy is obtained by adding a protocol stack hook function to determine whether to splice the packet. If the encryption policy is met, the data packet is matched with five tuples, and the data packets with the same five tuples are spliced ​​into the corresponding HASH linked list in sequence.

2. The algorithm card scheduling method according to claim 1, characterized in that: The five-tuple matching items of the data packet in the packet assembly process before encryption include: source IP address, destination IP address, source port number, destination port number and transmission protocol.

3. The algorithm card scheduling method according to claim 2, characterized in that: During the packet assembly process before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet; During the packet splicing process before encryption, the time wheel mechanism is started when the first data packet is inserted, and the timeout threshold is set according to business needs. If the packet splicing length is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

4. An algorithm card scheduling device, characterized in that: include: The packet splicing processing module before encryption is used to perform packet splicing processing on the data packets received by the local network card before encryption. In the packet splicing processing before encryption, the data packets are matched with five tuples, and the data packets with the same five tuples are spliced ​​into the corresponding HASH linked list in sequence. It is judged whether the packet splicing is completed by the preset cumulative length. If the data packet is completed, the data packet spliced ​​into the cumulative length under the HASH linked list is submitted to the IPSEC network protocol stack, and is sent to the opposite end after IPSEC encryption processing by the encryption card; The decryption and unpacking module is used to parse and verify the newly added spliced ​​data packet IP header after the data packet encrypted by IPSEC received by the other end is processed by the IPSEC network and decrypted by the encryption card, and obtain the length of the spliced ​​data packet after confirming that the data packet is correct. The length of the spliced ​​data packet is the sum of the lengths of all the spliced ​​IP packets, and the first several bytes are used as the header of the first spliced ​​IP packet, and the data packet length specified by the header of the first IP packet is used as the offset of the second spliced ​​IP packet, and all the spliced ​​IP packets are gradually split, and the split IP packets are polled and sent to the IPSEC network protocol stack until the sending is completed; In the decryption and unpacking module, after receiving the data packet ESP message processed by IPSEC encryption, the opposite end directly uses the encryption card to decrypt the assembled message and the normal message without distinguishing them; The message after decryption by the encryption card is marked and judged by the first 8 bytes of the packet. If it is a reassembled message, it will be unpacked. If it is not a reassembled message, it will be directly handed over to the IPSEC network protocol stack for processing, and the disassembled message will be polled and sent to the IPSEC network protocol stack; It also includes a packet splicing condition judgment module, which is used to issue encryption policies through the IPSEC network protocol stack, and obtain the encryption policies by adding protocol stack hook functions to determine whether to splice packets. If the encryption policies are met, the data packets are matched with five-tuples, and the data packets with consistent five-tuples are spliced ​​into the corresponding HASH linked list in sequence.

5. An algorithm card scheduling device according to claim 4, characterized in that: In the packet processing module before encryption, the items for five-tuple matching of the data packet include: source IP address, destination IP address, source port number, destination port number and transmission protocol; In the packet assembly processing module before encryption, a timeout mechanism is added to determine whether the assembled data packet is the last packet; In the packet splicing processing module before encryption, the time wheel mechanism is started when the first data packet is inserted, and the timeout threshold is set according to business requirements. If the packet splicing length is greater than the MTU value or the time interval is greater than the set timeout threshold, the existing data packets in the HASH linked list are combined into one data packet and handed over to the IPSEC protocol stack for processing.

6. A storage medium storing a program code of an algorithm card scheduling method, characterized in that: The program code includes instructions for executing an algorithm card scheduling method as described in any one of claims 1 to 3.

7. An electronic device comprising: Memory and processor; The processor and the memory communicate with each other via a bus; The memory stores program instructions that can be executed by the processor, and is characterized in that the processor calls the program instructions to execute an algorithm card scheduling method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • TCP / IP network transmission message recombination method transparent to terminal equipment

    CN109756505A