A message forwarding method, device, electronic device and storage medium

By using the filtering mechanism of access control lists and path tables in ECMP load balancing technology, the problem that the existing technology cannot filter path group members based on other feature information of the message is solved, and a more efficient load balancing effect is achieved.

CN116016337BActive Publication Date: 2025-05-27SUZHOU SHENGKE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310004705.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-03
Publication Date
2025-05-27
Estimated Expiration
2043-01-03

AI Technical Summary

Technical Problem

The existing ECMP load balancing technology cannot filter path group members based on other feature information of the message, resulting in poor load balancing.

Method used

By determining the message information of the received message, using it as an index, valid indication bits are determined from the predefined access control list, based on these indication bits, invalid paths are deleted from the path table, and valid path tables are obtained, and message forwarding is performed based on the table.

Benefits of technology

By filtering invalid paths in the path table, the packet forwarding efficiency is improved and the load balancing effect is enhanced, making load balancing more strategic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016337B_ABST
    Figure CN116016337B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a message forwarding method, apparatus, electronic device, and storage medium, relating to the field of communication technologies. The method includes: determining the message information of the received message, using the message information as an index, determining the valid indication bit corresponding to the message information from a pre-defined access control list, based on the valid indication bit, determining the invalid path corresponding to the valid indication bit from the path table, deleting the invalid path from the path table to obtain a valid path table, and forwarding the received message based on the valid path table. By first performing validity filtering on the path table to obtain a valid path table, and forwarding the current message based on the valid path table, it is avoided that the message is forwarded through an invalid path, improving the message forwarding efficiency and the effect of load balancing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular, to a method and apparatus for packet forwarding, an electronic device, and a storage medium. Background Art

[0002] ECMP is a widely used load balancing technology in current three-layer routing networks. It binds a group of reachable destination network paths into an equivalent path group. When a data stream needs to be forwarded to the corresponding destination, through data packet session characteristic fields, such as source IP address, destination IP address, four-layer protocol type, four-layer source port, and four-layer destination port, a hash value reflecting the session characteristics is generated through a Hash algorithm. Based on the hash value, the remainder is obtained by taking the remainder of the number of paths in the equivalent path group, and a forwarding path is obtained from the equivalent path group using the remainder, thereby achieving traffic load balancing of the paths in the equivalent path group through the above technology.

[0003] The above packet forwarding method has the following disadvantages: The selection of the path group set is determined by the destination IP of the packet and cannot filter the path group members based on other characteristic information of the packet, resulting in poor load balancing effect. Summary of the Invention

[0004] The purpose of the present invention is to provide a session retention method, apparatus, electronic device, and storage medium, which can improve the load balancing effect.

[0005] To achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a packet forwarding method, which is applied to a switching chip. The method includes:

[0007] Determine the packet information of the received packet;

[0008] Use the packet information as an index to determine the valid indication bit corresponding to the packet information from a pre-defined access control list;

[0009] Based on the valid indication bit, determine the invalid paths corresponding to the valid indication bit from a path table, where the path table includes all paths of the ECMP group;

[0010] Delete the invalid paths from the path table to obtain a valid path table;

[0011] Forward the received packet based on the valid path table.

[0012] In an alternative embodiment, the step of determining the packet information of the received packet includes:

[0013] Parse and perform a forwarding lookup on the received packet;

[0014] Parse the source address information, destination address information, and four-layer protocol information of the received message;

[0015] Perform a forwarding lookup based on the destination address information to obtain forwarding information, source port information, and destination ECMP group information.

[0016] In an alternative embodiment, search the predefined access control list according to the destination ECMP group information;

[0017] Determine the valid indication bits corresponding to the members in the destination ECMP group information in the predefined access control list.

[0018] In an alternative embodiment, the method further includes:

[0019] Search the predefined access control list according to the source address information, four-layer protocol information, destination address information, forwarding information, or source port information;

[0020] Determine the valid indication bits corresponding to the source address information, four-layer protocol information, forwarding information, destination address information, or source port information in the predefined access control list.

[0021] In an alternative embodiment, the step of determining the invalid path corresponding to the valid indication bit from the path table based on the valid indication bit includes:

[0022] Determine the path index corresponding to the valid indication bit from the path table according to the valid indication bit corresponding to the message information;

[0023] Based on the path index, determine the invalid path from the path table.

