CN113489659A - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN113489659A
CN113489659A CN202110735051.9A CN202110735051A CN113489659A CN 113489659 A CN113489659 A CN 113489659A CN 202110735051 A CN202110735051 A CN 202110735051A CN 113489659 A CN113489659 A CN 113489659A
Authority
CN
China
Prior art keywords
message
hash operation
forwarded
operation result
hash
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
CN202110735051.9A
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 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 CN202110735051.9A priority Critical patent/CN113489659A/en
Publication of CN113489659A publication Critical patent/CN113489659A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/30Peripheral units, e.g. input or output ports
    • 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
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/33Flow control; Congestion control using forward notification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a message processing method and a device, wherein the method comprises the following steps: acquiring triple information of a message to be forwarded, and performing a first hash operation based on the triple information to obtain a first hash operation result; acquiring port number information of a message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result; determining the message type of a message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, determining a first forwarding link based on a first hash operation result; and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result. The hash path consistency of the fragmented message can be guaranteed on the premise of higher utilization rate of the bandwidth of the switch.

Description

Message processing method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for processing a packet.
Background
The hash is usually transliterated as a hash, and can also be translated as a hash, that is, an input of a fixed or arbitrary length is converted into an output of a fixed length by a hash algorithm, and the output is a hash value.
In the field of data communication, network devices generally support a hash algorithm, and can use the hash algorithm to realize load sharing of data packets.
The specific process is as follows: when multiple forwarding links exist, the switch chip acquires a quintuple of the message as a hash key, namely a hash key, wherein the quintuple comprises a source ip address source ip, a destination ip address destination ip, a protocol number ip protocol, a source port number l4src port of a layer l4 and a destination port number l4 destination port of a layer l4, hash operation is performed according to the quintuple, and the link from which the message is forwarded is determined according to an operation result. Therefore, different messages are approximately evenly distributed to each link for forwarding, so that the purposes of fully utilizing the links and improving the forwarding efficiency are achieved.
When the message data volume is large, the message needs to be fragmented. For tcp (Transmission Control Protocol) or udp (User Datagram Protocol) fragment messages, the first fragment message contains a tcp/udp header, the subsequent fragments do not contain a tcp/udp header, and a data portion directly follows the ip header.
The current mainstream switch chip does not relate to the judgment of whether the message is fragmented in the hash operation logic, and for the fragmented non-first message, because the position of the port number of the four layers is actually a data field, if a quintuple is selected as a hash key, the data field is mistakenly used as a port l4 to participate in the calculation of the hash value, so that a plurality of fragmented messages of the same message are forwarded through different links and reach different servers, and the normal packet cannot be packed, thereby influencing the service operation of the servers.
Therefore, the hash key can only be set as the triples source ip, destination ip, and ip protocol of the packet, but the load sharing of the packet is not uniform enough, which results in the waste of the bandwidth of the switch.
Disclosure of Invention
An object of the embodiments of the present application is to provide a packet processing method and apparatus, so as to implement hash calculation using a quintuple for a non-fragmented packet, and hash calculation using a triplet for a fragmented packet, and ensure hash path consistency of the fragmented packet on the premise of a higher utilization rate of a switch bandwidth.
In order to achieve the above object, an embodiment of the present application provides a message processing method, which is applied to a switch, and the method includes:
obtaining triple information of a message to be forwarded, wherein the triple information comprises: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
acquiring the port number information of the message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
determining the message type of the message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message;
if the message to be forwarded is a fragmented message, determining a first forwarding link based on the first hash operation result;
and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
Optionally, the second hash operation is a consistent hash operation.
Optionally, the step of determining the packet type of the packet to be forwarded includes:
and performing Access Control List (ACL) matching on the message to be forwarded, wherein the ACL comprises a matching item aiming at a message fragment identifier, and determining the message type of the message to be forwarded according to the matching item matched with the message to be forwarded.
Optionally, the switch is preconfigured with a non-consistent hashing algorithm and a consistent hashing algorithm.
In order to achieve the above object, an embodiment of the present application further provides a packet processing apparatus, which is applied to a switch, and the apparatus includes:
a first obtaining module, configured to obtain triple information of a packet to be forwarded, where the triple information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
a second obtaining module, configured to obtain port number information of the packet to be forwarded, where the port number information includes: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
the fragment determining module is used for determining the message type of the message to be forwarded, wherein the message type comprises a fragment message and a non-fragment message;
a first link determining module, configured to determine a first forwarding link based on the first hash operation result if the packet to be forwarded is a fragmented packet;
and the second link determining module is used for performing third hash operation on the basis of the first hash operation result and the second hash operation result to obtain a third hash operation result if the message to be forwarded is a non-fragmentation message, and determining a second forwarding link on the basis of the third hash operation result.
Optionally, the second hash operation is a consistent hash operation.
Optionally, the fragment determining module is specifically configured to:
and performing Access Control List (ACL) matching on the message to be forwarded, wherein the ACL comprises a matching item aiming at a message fragment identifier, and determining the message type of the message to be forwarded according to the matching item matched with the message to be forwarded.
Optionally, the switch is preconfigured with a non-consistent hashing algorithm and a consistent hashing algorithm.
In order to achieve the above object, an embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any method step when executing the program stored in the memory.
To achieve the above object, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements any of the above method steps.
The embodiment of the application has the following beneficial effects:
the method and the device for processing the message, provided by the embodiment of the application, acquire triple information of the message to be forwarded, wherein the triple information comprises: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result; acquiring port number information of a message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result; determining the message type of a message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, determining a first forwarding link based on a first hash operation result; and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
It can be seen that, with the aid of two hash operation functions supported by the switch, the hash key of the first hash operation is configured as a packet triplet, the hash key of the second hash operation is configured as a packet port number, different hash operation results are selected for a fragmented packet and a non-fragmented packet, and the hash key actually effective for the non-fragmented packet is a packet quintet, so that load sharing of the non-fragmented packet is sufficiently uniform, and a higher utilization rate of the switch bandwidth is realized. The hash key actually effective in the fragmented message is a message triple, so that the hash paths of all the fragmented messages in the complete message are consistent, and the condition that the fragmented messages cannot be packaged is avoided.
Therefore, the existing mechanism of the switch can ensure the Hash path consistency of the fragmented messages on the premise of higher utilization rate of the bandwidth of the switch. The switch chip function does not need to be re-developed.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and it is also obvious for a person skilled in the art to obtain other embodiments according to the drawings.
Fig. 1 is a schematic diagram of a first fragment of a fragmented message and a non-first fragment of the fragmented message;
fig. 2 is a schematic flowchart of a message processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the description herein are intended to be within the scope of the present disclosure.
In order to solve the technical problems that in the prior art, a switch configures a quintuple for hash operation to cause abnormal packet packing of fragmented messages, and configures a triplet for hash operation to cause uneven load sharing of the messages, the embodiment of the present application provides a message processing method and device.
In the field of data communication, network devices generally support a hash algorithm, and can use the hash algorithm to realize load sharing of data packets.
The specific process is as follows: when multiple forwarding links exist, the switch chip firstly acquires a quintuple of the message as a Hash key, wherein the quintuple comprises a source ip address source ip, a destination ip address destination ip, a protocol number ip protocol, a source port number l4src port of a layer l4 and a destination port number l4 destination port of a layer l4, Hash operation is carried out according to the quintuple, and the message is forwarded from which link is determined according to an operation result. Therefore, different messages are approximately evenly distributed to each link for forwarding, so that the purposes of fully utilizing the links and improving the forwarding efficiency are achieved.
The process of the switch chip for acquiring the quintuple of the message is as follows: and shifting 9 bytes from the ip header, taking the ip protocol field, taking 4 bytes from the ip header message shift 12 bytes to the source ip, and taking 4 bytes from the shift 16 bytes to the destination ip. Shifting 0byte from l4 head, taking 2 bytes to l4 source port, shifting 2 bytes from l4 head, taking 2 bytes to l4 destination port, thus all quintuple is taken.
When the message data volume is large, the message needs to be fragmented. For tcp (Transmission Control Protocol) or udp (User Datagram Protocol) fragment messages, the first fragment of a fragment message contains a tcp/udp header, the subsequent fragments do not contain a tcp/udp header, and a data portion directly follows the ip header.
Referring to fig. 1, fig. 1 is a schematic diagram of a first fragment of a fragmented message and a non-first fragment of the fragmented message, as shown in fig. 1, the first fragment of the fragmented message includes a tcp/udp header, and for the non-first fragment of the fragmented message, a data portion directly follows the ip header.
Therefore, if the switch uniformly configures a packet quintuple as a hash key, for a fragment packet which is not the first fragment, the data field is mistakenly used as the port l4 to participate in calculating the hash value, so that hash paths of a plurality of fragment packets of the same packet are inconsistent, that is, the plurality of fragment packets are forwarded through different links and reach different servers, and normal packet packing cannot be performed, thereby affecting the service operation of the servers.
In order to avoid the above situation, in the related art, a triplet of a packet is set as a hash key, but l4 port information is lacked, which may cause that the hash of the packet is not uniform enough, that is, the load sharing of the packet is not uniform enough, resulting in the waste of bandwidth of the switch.
The following describes a message processing method and apparatus provided in this embodiment in detail.
Referring to fig. 2, fig. 2 is a schematic flowchart of a message processing method according to an embodiment of the present disclosure. As shown in fig. 2, the method may comprise the steps of:
s201: obtaining triple information of a message to be forwarded, wherein the triple information comprises: and performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result.
S202: acquiring port number information of a message to be forwarded, wherein the port number information comprises: and carrying out second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result.
The message processing method provided by the embodiment of the application can be applied to the switch.
In the embodiment of the present application, the first hash operation is a non-uniform hash operation, which can be understood as a normal hash operation and is a default hash operation configured in advance in the switch chip.
Besides, besides the ordinary hash operation, the switch also supports a coherent hash function, namely, a consistent hash operation function, which functions as: ensuring that a hash path of the packet remains unchanged under the condition that the next hop of the ecmp (Equal Cost Multi-path, Equal Cost Multi-path route) is increased or decreased, wherein the hash path can be understood as a packet forwarding link determined based on a hash result.
The specific way in which the switch implements the consistent hash operation function can be seen in the related art.
The consistency hash operation function is not started by default, the hash key used by the consistency hash operation function and the hash key used by the common hash function can be completely and independently started, and the calculated hash value is also independent.
Based on the above characteristics, in the embodiment of the present application, a new packet hash processing flow is implemented by using a consistent hash operation function supported by the switch in combination with a normal hash operation function.
Specifically, a common algorithm and a consistent hash algorithm, namely a non-consistent hash algorithm, are pre-configured in the switch chip. In the embodiment of the application, on the basis of the common hash process, the consistent hash process of the switch chip is additionally started, and the hash key of the common hash process and the hash key of the consistent hash process are respectively configured.
In the embodiment of the application, a hash key of a common hash process is set as a message triple, namely a source ip address, a destination ip address and a protocol number; and setting the hash key of the consistent hash flow as the port number of the message, namely the port number l4 source port and the port number l4 destination port.
After the switch chip obtains the message to be forwarded, the switch chip executes a common hash process and a consistent hash process based on the respective hash keys.
Wherein, the common hash process is:
obtaining triple information of a message to be forwarded, wherein the triple information comprises: and performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result.
Specifically, 9 bytes are shifted from the ip header, a protocol number ip protocol field is obtained, 4 bytes are taken from the ip header message shift 12 bytes to a source ip address source ip, and 4 bytes are taken from the 16 bytes to a destination ip address destination ip.
When the first hash operation is performed, a common hash algorithm configured in advance in the switch chip may be used to obtain a first hash operation result.
The consistent hash process is as follows:
acquiring port number information of a message to be forwarded, wherein the port number information comprises: and carrying out second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result.
Specifically, 0byte is shifted from the l4 header, 2 bytes are fetched to the l4 source port, and 2 bytes are fetched to the l4 destination port from the l4 header.
When the second hash operation is performed, a preconfigured consistent hash algorithm may be used to obtain a second hash operation result.
S203: determining the message type of a message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, executing S204; if the message to be forwarded is a non-fragmented message, S205 is executed.
S204: determining a first forwarding link based on the first hash operation result;
s205: and performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
In the embodiment of the application, the message type can be determined by matching the ACL, and then the hash value which is finally effective, namely the hash result, is selected.
The ACL contains matching items for the message fragment identifiers, and can determine the message type of the message to be forwarded according to the matching items matched with the message to be forwarded and execute corresponding action items.
As an example, if the packet is a non-fragmented packet, the fragmentation flag DF in the packet is 1, otherwise it is 0. Then a match for the fragment flag is configured in the ACL: DF is 1 and DF is 0. And when the message to be forwarded is successfully matched with the DF (1), the message to be forwarded is represented as a non-fragment message, and a corresponding action item is executed.
Specifically, the action items for the non-fragmented messages may be: and performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
When the third hash operation is performed, the third hash operation may be based on a normal hash algorithm or a consistent hash algorithm.
That is, the first hash operation result and the second hash operation result are used as the input of the hash algorithm together, and the hash operation is performed again to obtain the third hash operation result. For example, the first hash operation result and the second hash operation result are concatenated and used as the input of the hash algorithm, and the third hash operation result is obtained through the hash operation.
Therefore, for the third hash operation result, the hash key actually validated includes the triplet information and the port number information, i.e., the quintet information. That is, the third hash operation result is substantially a quintuple operation result.
Those skilled in the art can understand that, in the packet load sharing process, the hash operation result can directly determine the forwarding link of the packet. As an example, a remainder operation is performed on the hash value obtained as a result of the hash operation and the number of links, and a forwarding link of the packet is determined according to a result of the remainder operation.
Although the third hash operation result may be different from the result obtained by directly performing the hash operation using the quintuple, in the embodiment of the present application, for the non-fragmented packet, the third hash operation is performed based on the first hash operation result and the second hash operation result, and the hash operation is not directly performed using the quintuple. The packet forwarding link determined based on the third hash operation result may be different from the packet forwarding link determined based on the hash result obtained by directly performing the hash operation using the quintuple, but the packet forwarding link determined based on the third hash operation result may also complete load sharing of the packet without affecting the effect of the packet load sharing.
Therefore, for the non-fragmented packet, the third hash operation result is finally obtained, and for the third hash operation result, the hash key which actually takes effect is the packet quintuple, so that the packet hash is ensured to be uniform, that is, the load sharing of the packet is sufficiently uniform, and the higher utilization rate of the switch bandwidth is realized.
The action items for the fragment packet may be: a first forwarding link is determined based on the first hash operation result.
That is to say, for the fragmented packets, the hash key that actually takes effect is a packet triple including the source ip address, the destination ip address, and the protocol number, that is, the packet header of l4 layer is not selected as the hash key, so that the situation that the data bit is mistaken as the port number does not occur.
By applying the message processing method provided by the embodiment of the application, the triple information of the message to be forwarded is acquired, and the triple information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result; acquiring port number information of a message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result; determining the message type of a message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, determining a first forwarding link based on a first hash operation result; and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
It can be seen that, with the aid of two hash operation functions supported by the switch, the hash key of the first hash operation is configured as a packet triplet, the hash key of the second hash operation is configured as a packet port number, different hash operation results are selected for a fragmented packet and a non-fragmented packet, and the hash key actually effective for the non-fragmented packet is a packet quintet, so that load sharing of the non-fragmented packet is sufficiently uniform, and a higher utilization rate of the switch bandwidth is realized. The hash key actually effective in the fragmented message is a message triple, so that the hash paths of all the fragmented messages in the complete message are consistent, and the condition that the fragmented messages cannot be packaged is avoided.
Therefore, the existing mechanism of the switch can ensure the Hash path consistency of the fragmented messages on the premise of higher utilization rate of the bandwidth of the switch. The switch chip function does not need to be re-developed.
Corresponding to the message processing method provided in the embodiment of the present application, an embodiment of the present application further provides a message processing apparatus, referring to fig. 3, where fig. 3 is a schematic structural diagram of the message processing apparatus provided in the embodiment of the present application, and the message processing apparatus includes the following modules:
a first obtaining module 301, configured to obtain triple information of a packet to be forwarded, where the triple information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
a second obtaining module 302, configured to obtain port number information of the packet to be forwarded, where the port number information includes: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
a fragmentation determining module 303, configured to determine a message type of the to-be-forwarded message, where the message type includes a fragmentation message and a non-fragmentation message;
a first link determining module 304, configured to determine a first forwarding link based on the first hash operation result if the packet to be forwarded is a fragmented packet;
a second link determining module 305, configured to perform a third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result if the packet to be forwarded is a non-fragmented packet, and determine a second forwarding link based on the third hash operation result.
In an embodiment of the present application, the second hash operation is a consistent hash operation.
In an embodiment of the present application, the fragment determining module is specifically configured to:
and performing Access Control List (ACL) matching on the message to be forwarded, wherein the ACL comprises a matching item aiming at a message fragment identifier, and determining the message type of the message to be forwarded according to the matching item matched with the message to be forwarded.
In an embodiment of the present application, the switch is preconfigured with a non-consistent hashing algorithm and a consistent hashing algorithm.
By applying the message processing device provided by the embodiment of the application, the triple information of the message to be forwarded is acquired, and the triple information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result; acquiring the port number information of the message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result; determining the message type of the message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, determining a first forwarding link based on the first hash operation result; and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
It can be seen that, with the aid of two hash operation functions supported by the switch, the hash key of the first hash operation is configured as a packet triplet, the hash key of the second hash operation is configured as a packet port number, different hash operation results are selected for a fragmented packet and a non-fragmented packet, and the hash key actually effective for the non-fragmented packet is a packet quintet, so that load sharing of the non-fragmented packet is sufficiently uniform, and a higher utilization rate of the switch bandwidth is realized. The hash key actually effective in the fragmented message is a message triple, so that the hash paths of all the fragmented messages in the complete message are consistent, and the condition that the fragmented messages cannot be packaged is avoided.
Therefore, the existing mechanism of the switch can ensure the Hash path consistency of the fragmented messages on the premise of higher utilization rate of the bandwidth of the switch. The switch chip function does not need to be re-developed.
The method and the device are based on the same application concept, and because the principles of solving the problems of the method and the device are similar, the implementation of the device and the method can be mutually referred, and repeated parts are not repeated.
The embodiment of the present application further provides an electronic device, as shown in fig. 4, which includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
obtaining triple information of a message to be forwarded, wherein the triple information comprises: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
acquiring the port number information of the message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
determining the message type of the message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message;
if the message to be forwarded is a fragmented message, determining a first forwarding link based on the first hash operation result;
and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
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) or 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.
By applying the electronic device provided by the embodiment of the application, the triplet information of the message to be forwarded is acquired, and the triplet information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result; acquiring the port number information of the message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result; determining the message type of the message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message; if the message to be forwarded is a fragmented message, determining a first forwarding link based on the first hash operation result; and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
It can be seen that, with the aid of two hash operation functions supported by the switch, the hash key of the first hash operation is configured as a packet triplet, the hash key of the second hash operation is configured as a packet port number, different hash operation results are selected for a fragmented packet and a non-fragmented packet, and the hash key actually effective for the non-fragmented packet is a packet quintet, so that load sharing of the non-fragmented packet is sufficiently uniform, and a higher utilization rate of the switch bandwidth is realized. The hash key actually effective in the fragmented message is a message triple, so that the hash paths of all the fragmented messages in the complete message are consistent, and the condition that the fragmented messages cannot be packaged is avoided.
Therefore, the existing mechanism of the switch can ensure the Hash path consistency of the fragmented messages on the premise of higher utilization rate of the bandwidth of the switch. The switch chip function does not need to be re-developed.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the message processing methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
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.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the message processing apparatus, the electronic device, and the computer-readable storage medium, since they are substantially similar to the embodiments of the message processing method, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the message processing method.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (10)

