Application layer gateway ALG processing method and device, electronic equipment and storage medium

By recording the difference in the message length change value in the control channel session table and determining the message header serial number, the problem of high consumption of subsequent message serial number calculation in the NAT ALG scenario is solved, and stable and efficient message interaction is achieved.

CN119854209APending Publication Date: 2025-04-18ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311337132.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the NAT ALG scenario, the serial number operation of subsequent messages of TCP packet conversion consumes a lot, resulting in wasted CPU and memory resources, and may cause communication interruptions.

Method used

By recording the difference in the message payload content length change of the preset message when passing through the NAT router in the control channel session table, and determining the header sequence number of the second message is based on the type of the first message and the session table, and then forwarding processing is performed.

Benefits of technology

It realizes the rapid conversion of message header serial numbers, reduces the calculation of subsequent message header serial numbers, ensures the stability of message interaction, and does not consume additional CPU and memory resources, improving the performance of multi-channel protocol packets in ALG scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854209A_ABST
    Figure CN119854209A_ABST
Patent Text Reader

Abstract

The invention discloses an ALG (Application Layer Gateway) processing method and device, electronic equipment and a storage medium. The method comprises the steps that a control channel session table corresponding to a first message is detected, the control channel session table is used for recording a message load content length change difference value before and after a preset type of message is subjected to target conversion, and the preset type of message is a multi-channel protocol negotiation message based on a transmission control protocol; the target conversion is ALG application layer message information analysis and address conversion performed when passing through an NAT (Network Address Translation) router; determining a second message according to the type of the first message and a control channel session table corresponding to the first message, wherein the second message is a subsequent message which correspondingly needs to be forwarded after the first message; and carrying out forwarding processing on the second message. According to the technical scheme, the problem that the serial number operation consumption of the subsequent message after TCP message conversion in the NAT ALG scene is large is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to an application layer gateway (ALG) processing method, device, electronic device and storage medium. Background Art

[0002] For different application layer protocols, various ALG conversion functions need to be provided to ensure the normal operation of various services; for example, multimedia protocols (RTSP, SIP, etc.), FTP, and multi-channel protocols such as SQLNAT, the TCP payload carries negotiated address or port information. In the NAT usage scenario, these contents need to be NAT converted and processed for the negotiated IP address and port for address conversion, so as to ensure the correctness of application layer communication.

[0003] However, for TCP messages, changes in the TCP payload content often cause changes in the TCP message length. According to the TCP three-layer handshake protocol, the sequence number of the TCP message must be modified accordingly based on the length. The calculation of this sequence number is based on the cumulative calculation of the previous sequence number. Once the sequence number of a message in a TCP session changes, the sequence numbers of all subsequent TCP messages based on the connection must be changed accordingly. Operating on the message content each time will consume a lot of device performance, resulting in a waste of CPU resources and memory resources. At the same time, message retransmission during the message interaction process will also cause communication interruption. Summary of the invention

[0004] The present invention provides an application layer gateway (ALG) processing method, device, electronic device and storage medium to solve the problem of high consumption of sequence number calculation of subsequent messages after TCP message conversion in a NAT ALG scenario.

[0005] According to one aspect of the present invention, there is provided an application layer gateway (ALG) processing method, comprising:

[0006] Detecting a control channel session table corresponding to the first message, the control channel session table is used to record a difference in message payload content length before and after a preset message is converted to a target, the preset message is a multi-channel protocol negotiation message based on a transmission control protocol, and the target conversion is an ALG application layer message information parsing and address conversion performed when passing through a NAT router;

[0007] Determine a second message according to the type of the first message and the control channel session table corresponding to the first message, where the second message is a subsequent message that needs to be forwarded after the first message;

[0008] The second message is forwarded.

[0009] According to another aspect of the present invention, there is provided an application layer gateway (ALG) processing device, comprising:

[0010] A detection module, used for detecting a control channel session table corresponding to the first message, wherein the control channel session table is used for recording a difference in the length change of a message payload content of a preset class message before and after target conversion, wherein the preset class message is a multi-channel protocol negotiation message based on a transmission control protocol, and the target conversion is an ALG application layer message information parsing and address conversion performed when passing through a NAT router;

[0011] A determination module, configured to determine a second message according to the type of the first message and the control channel session table corresponding to the first message, wherein the second message is a subsequent message that needs to be forwarded after the first message;

