CN113542131A - Message forwarding method and device - Google Patents

Message forwarding method and device Download PDF

Info

Publication number
CN113542131A
CN113542131A CN202110569218.9A CN202110569218A CN113542131A CN 113542131 A CN113542131 A CN 113542131A CN 202110569218 A CN202110569218 A CN 202110569218A CN 113542131 A CN113542131 A CN 113542131A
Authority
CN
China
Prior art keywords
message
data message
packet
hash
output interface
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.)
Granted
Application number
CN202110569218.9A
Other languages
Chinese (zh)
Other versions
CN113542131B (en
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 Security Technologies Co Ltd
Original Assignee
New H3C Security 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 Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN202110569218.9A priority Critical patent/CN113542131B/en
Publication of CN113542131A publication Critical patent/CN113542131A/en
Application granted granted Critical
Publication of CN113542131B publication Critical patent/CN113542131B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Abstract

The application provides a message forwarding method and a device, and the method comprises the following steps: receiving a data message; analyzing the data message to obtain a message identifier and message indication information of the data message; judging whether the data message is a fragment message or not according to the message indication information; if the data message is confirmed to be a fragment message according to the message indication information, performing hash calculation by using the message identification to determine a first output interface; forwarding the data message by using the first output interface; if the data message is determined to be a non-fragmented message according to the message indication information, performing hash calculation by using quintuple information of the data message to determine a second output interface; and forwarding the data message by using the second output interface. Therefore, the problem of disorder caused by distributing the fragment messages to different links under an equivalent multipath scene is solved.

Description

Message forwarding method and device
Technical Field
The present application relates to the field of computer communications technologies, and in particular, to a method and an apparatus for forwarding a packet.
Background
In some networks, there are generally equivalent paths between a client and a server, and in such networks, a user may want a traffic of the client accessing a specific server to be able to take links corresponding to two equivalent paths for load sharing, but the following problems may occur after load sharing: if the flow accessed from the client to the server is large, generally, the large flow is sent, the flow is fragmented before the client sends out, that is, the service flow is divided into a plurality of fragment messages, and then the fragment messages are respectively sent to the server.
Therefore, how to solve the problem of disorder caused by distributing the fragment messages to different links in an equivalent multipath scenario is one of the considerable technical problems.
Disclosure of Invention
In view of this, the present application provides a message forwarding method and apparatus, so as to solve the problem of disorder caused by distributing fragment messages to different links in an equal-cost multipath scenario.
Specifically, the method is realized through the following technical scheme:
according to a first aspect of the present application, a method for forwarding a packet is provided, which is applied to a network device, and the method includes:
receiving a data message;
analyzing the data message to obtain a message identifier and message indication information of the data message;
judging whether the data message is a fragment message or not according to the message indication information;
if the data message is confirmed to be a fragment message according to the message indication information, performing hash calculation by using the message identification to determine a first output interface; forwarding the data message by using the first output interface;
if the data message is determined to be a non-fragmented message according to the message indication information, performing hash calculation by using quintuple information of the data message to determine a second output interface; and forwarding the data message by using the second output interface.
According to a second aspect of the present application, there is provided a packet forwarding apparatus, configured in a network device, the apparatus including:
the receiving module is used for receiving the data message;
the analysis module is used for analyzing and processing the data message to obtain a message identifier and message indication information of the data message;
the judging module is used for judging whether the data message is a fragment message according to the message indication information;
the interface determining module is used for performing hash calculation by using the message identifier to determine a first output interface if the judging module confirms that the data message is a fragment message according to the message indication information; if the judging module confirms that the data message is a non-fragmented message according to the message indication information, the five-tuple information of the data message is utilized to carry out Hash calculation to determine a second output interface
The message forwarding module is used for forwarding the data message by using the first output interface if the interface determining module determines the first output interface; and if the interface determining module determines a second output interface, forwarding the data message by using the second output interface.
According to a third aspect of the present application, there is provided an electronic device comprising a processor and a machine-readable storage medium, the machine-readable storage medium storing a computer program executable by the processor, the processor being caused by the computer program to perform the method provided by the first aspect of the embodiments of the present application.
According to a fourth aspect of the present application, there is provided a machine-readable storage medium storing a computer program which, when invoked and executed by a processor, causes the processor to perform the method provided by the first aspect of the embodiments of the present application.
The beneficial effects of the embodiment of the application are as follows:
after receiving the data message, the network equipment analyzes the data message, so as to obtain a message identifier and message indication information of the data message; then judging whether the data message is a fragment message according to the message indication information; when the data message is confirmed to be a fragment message according to the message indication information, performing hash calculation by using the message identification of the data message to determine a first output interface, and then forwarding the data message by using the first output interface; because the message identifications of the fragmented messages of the same service flow are all the same, hash calculation is performed by using the message identifications of the fragmented messages of the same service flow, the determined first output interfaces are all the same, and the forwarding paths corresponding to the first output interfaces are determined, so that the fragmented messages of the same service flow can be sent to a server from the same link, and thus, the problem of disorder does not exist, the problem of disorder caused by load sharing to different links in the prior art is solved, and the efficiency of reassembling the fragmented messages is improved.
Drawings
Fig. 1 is a schematic diagram of a networking architecture according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a message forwarding method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a format of message header information of a data message according to an embodiment of the present application;
fig. 4 is a block diagram of a message forwarding apparatus according to an embodiment of the present application;
fig. 5 is a schematic diagram of a hardware structure of an electronic device implementing the message forwarding method according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with aspects such as the present application.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application, 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 and all possible combinations of one or more of the corresponding listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The message forwarding method provided by this embodiment may be applied to a network device, the network device may be a device having an equivalent outgoing interface scenario, the network device may be configured in a plurality of networking systems, and as long as an equivalent multipath condition exists in the networking system, the network device related to the equivalent multipath selection may implement the message forwarding method provided by this application. In practical applications, the network device may include, but is not limited to, a router, a member device in an aggregation scenario, and the like, and may be determined according to a practical scenario.
For convenience of description, a network device is taken as an example to be described later, the router is a router 1 in the networking shown in fig. 1, and when receiving a data packet sent by a client, the router 1 performs forwarding processing on the data packet according to the packet forwarding method provided by the present application. After receiving the data message, the router 1 analyzes the data message, so as to obtain a message identifier and message indication information of the data message; then judging whether the data message is a fragment message according to the message indication information; when the data message is confirmed to be a fragment message according to the message indication information, performing hash calculation by using the message identification of the data message to determine a first output interface, and then forwarding the data message by using the first output interface; because the message identifications of the fragmented messages of the same service flow are all the same, hash calculation is performed by using the message identifications of the fragmented messages of the same service flow, the determined first output interfaces are all the same, and the forwarding paths corresponding to the first output interfaces are determined, so that the fragmented messages of the same service flow can be sent to a server from the same link, and thus, the problem of disorder does not exist, the problem of disorder caused by load sharing to different links in the prior art is solved, and the efficiency of reassembling the fragmented messages is improved.
When the router 1 determines that the data packet is a non-fragmented packet, hash calculation is performed directly using quintuple information in the packet header of the data packet to determine a second egress interface and forward the data packet using the second egress interface. Because the data message is a non-fragmented message, that is, the data message is a complete data message, the data message can be sent from any link, and the problem of disorder does not exist.
The following describes the message forwarding method provided in the present application in detail.
Referring to fig. 2, fig. 2 is a flowchart of a message forwarding method provided in the present application, and the method is applied to a network device, and may include the following steps:
s201, receiving a data message.
In this step, when the client needs to access the server, a data message is generated; and then sends the data message to a server through the network connected with the data message. When the message accessing the server is large, the message is fragmented, and then the fragmented message is sent to the network equipment one by one and forwarded to the server by the network equipment.
It should be noted that the fragmentation operation on the packet may be performed by the client, or may be performed by an intermediate device between the client and the network device, where when the intermediate device is performed, the client sends a complete packet to the intermediate device, and then the intermediate device performs fragmentation operation on the complete packet, and then sends the fragmented packets to the network device in the networking one by one.
S202, analyzing the data message to obtain the message identification and the message indication information of the data message.
The message indication information in this embodiment is used to indicate whether the data message is a fragment message.
In this step, after the network device receives the data packet, the packet identifier and the packet indication information may be analyzed from the data packet, as shown in fig. 3, where fig. 3 shows the packet header information of the data packet, and the packet header information includes the packet identifier and the packet indication information. Specifically, the network device may extract the two contents of the message identifier and the message indication information from the message header information according to the positions of the message identifier and the message indication information in the message header information, respectively.
It should be noted that, when a complete message is divided into multiple fragmented messages, the message identifiers in the respective fragmented messages are the same.
In addition, when the packet is not segmented, the packet also includes transmission related information, i.e., five-tuple information, which generally includes a source IP address, a destination IP address, a source port, a destination port, and a transport layer protocol.
S203, judging whether the data message is a fragment message or not according to the message indication information, and if so, executing the step S204; if the determination result is negative, step S205 is executed.
Optionally, the message indication information includes a fragmentation flag bit and an offset, and on this basis, the network device may determine whether the data packet is a fragmentation packet according to the parsed message indication information by the following method: judging whether the offset in the data message is not a set value; if the offset in the data message is not the set value, determining that the data message is a fragment message; if the deviation of the data message is the set value, judging whether the fragment marking bit of the data message is the set value; and if the fragment marking bit in the data message is the set value, determining that the data message is a non-fragment message.
Specifically, it may be determined whether a value of the offset is equal to the set value, and when the value of the offset is not equal to the set value, the data packet may be determined to be a fragment packet no matter what value the value of the fragment flag bit is. And when the value of the offset is the set value, it needs to be determined whether the value of the fragmentation flag bit of the data packet is also the set value, and when the value is also the set value, it is determined that the data packet is a non-fragmentation packet, that is, the data packet is a complete packet. In practical applications, there is generally no situation where the offset of the data packet takes a value other than the set value but the fragmentation flag bit takes the set value. Based on this, it can be determined whether the data packet is a fragment packet.
Alternatively, the above set value may be, but is not limited to, 0.
Specifically, the message flag bits in the message indication information may be represented by More fragments, and the offset in the message indication information may be represented by Fragment offset. In general, when the Fragment offset in the data message is a value other than 0, it can be determined that the data message is a Fragment message regardless of whether the value of More fragments in the data message is 1 or 0; only when Fragment offset in the data message is 0 and More fragments in the data message are also 0, the data message can be confirmed to be a non-fragmented message. For convenience of understanding, the message header information shown in fig. 3 may be taken as an example for description, and it can be known from fig. 3 that Fragment offset and More fragments are both 0, which indicates that the data message to which the message header information shown in fig. 3 belongs is a non-fragmented message.
S204, performing hash calculation by using the message identifier to determine a first output interface; and the first output interface is used for forwarding the data message.
Specifically, when it is determined that the data packet is a fragmented packet, hash calculation may be performed on the packet identifier, and then a first outgoing interface for forwarding the data packet may be determined based on a hash calculation result; and then, the data message is forwarded by using the determined first output interface. Because the message identifications of all the fragmented messages belonging to a complete message are the same, the first output interfaces determined by performing hash calculation on all the fragmented messages of the complete message are the same, further, it indicates that the paths for forwarding the respective fragmented packets are the same, that is, the links for forwarding the respective fragmented packets are also the same, so that each fragmented message of the complete message can reach the server through the same link, the network device transmits the fragment messages according to the first-in first-out principle when transmitting the fragment messages, so that the server receives each fragment message in sequence, and then, all the received fragment messages are recombined, so that the problem of disorder does not exist, and the disorder problem caused by distributing the fragment messages to different links under the equivalent multipath scene in the prior art does not exist.
Optionally, based on any of the above embodiments, in this embodiment, the network device maintains a hash factor selection table, where the hash factor selection table is used to record a corresponding relationship between a packet type and a hash factor, where the packet type includes a fragmented packet and a non-fragmented packet, where the hash factor corresponding to the fragmented packet is a packet identifier, and the hash factor corresponding to the non-fragmented packet is quintuple information, as shown in reference table 1:
index Type of message Hash factor
1 1 Identification of message
2 0 Quintuple
Based on this, the determination of the first output interface in step S204 may be performed as follows: when the data message is a fragment message, selecting a hash factor corresponding to the fragment message from the data message based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a first hash value; and determining a first output interface corresponding to the first hash value based on the corresponding relation between the hash value and the output interface.
Specifically, a network device generally includes a control plane and a forwarding plane; after the network device receives the data packet, the forwarding plane performs steps S201 to S202, that is, determines whether the data packet is a fragmented packet or a non-fragmented packet, and then the forwarding plane continues to perform steps S203 to S205, that is, forwards the data packet through the determined egress interface (the first egress interface or the second egress interface). The control plane in the network device is mainly responsible for issuing the hash factor selection table to the forwarding plane. Therefore, after the forwarding plane analyzes the message identifier and the message indication information from the data message, five-tuple information can be analyzed for the non-fragmented message, and the analyzed information is recorded. Meanwhile, the forwarding plane can judge whether the data message is a fragment message or not based on the analyzed message indication information, when the data message is judged to be the fragment message, namely the value of the message type is 1, so as to represent the fragment message, then a hash factor selection table issued by the control plane can be inquired, a hash factor corresponding to the message type (value 1) is confirmed, and then the forwarding plane performs hash calculation by using the message identifier, so that a first hash value can be obtained; and finally, the forwarding plane confirms the first output interface corresponding to the first hash value based on the corresponding relation between the hash value and the output interface, and then forwards the data message by using the first output interface, namely forwards the data message by using the link corresponding to the first output interface.
S205, performing hash calculation by utilizing quintuple information of the data message, and determining a second output interface; and the second output interface is used for forwarding the data message.
In this step, when the network device determines that the data packet is a non-fragmented packet based on step S203, the network device may analyze the quintuple information from the packet header information of the data packet, perform hash calculation on the quintuple information, determine a second egress interface for forwarding the data packet based on a hash calculation result, and forward the data packet using a link corresponding to the second egress interface. Therefore, the output interface calculation method of the non-fragmented message and the fragmented message can be distinguished, the load sharing of the non-fragmented message can be ensured, and the message fragmented message can be forwarded according to the same link.
Alternatively, when the network device maintains the hash factor selection table, the network device may perform the step S205 of determining the second output interface according to the following method: when the data message is a non-fragmented message, selecting a hash factor corresponding to the non-fragmented message from the data message based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a second hash value; and determining a second output interface corresponding to the second hash value based on the corresponding relation between the hash value and the output interface.
Specifically, when the forwarding plane judges that the data packet is a non-fragmented packet, that is, the value of the packet type is 0, to represent the non-fragmented packet, then the forwarding plane may query a hash factor selection table issued by the control plane, confirm that the hash factor corresponding to the packet type (value 0) is quintuple information, and then the forwarding plane locally reads the quintuple information parsed from the data packet, and performs hash calculation by using the quintuple information, thereby obtaining a second hash value; and then the forwarding plane confirms a second output interface corresponding to the second hash value based on the corresponding relation between the hash value and the output interface, and then forwards the data message by using the second output interface, namely forwards the data message by using a link corresponding to the second output interface.
Optionally, before executing step S201, the message forwarding method provided in this embodiment further includes: inquiring a forwarding table, and determining an outgoing interface for forwarding the data message; and determining queries to multiple egress interfaces
Specifically, the network device may query a forwarding table by using an IP address of the data packet, and then determine the number of outgoing interfaces recorded in the forwarding table and corresponding to the IP address of the data packet; if the number of the outgoing interfaces is multiple, that is, if multiple outgoing interfaces are found, it indicates that the equal cost multiple path exists, then step S201 is executed, that is, it is determined whether the data packet is a fragment packet according to the packet indication information.
And when the network equipment confirms that the number of the inquired output interfaces is 1, namely when one output interface is inquired, the condition of equal cost and multipath does not exist at the moment, and the inquired output interface is directly utilized to forward the data message.
For better understanding of the message forwarding method provided in any embodiment of the present application, the description may be made with reference to the networking shown in fig. 1, where the router Route1 receives a data message sent by a Client to a Server, the router Route1 queries a forwarding table based on message header information of the data message, and then determines the number of outgoing interfaces matched with the data message; when multiple outgoing interfaces are matched, a scenario that an equal-cost multipath exists from the router Route1 to the Server side is indicated, that is, 2 equal-cost routes exist between the router Route1 and the Server in fig. 1, and these routes are Route 1: route 1-Route 3-Route 4 and Route 2: route 1-Route 2-Route 4, then Route1 parses the packet identifier and the packet indication information from the data packet, and then determines whether the data packet is a Fragment packet according to the packet indication information, for example, when it is known that More fragments in the packet indication information are 1 and Fragment offset is not 0, it can be determined that the data packet is a Fragment packet, then a hash factor selection table can be queried, when the hash factor selection table is queried, a Type of the data packet is 1, then a hash factor matching the Type can be queried as the packet identifier, then Route1 can perform hash calculation by using the packet identifier in the data packet, and then determine a first output interface for forwarding the data packet; for example, if the first outgoing interface corresponds to the Route1, the Route1 may forward the data packet to a link corresponding to the Route1 by using the first outgoing interface, that is, the Route1 forwards the data packet to the Route3, and then reaches the Server through the Route 4; when a data message is subsequently received again, by executing the above-mentioned flow, if the data message is also confirmed to be a fragment message and to belong to the same message as the previous data message, that is, the message identifier in the current data message is the same as the message identifier in the previous data message, it can be confirmed that the output interface matched after hash calculation by using the message identifier is still the first output interface, and accordingly, the link forwarded to the Server is still the link corresponding to the route1, so that the fragment messages of the same message can reach the Server side through the same link, and thus, the problem of disorder does not exist, and the reassembly efficiency of the fragment messages is improved to a certain extent.
In addition, when the Route1 determines that the data packet is a non-fragmented packet, the packet header information of the data packet includes quintuple information, the Route1 may extract the quintuple information from the packet header information, and perform hash calculation using the quintuple information, so as to determine the second egress interface, for example, the Route corresponding to the second egress interface is Route2, and the Route1 may forward the data packet to the link corresponding to the Route2 using the second egress interface, that is, the Route1 forwards the data packet to the Route2, and then the data packet passes through the Route4 and reaches the Server.
Therefore, by implementing the message forwarding method provided by the application, not only can the fragmented messages of the same message be forwarded to the server side through the same link, but also the non-fragmented messages can be distributed to different links in a balanced manner according to the load sharing principle, so as to balance the load on each link and avoid the situation that the load of a certain link is large.
Based on the same inventive concept, the application also provides a message forwarding device corresponding to the message forwarding method. The implementation of the message forwarding apparatus may refer to the above description of the message forwarding method, and is not discussed here one by one.
Referring to fig. 4, fig. 4 is a message forwarding apparatus provided in a network device according to an exemplary embodiment of the present application, where the apparatus includes:
a receiving module 401, configured to receive a data packet;
an analysis module 402, configured to perform analysis processing on the data packet to obtain a packet identifier and packet indication information of the data packet;
a judging module 403, configured to judge whether the data packet is a fragment packet according to the packet indication information;
an interface determining module 404, configured to perform hash calculation by using the packet identifier if the determining module 403 determines that the data packet is a fragmented packet according to the packet indication information, and determine a first output interface; if the determining module 403 determines that the data packet is a non-fragmented packet according to the packet indication information, hash calculation is performed by using quintuple information of the data packet to determine a second output interface
A message forwarding module 405, configured to forward the data message by using the first outgoing interface if the interface determining module 404 determines the first outgoing interface; if the interface determining module 404 determines a second outgoing interface, the data packet is forwarded by using the second outgoing interface.
Optionally, the message indication information provided in this embodiment includes a fragmentation flag bit and an offset; then
The determining module 403 is specifically configured to determine whether the offset in the data packet is not a set value; if the offset in the data message is not the set value, determining that the data message is a fragment message; if the deviation in the data message is the set value, judging whether the fragment marking bit in the data message is the set value; and if the fragment marking bit in the data message is the set value, determining that the data message is a non-fragment message.
Optionally, the network device in this embodiment maintains a hash factor selection table, where the hash factor selection table is used to record a correspondence between a packet type and a hash factor, where the packet type includes a fragmented packet and a non-fragmented packet, where the hash factor corresponding to the fragmented packet is a packet identifier, and the hash factor corresponding to the non-fragmented packet is quintuple information; then
The interface determining module 404 is specifically configured to, when the data packet is a fragment packet, select a hash factor corresponding to the fragment packet from the data packet based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a first hash value; determining a first output interface corresponding to the first hash value based on the corresponding relation between the hash value and the output interface;
the interface determining module 404 is further configured to, when the data packet is a non-fragmented packet, select a hash factor corresponding to the non-fragmented packet from the data packet based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a second hash value; and determining a second output interface corresponding to the second hash value based on the corresponding relation between the hash value and the output interface.
Optionally, the message forwarding method provided in this embodiment further includes:
a query module (not shown in the figure), configured to query a forwarding table, determine an egress interface for forwarding the data packet, and determine to query multiple egress interfaces before the determining module 403 determines whether the data packet is a fragment packet according to the packet indication information.
On this basis, the message forwarding module 405 is further configured to forward the data message by using an outbound interface obtained by the query module (not shown in the figure) when the query module (not shown in the figure) finds an outbound interface.
By providing the message forwarding device, since the message identifiers of the respective fragmented messages belonging to a complete message are the same, therefore, the first output interfaces determined after the hash calculation is performed on each fragmented packet of the complete packet are all the same, further, it indicates that the paths for forwarding the respective fragmented packets are the same, that is, the links for forwarding the respective fragmented packets are also the same, so that each fragmented message of the complete message can reach the server through the same link, the network device transmits the fragment messages according to the first-in first-out principle when transmitting the fragment messages, so that the server receives each fragment message in sequence, and then, all the received fragment messages are recombined, so that the problem of disorder does not exist, and the disorder problem caused by distributing the fragment messages to different links under the equivalent multipath scene in the prior art does not exist.
Based on the same inventive concept, the embodiment of the present application provides an electronic device, which may be the above network device. As shown in fig. 5, the electronic device includes a processor 501 and a machine-readable storage medium 502, where the machine-readable storage medium 502 stores a computer program capable of being executed by the processor 501, and the processor 501 is caused by the computer program to execute the message forwarding method provided in any embodiment of the present application. In addition, the electronic device further comprises a communication interface 503 and a communication bus 504, wherein the processor 501, the communication interface 503 and the machine-readable storage medium 502 are communicated with each other through the communication bus 504.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM), a DDR SRAM (Double Data Rate Dynamic Random Access Memory), and a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In addition, the embodiment of the present application provides a machine-readable storage medium, which stores a computer program, and when the computer program is called and executed by a processor, the computer program causes the processor to execute the message forwarding method provided by the embodiment of the present application.
For the embodiments of the electronic device and the machine-readable storage medium, since the contents of the related methods are substantially similar to those of the foregoing embodiments of the methods, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the methods.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The implementation process of the functions and actions of each unit/module in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the units/modules described as separate parts may or may not be physically separate, and the parts displayed as units/modules may or may not be physical units/modules, may be located in one place, or may be distributed on a plurality of network units/modules. Some or all of the units/modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A message forwarding method is applied to a network device, and the method comprises the following steps:
receiving a data message;
analyzing the data message to obtain a message identifier and message indication information of the data message;
judging whether the data message is a fragment message or not according to the message indication information;
if the data message is confirmed to be a fragment message according to the message indication information, performing hash calculation by using the message identification to determine a first output interface; forwarding the data message by using the first output interface;
if the data message is determined to be a non-fragmented message according to the message indication information, performing hash calculation by using quintuple information of the data message to determine a second output interface; and forwarding the data message by using the second output interface.
2. The method of claim 1, wherein the packet indication information comprises a fragmentation flag bit and an offset;
judging whether the data message is a fragment message according to the message indication information, including:
judging whether the offset in the data message is not a set value;
if the offset in the data message is not the set value, determining that the data message is a fragment message;
if the deviation in the data message is the set value, judging whether the fragment marking bit in the data message is the set value;
and if the fragment marking bit in the data message is the set value, determining that the data message is a non-fragment message.
3. The method according to claim 1, wherein the network device maintains a hash factor selection table, the hash factor selection table is used for recording a correspondence between packet types and hash factors, the packet types include a fragmented packet and a non-fragmented packet, wherein the hash factor corresponding to the fragmented packet is a packet identifier, and the hash factor corresponding to the non-fragmented packet is quintuple information;
performing hash calculation by using the packet identifier to determine a first output interface, including:
when the data message is a fragment message, selecting a hash factor corresponding to the fragment message from the data message based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a first hash value; determining a first output interface corresponding to the first hash value based on the corresponding relation between the hash value and the output interface;
performing hash calculation by using quintuple information of the data packet to determine a second output interface, including:
when the data message is a non-fragmented message, selecting a hash factor corresponding to the non-fragmented message from the data message based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a second hash value; and determining a second output interface corresponding to the second hash value based on the corresponding relation between the hash value and the output interface.
4. The method according to claim 1, before determining whether the data packet is a fragmented packet according to the packet indication information, further comprising:
inquiring a forwarding table, and determining an output interface for forwarding the data message; and are
Queries to a plurality of egress interfaces are determined.
5. The method of claim 4, further comprising:
and when one output interface is inquired, forwarding the data message by using the inquired output interface.
6. A message forwarding apparatus, configured in a network device, the apparatus comprising:
the receiving module is used for receiving the data message;
the analysis module is used for analyzing and processing the data message to obtain a message identifier and message indication information of the data message;
the judging module is used for judging whether the data message is a fragment message according to the message indication information;
the interface determining module is used for performing hash calculation by using the message identifier to determine a first output interface if the judging module confirms that the data message is a fragment message according to the message indication information; if the judging module confirms that the data message is a non-fragmented message according to the message indication information, the five-tuple information of the data message is utilized to carry out Hash calculation to determine a second output interface
The message forwarding module is used for forwarding the data message by using the first output interface if the interface determining module determines the first output interface; and if the interface determining module determines a second output interface, forwarding the data message by using the second output interface.
7. The apparatus according to claim 6, wherein the packet indication information comprises a fragmentation flag bit and an offset;
the judging module is specifically configured to judge whether the offset in the data packet is not a set value; if the offset in the data message is not the set value, determining that the data message is a fragment message; if the deviation in the data message is the set value, judging whether the fragment marking bit in the data message is the set value; and if the fragment marking bit in the data message is the set value, determining that the data message is a non-fragment message.
8. The apparatus according to claim 7, wherein the network device maintains a hash factor selection table, and the hash factor selection table is used to record a correspondence between packet types and hash factors, and the packet types include a fragmented packet and a non-fragmented packet, where the hash factor corresponding to the fragmented packet is a packet identifier and the hash factor corresponding to the non-fragmented packet is quintuple information; then
The interface determining module is specifically configured to, when the data packet is a fragmented packet, select a hash factor corresponding to the fragmented packet from the data packet based on the hash factor selection table; performing hash calculation by using the selected hash factor to obtain a first hash value; determining a first output interface corresponding to the first hash value based on the corresponding relation between the hash value and the output interface;
the interface determining module is further configured to select a hash factor corresponding to a non-fragmented packet from the data packet based on the hash factor selection table when the data packet is the non-fragmented packet; performing hash calculation by using the selected hash factor to obtain a second hash value; and determining a second output interface corresponding to the second hash value based on the corresponding relation between the hash value and the output interface.
9. The apparatus of claim 6, further comprising:
and the query module is used for querying a forwarding table, determining an output interface for forwarding the data message and determining to query a plurality of output interfaces before the judgment module judges whether the data message is a fragment message according to the message indication information.
10. The apparatus of claim 9,
and the message forwarding module is further configured to forward the data message by using the queried output interface when the query module queries one output interface.
CN202110569218.9A 2021-05-25 2021-05-25 Message forwarding method and device Active CN113542131B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110569218.9A CN113542131B (en) 2021-05-25 2021-05-25 Message forwarding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110569218.9A CN113542131B (en) 2021-05-25 2021-05-25 Message forwarding method and device