1. A message processing method is applied to a switch, and the method comprises the following steps:
obtaining triple information of a message to be forwarded, wherein the triple information comprises: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
acquiring the port number information of the message to be forwarded, wherein the port number information comprises: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
determining the message type of the message to be forwarded, wherein the message type comprises a fragmented message and a non-fragmented message;
if the message to be forwarded is a fragmented message, determining a first forwarding link based on the first hash operation result;
and if the message to be forwarded is a non-fragmentation message, performing third hash operation based on the first hash operation result and the second hash operation result to obtain a third hash operation result, and determining a second forwarding link based on the third hash operation result.
2. The method of claim 1, wherein the second hash operation is a consistent hash operation.
3. The method according to claim 1, wherein the step of determining the packet type of the packet to be forwarded comprises:
and performing Access Control List (ACL) matching on the message to be forwarded, wherein the ACL comprises a matching item aiming at a message fragment identifier, and determining the message type of the message to be forwarded according to the matching item matched with the message to be forwarded.
4. The method of claim 1, wherein the switch is preconfigured with a non-consistent hashing algorithm and a consistent hashing algorithm.
5. A message processing apparatus, applied to a switch, the apparatus comprising:
a first obtaining module, configured to obtain triple information of a packet to be forwarded, where the triple information includes: performing a first hash operation on the source ip address, the destination ip address and the protocol number based on the triple information to obtain a first hash operation result;
a second obtaining module, configured to obtain port number information of the packet to be forwarded, where the port number information includes: performing a second hash operation on the source port number and the destination port number based on the port number information to obtain a second hash operation result;
the fragment determining module is used for determining the message type of the message to be forwarded, wherein the message type comprises a fragment message and a non-fragment message;
a first link determining module, configured to determine a first forwarding link based on the first hash operation result if the packet to be forwarded is a fragmented packet;
and the second link determining module is used for performing third hash operation on the basis of the first hash operation result and the second hash operation result to obtain a third hash operation result if the message to be forwarded is a non-fragmentation message, and determining a second forwarding link on the basis of the third hash operation result.
6. The apparatus of claim 5, wherein the second hash operation is a consistent hash operation.
7. The apparatus according to claim 5, wherein the fragmentation determination module is specifically configured to:
and performing Access Control List (ACL) matching on the message to be forwarded, wherein the ACL comprises a matching item aiming at a message fragment identifier, and determining the message type of the message to be forwarded according to the matching item matched with the message to be forwarded.
8. The apparatus of claim 5, wherein the switch is preconfigured with a non-consistent hashing algorithm and a consistent hashing algorithm.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
CN202110735051.9A 2021-06-30 2021-06-30 Message processing method and device Pending CN113489659A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110735051.9A CN113489659A (en) 2021-06-30 2021-06-30 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110735051.9A CN113489659A (en) 2021-06-30 2021-06-30 Message processing method and device