[0012] A forwarding module is used to forward the second message.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the application layer gateway ALG processing method described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the application layer gateway ALG processing method described in any embodiment of the present invention when executed.

[0018] The technical solution of the embodiment of the present invention is based on the message length change caused by the change of the payload content of the multi-channel protocol negotiation message based on the transmission control protocol, and the change characteristics of the sequence number of the multi-channel protocol negotiation message based on the transmission control protocol. The difference of the message payload content length change before and after the ALG application layer message information parsing and address conversion performed when the multi-channel protocol negotiation message based on the transmission control protocol passes through the NAT router is recorded in a control channel session table in a timely manner, and for the second message that needs to be forwarded after the first message, the header sequence number of the second message is determined based on the type of the first message and the control channel session table corresponding to the first message, and then the second message is forwarded, so as to realize the rapid conversion of the message header sequence number, reduce the calculation of the subsequent message header sequence number, ensure the subsequent second message is processed without differentiation and the stability of the message interaction, and at the same time, it does not need to consume the processing power of the CPU or the large memory, so as to greatly improve the performance of the multi-channel protocol message in the ALG scenario.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 is a flowchart of an application layer gateway ALG processing method provided by an embodiment of the present invention;

[0022] Figure 2 is a schematic diagram of an application layer gateway ALG processing process applicable to an embodiment of the present invention;

[0023] Figure 3 is a schematic diagram of another application layer gateway ALG processing process provided according to an embodiment of the present invention;

[0024] Figure 4 It is a structural schematic diagram of an application layer gateway ALG processing device provided according to an embodiment of the present invention;

[0025] Figure 5 It is a structural schematic diagram of an electronic device for implementing the application layer gateway ALG processing method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Figure 1 A flow chart of an application layer gateway ALG processing method is provided for an embodiment of the present invention. This embodiment is applicable to the situation where the header sequence number of a multi-channel protocol negotiation message based on a transmission control protocol is adjusted and the message is forwarded. The method can be executed by an application layer gateway ALG processing device. The application layer gateway ALG processing device can be implemented in the form of hardware and / or software. The application layer gateway ALG processing device can be configured in any electronic device with network communication function.

[0029] like Figure 1 As shown, the application layer gateway ALG processing method of this embodiment may include the following process:

[0030] S110. Detect the control channel session table corresponding to the first message, where the control channel session table is used to record the difference in message payload content length change before and after the target conversion of the preset class message, the preset class message is a multi-channel protocol negotiation message based on the transmission control protocol, and the target conversion is the ALG application layer message information parsing and address conversion performed when passing through the NAT router.

[0031] Many application layer protocols, such as multimedia protocols (RTSP, SIP, etc.), FTP, SQLNAT, etc., are multi-channel protocols. The payload of the multi-channel protocol negotiation message based on the transmission control protocol carries the negotiation address or port information. In the NAT usage scenario, these contents not only need to convert the IP address in the message header, but also need to perform NAT conversion and processing on the IP address and port in the negotiated message payload to ensure the correctness of the application layer communication.

[0032] The payload content of the multi-channel protocol negotiation message based on the transmission control protocol changes, which often causes the length of the multi-channel protocol negotiation message based on the transmission control protocol to change. Therefore, after the ALG application layer message information parsing and address conversion of the multi-channel protocol negotiation message based on the transmission control protocol passes through the NAT router, it is found that the message payload content length changes before and after the ALG application layer message information parsing and address conversion when passing through the NAT router. The difference in the change of the message payload content length is recorded in real time through the control channel session table. Among them, the application layer gateway ALG is used to automatically detect the application layer information of the message in the NAT scenario, and automatically convert the IP address and port information in the message payload according to the application layer information by releasing the corresponding access rules.

[0033] As an optional but non-limiting implementation, before detecting the control channel session table corresponding to the first message, the following steps are also included:

[0034] If it is detected that the difference in the length change of the message payload content of the first message before and after the target conversion is not zero, the control channel session table is updated according to the difference in the length change of the message payload content of the first message before and after the target conversion.

[0035] When the first message belongs to a multi-channel protocol negotiation message based on the transmission control protocol, when the ALG application layer message information is parsed and the address is converted when the first message passes through the NAT router, the address and port in the payload of the first message are replaced with the address and port after NAT conversion, and the difference before and after the ALG application layer message information is parsed and the address is converted when passing through the NAT router is recorded. If there is a difference, the value in the control channel session table is updated to the difference before and after the first message passes through the target conversion. Optionally, the first message is an ftp message.

