[go: up one dir, main page]

CN117675753A - A processing method and routing device for controlling sessions - Google Patents

A processing method and routing device for controlling sessions Download PDF

Info

Publication number
CN117675753A
CN117675753A CN202311585585.3A CN202311585585A CN117675753A CN 117675753 A CN117675753 A CN 117675753A CN 202311585585 A CN202311585585 A CN 202311585585A CN 117675753 A CN117675753 A CN 117675753A
Authority
CN
China
Prior art keywords
cpu
control message
message
source address
npu
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311585585.3A
Other languages
Chinese (zh)
Inventor
师哲
王宇轩
崔佰会
戴冰琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN202311585585.3A priority Critical patent/CN117675753A/en
Publication of CN117675753A publication Critical patent/CN117675753A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2557Translation policies or rules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本说明书提供了一种控制会话的处理方法和路由设备,方法包括:NPU接收携带第一控制报文,将所述第一控制报文中的第一源地址根据网络地址转换NAT规则转换为的第二源地址,NPU将所述第一控制报文和第二源地址上送CPU内核态,NPU接收CPU内核态发送的第二控制报文,将第二控制报文中的第一目的地址根据NAT规则转换为第二目的地址,NPU将第二控制报文和第二目的地址上送CPU内核态,NPU接收CPU内核态发送的接管通知和用户态转换的控制报文进行会话处理。通过该方法,避免受限于NPU硬件的处理逻辑,每次流程处理仅可以对IP进行一次转换处理,无法实现NAT hairpin场景中的两次NAT转换的技术问题。

This specification provides a control session processing method and routing device. The method includes: the NPU receives the first control message and converts the first source address in the first control message into according to the network address translation NAT rule. The second source address, the NPU sends the first control message and the second source address to the CPU kernel state, the NPU receives the second control message sent by the CPU kernel state, and sends the first destination address in the second control message Convert to the second destination address according to NAT rules, and the NPU sends the second control message and the second destination address to the CPU kernel state. The NPU receives the takeover notification sent by the CPU kernel state and the control message for user state conversion for session processing. Through this method, we avoid being limited by the processing logic of the NPU hardware. Each process process can only convert the IP once, which makes it impossible to achieve the technical problem of two NAT conversions in the NAT hairpin scenario.

Description