[0024] In an alternative embodiment, the method further includes:

[0025] When the valid indication bit corresponding to the message information is not found in the predefined access control list, forward the message based on the path table.

[0026] In an alternative embodiment, the step of forwarding the received message based on the valid path table includes:

[0027] Calculate the hash value based on the message information of the message;

[0028] Determine the number of members in the valid path table;

[0029] Perform a modulo operation based on the hash value and the number of members to obtain a modulo value;

[0030] Determine a target path from the valid path table based on the remainder value;

[0031] Forward the message based on the target path.

[0032] In a second aspect, an embodiment of the present application provides a message forwarding device, where the device includes:

[0033] A first determination module, configured to determine the message information of the received message;

[0034] A second determination module, configured to use the message information as an index to determine the valid indication bit corresponding to the message information from a predefined access control list;

[0035] A third determination module, configured to determine, based on the valid indication bit, an invalid path corresponding to the valid indication bit from a path table, where the path table includes all paths of an ECMP group;

[0036] A deletion module, configured to delete the invalid path from the path table to obtain a valid path table;

[0037] A forwarding module, configured to forward the received message based on the valid path table.

[0038] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the message forwarding method are implemented.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the message forwarding method are implemented.

[0040] The present application has the following beneficial effects:

[0041] In the present application, by determining the message information of the received message, using the message information as an index to determine the valid indication bit corresponding to the message information from a predefined access control list, determining, based on the valid indication bit, an invalid path corresponding to the valid indication bit from a path table, deleting the invalid path from the path table to obtain a valid path table, and forwarding the received message based on the valid path table. By first filtering the validity of the path table to obtain a valid path table, and forwarding the current message based on the valid path table, it is possible to avoid forwarding the message through an invalid path, improve the message forwarding efficiency, and enhance the load balancing effect. Description of the Drawings

[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0043] Figure 1 A block diagram of the electronic device provided by the embodiment of the present invention;

[0044] Figure 2 One of the flow diagrams of a message forwarding method provided by the embodiment of the present invention;

[0045] Figure 3 An application scenario diagram of the message forwarding method provided by the embodiment of the present invention;

[0046] Figure 4 Two of the flow diagrams of a message forwarding method provided by the embodiment of the present invention;

[0047] Figure 5 Three of the flow diagrams of a message forwarding method provided by the embodiment of the present invention;

[0048] Figure 6 Four of the flow diagrams of a message forwarding method provided by the embodiment of the present invention;

[0049] Figure 7 A structural block diagram of a message forwarding device provided by the embodiment of the present invention. Detailed Embodiments

[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0051] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0052] It should be noted that: similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0053] In the description of the present invention, it should be noted that if terms such as "upper", "lower", "inner", "outer", etc. are used to indicate the orientation or positional relationship, it is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the product of the present invention is usually placed during use. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention.

[0054] In addition, terms such as "first", "second", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0055] In the description of the present application, it should also be noted that unless otherwise clearly specified and defined, the terms "set", "install", "connect", "couple" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific situations.

[0056] Through extensive research by the inventors, it is found that ECMP is a widely used load balancing technology in the current three-layer routing network. It binds a group of reachable destination network paths into an equivalent path group. When the data stream needs to be forwarded to the corresponding destination, through the session characteristic fields of the data packet, such as the source IP address, destination IP address, four-layer protocol type, four-layer source port, four-layer destination port, a hash value reflecting the session characteristics is generated through the Hash algorithm. Based on the hash value, the remainder is obtained by taking the modulus of the number of paths in the equivalent path group, and a forwarding path is obtained from the equivalent path group using the remainder, thus realizing the traffic load balancing of the paths in the equivalent path group through the above technology.

[0057] The above packet forwarding method has the following disadvantages: The selection of the path group set is determined by the destination IP of the packet and it is impossible to screen the path group members based on other characteristic information of the packet, resulting in poor load balancing effect.

[0058] Moreover, the traditional load sharing and balancing "path selection module" uses the method of taking the remainder by Hash, and has the following disadvantages: The selection of the path group set is determined by the destination IP of the packet and it is impossible to screen the path group members based on other characteristic information of the packet.