Publications (1)

Publication Number Publication Date
CN113489659A true CN113489659A (en) 2021-10-08

Family

ID=77936630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110735051.9A Pending CN113489659A (en) 2021-06-30 2021-06-30 Message processing method and device

Country Status (1)

Country Link
CN (1) CN113489659A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113946313A (en) * 2021-10-12 2022-01-18 哲库科技(北京)有限公司 Processing circuit, chip and terminal of LOOKUP3 hash algorithm

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009103225A1 (en) * 2008-02-18 2009-08-27 华为技术有限公司 A packet forwarding method and equipment
CN101656677A (en) * 2009-09-18 2010-02-24 杭州迪普科技有限公司 Message diversion processing method and device
CN104365067A (en) * 2012-06-15 2015-02-18 思杰系统有限公司 Systems and methods for reassembly of packets distributed across a cluster
CN104486226A (en) * 2014-12-23 2015-04-01 北京天融信科技有限公司 Message processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009103225A1 (en) * 2008-02-18 2009-08-27 华为技术有限公司 A packet forwarding method and equipment
CN101656677A (en) * 2009-09-18 2010-02-24 杭州迪普科技有限公司 Message diversion processing method and device
CN104365067A (en) * 2012-06-15 2015-02-18 思杰系统有限公司 Systems and methods for reassembly of packets distributed across a cluster
CN104486226A (en) * 2014-12-23 2015-04-01 北京天融信科技有限公司 Message processing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113946313A (en) * 2021-10-12 2022-01-18 哲库科技(北京)有限公司 Processing circuit, chip and terminal of LOOKUP3 hash algorithm