[0036] As an optional but non-limiting implementation, detecting the control channel session table corresponding to the first message may include the following steps A1-A2:

[0037] Step A1: Perform packet receiving processing on a first message received by a network adapter through DPDK.

[0038] Step A2: Detect whether there is a control channel session table corresponding to the first message, where the control channel session table is a session table established based on DPDK.

[0039] See also Figure 2 , receiving the first message through the network adapter, and performing packet processing on the received first message through DPDK to perform service identification. Among them, DPDK is a data plane development kit, a function library and driver set for fast data packet processing, which can greatly improve data processing performance and throughput, and improve the work efficiency of data plane applications. In the process of service identification, it is detected whether there is a control channel session table corresponding to the first message. If it is detected that there is no control channel session table corresponding to the first message, a control channel session table corresponding to the first message is established based on DPDK, and the second message that needs to be forwarded after the first message is forwarded. Among them, the target conversion is the ALG application layer message information parsing and address conversion performed when passing through the NAT router. If it is detected that there is a control channel session table corresponding to the first message, it is detected whether the first message belongs to a multi-channel protocol negotiation message based on the transmission control protocol.

[0040] S120: Determine a second message according to the type of the first message and the control channel session table corresponding to the first message, where the second message is a subsequent message that needs to be forwarded after the first message.

[0041] Optionally, the header sequence number of the second message is adjusted and controlled based on the type of the first message and the difference in message payload content length before and after the target conversion of the preset type message recorded in the control channel session table corresponding to the first message, and the second message is a subsequent message that needs to be forwarded corresponding to the first message.

[0042] As an optional but non-limiting implementation, determining the second message according to the type of the first message and the control channel session table corresponding to the first message includes steps B1-B2:

[0043] Step B1: If the first message belongs to a preset message category, the header sequence number of the second message is adjusted according to the control channel session table corresponding to the first message.

[0044] Step B2: If the first message does not belong to the preset message category, stop querying the control channel session table corresponding to the first message, and keep the header sequence number of the second message unchanged.

[0045] After detecting the control channel session table corresponding to the first message, if the first message does not belong to the preset class message, the second message is directly forwarded, the preset class message is a multi-channel protocol negotiation message based on the transmission control protocol, and the second message is a subsequent message that needs to be forwarded after the ALG application layer message information parsing and address conversion performed when the first message passes through the NAT router. If the first message belongs to the preset class message, the header sequence number of the second message that needs to be forwarded after the ALG application layer message information parsing and address conversion performed when the first message passes through the NAT router is adjusted based on the control channel session table.

[0046] As an optional but non-limiting implementation, adjusting the header sequence number of the second message according to the control channel session table corresponding to the first message may include steps C1-C2:

[0047] Step C1: Based on the control channel session table corresponding to the first message, query the difference in message payload content length before and after the first message is converted to a target.

[0048] Step C2: adjusting the header sequence number of the second message according to the difference in the length of the message payload content of the first message before and after the target conversion.

[0049] As an optional but non-limiting implementation, adjusting the header sequence number of the second message according to the difference in the length of the message payload content before and after the first message is converted to the target may include steps D1-D2:

[0050] Step D1: If the difference in the length of the message payload content of the first message before and after the target conversion is not zero, determine the message protocol characteristics of the first message and the third message hits the session direction, and the third message is the message result after the target conversion of the first message.

[0051] Step D2: According to the message protocol characteristics of the first message and the session direction hit by the third message, the header sequence number of the second message is adjusted by the difference in the message payload content length change of the first message before and after the target conversion.

[0052] See also Figure 2, if the difference in the length change of the message payload content recorded in the control channel session table is a non-zero value, it means that the message payload length has changed before and after the message payload is modified. For the second message that needs to be forwarded by the control channel, different subsequent processing processes are entered according to the message protocol characteristics of the first message and the direction of the third message hitting the session. Among them, the third message is the message result after the target conversion of the first message. In the case that the first message belongs to a multi-channel protocol negotiation message based on the transmission control protocol, if the first message is a forward message and the third message is a reverse message after negotiation, then the received sequence number in the header of the second message is subtracted from the difference in the length change of the message payload content recorded in the session table; if the first message is a forward message and the third message is a forward message after forward negotiation, then the sent sequence number in the header of the second message is added to the difference in the length change of the message payload content recorded in the session table.