[0059] In view of the discovery of the above problems, this embodiment provides a message forwarding method, device, electronic device and storage medium, which can determine the message information of the received message, use the message information as an index, determine the valid indication bit corresponding to the message information from the pre-defined access control list, and determine the invalid path corresponding to the valid indication bit from the path table based on the valid indication bit, delete the invalid path from the path table, obtain the valid path table, and forward the received message based on the valid path table. By first filtering the path table for validity, a valid path table is obtained, and the current message is forwarded based on the valid path table, avoiding the message forwarding through an invalid path, improving the message forwarding efficiency and improving the effect of load balancing. The scheme provided by this embodiment is described in detail below.

[0060] This embodiment provides an electronic device that can forward messages. In a possible implementation, the electronic device can be a user terminal, for example, the electronic device can be, but is not limited to, a server, a smart phone, a personal computer (PC), a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), etc.

[0061] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of the structure of the electronic device 100 provided in the embodiment of the present application. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0062] The electronic device 100 includes a message forwarding device 110 , a memory 120 and a processor 130 .

[0063] The memory 120 and the processor 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The message forwarding device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the memory 120, such as the software function modules and computer programs included in the message forwarding device 110.

[0064] Among them, the memory 120 can be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electric Erasable Programmable Read-Only Memory (EEPROM), etc. Among them, the memory 120 is used to store a program, and after receiving an execution instruction, the processor 130 executes the program.

[0065] Please refer to Figure 2 , Figure 2 which is a flowchart of a message forwarding method for an electronic device 100 applied to Figure 1 . The following will elaborate on each step included in the method in detail.

[0066] Step 201: Determine the message information of the received message.

[0067] Step 202: Use the message information as an index to determine the valid indication bit corresponding to the message information from a pre-defined access control list.

[0068] Step 203: Based on the valid indication bit, determine the invalid path corresponding to the valid indication bit from the path table.

[0069] Among them, the path table includes all paths of the ECMP group.

[0070] Step 204: Delete the invalid path from the path table to obtain a valid path table.

[0071] Step 205: Forward the received message based on the valid path table.

[0072] As Figure 3As shown in the figure, it is a schematic diagram of the application scenario of the packet forwarding method, including a first-layer network device, a second-layer network device, and an interconnected network. The first-layer network device includes multiple access switches, such as access switch 1-1, access switch 1-2, access switch 1-3... access switch 1-n, etc. The second-layer network device includes multiple aggregation switches, such as aggregation switch 2-1, aggregation switch 2-2, aggregation switch 2-3... aggregation switch 2-n. The connections between access switch 1-1 and aggregation switches 2-1, 2-2, 2-3... 2-n, switch 1-2 and aggregation switches 2-1, 2-2... 2-n, access switch 1-3 and aggregation switches 2-1, 2-2, 2-3... 2-n, and access switch 1-n and aggregation switches 2-1, 2-2, 2-3... 2-n form a path table.

[0073] In an example, when forwarding packets based on the first-layer network device and the second-layer network device, for example, when access switch 1-1 in the first-layer network device receives packet A, the packet information of packet A is determined. Among them, the packet information includes but is not limited to source address information, four-layer protocol information, destination address information, forwarding information, source port information, destination ECMP group information, etc. Among them, the forwarding information, source port information, and destination ECMP group information are obtained by forwarding and looking up based on the destination address information of the packet. The source address information, four-layer protocol information, destination address information, forwarding information, source port information, and destination ECMP group information in the packet information are used as an index. Among them, the destination ECMP group information is mandatory information, and the corresponding valid indication position is determined from a pre-defined access control list. The source address information, destination address information, four-layer protocol information, forwarding information, or source port information can also be used as an index to determine the valid indication bit corresponding to the index from the pre-defined access control list. Among them, the valid indication bit indicates an invalid path in the determined path table. For example, if the valid indication bit corresponds to 1, based on the valid indication bit 1, the path between access switch 1-1 and aggregation switch 2-1 in the path table is determined to be an invalid path, and the invalid path is deleted from the path table containing all paths to obtain a valid path table. The received packet is forwarded based on the valid path table so that the packet will not be forwarded to the invalid path again, resulting in packet forwarding failure.

[0074] There are multiple implementation methods for determining the valid indication bit corresponding to the packet information based on the received packet information. In one implementation method, as Figure 4 shown, it includes the following steps:

[0075] Step 201-1: Parse and forward and look up the received packet.

[0076] Step 201-2: Parse the source address information, destination address information, and four-layer protocol information of the received message.