Similar Documents

Publication Publication Date Title
US10375193B2 (en) Source IP address transparency systems and methods
US9742659B2 (en) Multipath bandwidth usage
CN106878194B (en) Message processing method and device
CN113452594B (en) Inner layer message matching method and device of tunnel message
CN110430135B (en) Message processing method and device
US9135833B2 (en) Process for selecting compressed key bits for collision resolution in hash lookup table
US20220029917A1 (en) Executing workloads across multiple cloud service providers
CN106797384B (en) Routing requests to the same endpoint in a cluster in different protocols
CN109067657B (en) Message processing method and device
CN113489659A (en) Message processing method and device
US9667540B2 (en) Fiber channel over ethernet (FCoE) frame forwarding system
US10229459B1 (en) Method and apparatus for routing in transaction management systems
CN111245858A (en) Network flow interception method, system, device, computer equipment and storage medium
CN110620729A (en) Message forwarding method and device and message forwarding equipment
CN113347084B (en) Message forwarding method and device
US10917502B2 (en) Method for using metadata in internet protocol packets
WO2024114138A1 (en) Message transmission method, electronic device, and storage medium
US11637812B2 (en) Dynamic forward proxy chaining
CN116600031B (en) Message processing method, device, equipment and storage medium
CN111865713B (en) Throughput testing method and device, storage medium and electronic equipment
CN113452614B (en) Message processing method and device
CN113852572B (en) Message processing method and device
US20230072491A1 (en) Network processing using multi-level match action tables
CN110798540B (en) Data interaction method and device
WO2023169364A1 (en) Routing generation method and apparatus, and data message forwarding method and apparatus

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20211008