[0053] See also Figure 2 , in the case where the first message is a multi-channel protocol negotiation message based on the transmission control protocol, if the first message is a reverse message and the third message is a forward message after reverse negotiation, then the received sequence number in the header of the second message is subtracted from the message payload content length change difference recorded in the session table; if the first message is a reverse message and the third message is a reverse message after reverse negotiation, then the sent sequence number in the header of the second message is added to the message payload content length change difference recorded in the session table.

[0054] S130: forward the second message.

[0055] As an optional but non-limiting implementation, the application layer gateway ALG processing method of this embodiment further includes the following steps:

[0056] If it is detected that the difference in the length change of the message payload content of the second message before and after the target conversion is not zero, the control channel session table is updated according to the accumulated result of the difference in the length change of the message payload content of the second message before and after the target conversion.

[0057] See also Figure 3 In the scenario where the control channel session table has been established, for the subsequent processing of the second message, when the session table is matched, if the session table status is already in a disconnected state or an abnormal state, the sequence number of the second message header or the message payload content length has been adjusted, and it is directly forwarded after the subsequent processing flow is completed. Subsequent messages with abnormal session table status are directly forwarded in the subsequent process.

[0058] See also Figure 3, when the session table state is in a normal state, if the second message is not a four-wave disconnect message or an RST message, then detect whether the subsequent second message is a multi-channel protocol negotiation message based on the transmission control protocol. If the subsequent second message is not a multi-channel protocol negotiation message based on the transmission control protocol, the sequence number of the second message header or the message payload content length has been adjusted, and it is directly forwarded after the subsequent processing flow is completed. If the subsequent second message is a multi-channel protocol negotiation message based on the transmission control protocol, then detect whether the difference in the length change of the message payload content before and after the target conversion of the second message is not zero. If it is not zero, the control channel session table is updated according to the accumulated result of the difference in the length change of the message payload content before and after the target conversion of the second message.

[0059] See also Figure 3 , based on the control channel session table corresponding to the second message, query the difference in message payload content length before and after the second message is converted to the target, and determine the fourth message header sequence number according to the difference in message payload content length before and after the second message is converted to the target, where the fourth message is a subsequent message that needs to be forwarded after the ALG application layer message information parsing and address conversion performed when the second message passes through the NAT router.

[0060] See also Figure 3 Optionally, determining the header sequence number of the fourth message according to the difference in the length of the message payload content before and after the second message is converted to the target, includes: if the difference in the length of the message payload content before and after the second message is converted to the target is not zero, determining the message protocol feature of the second message and the fifth message hitting the session direction, and adjusting the header sequence number of the fourth message according to the difference in the length of the message payload content before and after the second message is converted to the target. The fifth message is the message result after the second message is converted to the target.

[0061] See also Figure 3 , it has been identified that the second message is a multi-channel protocol negotiation message based on the transmission control protocol, and it is determined whether there is a message payload content length offset difference in the session table. If so, it means that the data channel has been negotiated based on the session control channel, and the payload length offset difference modified by the second message is added to the message payload content length offset difference in the session table and saved, and the header sending sequence number and receiving sequence number of the fourth message are set according to the message protocol characteristics and the message hit direction; if there is no length offset difference in the message payload content in the session table, the negotiated second message address or port is replaced with the address or port converted by NAT, and the address and port length difference before and after the conversion is calculated and saved to the payload content length offset difference in the session table.

[0062] The technical solution of the embodiment of the present invention is based on the message length change caused by the change of the payload content of the multi-channel protocol negotiation message based on the transmission control protocol, and the change characteristics of the sequence number of the multi-channel protocol negotiation message based on the transmission control protocol. By timely recording the ALG application layer message information parsing and the message payload content length change difference before and after the address conversion of the multi-channel protocol negotiation message based on the transmission control protocol through the NAT router in the control channel session table, when it is detected that the first message belongs to the multi-channel protocol negotiation message based on the transmission control protocol, the control channel session table will be used to determine the header sequence number of the second message, and then the second message will be forwarded, so as to realize the rapid conversion of the message header sequence number, reduce the calculation of the subsequent message header sequence number, ensure the subsequent second message is processed without differentiation and the stability of the message interaction, and at the same time, it does not need to consume the CPU processing power or large memory, so as to greatly improve the performance of the multi-channel protocol message in the ALG scenario.

[0063] Figure 4 A structural schematic diagram of an application layer gateway ALG processing device is provided for an embodiment of the present invention. This embodiment can be applicable to the situation where the header sequence number of a multi-channel protocol negotiation message based on a transmission control protocol is adjusted and the message is forwarded. The application layer gateway ALG processing device can be implemented in the form of hardware and / or software. The application layer gateway ALG processing device can be configured in any electronic device with a network communication function.

[0064] like Figure 4 As shown, the application layer gateway ALG processing device of this embodiment may include:

[0065] The detection module 410 is used to detect the control channel session table corresponding to the first message, wherein the control channel session table is used to record the difference in the length change of the message payload content of the preset class message before and after the target conversion, wherein the preset class message is a multi-channel protocol negotiation message based on the transmission control protocol, and the target conversion is the ALG application layer message information parsing and address conversion performed when passing through the NAT router;

[0066] A determination module 420, configured to determine a second message according to the type of the first message and the control channel session table corresponding to the first message, where the second message is a subsequent message that needs to be forwarded after the first message;

[0067] The forwarding module 430 is used to forward the second message.

[0068] Based on the above embodiment, optionally, detecting the control channel session table corresponding to the first message includes:

[0069] Performing packet processing on a first message received by the network adapter through DPDK;

[0070] Detect whether there is a control channel session table corresponding to the first message, where the control channel session table is a session table established based on DPDK.

[0071] Based on the above embodiment, optionally, before detecting the control channel session table corresponding to the first message, the method further includes:

[0072] If it is detected that the difference in length change of the message payload content of the first message before and after the target conversion is not zero, the control channel session table is updated according to the difference in length change of the message payload content of the first message before and after the target conversion.

[0073] On the basis of the above embodiment, optionally, determining the second message according to the type of the first message and the control channel session table corresponding to the first message includes:

[0074] If the first message belongs to a preset message type, adjusting the header sequence number of the second message according to the control channel session table corresponding to the first message;

[0075] If the first message does not belong to the preset message category, stop querying the control channel session table corresponding to the first message, and keep the header sequence number of the second message unchanged.

[0076] Based on the above embodiment, optionally, adjusting the header sequence number of the second message according to the control channel session table corresponding to the first message includes:

[0077] Based on the control channel session table corresponding to the first message, query the difference in message payload content length before and after the first message is converted to a target;

[0078] The header sequence number of the second message is adjusted according to the difference in the length of the message payload content of the first message before and after the target conversion.

[0079] Based on the above embodiment, optionally, adjusting the header sequence number of the second message according to the difference in message payload content length before and after the first message is converted to a target, includes:

[0080] If the difference in the length change of the message payload content of the first message before and after the target conversion is not zero, determining the message protocol feature of the first message and the third message hitting the session direction, the third message being the message result after the target conversion is performed on the first message;

[0081] According to the message protocol characteristics of the first message and the third message hitting the session direction, the header sequence number of the second message is adjusted by the difference in message payload content length change of the first message before and after target conversion.

[0082] Based on the above embodiment, optionally, the method further includes:

[0083] If it is detected that the difference in the length change of the message payload content of the second message before and after the target conversion is not zero, the control channel session table is updated according to the accumulated result of the difference in the length change of the message payload content of the second message before and after the target conversion.

[0084] The technical solution of the embodiment of the present invention is based on the message length change caused by the change of the payload content of the multi-channel protocol negotiation message based on the transmission control protocol, and the change characteristics of the sequence number of the multi-channel protocol negotiation message based on the transmission control protocol. The difference of the message payload content length change before and after the ALG application layer message information parsing and address conversion performed when the multi-channel protocol negotiation message based on the transmission control protocol passes through the NAT router is recorded in a control channel session table in a timely manner, and for the second message that needs to be forwarded after the first message, the header sequence number of the second message is determined based on the type of the first message and the control channel session table corresponding to the first message, and then the second message is forwarded, so as to realize the rapid conversion of the message header sequence number, reduce the calculation of the subsequent message header sequence number, ensure the subsequent second message is processed without differentiation and the stability of the message interaction, and at the same time, it does not need to consume the processing power of the CPU or the large memory, so as to greatly improve the performance of the multi-channel protocol message in the ALG scenario.