Publications (2)

Publication Number Publication Date
CN113542131A true CN113542131A (en) 2021-10-22
CN113542131B CN113542131B (en) 2023-08-22

Family

ID=78094740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110569218.9A Active CN113542131B (en) 2021-05-25 2021-05-25 Message forwarding method and device

Country Status (1)

Country Link
CN (1) CN113542131B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040235480A1 (en) * 2003-05-02 2004-11-25 Alcatel Equivalent multiple path traffic distribution in communications networks
CN101119313A (en) * 2007-09-14 2008-02-06 杭州华三通信技术有限公司 Load sharing method and equipment
CN101656677A (en) * 2009-09-18 2010-02-24 杭州迪普科技有限公司 Message diversion processing method and device
CN102223305A (en) * 2011-06-17 2011-10-19 华为数字技术有限公司 Methods, devices and systems for transmitting and receiving data
US8644339B1 (en) * 2011-12-01 2014-02-04 Juniper Networks, Inc. In-line packet reassembly within a mobile gateway
CN104168201A (en) * 2014-08-06 2014-11-26 福建星网锐捷网络有限公司 Multipath forwarding method and device
CN104836741A (en) * 2015-04-15 2015-08-12 国家计算机网络与信息安全管理中心 Method and processing board for processing fragmented messages in network message diverting equipment
CN106411783A (en) * 2016-09-30 2017-02-15 杭州华三通信技术有限公司 Message sending method and device
CN106559324A (en) * 2015-09-24 2017-04-05 华为技术有限公司 A kind of method E-Packeted based on equal cost multipath and the network equipment
WO2017198108A1 (en) * 2016-05-19 2017-11-23 中兴通讯股份有限公司 Method and device for processing fragment messages
WO2018121535A1 (en) * 2016-12-30 2018-07-05 华为技术有限公司 Load balance processing method and apparatus
CN108574632A (en) * 2017-03-10 2018-09-25 华为技术有限公司 A kind of message processing method, apparatus and system
CN109067935A (en) * 2018-08-16 2018-12-21 深圳市风云实业有限公司 Packet message processing method and multi-core processor system
CN112311692A (en) * 2019-07-31 2021-02-02 华为技术有限公司 Message processing method and device and end equipment
US20210119925A1 (en) * 2019-10-17 2021-04-22 Cisco Technology, Inc. Accurate analytics, quality of service and load balancing for internet protocol fragmented packets in data center fabrics

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040235480A1 (en) * 2003-05-02 2004-11-25 Alcatel Equivalent multiple path traffic distribution in communications networks
CN101119313A (en) * 2007-09-14 2008-02-06 杭州华三通信技术有限公司 Load sharing method and equipment
CN101656677A (en) * 2009-09-18 2010-02-24 杭州迪普科技有限公司 Message diversion processing method and device
CN102223305A (en) * 2011-06-17 2011-10-19 华为数字技术有限公司 Methods, devices and systems for transmitting and receiving data
US8644339B1 (en) * 2011-12-01 2014-02-04 Juniper Networks, Inc. In-line packet reassembly within a mobile gateway
CN104168201A (en) * 2014-08-06 2014-11-26 福建星网锐捷网络有限公司 Multipath forwarding method and device
CN104836741A (en) * 2015-04-15 2015-08-12 国家计算机网络与信息安全管理中心 Method and processing board for processing fragmented messages in network message diverting equipment
CN106559324A (en) * 2015-09-24 2017-04-05 华为技术有限公司 A kind of method E-Packeted based on equal cost multipath and the network equipment
WO2017198108A1 (en) * 2016-05-19 2017-11-23 中兴通讯股份有限公司 Method and device for processing fragment messages
CN106411783A (en) * 2016-09-30 2017-02-15 杭州华三通信技术有限公司 Message sending method and device
WO2018121535A1 (en) * 2016-12-30 2018-07-05 华为技术有限公司 Load balance processing method and apparatus
CN108270687A (en) * 2016-12-30 2018-07-10 华为技术有限公司 A kind of load balance process method and device
CN108574632A (en) * 2017-03-10 2018-09-25 华为技术有限公司 A kind of message processing method, apparatus and system
CN109067935A (en) * 2018-08-16 2018-12-21 深圳市风云实业有限公司 Packet message processing method and multi-core processor system
CN112311692A (en) * 2019-07-31 2021-02-02 华为技术有限公司 Message processing method and device and end equipment
US20210119925A1 (en) * 2019-10-17 2021-04-22 Cisco Technology, Inc. Accurate analytics, quality of service and load balancing for internet protocol fragmented packets in data center fabrics