[0077] Step 201-3: Perform a forwarding lookup based on the destination address information to obtain forwarding information, source port information, and destination ECMP group information.

[0078] Step 202-1: Look up the predefined access control list according to the destination ECMP group information.

[0079] Step 202-2: Determine the valid indicator bits corresponding to the members in the destination ECMP group information in the predefined access control list.

[0080] Obtain message information including but not limited to source address information, four-layer protocol information, destination address information, forwarding information, source port information, and destination ECMP group information based on the received message, where the destination ECMP group information is an essential path lookup element

[0081] In one example, since the predefined access control list includes the correspondence between the valid indicator bits and the members of the destination ECMP group, the members of the destination ECMP group are used as indexes to sequentially query the predefined access control list, and the valid indicator bits corresponding to the members of the destination ECMP group are determined from the predefined access control list. Assume that the destination ECMP group has 8 members, then the valid indicator bits are composed of 8 bits, bit0 corresponds to path 0, bits1 corresponds to path 1... bits7 corresponds to path 7.

[0082] For the lookup method of valid paths, in another example, the predefined access control list is looked up according to the source address information, four-layer protocol information, destination address information, forwarding information, or source port information; the valid indicator bits corresponding to the source address information, four-layer protocol information, destination address information, forwarding information, or source port information are determined in the predefined access control list.

[0083] That is, query the predefined access control list based on the source address information, query the predefined access control list based on the four-layer protocol information, query the access control list based on the forwarding information, query the predefined access control list based on the source port information, and query the predefined access control list based on the destination address information. Determine the valid indicator bits corresponding to the source address information, four-layer protocol information, destination address information, forwarding information, or source port information in the predefined access control list.

[0084] In another example, when the valid indication bit corresponding to the packet information is not found in the predefined access control list, the packet is forwarded based on the path table. For example: when the first-layer network devices include access switch 1 and access switch 2, and the second-layer network devices include aggregation switch A and aggregation switch B, all the paths in the path table include: path A-1 between aggregation switch A and access switch 1, path A-2 between aggregation switch A and access switch 2, path B-1 between aggregation switch B and access switch 1, and path B-2 between aggregation switch B and access switch 2. Based on the packet information of the packet, when the corresponding ACL entry is not found in the predefined access control list, the packet is forwarded based on the path table composed of path A-1 between aggregation switch A and access switch 1, path A-2 between aggregation switch A and access switch 2, path B-1 between aggregation switch B and access switch 1, and path B-2 between aggregation switch B and access switch 2.

[0085] It should be noted that the access control list is configured based on the packet information of the received packet.

[0086] In one example, when the first-layer network devices include access switch 1 and access switch 2, and the second-layer network devices include aggregation switch A and aggregation switch B, when the path A-1 between the access switch and aggregation switch A fails to connect, the packet is received by access switch 2. When access switch 2 selects aggregation switch A for packet forwarding, and aggregation switch A forwards the packet based on the path between aggregation switch A and access switch 2, at this time the packet is sent from switch 2 to switch 2, and the predefined access control list is configured based on the packet information received by the current switch 2. The valid indication bit in the configured access control list indicates that the path between aggregation switch A and access switch 2 is an invalid path.

[0087] There are various implementation methods for determining the invalid paths in the path table. In one implementation method, as Figure 5 shown, it includes the following steps:

[0088] Step 203-1: Determine the path index corresponding to the valid indication bit from the path table according to the valid indication bit corresponding to the packet information.

[0089] Step 203-2: Based on the path index, determine the invalid paths from the path table.

[0090] After finding the corresponding packet information in the predefined access control list based on the packet information, based on the valid indication bit corresponding to the packet information, determine the path index corresponding to the valid indication bit, and find the invalid paths among all the paths in the path table.

[0091] In one example, when, in a packet forwarding scenario, the path between access switch 1-3 of a first-layer network device and aggregation switch 2-1 is an invalid path, when packet A is sent from access switch 1-1 to access switch 1-3 via the aggregation switch, the valid indication bit corresponding to the packet information of packet A is determined from a pre-defined access control list based on the packet information of packet A, and based on the valid indication bit, it is found from the path table that the path between aggregation switch 2-1 and access switch 1-3 is an invalid path.

[0092] In another example, when the first-layer network device includes access switch 1 and access switch 2, and the second-layer network device includes aggregation switch A and aggregation switch B, when the connection of path A-1 between access switch 1 and aggregation switch A fails, when a packet is received by access switch 1, then based on the packet information of the packet, the invalid path indicated by the valid indication bit determined in the pre-defined access control list is the path A-1 between aggregation switch A and access switch 1. When the packet is received by access switch 2, then based on the packet information of the packet, the invalid paths indicated by the valid indication bit determined from the pre-defined access control list are the path A-1 between aggregation switch A and switch A and the path A-2 between aggregation switch A and switch 2. When access switch 1 receives a packet, among all the paths in the path table: the path A-1 between aggregation switch A and access switch 1, the path A-2 between aggregation switch A and access switch 2, the path B-1 between aggregation switch B and access switch 1, and the path B-2 between aggregation switch B and access switch 2, the invalid path of the path A-1 between aggregation switch A and access switch 1 is deleted. Finally, an effective path table composed of the path A-2 between aggregation switch A and access switch 2, the path B-1 between aggregation switch B and access switch 1, and the path B-2 between aggregation switch B and access switch 2 is obtained, and the packet is forwarded based on the paths in the effective path table.

[0093] When access switch 2 receives a packet, the invalid paths of the path A-1 between aggregation switch A and access switch 1 and the path A-2 between aggregation switch A and access switch 2 in the path table are deleted. Finally, an effective path table composed of the path B-1 between aggregation switch B and access switch 1 and the path B-2 between aggregation switch B and access switch 2 is obtained, and the packet is forwarded based on the paths in the effective path table.

[0094] There are various ways to forward a packet based on the effective path table. In one implementation, as Figure 6 shown, it includes the following steps:

[0095] Step 301: Calculate a hash value based on the packet information of the packet.

[0096] Step 302: Determine the number of members in the effective path table.

[0097] Step 303: Perform a modulo operation based on the hash value and the number of members to obtain a modulo value.

[0098] Step 304: Determine the target path from the valid path table based on the modulo value.

[0099] Step 305: Forward the packet based on the target path.

[0100] Exemplarily, when the first-layer network devices include access switch 1 and access switch 2, and the second-layer network devices include aggregation switch A and aggregation switch B, when access switch 1 receives a packet, the determined valid path table is: path A-2 between aggregation switch A and access switch 2, path B-1 between aggregation switch B and access switch 1, path B-2 between aggregation switch B and access switch 2, the path A-2 between aggregation switch A and access switch 2 corresponds to a first modulo value, the path B-1 between aggregation switch B and access switch 1 corresponds to a second modulo value, and the path B-2 between aggregation switch B and access switch 2 corresponds to a third modulo value.

[0101] Determine the packet information of the packet received by access switch 1, calculate the hash value of the packet based on the packet information, determine that the number of members in the ECMP group is 2, calculate the target modulo value of the hash value of the packet received by access switch 1 and the number of members 2, and compare the target modulo value with the first modulo value corresponding to the path A-2 between aggregation switch A and access switch 2. When the target modulo value matches successfully with the first modulo value corresponding to the path A-2 between aggregation switch A and access switch 2, use the path A-2 between aggregation switch A and access switch 2 as the target path and forward the packet received by access switch 1.

[0102] When the target modulo value does not match the first modulo value of the path A-2 between aggregation switch A and access switch 2, compare the target modulo value with the second modulo value corresponding to the path B-1 between aggregation switch B and access switch 1. When the target modulo value matches successfully with the second modulo value corresponding to the path B-1 between aggregation switch B and access switch 1, use the path B-1 between aggregation switch B and access switch 1 as the target path and forward the packet received by access switch 1. When the target modulo value does not match the second modulo value of the path B-1 between aggregation switch B and access switch 1, compare the target modulo value with the third modulo value corresponding to the path B-2 between aggregation switch B and access switch 2. When the target modulo value matches successfully with the third modulo value corresponding to the path B-2 between aggregation switch B and access switch 2, use the path B-2 between aggregation switch B and access switch 2 as the target path and forward the packet received by access switch 1.

[0103] The present invention improves the "path selection module" in the existing load sharing and balancing, introduces a policy-based filtering mechanism, first filters the validity of the paths in the path table, and then uses the set of members valid for the current packet for the selection of the load sharing and balancing path, solving the defect that the traditional path selection set can only be determined based on the destination IP of the packet, so that the load sharing and balancing can select the set of members based on the policy in the scenario.