[0085] The application layer gateway ALG processing device provided in the embodiment of the present invention can execute the application layer gateway ALG processing method provided in any embodiment of the present invention, and has the corresponding functions and beneficial effects of executing the application layer gateway ALG processing method. For detailed process, please refer to the relevant operations of the application layer gateway ALG processing method in the above embodiment.

[0086] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.

[0087] Figure 5A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0088] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0089] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0090] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the application layer gateway ALG processing method.

[0091] In some embodiments, the application layer gateway ALG processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the application layer gateway ALG processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the application layer gateway ALG processing method in any other appropriate manner (e.g., by means of firmware).

[0092] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0093] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0094] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0095] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 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 trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0096] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0097] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may 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 difficult management and weak business scalability in traditional physical hosts and VPS services.

[0098] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0099] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An application layer gateway ALG processing method, characterized in that: include: Detecting a control channel session table corresponding to the first message, the control channel session table is used to record a difference in message payload content length before and after a preset message is converted to a target, the preset message is a multi-channel protocol negotiation message based on a transmission control protocol, and the target conversion is an ALG application layer message information parsing and address conversion performed when passing through a NAT router; Determine a second message according to the type of the first message and the control channel session table corresponding to the first message, where the second message is a subsequent message that needs to be forwarded after the first message; The second message is forwarded.

2. The method according to claim 1, characterized in that Detecting the control channel session table corresponding to the first message includes: Performing packet processing on a first message received by the network adapter through DPDK; Detect whether there is a control channel session table corresponding to the first message, where the control channel session table is a session table established based on DPDK.

3. The method according to claim 1, characterized in that Before detecting the control channel session table corresponding to the first message, the method further includes: If it is detected that the difference in length change of the message payload content of the first message before and after the target conversion is not zero, the control channel session table is updated according to the difference in length change of the message payload content of the first message before and after the target conversion.

4. The method according to claim 1, characterized in that: Determining a second message according to the type of the first message and a control channel session table corresponding to the first message includes: If the first message belongs to a preset message type, adjusting the header sequence number of the second message according to the control channel session table corresponding to the first message; If the first message does not belong to the preset message category, stop querying the control channel session table corresponding to the first message, and keep the header sequence number of the second message unchanged.

5. The method according to claim 4, characterized in that Adjusting the header sequence number of the second message according to the control channel session table corresponding to the first message includes: Based on the control channel session table corresponding to the first message, query the difference in message payload content length before and after the first message is converted to a target; The header sequence number of the second message is adjusted according to the difference in the length of the message payload content of the first message before and after the target conversion.

6. The method according to claim 5, characterized in that Adjusting the header sequence number of the second message according to the difference in the length of the message payload content of the first message before and after the target conversion, including: If the difference in the length change of the message payload content of the first message before and after the target conversion is not zero, determining the message protocol feature of the first message and the third message hitting the session direction, the third message being the message result after the target conversion is performed on the first message; According to the message protocol characteristics of the first message and the third message hitting the session direction, the header sequence number of the second message is adjusted by the difference in message payload content length change of the first message before and after target conversion.

7. The method according to claim 1, characterized in that The method further comprises: If it is detected that the difference in the length change of the message payload content of the second message before and after the target conversion is not zero, the control channel session table is updated according to the accumulated result of the difference in the length change of the message payload content of the second message before and after the target conversion.

8. An application layer gateway ALG processing device, characterized in that: include: A detection module, used for detecting a control channel session table corresponding to the first message, wherein the control channel session table is used for recording a difference in the length change of a message payload content of a preset class message before and after target conversion, wherein the preset class message is a multi-channel protocol negotiation message based on a transmission control protocol, and the target conversion is an ALG application layer message information parsing and address conversion performed when passing through a NAT router; A determination module, configured to determine a second message according to the type of the first message and the control channel session table corresponding to the first message, wherein the second message is a subsequent message that needs to be forwarded after the first message; A forwarding module is used to forward the second message.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the application layer gateway ALG processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the application layer gateway ALG processing method according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • ALG lightweight implementation method and device of embedded network equipment

    CN120658730A

  • A lightweight implementation method and device of an application layer gateway (ALG) for embedded network equipment

    CN120658730B