Also Published As

Publication number Publication date
CN113542131B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
US20220078114A1 (en) Method and Apparatus for Providing Service for Traffic Flow
US7852774B2 (en) User datagram protocol traceroute probe extension
US8218539B2 (en) Flexible packet field processor
US8824466B2 (en) Creating and/or managing meta-data for data storage devices using a packet switch appliance
US8229705B1 (en) Performance monitoring in computer networks
US20050129012A1 (en) Switch capable of controlling data packet transmission and related method
US7751319B2 (en) Method and processor for classifying data packet units
CN108307434A (en) Method for flow control and equipment
US9350631B2 (en) Identifying flows causing undesirable network events
US8854961B1 (en) Integrated circuit for network stress testing
WO2018036100A1 (en) Data message forwarding method and apparatus
EP3657742A1 (en) Method and apparatus for processing modified packet
TWI721103B (en) Cluster accurate speed limiting method and device
US10771363B2 (en) Devices for analyzing and mitigating dropped packets
US11700202B2 (en) Port extender with local switching
CN111726299B (en) Flow balancing method and device
US7110404B1 (en) System and method for sending a packet to multiple destinations using a pipeline network processor
US7864776B2 (en) Method and equipment for making a routing decision dependent on a quality-of-service class
US20220294712A1 (en) Using fields in an encapsulation header to track a sampled packet as it traverses a network
US20160248652A1 (en) System and method for classifying and managing applications over compressed or encrypted traffic
CN111711555B (en) Message processing method and device
CN110784378B (en) Method and device for realizing accurate flow balance by using TWAMP (two way operational amplifier)
CN116095197B (en) Data transmission method and related device
CN113542131A (en) Message forwarding method and device
CN115567436A (en) Multicast message processing method, system, computer equipment and readable storage medium

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
GR01 Patent grant
GR01 Patent grant