[0104] Please refer to Figure 7 , the embodiment of the present application also provides a packet forwarding device 110 applied to Figure 1 the electronic device 100, and the packet forwarding device 110 includes:

[0105] A first determination module 111, configured to determine the packet information of the received packet;

[0106] A second determination module 112, configured to use the packet information as an index to determine the valid indication bit corresponding to the packet information from a predefined access control list;

[0107] A third determination module 113, configured to determine the invalid paths corresponding to the valid indication bits from the path table based on the valid indication bits, where all paths of the ECMP group are included in the path table;

[0108] A deletion module 114, configured to delete the invalid paths from the path table to obtain a valid path table;

[0109] A forwarding module 115, configured to forward the received packet based on the valid path table.

[0110] The present application further provides an electronic device 100, and the electronic device 100 includes a processor 130 and a memory 120. The memory 120 stores computer-executable instructions, and when the computer-executable instructions are executed by the processor 130, the packet forwarding method is implemented.

[0111] The embodiment of the present application further provides a computer-readable storage medium, and the storage medium stores a computer program, and when the computer program is executed by the processor 130, the packet forwarding method is implemented.

[0112] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0113] In addition, each functional module in various embodiments of this application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0114] It should be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.

[0115] As described above, the above are only various embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A packet forwarding method, applied to a switching chip, Characterized in that, The method includes: Determine the packet information of the received packet; Use the packet information as an index to determine the valid indication bit corresponding to the packet information from a predefined access control list; Based on the valid indication bit, determine the invalid path corresponding to the valid indication bit from the path table, where the path table includes all paths of the ECMP group; Delete the invalid path from the path table to obtain a valid path table; Forward the received packet based on the valid path table; The step of determining the packet information of the received packet includes: Parse and perform a forwarding lookup on the received packet; Parse to obtain the source address information, destination address information, and four-layer protocol information of the received packet; Perform a forwarding lookup based on the destination address information to obtain forwarding information, source port information, and destination ECMP group information.

2. The method according to claim 1, Characterized in that, The step of using the packet information as an index to determine the valid indication bit corresponding to the packet information from a predefined access control list includes: Search the predefined access control list according to the destination ECMP group information; Determine the valid indication bit corresponding to the member in the destination ECMP group information in the predefined access control list.

3. The method according to claim 2, Characterized in that, The method further includes: Search the predefined access control list according to the source address information, four-layer protocol information, destination address information, forwarding information, or source port information; Determine the valid indication bit corresponding to the source address information, four-layer protocol information, forwarding information, destination address information, or source port information in the predefined access control list.

4. The method according to claim 2 or 3, Characterized in that, The step of determining the invalid path corresponding to the valid indication bit from the path table based on the valid indication bit includes: Determine the path index corresponding to the valid indication bit from the path table according to the valid indication bit corresponding to the packet information; Based on the path index, determine the invalid path from the path table.

5. The method according to claim 1, Characterized in that, The method further includes: When the valid indication bit corresponding to the packet information is not found in the predefined access control list, forward the packet based on the path table.

6. The method according to claim 1, Characterized in that, The step of forwarding the received packet based on the valid path table includes: Calculate a hash value based on the packet information of the packet; Determine the number of members in the valid path table; Perform a modulo operation based on the hash value and the number of members to obtain a modulo value; Determine the target path from the valid path table based on the modulo value; Forward the packet based on the target path.

7. A packet forwarding device, Characterized in that, The device includes: A first determination module for determining the packet information of the received packet; A second determination module, configured to use the packet information as an index to determine a valid indication bit corresponding to the packet information from a pre-defined access control list; A third determination module, configured to determine an invalid path corresponding to the valid indication bit from a path table based on the valid indication bit, where the path table includes all paths of an ECMP group; A deletion module, configured to delete the invalid path from the path table to obtain a valid path table; A forwarding module, configured to forward a received packet based on the valid path table; The first determination module is specifically configured to: Parse and perform a forwarding lookup on a received packet; Parse to obtain source address information, destination address information, and four-layer protocol information of the received packet; Perform a forwarding lookup based on the destination address information to obtain forwarding information, source port information, and destination ECMP group information.

8. An electronic device, characterized in that it includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the method according to any one of claims 1-6 are implemented.

9. A storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1-6 are implemented.

Citation Information

Patent Citations

  • Multipath selection method and multipath selection equipment

    CN106685821A