Control session processing method and routing equipment
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a method and a routing device for controlling a session.
Background
NPU: network Processing Unit, a network processing unit;
NAT: network Address Translation network address translation;
ALG: application Level Gateway application layer gateway;
NAT hairpin: the NAT hairpin function is used for meeting the requirement of accessing between users located on the intranet side or between the users located on the intranet side and the server through NAT addresses.
The ALG (Application Level Gateway, application layer gateway) mainly completes processing of application layer messages. Normally, NAT only converts the IP address and port information in the header, and does not analyze the fields in the application layer data payload. However, some special protocols may include IP address or port information in the data payload of their message, and these contents cannot be effectively translated by NAT, which may cause problems. For example, FTP applications are commonly completed by both data and control sessions, and the establishment of a data session is dynamically determined by payload field information in the control session, which requires ALGs to complete the conversion of the payload field information to ensure the correct establishment of subsequent data sessions.
The NAT hairpin function is used for meeting the requirement of accessing between users located on the intranet side or between the users located on the intranet side and the server through NAT addresses. And the method can convert the source address and the destination address of the message at the same time by starting an intranet side interface of the NAT hairpin. It supports two networking modes:
P2P: and the users on the intranet side are mutually visited through the NAT address which is dynamically allocated. Each host computer in the intranet registers own external network address information to the external network server, the address information is NAT address converted from the external network side output direction address, and then the internal network hosts mutually visit through the external network addresses registered to the external network server.
C/S: and the user at the intranet side accesses the intranet server by using the NAT address. And the NAT simultaneously converts the source and destination IP addresses of the message accessing the intranet server on the intranet interface, wherein the destination IP address conversion is completed by matching the configuration of the intranet server on a certain extranet interface, and the source address conversion is completed by matching the outbound dynamic address conversion or the outbound static address conversion on the interface where the intranet server is positioned.
The processing mode of the ALG NAT hairpin commonly used at present is simpler, the destination IP address of the message hits the NAT Server address pool configured by the interface of the device in the process of forwarding the hardware of the device, the message is directly sent to the CPU user state for processing after being routed, the user state converts the IP addresses (including source IP and destination IP) possibly contained in the three-layer header and the data load of the message to generate a control session table item, the message is sent to the hardware, and the device forwards the message according to the corresponding next hop outlet.
At present, all data session messages and control session messages of the NAT ALG hairpin are usually processed in a CPU, the performance of the CPU is limited, the forwarding capability of the actual NAT ALG service is limited and can not meet the requirements of users, the processing of the session in the NPU is limited by processing logic of NPU hardware, and each flow processing can only perform one conversion processing on an IP address and can not perform proper processing on two NAT conversions related to the NAT hairpin scene.
Disclosure of Invention
To overcome the problems in the related art, the present specification provides a method of processing a control session and a routing apparatus.
According to a first aspect of embodiments of the present specification, there is provided a method of processing a control session, the method comprising:
the network processing unit NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
the NPU uploads the first control message and the second source address to a CPU kernel mode;
the NPU receives a second control message sent by the CPU in a kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
the NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
the NPU receives a take-over notification sent by the CPU kernel mode and a control message for user mode conversion to perform session processing, wherein the take-over notification is sent to the CPU kernel mode by the CPU user mode after a session table is established.
Before the first source address in the first control message is converted into the second source address according to the network address translation NAT rule, the method further includes:
and judging whether the first control message needs to be subjected to address conversion according to NAT rules issued by the user in advance, and if so, executing the second source address converted from the first source address in the first control message according to the NAT rules.
The converting the first source address in the first control message into the second source address according to the NAT rule includes:
the NPU allocates address resources, establishes a first control session hardware table, converts a first source address into a second source address according to NAT rules, and simultaneously sets a first identification position in the first control session hardware table, wherein the first identification position is used for indicating that the first control session hardware table needs to perform NAT address conversion twice.
The NPU sends the first control message and the second source address to a CPU kernel mode, including:
the NPU encapsulates a first message and sends the first message to the CPU kernel mode, the first message carries a first control message, a second source address and a first identification bit after setting, and the first identification bit is used for indicating that the first control session hardware table needs to perform NAT address conversion twice.
Optionally, the method further comprises:
after receiving a first control message and a second source address sent by an NPU, the CPU kernel mode establishes a session table, wherein the session table comprises: the system comprises a first kernel mode software table and a second kernel mode software table, wherein the first kernel mode software table is used for storing a first control message and a second source address, and the second kernel mode software table is used for storing a second control message and the first source address.
The NPU receives a second control message sent by the CPU kernel mode, including:
and the NPU establishes a second control session hardware table according to the second control message.
The NPU sends the second control message and the second destination address to the CPU kernel state, including:
the NPU encapsulates a second message, where the second message carries a second control message and a second destination address.
After the CPU kernel mode receives the second message, the method further includes:
the CPU kernel mode queries a second kernel mode software table according to the second message to obtain a first source address, and obtains a first control message according to the first source address and a second control message in the second message;
the CPU kernel mode sends the first control message and the second source address to the CPU user mode;
the CPU user state obtains a first control message, converts a first destination address in the first control message according to the input interface to obtain a second destination address, converts a first source address in the first control message to obtain a second source address, and establishes a session table.
Optionally, after the NPU receives the take-over notification sent by the CPU kernel mode, the method further includes:
the NPU receives a third message sent by the CPU kernel mode, determines a target control session hardware table from the control session hardware table according to the third message, deletes the target control session hardware table and sends a fourth message to the CPU kernel mode, wherein the fourth message is used for indicating that the target control session hardware table is deleted;
the CPU kernel mode sends a fifth message to the CPU user mode according to the fourth message, and the user instructs the CPU user mode to delete the session table corresponding to the fifth message;
the CPU user state deletes the corresponding session table according to the fifth message, and sends a sixth message to the CPU kernel state, which is used for indicating the CPU kernel state to delete the session table corresponding to the sixth message;
wherein the third message, the fourth message, the fifth message and the sixth message have the same source address and destination address.
According to the embodiments, session tables (a user state software table, a kernel state software table and a control session hardware table) are respectively established in the NPU, the CPU kernel state and the CPU user state, so that the technical problem that the user side observes that the NAT session is one session and is consistent with the session display of the ALG NAT hairpin realized by the original pure CPU, and meanwhile, the processing logic limited by the NPU hardware is solved, only one conversion process can be carried out on the IP in each flow processing, and the two NAT conversions in the NAT hairpin scene cannot be realized is solved.
According to a second aspect of embodiments of the present specification, there is provided a routing device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the following method when executing the program:
the network processing unit NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
the NPU uploads the first control message and the second source address to a CPU kernel mode;
the NPU receives a second control message sent by the CPU in a kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
the NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
the NPU receives a take-over notification sent by the CPU kernel mode and a control message for user mode conversion to perform session processing, wherein the take-over notification is sent to the CPU kernel mode by the CPU user mode after a session table is established.
According to a second aspect of embodiments of the present specification, there is provided a routing device comprising: NPU and CPU, the CPU comprising: CPU kernel mode and CPU user mode, NPU includes:
the receiving module is used for receiving a first control message, and converting a first source address in the first control message into a second source address according to a network address translation NAT rule;
the sending module is used for uploading the first control message and the second source address to a CPU kernel mode;
the receiving module is further configured to receive a second control message sent by the CPU in a kernel mode, and convert a first destination address in the second control message into a second destination address according to NAT rules, where the second control message is a first control message with a source address being a second source address;
the sending module is further configured to send the second control message and the second destination address to the CPU kernel state, and send the first control message and the second source address to the CPU user state by the CPU kernel state, so that the CPU user state establishes a session table;
the receiving module is further configured to receive a takeover notification sent by the CPU kernel mode to perform session processing, where the takeover notification is sent by the CPU user mode to the CPU kernel mode after the session table is established.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and together with the description, serve to explain the principles of the specification.
Fig. 1 is a diagram illustrating a method of processing a control session according to an exemplary embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present description as detailed in the accompanying claims.
The terminology used in the description presented herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
At present, all data session messages and control session messages of NAT ALG hairpin are usually processed in a CPU, the performance of the CPU is limited, the forwarding capability of the actual NAT ALG service is limited and can not meet the requirements of users, the processing of the session in an NPU is limited by processing logic of NPU hardware, and each flow processing can only perform one conversion processing on IP, and two NAT conversions related to NAT hairpin scenes can not be properly processed.
In order to solve the above technical problems, an embodiment of the present disclosure provides a method for processing a control session, as shown in fig. 1, including:
s101, an NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
s102NPU sends the first control message and the second source address to CPU kernel mode;
s103, the NPU receives a second control message sent by the CPU kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
s104NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
s105NPU receives the take-over notice and the control message of user mode conversion sent by CPU kernel mode to process the session, wherein the take-over notice is sent to CPU kernel mode by CPU user mode after establishing session list.
In this embodiment, the user may preset the NAT rule and issue the NAT rule.
In step 101, after receiving the first control message, the NPU may determine whether address conversion needs to be performed on the first control message according to the NAT rule, if so, execute step S101, otherwise, process the first control message conventionally.
In this embodiment, after the first control packet hits the NAT rule, the NPU allocates an address resource (e.g., an IP address resource), establishes a first control session hardware table (i.e., establishes a hardware session table), converts a first source address in the first control packet into a second source address, and simultaneously sets a first identification bit in the first control session hardware table, where the first identification bit may be a alice tag in the first control session hardware table, and the first identification bit is used to indicate that the first control session hardware table needs to perform NAT address conversion Twice.
In step S102, the NPU encapsulates a first message, where the first message carries a first control message, a second source address, and a first set identification bit, where the first identification bit is used to indicate that the first control session hardware table needs to perform NAT address translation twice.
In this embodiment, after receiving a first control message and a second source address sent by an NPU, the CPU kernel mode establishes a session table, where the session table includes: the system comprises a first kernel mode software table and a second kernel mode software table, wherein the first kernel mode software table is used for storing a first control message and a second source address, and the second kernel mode software table is used for storing a second control message and the first source address.
In step S103, the NPU acquires the second control packet, and the first destination address in the second control packet is converted into the second destination address according to the NAT rule, and at the same time, the NPU establishes a session table (i.e., a second control session hardware table) according to the second control packet and the second destination address.
In this embodiment, the NPU encapsulates a second message, where the second message carries a second control message and a second destination address.
The CPU kernel mode queries a second kernel mode software table according to the second message to obtain a first source address, and obtains a first control message according to the first source address and a second control message in the second message;
the CPU kernel mode sends the first control message and the second source address to the CPU user mode;
the CPU user state obtains a first control message, converts a first destination address in the first control message according to the input interface to obtain a second destination address, converts a first source address in the first control message to obtain a second source address, and establishes a session table.
For ease of description, the techniques in this disclosure are further described:
(1) the method comprises the following steps The message entering device hits the NAT rule previously issued by the user on the NPU, and discovers that the message needs to perform conversion processing on the source IP and the destination IP. The NPU allocates IP resources, establishes a control session hardware table A (i.e. a first control session hardware table), converts the source IP address of the message, and sets a Tvice mark in the hardware table A (which means that the session table item needs to be subjected to the subsequent processing of NAT Twice);
(2) the method comprises the following steps And (3) uploading the NPU encapsulation message to a CPU, wherein the message carries the original message in the step (1), the converted source IP address and the Tvice mark. The CPU kernel mode establishes a kernel mode software table A and a kernel mode software table B, wherein the kernel mode software table A stores an original message before NAT conversion and a source IP address after conversion, and a Tvice mark in the software table is set; the kernel mode software table B stores the source IP address of the message after converting the source IP and the original message;
(3) the method comprises the following steps After the CPU kernel mode establishes a software table, converting a message source IP address, updating a checksum field, and then re-issuing to the NPU, wherein the NPU establishes a control session hardware table B, and converts a message destination IP address;
(4) the method comprises the following steps The message packaging information is uploaded to the CPU from the NPU again, and the message carries the message with the converted source IP and the converted destination IP address;
(5) the method comprises the following steps The CPU kernel mode inquires the kernel mode software table B according to the sent message, acquires the source IP of the original message, replaces the source IP address of the message in the sent message with the source IP address of the original message, and then sends the message to the CPU user mode (the sent message is the same as the original message in the step (1);
(6) the method comprises the following steps After the CPU user state receives the original message, firstly converting the destination IP of the message according to the Nat server configuration of the device inlet interface; then calling a kernel mode interface, inquiring a kernel mode software table A, acquiring source IP resources to be converted, which are distributed by an NPU, converting the source IP of the message, generating a user mode software table, and forwarding the message from the CPU user mode to the CPU kernel mode;
(7) the method comprises the following steps The message is issued to the NPU from the CPU kernel mode;
(8) the method comprises the following steps And the NAT control session message after the IP address conversion searches the next jump-out interface forwarding equipment.
According to the embodiments, session tables (a user state software table, a kernel state software table and a control session hardware table) are respectively established in the NPU, the CPU kernel state and the CPU user state, so that the technical problem that the user side observes that the NAT session is one session and is consistent with the session display of the ALG NAT hairpin realized by the original pure CPU, and meanwhile, the processing logic limited by the NPU hardware is solved, only one conversion process can be carried out on the IP in each flow processing, and the two NAT conversions in the NAT hairpin scene cannot be realized is solved.
In this embodiment, the NPU receives a third message sent by the CPU kernel mode, determines a target control session hardware table from the control session hardware table according to the third message, deletes the target control session hardware table, and sends a fourth message to the CPU kernel mode, where the fourth message is used to indicate that the target control session hardware table has been deleted;
the CPU kernel mode sends a fifth message to the CPU user mode according to the fourth message, and the user instructs the CPU user mode to delete the session table corresponding to the fifth message;
the CPU user state deletes the corresponding session table according to the fifth message, and sends a sixth message to the CPU kernel state, which is used for indicating the CPU kernel state to delete the session table corresponding to the sixth message;
wherein the third message, the fourth message, the fifth message and the sixth message have the same source address and destination address.
The embodiment of the disclosure also provides a state synchronization mechanism of the same control session of the CPU user mode, the kernel mode and the NPU, so that the list item uniformity is ensured, and the potential list item residue problem in the new and deleting processes is avoided at the same time:
(1) the method comprises the following steps The CPU user state informs the table item deletion for the first time, the kernel state software table state is set to be deleted, and the timestamp of the kernel state software table to be deleted is refreshed;
(2) the method comprises the following steps The CPU kernel state sends a message to inform the NPU, and the hardware table state is set to be deleted;
(3) the method comprises the following steps The NPU timer polls the hardware table state at regular time, deletes the hardware table when the hardware table state is inquired to be the hardware table to be deleted, and sends a message to inform the CPU that the hardware table is deleted after the hardware table is deleted;
(4) the method comprises the following steps The CPU kernel mode reports the user mode information event and notifies the deletion of the user mode software table. If the state of the kernel mode software table is to be taken over (the processing of the step (4) in fig. 1 is abnormal) or is forcedly deleted, directly constructing a message and executing the subsequent step (5);
(5) the method comprises the following steps User state software table deletion, CPU user state second time notifying table item deletion, deleting kernel state software table, completing deletion flow;
(6) the method comprises the following steps Limited by the reliability of the hardware channel for transmitting information, the foregoing processes (1) - (5) may have the situation that the message notification is lost or fails to be processed, so as to avoid entry residues and synchronize the user state and the hardware table state in time, the CPU kernel mode software timer periodically polls the kernel mode software table state, and performs the following processing:
the CPU kernel mode software table does not receive the information of the CPU user mode taking over the session (step (4) in the figure 1) when the appointed time is exceeded, and the state of the kernel mode software table is set to be deleted;
b. the state of the kernel-mode software table is to be deleted, the state continuously exceeds the scheduled time table item and is not deleted, the state of the kernel-mode software table is set to be deleting, and meanwhile, the step (4) in the repeated execution deleting process informs a user of deleting the software table;
c. setting a state flag of the kernel-mode software table to be deleted (a double state is supposed to be that the user-mode flow in the step (5) cannot be issued correctly at the moment) and setting the kernel-mode software table to be forcedly deleted;
(7) the method comprises the following steps Limited by the reliability of the hardware channel for transmitting information, in the foregoing cases of message notification loss may exist in the flows (2) - (5) in fig. 1, in order to avoid table entry residues and synchronize the user state and the hardware table state, the CPU kernel-mode software timer periodically polls the kernel-mode software table state, and performs the following processing: the NPU timer polls the hardware table state at regular time, and the following processing is carried out:
a. the session hardware table does not receive the information of the CPU to take over the session when exceeding the fixed aging time, the hardware table is directly deleted according to the timing aging treatment, and then the step (3) is executed to inform the CPU;
according to the embodiments, the control session table states on the CPU user state, the kernel state and the NPU are synchronized, the protection is added to the three-party control session on the basis of guaranteeing NAT forwarding performance, the reliability of the session table entry is improved, and the risk caused by uncertainty of hardware channel transmission information is reduced.
The embodiment of the disclosure also provides a routing device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the following method:
the network processing unit NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
the NPU uploads the first control message and the second source address to a CPU kernel mode;
the NPU receives a second control message sent by the CPU in a kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
the NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
the NPU receives a take-over notification sent by a CPU kernel mode and a control message converted by a user mode for session processing, wherein the take-over notification is sent to the CPU kernel mode by the CPU user mode after a session table is established, and the control message converted by the user mode is a control message converted by the user mode by SIP and DIP.
The embodiment of the disclosure also provides a routing device, which comprises: NPU and CPU, the CPU comprising: CPU kernel mode and CPU user mode, NPU includes:
the receiving module is used for receiving a first control message, and converting a first source address in the first control message into a second source address according to a network address translation NAT rule;
the sending module is used for uploading the first control message and the second source address to a CPU kernel mode;
the receiving module is further configured to receive a second control message sent by the CPU in a kernel mode, and convert a first destination address in the second control message into a second destination address according to NAT rules, where the second control message is a first control message with a source address being a second source address;
the sending module is further configured to send the second control message and the second destination address to the CPU kernel state, and send the first control message and the second source address to the CPU user state by the CPU kernel state, so that the CPU user state establishes a session table;
the receiving module is further configured to receive a takeover notification sent by the CPU kernel mode to perform session processing, where the takeover notification is sent by the CPU user mode to the CPU kernel mode after the session table is established.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the modules illustrated as separate components may or may not be physically separate, and the components shown as modules may or may not be physical, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present description. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Other embodiments of the present description will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the specification following, in general, the principles of the specification and including such departures from the present disclosure as come within known or customary practice within the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It is to be understood that the present description is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The foregoing description of the preferred embodiments is provided for the purpose of illustration only, and is not intended to limit the scope of the disclosure, since any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the disclosure are intended to be included within the scope of the disclosure.

Claims (11)

1. A method of handling a control session, the method comprising:
the network processing unit NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
the NPU uploads the first control message and the second source address to a CPU kernel mode;
the NPU receives a second control message sent by the CPU in a kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
the NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
the NPU receives a take-over notification sent by the CPU kernel mode and a control message for user mode conversion to perform session processing, wherein the take-over notification is sent to the CPU kernel mode by the CPU user mode after a session table is established.
2. The method of claim 1, wherein prior to translating the first source address in the first control message to the second source address according to network address translation, NAT, rules, the method further comprises:
and judging whether the first control message needs to be subjected to address conversion according to NAT rules issued by the user in advance, and if so, executing the second source address converted from the first source address in the first control message according to the NAT rules.
3. The method of claim 1, wherein the translating the first source address in the first control message to the second source address according to network address translation NAT rules comprises:
the NPU allocates address resources, establishes a first control session hardware table, converts a first source address into a second source address according to NAT rules, and simultaneously sets a first identification position in the first control session hardware table, wherein the first identification position is used for indicating that the first control session hardware table needs to perform NAT address conversion twice.
4. The method of claim 1, wherein the NPU uploading the first control message and the second source address to a CPU kernel mode, comprising:
the NPU encapsulates a first message and sends the first message to the CPU kernel mode, the first message carries a first control message, a second source address and a first identification bit after setting, and the first identification bit is used for indicating that the first control session hardware table needs to perform NAT address conversion twice.
5. The method according to claim 1, wherein the method further comprises:
after receiving a first control message and a second source address sent by an NPU, the CPU kernel mode establishes a session table, wherein the session table comprises: the system comprises a first kernel mode software table and a second kernel mode software table, wherein the first kernel mode software table is used for storing a first control message and a second source address, and the second kernel mode software table is used for storing a second control message and the first source address.
6. The method of claim 1, wherein the NPU receives a second control message sent by a CPU kernel mode, comprising:
and the NPU establishes a second control session hardware table according to the second control message.
7. The method of claim 1, wherein the NPU forwarding the second control message and the second destination address to the CPU core state comprises:
the NPU encapsulates a second message, where the second message carries a second control message and a second destination address.
8. The method of claim 7, wherein upon receipt of the second message by the CPU kernel mode, the method further comprises:
the CPU kernel mode queries a second kernel mode software table according to the second message to obtain a first source address, and obtains a first control message according to the first source address and a second control message in the second message;
the CPU kernel mode sends the first control message and the second source address to the CPU user mode;
the CPU user state obtains a first control message, converts a first destination address in the first control message according to configuration information of an input interface to obtain a second destination address, converts a first source address in the first control message to obtain a second source address, and establishes a session table.
9. The method of claim 1, wherein after the NPU receives the takeover notification sent by the CPU in kernel mode, the method further comprises:
the NPU receives a third message sent by the CPU kernel mode, determines a target control session hardware table from the control session hardware table according to the third message, deletes the target control session hardware table and sends a fourth message to the CPU kernel mode, wherein the fourth message is used for indicating that the target control session hardware table is deleted;
the CPU kernel mode sends a fifth message to the CPU user mode according to the fourth message, and the user instructs the CPU user mode to delete the session table corresponding to the fifth message;
the CPU user state deletes the corresponding session table according to the fifth message, and sends a sixth message to the CPU kernel state, which is used for indicating the CPU kernel state to delete the session table corresponding to the sixth message;
wherein the third message, the fourth message, the fifth message and the sixth message have the same source address and destination address.
10. A routing device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor performs the following method when executing the program:
the network processing unit NPU receives a first control message, and converts a first source address in the first control message into a second source address according to a network address translation NAT rule;
the NPU uploads the first control message and the second source address to a CPU kernel mode;
the NPU receives a second control message sent by the CPU in a kernel mode, and converts a first destination address in the second control message into a second destination address according to NAT rules, wherein the second control message is a first control message with a source address being a second source address;
the NPU sends the second control message and the second destination address to the CPU kernel state, and the CPU kernel state sends the first control message and the second source address to the CPU user state, so that the CPU user state establishes a session table;
the NPU receives a take-over notification sent by the CPU kernel mode and a control message for user mode conversion to perform session processing, wherein the take-over notification is sent to the CPU kernel mode by the CPU user mode after a session table is established.
11. A routing device, the routing device comprising: NPU and CPU, the CPU comprising: CPU kernel mode and CPU user mode, NPU includes:
the receiving module is used for receiving a first control message, and converting a first source address in the first control message into a second source address according to a network address translation NAT rule;
the sending module is used for uploading the first control message and the second source address to a CPU kernel mode;
the receiving module is further configured to receive a second control message sent by the CPU in a kernel mode, and convert a first destination address in the second control message into a second destination address according to NAT rules, where the second control message is a first control message with a source address being a second source address;
the sending module is further configured to send the second control message and the second destination address to the CPU kernel state, and send the first control message and the second source address to the CPU user state by the CPU kernel state, so that the CPU user state establishes a session table;
the receiving module is further configured to receive a takeover notification sent by the CPU kernel mode to perform session processing, where the takeover notification is sent by the CPU user mode to the CPU kernel mode after the session table is established.
CN202311585585.3A 2023-11-24 2023-11-24 A processing method and routing device for controlling sessions Pending CN117675753A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311585585.3A CN117675753A (en) 2023-11-24 2023-11-24 A processing method and routing device for controlling sessions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311585585.3A CN117675753A (en) 2023-11-24 2023-11-24 A processing method and routing device for controlling sessions

Publications (1)

Publication Number Publication Date
CN117675753A true CN117675753A (en) 2024-03-08

Family

ID=90069136

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311585585.3A Pending CN117675753A (en) 2023-11-24 2023-11-24 A processing method and routing device for controlling sessions

Country Status (1)

Country Link
CN (1) CN117675753A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040114589A1 (en) * 2002-12-13 2004-06-17 Alfieri Robert A. Method and apparatus for performing network processing functions
US20170078245A1 (en) * 2015-09-15 2017-03-16 Juniper Networks, Inc. Nat port manager for enabling port mapping using remainders
CN106789617A (en) * 2016-12-22 2017-05-31 东软集团股份有限公司 A kind of message forwarding method and device
CN107888500A (en) * 2017-11-03 2018-04-06 东软集团股份有限公司 Message forwarding method and device, storage medium, electronic equipment
WO2021168773A1 (en) * 2020-02-28 2021-09-02 华为技术有限公司 Communication method and communication apparatus
WO2021184551A1 (en) * 2020-03-18 2021-09-23 平安科技(深圳)有限公司 Communication method and apparatus based on plurality of networks, electronic device, and storage medium
CN115426305A (en) * 2021-05-31 2022-12-02 华为技术有限公司 Message processing method, device and system
CN116686277A (en) * 2020-12-30 2023-09-01 甲骨文国际公司 Class-based queuing for scalable multi-tenant RDMA traffic

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040114589A1 (en) * 2002-12-13 2004-06-17 Alfieri Robert A. Method and apparatus for performing network processing functions
US20170078245A1 (en) * 2015-09-15 2017-03-16 Juniper Networks, Inc. Nat port manager for enabling port mapping using remainders
CN106534394A (en) * 2015-09-15 2017-03-22 瞻博网络公司 NAT port manager used for realizing port mapping by using remainder
CN106789617A (en) * 2016-12-22 2017-05-31 东软集团股份有限公司 A kind of message forwarding method and device
CN107888500A (en) * 2017-11-03 2018-04-06 东软集团股份有限公司 Message forwarding method and device, storage medium, electronic equipment
WO2021168773A1 (en) * 2020-02-28 2021-09-02 华为技术有限公司 Communication method and communication apparatus
WO2021184551A1 (en) * 2020-03-18 2021-09-23 平安科技(深圳)有限公司 Communication method and apparatus based on plurality of networks, electronic device, and storage medium
CN116686277A (en) * 2020-12-30 2023-09-01 甲骨文国际公司 Class-based queuing for scalable multi-tenant RDMA traffic
CN115426305A (en) * 2021-05-31 2022-12-02 华为技术有限公司 Message processing method, device and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
吴兆立;孙敏燕;: "NAT ALG原理与应用", 计算机光盘软件与应用, no. 23, 1 December 2013 (2013-12-01) *
周轶男;李曦;冯朝阳;: "基于NPU架构的VPN防火墙硬件结构模型", 计算机工程与设计, no. 05, 28 May 2006 (2006-05-28) *
王美娇;王豪杰;陈辰;杨龙飞;: "一种轻量级双协议栈隧道技术的设计和实现", 硅谷, no. 19, 8 October 2013 (2013-10-08) *

Similar Documents

Publication Publication Date Title
US10855654B2 (en) Session identifier for a communication session
US11856065B2 (en) Data transmission for service integration between a virtual private cloud and an intranet
JP6538986B2 (en) Virtual machine packet control
CN112583618B (en) Methods, devices and computing equipment for providing network services to businesses
JP2021530892A (en) Communication method and communication device
JP2001356973A (en) Network system
CN111193773A (en) Load balancing method, device, equipment and storage medium
JP4789425B2 (en) Route table synchronization method, network device, and route table synchronization program
CN107094110B (en) DHCP message forwarding method and device
US10212126B2 (en) System for mediating connection
CN111526223A (en) Management method of edge service server, service data processing method and device
US20240259316A1 (en) Network load balancing method and apparatus, electronic device, medium, and program product
CN111277481A (en) Method, device, equipment and storage medium for establishing VPN tunnel
KR101083480B1 (en) Virtual connection with subscription notification service
CN118301214A (en) Method, system, storage medium and electronic device for transmitting target service data
US20190089675A1 (en) Network address translation device, setting requesting device, communication system, communication method and storage medium storing program
US8943123B2 (en) Server apparatus, network access method, and computer program
CN114363902B (en) 5G private network service security assurance method, device, equipment and storage medium
CN114845350B (en) A routing selection method and device
JP5093012B2 (en) COMMUNICATION CONTROL DEVICE, COMMUNICATION CONTROL METHOD, AND COMMUNICATION CONTROL PROGRAM
CN117675753A (en) A processing method and routing device for controlling sessions
WO2018032499A1 (en) Load balancing method and associated device
WO2024222010A1 (en) Method and apparatus for proxying a response to address request message, electronic device, and storage medium
WO2023207278A1 (en) Message processing method and apparatus
JP2013126219A (en) Transfer server and transfer program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination