CN115604186A - Routing method and related equipment - Google Patents

Routing method and related equipment Download PDF

Info

Publication number
CN115604186A
CN115604186A CN202110780197.5A CN202110780197A CN115604186A CN 115604186 A CN115604186 A CN 115604186A CN 202110780197 A CN202110780197 A CN 202110780197A CN 115604186 A CN115604186 A CN 115604186A
Authority
CN
China
Prior art keywords
search tree
prefix
data table
index
prefix search
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
CN202110780197.5A
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110780197.5A priority Critical patent/CN115604186A/en
Publication of CN115604186A publication Critical patent/CN115604186A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/748Address table lookup; Address filtering using longest matching prefix

Abstract

The embodiment of the application provides a routing method and related equipment, wherein the method comprises the following steps: receiving a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; after receiving a first packet, sending a second packet to the second routing device, where the second packet includes the first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index. By adopting the embodiment of the application, the efficiency of the routing table lookup can be improved.

Description

Routing method and related equipment
Technical Field
The present application relates to the field of network technologies, and in particular, to a routing method and a related device.
Background
Internet Protocol (IP) is a network layer Protocol in the Transmission Control Protocol (TCP)/IP architecture. The purpose of designing IP is to improve the scalability of the network: firstly, the problem of the internet is solved, and interconnection and intercommunication of large-scale and heterogeneous networks are realized; and secondly, dividing the coupling relation between the top network application and the bottom network technology so as to be beneficial to the independent development of the top network application and the bottom network technology. IP only provides a connectionless, unreliable, best-effort packet transport service to hosts according to the end-to-end design principle. In IP network transmission or a communication packet network constructed by IP, route searching is an extremely important part, and a route table item matched to a target IP address at the fastest speed is a main function of route searching, wherein the IP address is used for identifying a communication address of a communication terminal. The existing routing table searching methods are very many, and comprise a Lulea algorithm, a PBF algorithm, an LC-trie algorithm adopted by a Linux kernel and a Tree Bitmap algorithm adopted by a Cisco router. However, with the rapid growth of routing tables (about 15% per year), the performance of existing routing table lookup methods is poor.
Disclosure of Invention
The embodiment of the application provides a routing method and related equipment, which can improve the efficiency of routing table lookup.
In a first aspect, an embodiment of the present application provides a routing method, which is applied to a first routing device, and the method includes: receiving a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; after receiving a first packet, sending a second packet to the second routing device, where the second packet includes the first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index. The IP address Prefix may be simply referred to as Prefix (Prefix).
In the embodiment of the application, a downstream second routing device sends a target message through an upstream first routing device, so that at least one index corresponding to at least one IP address prefix in the target message is sent to the upstream first routing device; after receiving a first message to be forwarded, a first routing device sends a first target index in the at least one index and the first message to a second routing device as a second message, for example, the first target index is placed in a header of the first message and sent to the second routing device as the second message; the first target index is used for the second routing device to determine the egress port of the first packet, that is, the second routing device can quickly query which specific downstream routing device needs to forward the first packet to the second routing device according to the first target index, so that the efficiency of the second routing device in routing table lookup can be improved.
In one possible implementation, the at least one index includes at least one of: an index of a Routing Engine Table (RE Table), an index of a data Table of a full Prefix search tree (RPS) structure, and an index of a data Table of a Virtual Prefix search tree (VPS) structure. The Index of the routing engine table (abbreviated as RE Index) is used for searching the routing engine table, the Index of the data table of the complete prefix search tree structure (abbreviated as RPS table Index, abbreviated as RPS Index) is used for searching the data table of the complete prefix search tree structure, and the Index of the data table of the virtual prefix search tree structure (abbreviated as VPS table Index, abbreviated as VPS Index) is used for searching the data table of the virtual prefix search tree structure. It should be understood that the search tree described herein is also called a search tree.
In the embodiment of the present application, the routing table lookup is performed in stages, that is, a Ternary Content Addressable Memory (TCAM) table (TCAM table for short) is first looked up, then a data table 2 (VPS 2 table for short) of the virtual prefix search tree structure is looked up according to a table lookup result of looking up the TCAM table, then a data table 1 (VPS 1table for short) of the virtual prefix search tree structure is looked up according to a table lookup result of looking up the VPS2 table, then a data table (RPS table for short) of the complete prefix search tree structure is looked up according to a table lookup result of looking up the VPS1table for short, and finally a routing engine table is looked up according to a table lookup result of looking up the data table of the complete prefix search tree structure, so as to look up a specific routing table entry. And at least one index of the present application includes at least one of an index of the routing engine table (i.e., a lookup result of looking up the RPS table), an index of the data table of the full prefix search tree structure (i.e., a lookup result of looking up the VPS1 table), and an index of the data table of the virtual prefix search tree structure (including an index of the VPS2 table and an index of the VPS1table, an index of the VPS2 table is a lookup result of looking up the TCAM table, and an index of the VPS1table is a lookup result of looking up the VPS2 table), so the first target index may be any one of an index of the routing engine table, an index of the TCAM table, an index of the VPS1table, an index of the VPS2 table, and an index of the RPS table. If the first target index is the index of the routing engine table, the second routing device can directly inquire the routing engine table according to the first target index to inquire the output port of the first message, so that the stage of inquiring a TCAM table, a VPS2 table, a VPS1table and an RPS table is omitted, and the efficiency of the second routing device in the table lookup of the routing is improved. If the first target index is the index of the RPS table, the second routing device can directly inquire the RPS table according to the first target index, and then inquire the routing engine table according to the table look-up result of the RPS table to look up the output port of the first message, so that the stage of inquiring the TCAM table, the VPS2 table and the VPS1table is omitted, and the efficiency of looking up the table by the second routing device can be improved. If the first target index is an index of a data table of a virtual prefix search tree structure, two cases are distinguished: the first target index is the index of the VPS1table, so that the second routing equipment can directly inquire the VPS1table according to the first target index, then check the RPS table according to the table look-up result of checking the VPS1table, and then inquire the routing engine table according to the table look-up result of checking the RPS table so as to check the exit port of the first message, thus omitting the stages of inquiring the TCAM table and checking the VPS2 table; the first target index is the index of the VPS2 table, so that the second routing equipment can directly inquire the VPS2 table according to the first target index, then check the VPS1table according to the table look-up result of checking the VPS2 table, check the RPS table according to the table look-up result of checking the VPS1table, and then inquire the routing engine table according to the table look-up result of checking the RPS table to check the exit port of the first message, thus omitting the stage of inquiring the TCAM table; thereby also improving the efficiency of the second routing device routing table lookup.
In one possible implementation, the target message further includes the at least one IP address prefix; after receiving the target message from the second routing device, and before sending the second packet to the second routing device, the method further includes: querying a first target data table according to any one of the at least one IP address Prefix, so as to determine a first target IP address Prefix matching (LPM) with the Longest Prefix of any IP address Prefix in the first target data table; adding an index corresponding to any IP address prefix in the at least one index into a table entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table; if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
In this embodiment of the present application, the second routing device may further send at least one IP address prefix and at least one index corresponding to the at least one IP address prefix to the first routing device, and the first routing device may first add each IP address prefix in the at least one IP address prefix to the second target data table. Thus, after receiving the first message sent by the upstream routing device, the first routing device may look up the first target index in the second target data table in the process of looking up the routing table look-up of the egress port of the first message, and place the first target index in the header of the first message as the second message to send to the second routing device, thereby facilitating the second routing device to look up the table by fast routing. Specifically, for any IP address prefix in the at least one IP address prefix, if the any IP address prefix is an IP address prefix in an RPS table in the second routing device, the first routing device queries, in the RPS table therein, a first target IP address prefix matching the longest prefix of the any IP address prefix, then adds an index corresponding to the any IP address prefix in the at least one index to an entry corresponding to a second target index in a routing engine table therein, and the second target index is an index corresponding to the first target IP address prefix in the RPS table in the first routing device; therefore, in the process of table lookup of the first routing device, the first target index can be looked up in the routing engine table, and the first target index is sent to the second routing device; therefore, the second routing device can directly query the routing engine table according to the first target index without querying the TCAM table, the VPS2 table, the VPS1table and the RPS table. If the any IP address prefix is an IP address prefix in a VPS1table in the second routing equipment, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of the any IP address prefix in the VPS1table, then an index corresponding to the any IP address prefix in at least one index is added in a table entry corresponding to a second target index in the RPS table, and the second target index is an index corresponding to the first target IP address prefix in the VPS1table in the first routing equipment; thus, in the process of table lookup of the first routing device, the first target index can be looked up in the RPS table therein, and the first target index is sent to the second routing device; therefore, the second routing device can directly inquire the RPS table according to the first target index without inquiring the TCAM table, the VPS2 table and the VPS1 table. If the any IP address prefix is the IP address prefix in the VPS2 table in the second routing equipment, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of the any IP address prefix in the VPS2 table in the first routing equipment, then an index corresponding to the any IP address prefix in at least one index is added in a table entry corresponding to a second target index in the VPS1table in the first routing equipment, and the second target index is an index corresponding to the first target IP address prefix in the VPS2 table in the first routing equipment; thus, in the process of table lookup of the first routing device, the first target index can be looked up in the VPS1table therein, and the first target index is sent to the second routing device; therefore, the second routing equipment can directly query the VPS1table according to the first target index without querying the TCAM table and the VPS2 table firstly. If any IP address prefix is an IP address prefix in a TCAM table, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of any IP address prefix in the TCAM table, then an index corresponding to any IP address prefix in at least one index is added in a table entry corresponding to a second target index in a VPS2 table, and the second target index is an index corresponding to the first target IP address prefix in the TCAM table in the first routing equipment; therefore, in the process of table lookup of the first routing device, a first target index can be looked up in a VPS2 table in the table lookup process of the first routing device, and the first target index is sent to the second routing device; thus, the second routing device can directly query the VPS2 table therein according to the first target index without first querying the TCAM table.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: receiving a first binary string from the second routing device, where the first binary string is obtained by encoding the second complete prefix search tree; obtaining a third complete prefix search tree according to a second binary string and the first complete prefix search tree, wherein the second binary string is obtained after the OR operation is carried out on the first binary string and the third binary string, and the third binary string is obtained by coding the first complete prefix search tree; adding table entries in the first data table according to the third complete prefix search tree; wherein a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared to the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, a position of the first target node in the third complete prefix search tree is the same as a position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node. The IP address prefix corresponding to the second target node refers to the IP address prefix corresponding to the second target node in the second data table; the Index corresponding to the nearest ancestor node of the first target node is also the table look-up result of the first data table, and the RE Index in the first data table (RPS table) is also the Index of the routing engine table; or, the Index corresponding to the nearest ancestor node of the first target node is an Index (RE Index) of a routing engine table in the first routing device.
In the embodiment of the present application, a first data table in a first routing device is a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the first data table is a first complete prefix search tree; a second data table in the second routing equipment is also a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the second data table is a second complete prefix search tree; if the depth of the first complete prefix search tree is the same as the depth of the second complete prefix search tree and the topology of the first complete prefix search tree is different from the topology of the second complete prefix search tree, or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1, at least one entry exists in the second data table, and no entry corresponding to the entry exists in the first data table. If at least one IP address prefix and at least one index sent to the first routing device by the second routing device are respectively the IP address prefix and the index in the second data table, for any IP address prefix in the at least one IP address prefix, the first routing device can inquire the IP address prefix matched with the longest prefix of the any IP address prefix in the first data table, and then adds the at least one index in the routing engine table of the first routing device, so as to realize the rapid routing table look-up scheme provided by the application. Since there is at least one entry in the second data table, and there is no corresponding entry in the first data table, as for the IP address prefix in the at least one entry, it cannot query the IP address prefix with the longest prefix match in the first data table, and then the index in the at least one entry cannot be added in the routing engine table of the first routing device, so that the at least one entry cannot adopt the fast routing table lookup scheme provided by the present application. Therefore, the second routing equipment encodes the second complete prefix search tree to obtain a first binary string and sends the first binary string to the first routing equipment; the first routing equipment also encodes the first complete prefix search tree to obtain a third binary string, performs OR operation on the received first binary string and the third binary string to obtain a second binary string, and then adds nodes in the first complete prefix search tree according to the second binary string to obtain a third complete prefix search tree; it should be understood that entries in the data table of the full prefix search tree structure are embodied in the full prefix search tree, i.e., nodes in the full prefix search tree, so that nodes added to the third full prefix search tree compared to the first full prefix search tree are also added entries in the first data table. The second target IP address prefix in the table entry added in the first data table is the IP address prefix corresponding to the first target node added in the third complete prefix search tree compared with the first complete prefix search tree, the IP address prefix corresponding to the first target node is the IP address prefix corresponding to the second target node in the second complete prefix search tree, and meanwhile, the position of the first target node in the third complete prefix search tree is the same as the position of the second target node in the second complete prefix search tree; the third target index in the added entry in the first data table is the index corresponding to the nearest ancestor node of the first target node. Thus, for at least one entry in the second data table, which originally has no corresponding entry in the first data table, due to the addition of the entry in the first data table, the IP address prefix in the entry added in the first data table is the IP address prefix in the at least one entry in the second data table; then, for the IP address prefix in the at least one table entry, the table entry corresponding to the IP address prefix exists in the first data table, that is, the added table entry is a table entry corresponding to the IP address prefix, so that the first routing device may query the IP address prefix matching the longest prefix of the at least one table entry in the first data table after the table entry is added, that is, query the at least one table entry itself, so that the first routing device may query the index in the at least one table entry in its routing engine table, and may add the index in the at least one table entry to the header of the first packet as the second packet to be sent to the second routing device, thereby implementing that the at least one table entry may also adopt the fast routing table lookup scheme provided by the present application.
In one possible implementation, the encoding the first full prefix search tree includes: supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree; encoding the fourth complete prefix search tree; the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the node codes of the empty node and the node corresponding to the non-IP address prefix in the fourth complete prefix search tree are 0.
In this embodiment of the present application, the process of the first routing device encoding the first complete prefix search tree to obtain the third binary string is: the first complete prefix search tree is supplemented into a full binary tree to obtain a fourth complete prefix search tree containing supplemented empty nodes, then nodes corresponding to the IP address prefixes in the fourth complete prefix search tree are coded into 1, the empty nodes in the fourth complete prefix search tree and the nodes corresponding to the non-IP address prefixes are coded into 0, and therefore a third binary string is obtained. The process of the second routing device coding the second complete prefix search tree to obtain the first binary string is the same as the process of the first routing device coding the first complete prefix search tree to obtain the third binary string. In this way, the lengths of the first binary string and the third binary string are the same, so that the second binary string can be obtained after the first binary string and the third binary string are subjected to or operation.
In one possible implementation, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: receiving a fourth binary string from the second routing device, where the fourth binary string is obtained by encoding a first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree; obtaining a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, wherein the fifth binary string is obtained by performing or operation on the fourth binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; adding table entries in the first data table according to the second virtual prefix search tree; wherein, a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, the IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
In the embodiment of the present application, a first data table in a first routing device is a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the first data table is a first complete prefix search tree; a second data table in the second routing device is also a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the second data table is a second complete prefix search tree; if the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is greater than 1, then there is at least one entry in the second data table that does not have an entry in the first data table corresponding thereto. If at least one IP address prefix and at least one index sent to the first routing device by the second routing device are respectively the IP address prefix and the index in the second data table, for any IP address prefix in the at least one IP address prefix, the first routing device can inquire the IP address prefix matched with the longest prefix of the any IP address prefix in the first data table, and then adds the at least one index in the routing engine table of the first routing device, so as to realize the rapid routing table look-up scheme provided by the application. Since there is at least one entry in the second data table, and there is no corresponding entry in the first data table, as for the IP address prefix in the at least one entry, it cannot query the IP address prefix with the longest prefix match in the first data table, and then the index in the at least one entry cannot be added in the routing engine table of the first routing device, so that the at least one entry cannot adopt the fast routing table lookup scheme provided by the present application. For this purpose, the second routing device obtains the first virtual prefix search tree according to the second complete prefix search tree, for example, virtualizes a plurality of nodes in the second complete prefix search tree into one node, thereby obtaining the first virtual prefix search tree; then the second routing equipment encodes the first virtual prefix search tree to obtain a fourth binary string, and sends the fourth binary string to the first routing equipment; the first routing equipment also encodes the first complete prefix search tree to obtain a third binary string, performs OR operation on a received fourth binary string and the third binary string to obtain a fifth binary string, and then adds nodes in the first complete prefix search tree according to the fifth binary string, namely adds the nodes in the first virtual prefix search tree to the first complete prefix search tree, so that the virtual prefix search tree is obtained after the nodes are added in the first complete prefix search tree, namely the second virtual prefix search tree; it should be appreciated that the added nodes of the second virtual prefix search tree as compared to the first full prefix search tree are also added entries in the first data table. The second target IP address prefix in the added table entry of the first data table is an IP address prefix corresponding to a third target node which is added in the second virtual prefix search tree and is compared with the first complete prefix search tree, the IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, meanwhile, the IP address prefix corresponding to the fourth target node is an IP address prefix in the third data table, the table look-up result of the third data table is used for looking up the second data table, and the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree; that is, the third data table is a data table of a virtual prefix search tree structure corresponding to the first virtual prefix search tree, and the first virtual prefix search tree is virtually obtained by the second complete prefix search tree, so the table look-up result of the third data table is used for looking up the second data table; in addition, the third target index in the added entry of the first data table is the index corresponding to the nearest ancestor node of the third target node. Thus, for at least one entry in the second data table for which no corresponding entry exists in the first data table originally, the second complete prefix search tree corresponding to the second data table is virtualized to obtain a first virtual prefix search tree, the third data table corresponding to the first virtual prefix search tree can be used for searching the second data table, and then the second routing device can send the prefix and the index in the third data table to the first routing device; after receiving the first message, the first routing equipment places an index in a third data table sent to the first routing equipment by the second routing equipment in a header of the first message and sends the index to the second routing equipment; the second routing equipment searches the second data table quickly according to the index sent by the first routing equipment, and then searches the routing engine table according to the table searching result of the second data table, so that the quick routing table searching scheme provided by the application can be adopted.
In a second aspect, an embodiment of the present application provides a routing method, which is applied to a second routing device, and the method includes: sending a target message to a first routing device, wherein the second routing device is a downstream routing device of the first routing device, the target message comprises at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; receiving a second packet from the first routing device, where the second packet includes a first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: and sending a first binary string to the first routing device, wherein the first binary string is obtained by encoding the second complete prefix search tree.
In one possible implementation, the encoding the second full prefix search tree includes: supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree; encoding the fifth complete prefix search tree; and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
In a possible implementation manner, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: a fourth binary string to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree.
It should be noted that, for the beneficial effects of the second aspect of the present application, reference may be made to the description related to the first aspect of the present application, and details are not described herein again.
In a third aspect, an embodiment of the present application provides a routing apparatus, which is applied to a first routing device, and the apparatus includes: a receiving unit, configured to receive a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; a sending unit, configured to send a second packet to the second routing device after receiving the first packet, where the second packet includes the first packet and a first target index, the first target index is used for the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
In one possible implementation, the target message further includes the at least one IP address prefix; the apparatus further comprises a processing unit for: after the target message from the second routing equipment is received, before the second message is sent to the second routing equipment; inquiring a first target data table according to any IP address prefix in the at least one IP address prefix so as to determine a first target IP address prefix matched with the longest prefix of any IP address prefix in the first target data table; adding an index corresponding to any IP address prefix in the at least one index into a table entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table; if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the receiving unit is further configured to receive a first binary string from the second routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree; the processing unit is further configured to obtain a third complete prefix search tree according to a second binary string and the first complete prefix search tree, where the second binary string is obtained by performing an or operation on the first binary string and the third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; adding table entries in the first data table according to the third complete prefix search tree; wherein, a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared with the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, the position of the first target node in the third complete prefix search tree is the same as the position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node.
In one possible implementation, the encoding the first full prefix search tree includes: supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree; encoding the fourth complete prefix search tree; and the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fourth complete prefix search tree are 0.
In one possible implementation, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the receiving unit is further configured to receive a fourth binary string from the second routing device, where the fourth binary string is obtained by encoding a first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree; the processing unit is further configured to obtain a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, where the fifth binary string is obtained by performing an or operation on the fourth binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; adding table entries in the first data table according to the second virtual prefix search tree; a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, an IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
It should be noted that, for the beneficial effects of the third aspect of the present application, reference may be made to the relevant description of the first aspect of the present application, and details are not described herein again.
In a fourth aspect, an embodiment of the present application provides a routing apparatus, which is applied to a second routing device, where the apparatus includes: a sending unit, configured to send a target message to a first routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; a receiving unit, configured to receive a second packet from the first routing device, where the second packet includes a first packet and a first target index, the first target index is used for the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit is further configured to: and sending a first binary string to the first routing device, wherein the first binary string is obtained by encoding the second complete prefix search tree.
In one possible implementation, the encoding the second full prefix search tree includes: supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree; encoding the fifth complete prefix search tree; and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
In one possible implementation, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit is further configured to: a fourth binary string to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree.
It should be noted that, for the beneficial effects of the fourth aspect of the present application, reference may be made to the relevant description of the first aspect of the present application, and details are not described herein again.
In a fifth aspect, an embodiment of the present application provides a first routing device, including a processor, a memory, a communication interface, and one or more programs, stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps in the method according to any one of the first aspect.
In a sixth aspect, an embodiment of the present application provides a second routing device, including a processor, a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor, the program including instructions for performing the steps in the method according to any one of the second aspects.
In a seventh aspect, an embodiment of the present application provides a chip, including: a processor configured to call and run a computer program from a memory, so that a device on which the chip is installed performs the method according to any one of the first or second aspects.
In an eighth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to perform the method according to any one of the first or second aspects.
In a ninth aspect, embodiments of the present application provide a computer program, which causes a computer to execute the method according to any one of the first or second aspects.
Drawings
Fig. 1 is a schematic diagram of a phased routing lookup table.
Fig. 2 is a schematic diagram of a routing table look-up of neighboring routing devices of the same network.
Figure 3 is a schematic diagram of a clue-based routing lookup table.
Fig. 4 is a flowchart illustrating a routing method according to an embodiment of the present application.
Fig. 5 is a schematic diagram of a fast routing lookup table according to an embodiment of the present application.
Fig. 6 is a schematic diagram of a full prefix search tree advertisement method according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a search tree encoded into a binary string according to an embodiment of the present application.
Fig. 8 is a schematic diagram of another search tree encoded into a binary string according to an embodiment of the present application.
Fig. 9 is a schematic diagram of another full prefix search tree advertisement method according to an embodiment of the present application.
Fig. 10 is a schematic diagram for constructing a complete prefix search tree according to an embodiment of the present application.
Fig. 11 is a schematic diagram of adding an entry according to an embodiment of the present application.
Fig. 12 is a schematic diagram of another complete prefix search tree advertisement method according to an embodiment of the present application.
Fig. 13 is a schematic diagram of a virtual prefix search tree advertisement method according to an embodiment of the present application.
Fig. 14 is a schematic diagram of another virtual prefix search tree advertisement method according to an embodiment of the present application.
Fig. 15 is a schematic diagram of constructing a virtual prefix search tree according to an embodiment of the present application.
Fig. 16 is a schematic diagram of another virtual prefix search tree advertisement method according to an embodiment of the present application.
Fig. 17 is a diagram illustrating another fast routing lookup table according to an embodiment of the present application.
Fig. 18 is a schematic diagram of a prefix advertisement method for static configuration according to an embodiment of the present application.
Fig. 19 is a schematic diagram of another static configuration prefix advertisement method according to an embodiment of the present application.
Fig. 20 is a schematic diagram of an application scenario of the fast route table lookup scheme according to an embodiment of the present application.
Fig. 21 is a schematic diagram of packet forwarding according to an embodiment of the present application.
Fig. 22 is a schematic structural diagram of a routing device according to an embodiment of the present application.
Fig. 23 is a schematic structural diagram of another routing apparatus according to an embodiment of the present application.
Fig. 24 is a schematic structural diagram of a first routing device according to an embodiment of the present application.
Fig. 25 is a schematic structural diagram of a second routing device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood by those skilled in the art, 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 the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The terms "including" and "having," and any variations thereof in the description and claims of this application and the above-described drawings, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described in this specification can be combined with other embodiments.
In order to facilitate an understanding of the embodiments of the present application, the technical problems specifically addressed by the present application are further analyzed and presented. At present, the implementation of the routing table lookup includes various technical solutions, and the following two solutions are exemplarily listed below.
Scheme one, gradient descent Iterative Solution (ISTA) scheme.
In order to solve the problem of slow table lookup, various solutions are proposed in academia and industry, wherein table lookup is performed on a large-scale routing table requiring storage of multiple physical tables, and an ISTA scheme of hierarchical table lookup is proposed in industry, and is also a table lookup scheme of current mainstream equipment.
As shown in fig. 1, the root routing table is mainly stored in a Ternary Content Addressable Memory (TCAM), and may be called as a TCAM table, where the routing table lookup process of the ISTA scheme is as follows: firstly, inquiring an index of a data table 2 (VPS 2 table for short) of a Virtual Prefix search tree (VPS) structure in a root routing table (namely a TCAM table); then, inquiring a VPS2 table according to the index of the VPS2 table to obtain the index of a data table 1 (VPS 1table for short) of a virtual prefix search tree structure; then, inquiring the VPS1table according to the index of the VPS1table to obtain the index of a data table (RPS table for short) of a complete Prefix search tree (Rich Prefix Subtrie, RPS) structure; then, inquiring the RPS Table according to the Index of the RPS Table to obtain the Index (RE Index) of a Routing Engine Table (RE Table); and finally, querying the RE Table according to the RE Index to obtain a specific routing Table item, such as Forwarding information (Forwarding Info) and the like. As can be seen, the ISTA scheme takes at least 5-6 stages for a route lookup.
As shown in fig. 2, there are two IP address prefixes, "010" and "110", respectively. For the routing device R1 of the same network, for example, the IP address prefix "010" is first queried from the Node of the 1 st level of the search tree, that is, from the Root Node (Root Node) to the Node of the 2 nd level, the 1 st bit from left to right in the IP address prefix "010" is "0", so that when the Node of the 1 st level queries the Node of the 2 nd level, the Node of the 1 st level queries the left side of the search tree; the 2 nd bit counted from left to right in the IP address prefix "010" is "1", so that when a node of the 2 nd level queries a node of the 3 rd level, the node queries the right side of the search tree; since the 3 rd bit from left to right in the IP address prefix "010" is "0", when a Node in the 3 rd level is searched for a Node in the 4 th level, the Node in the 3 rd level is searched for a Leaf Node (Leaf Node) P1 by searching for a Node in the left side of the search tree. For example, the IP address prefix "110" is provided, and the 1 st bit counted from left to right in the IP address prefix "110" is "1", so that when a node of the 1 st level queries a node of the 2 nd level, the node queries the right side of the search tree; the 2 nd bit counted from left to right in the IP address prefix '110' is '1', so that when a node of the 2 nd level queries a node of the 3 rd level, the node queries the right side of the search tree; since the 3 rd bit from left to right in the IP address prefix "110" is "0", when a node of the 3 rd level is queried for a node of the 4 th level, the node is searched downward to the left of the search tree, and the leaf node P2 is found. In addition, as shown in fig. 2, the routing table look-up process for the routing device R2 of the same network is similar to that for the routing device R1.
The first scheme has the following defects: each address table lookup needs to go through 5-6 stages, and the consumption of resources is very large. In addition, the routing tables of neighboring routing devices within the same network have a very high similarity, because the routing prefixes are learned by the same Interior Gateway Protocol (IGP) and Border Gateway Protocol (BGP) route advertisements, and only slightly differ in Local configuration (Local Config) policy. For the same part, the table lookup operation of the upstream routing device, the downstream routing device needs to go through the same lookup operation, greatly affecting the table lookup efficiency.
Scheme two, a routing with a true scheme.
The clue route (routing with a true) scheme proposed by academia aims to establish a fast index at a downstream routing device by using the table lookup result of a forward adjacent routing device so as to establish a fast index table lookup at the downstream routing device.
As shown in fig. 3, the main practice of this scheme is that the routing device R1 carries a Clue of 5bits in the header, that is, sends to the routing device R2 a Clue Hash Table (Clue's Hash Table), and the routing device R2 performs fast IP lookup according to the Clue, which is similar to the rate of label switching, but saves more memory. The mechanism avoids repeating the calculation and table lookup, and disperses the whole table lookup process to all the routing devices along the way. Each routing device can help the downstream routing device to perform initial table lookup, so that the scheme can play a great role in the homogeneous IP network.
The second scheme has the following defects: the method is only suitable for homogeneous networks, an additional hash table needs to be established, if the network scale is large, the specification of the hash table is also large, the size of the hash table is similar to that of a full-scale linear table, and the method is not suitable for large networks.
To sum up, the main technical problems to be solved by the present application are: the method aims at solving the problems that the existing route table look-up scheme is low in efficiency and low in speed and the existing route table look-up scheme is not suitable for large networks, provides a fast and efficient route table look-up scheme, does not occupy too much storage space, and is effectively suitable for isomorphic and various heterogeneous networks.
Referring to fig. 4, fig. 4 is a schematic flow chart of a routing method according to an embodiment of the present application, where the routing method includes, but is not limited to, the following steps:
401. the second routing equipment sends a target message to the first routing equipment, the second routing equipment is downstream routing equipment of the first routing equipment, the target message comprises at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing equipment.
The first routing device may be a routing device R1 in this application, and the second routing device may be a routing device R2 in this application. The target message may be a Link Layer Discovery Protocol (LLDP) message. The at least one index is an index corresponding to at least one IP address prefix in the second routing device, that is, in the second routing device, the at least one index may be looked up according to the table lookup of the at least one IP address prefix.
In the present application, the IP address Prefix may be simply referred to as a Prefix (Prefix in english).
402. The first routing device receives a destination message from the second routing device.
403. After receiving a first packet, a first routing device sends a second packet to a second routing device, where the second packet includes the first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and at least one index includes the first target index.
The first routing device receives a first packet from an upstream routing device of the first routing device, and then sends the first packet and the first target index as a second packet to the second routing device, for example, the first target index may be added to a header of the first packet, so as to obtain the second packet. The first target index is used by the second routing device to determine that the egress port of the first packet means that the second routing device can determine, according to the first target index, to which downstream routing device or downstream routing devices of the second routing device the first packet is sent.
404. And the second routing equipment receives the second message from the first routing equipment.
After receiving the second message, the second routing device obtains the first target index from the second message, thereby determining which downstream routing device or downstream routing devices of the second routing device the first message is sent to according to the first target index, and sending the first message to the determined downstream routing devices.
In the embodiment of the application, the downstream second routing device sends the target message through the upstream first routing device, so as to send at least one index corresponding to at least one IP address prefix in the target message to the upstream first routing device; after receiving a first message to be forwarded, the first routing device sends a first target index and the first message in the at least one index to the second routing device as a second message, for example, the first target index is placed in a header of the first message and sent to the second routing device as the second message; the first target index is used for the second routing device to determine the egress port of the first packet, that is, the second routing device can quickly query which specific downstream routing device needs to forward the first packet to the second routing device according to the first target index, so that the efficiency of the second routing device in routing table lookup can be improved.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure. The Index of the routing engine table (english name is RE Index) is used to search the routing engine table, the Index of the data table of the complete prefix search tree structure (abbreviated as RPS table Index, english name is RPS Index) is used to search the data table of the complete prefix search tree structure, and the Index of the data table of the virtual prefix search tree structure (abbreviated as VPS table Index, english name is VPS Index) is used to search the data table of the virtual prefix search tree structure. It should be understood that the search tree described herein is also called a search tree.
In the embodiment of the present application, the routing table lookup is performed in stages, that is, the ternary content addressable memory table (TCAM table for short) is first looked up, then the data table 2 (VPS 2 table for short) of the virtual prefix search tree structure is looked up according to the lookup result of looking up the ternary content addressable memory table, then the data table 1 (VPS 1table for short) of the virtual prefix search tree structure is looked up according to the lookup result of looking up the VPS2 table, then the data table (RPS table for short) of the complete prefix search tree structure is looked up according to the lookup result of looking up the data table of the complete prefix search tree structure, and finally the routing engine table is looked up according to the lookup result of looking up the data table of the complete prefix search tree structure, so as to find out specific routing table entries. And at least one index of the present application includes at least one of an index of the routing engine table (i.e., a lookup result of looking up the RPS table), an index of the data table of the full prefix search tree structure (i.e., a lookup result of looking up the VPS1 table), and an index of the data table of the virtual prefix search tree structure (including an index of the VPS2 table and an index of the VPS1table, an index of the VPS2 table is a lookup result of looking up the TCAM table, and an index of the VPS1table is a lookup result of looking up the VPS2 table), so the first target index may be any one of an index of the routing engine table, an index of the TCAM table, an index of the VPS1table, an index of the VPS2 table, and an index of the RPS table. If the first target index is the index of the routing engine table, the second routing device can directly inquire the routing engine table according to the first target index to inquire the output port of the first message, so that the stage of inquiring a TCAM table, a VPS2 table, a VPS1table and an RPS table is omitted, and the efficiency of the second routing device in the table lookup of the routing is improved. If the first target index is the index of the RPS table, the second routing device can directly inquire the RPS table according to the first target index, and then inquire the routing engine table according to the table look-up result of the RPS table to look up the output port of the first message, so that the stage of inquiring the TCAM table, the VPS2 table and the VPS1table is omitted, and the efficiency of looking up the table by the second routing device can be improved. If the first target index is an index of a data table of the virtual prefix search tree structure, two cases are distinguished: the first target index is the index of the VPS1table, so that the second routing equipment can directly inquire the VPS1table according to the first target index, then check the RPS table according to the table look-up result of checking the VPS1table, and then inquire the routing engine table according to the table look-up result of checking the RPS table so as to check the output port of the first message, thus omitting the stages of inquiring the TCAM table and checking the VPS2 table; the first target index is the index of the VPS2 table, so that the second routing equipment can directly inquire the VPS2 table according to the first target index, then check the VPS1table according to the table look-up result of checking the VPS2 table, check the RPS table according to the table look-up result of checking the VPS1table, and then inquire the routing engine table according to the table look-up result of checking the RPS table to check the exit port of the first message, thus omitting the stage of inquiring the TCAM table; thereby also improving the efficiency of the second routing device routing table look-up.
In one possible implementation, the target message further includes the at least one IP address prefix; after receiving the target message from the second routing device, and before sending the second packet to the second routing device, the method further includes: the first routing equipment inquires a first target data table according to any IP address prefix in the at least one IP address prefix so as to determine a first target IP address prefix matched with the longest prefix of the any IP address prefix in the first target data table; the first routing equipment adds an index corresponding to any IP address prefix in the at least one index into an entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table; if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
For example, please refer to fig. 5, fig. 5 is a schematic diagram illustrating a fast routing lookup table according to an embodiment of the present application. As shown in fig. 5, the table entry of the VPS2 table includes a Prefix (Prefix) and an exit port (Val), where Val represents an index pointing to the next-level table lookup; for example, a Val of 0 indicates that the next lookup table looks at the VP 1table on the left side of FIG. 5, and a Val of 0 indicates that the next lookup table looks at the VPS1table on the left side of FIG. 5. The table items of the VPS1table comprise a Prefix and a Val, wherein the Val represents an index pointing to the next-level table look-up; for example, for one of the VPS1 tables, a Val of 00 indicates that the next level of lookup is looking up the left RPS table in fig. 5, and a Val of 01 indicates that the next level of lookup is looking up the left RPS table in fig. 5. The entries of the RPS table include Prefix, val, and the Index of the routing engine table (RE Index). The entry of the routing engine Table (RE Table) includes RE Index and egress Port (Out Port), where Out Port is 1 for egress Port number 1 and Out Port is 2 for egress Port number 2. Fig. 5 shows a case where at least one IP address Prefix sent by the routing device R2 to the routing device R1 is an IP address Prefix (Prefix) in the RPS table in the routing device R2, which is specifically as follows:
(1) The routing device R2 sends the Prefix in the locally stored RPS table and the RE Index corresponding to the Prefix to the routing device R1 through an LLDP message.
(2) The routing device R1 performs a local table lookup for the Prefix sent by the routing device R2, that is, looks up the RPS table locally stored by the routing device R1, and looks up the Prefix matched with the longest Prefix in the RPS table locally stored by the routing device R1, where the Prefix matched with the longest Prefix may be completely consistent with the Prefix sent by the routing device R2; then, an R2 RE Index entry is added to the RE Table locally stored by the routing device R1, because the RE Index in the RE Table locally stored by the routing device R1 is the RE Index in the RPS Table locally stored by the routing device R1, so that the RE Index corresponding to the Prefix matching the longest Prefix in the RPS Table locally stored by the routing device R1 is also in the RE Table locally stored by the routing device R1, and the RE Index sent by the routing device R2 is added to the position corresponding to the RE Index corresponding to the Prefix matching the longest Prefix in the R2 RE Index entry. For example, as shown in the gray filling part in fig. 5, the RE Index sent by the routing device R2 is 1, the Prefix matched with the Prefix longest Prefix sent by the routing device R2 in the RPS Table locally stored by the routing device R1 is 010, the Prefix (i.e., 010) matched with the longest Prefix is 1 in the RPS Table locally stored by the routing device R1 and the corresponding RE Index in the RE Table, and then the RE Index (i.e., 1) sent by the routing device R2 is added to the same column position of the RE Index (1) corresponding to the Prefix (i.e., 010) matched with the longest Prefix in the R2 RE Index Table entry.
(3) After the routing device R1 receives the message, it searches the RE Table locally stored by the routing device R1 to obtain that the egress port corresponding to the message is the routing device R2, and meanwhile, it also obtains the R2 RE Index by searching the RE Table locally stored by the routing device R1, places the R2 RE Index into the header of the message to carry and send the message to the routing device R2.
(4) The routing device R2 receives the RE Index (i.e., R2 RE Index) sent by the routing device R1, and directly checks the RE Table locally stored by the routing device R2, thereby omitting the multi-stage Table lookup process from the root Table (TCAM Table) to the RPS Table. Similarly, if there is a routing device R3 downstream of the routing device R2, the routing device R2 adds the locally searched RE Index (i.e. R3 RE Index) of the routing device R3 to the header and sends the header to the routing device R3, which is used as auxiliary information for table lookup of the routing device R3, so that the routing device R3 can also quickly lookup a table. It should be understood that all downstream routing devices after routing device R3 may repeat the process.
Similarly, when at least one IP address Prefix sent to the routing device R1 by the routing device R2 is an IP address Prefix (Prefix) in the VPS1table in the routing device R2, at least one index sent to the routing device R1 by the routing device R2 is an index of an RPS table to be locally stored by the routing device R2; in this case, the routing device R1 searches the VPS1table locally stored in the routing device R1 for the Prefix sent by the routing device R2, searches the VPS1table locally stored in the routing device R1 for the Prefix with the longest Prefix match, and then adds at least one index for adding the routing device R2 to the routing device R1 in the RPS table locally stored in the routing device R1; after the routing device R1 receives the message, looking up the RPS table locally stored by the routing device R1 can obtain any index in at least one index sent to the routing device R1 by the routing device R2, and putting any index into the header of the message to carry and send the message to the routing device R2; the routing device R2 receives any index sent by the routing device R1, and directly checks the RPS table locally stored by the routing device R2, thereby omitting a multi-stage table look-up process from the root table (TCAM table) to the VPS1 table.
Similarly, when at least one IP address Prefix sent to the routing device R1 by the routing device R2 is an IP address Prefix (Prefix) in the VPS2 table in the routing device R2, at least one index sent to the routing device R1 by the routing device R2 is an index of the VPS1table to be locally stored by the routing device R2; in this case, the routing device R1 searches the VPS2 table locally stored in the routing device R1 for the Prefix sent by the routing device R2, searches the VPS2 table locally stored in the routing device R1 for the Prefix with the longest Prefix match, and then adds at least one index for adding the routing device R2 to the routing device R1 in the VPS1table locally stored in the routing device R1; after the routing device R1 receives the message, looking up the VPS1table locally stored by the routing device R1 can obtain any index in at least one index sent to the routing device R1 by the routing device R2, and putting any index into the header of the message to carry and send the message to the routing device R2; the routing device R2 receives any index sent by the routing device R1, and directly checks the VPS1table locally stored by the routing device R2, thereby omitting a multi-stage table look-up process from the root table (TCAM table) to the VPS2 table.
Similarly, when at least one IP address Prefix sent to the routing device R1 by the routing device R2 is an IP address Prefix (Prefix) in a TCAM table in the routing device R2, at least one index sent to the routing device R1 by the routing device R2 is an index of a VPS2 table to be locally stored by the routing device R2; in this case, the routing device R1 searches a TCAM table locally stored by the routing device R1 for the Prefix sent by the routing device R2, searches the TCAM table locally stored by the routing device R1 for the Prefix with the longest Prefix match, and then adds at least one index for adding the routing device R2 to the routing device R1 in a VPS2 table locally stored by the routing device R1; after the routing device R1 receives the message, looking up the VPS2 table locally stored by the routing device R1 can obtain any index in at least one index sent to the routing device R1 by the routing device R2, and place any index in the header of the message to carry and send the index to the routing device R2; the routing device R2 receives any index sent by the routing device R1, and directly checks the VPS2 table locally stored by the routing device R2, thereby omitting the table checking process of checking a root table (TCAM table).
In this embodiment of the present application, the second routing device may further send at least one IP address prefix and at least one index corresponding to the at least one IP address prefix to the first routing device, and the first routing device may first add each IP address prefix in the at least one IP address prefix to the second target data table. Thus, after receiving the first message sent by the upstream routing device, the first routing device may look up the first target index in the second target data table in the process of looking up the routing table look-up of the egress port of the first message, and place the first target index in the header of the first message as the second message to send to the second routing device, thereby facilitating the second routing device to look up the table by fast routing. Specifically, for any IP address prefix in the at least one IP address prefix, if the any IP address prefix is an IP address prefix in an RPS table in the second routing device, the first routing device queries, in the RPS table therein, a first target IP address prefix matching the longest prefix of the any IP address prefix, then adds an index corresponding to the any IP address prefix in the at least one index to an entry corresponding to a second target index in a routing engine table therein, and the second target index is an index corresponding to the first target IP address prefix in the RPS table in the first routing device; therefore, in the process of table lookup of the first routing device, the first target index can be looked up in the routing engine table, and the first target index is sent to the second routing device; therefore, the second routing device can directly query the routing engine table according to the first target index without querying the TCAM table, the VPS2 table, the VPS1table and the RPS table. If the any IP address prefix is an IP address prefix in a VPS1table in the second routing equipment, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of the any IP address prefix in the VPS1table, then an index corresponding to the any IP address prefix in at least one index is added in a table entry corresponding to a second target index in the RPS table, and the second target index is an index corresponding to the first target IP address prefix in the VPS1table in the first routing equipment; therefore, in the process of table lookup of the first routing device, the first target index can be looked up in the RPS table, and the first target index is sent to the second routing device; therefore, the second routing equipment can directly query the RPS table according to the first target index without querying the TCAM table, the VPS2 table and the VPS1table firstly. If the any IP address prefix is an IP address prefix in a VPS2 table in the second routing equipment, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of the any IP address prefix in the VPS2 table, then an index corresponding to the any IP address prefix in at least one index is added in an entry corresponding to a second target index in a VPS1table, and the second target index is an index corresponding to the first target IP address prefix in the VPS2 table in the first routing equipment; thus, in the process of table lookup of the first routing device, the first target index can be looked up in the VPS1table therein, and the first target index is sent to the second routing device; therefore, the second routing equipment can directly query the VPS1table according to the first target index without querying the TCAM table and the VPS2 table firstly. If any IP address prefix is an IP address prefix in a TCAM table, the first routing equipment inquires a first target IP address prefix matched with the longest prefix of any IP address prefix in the TCAM table, then an index corresponding to any IP address prefix in at least one index is added in an entry corresponding to a second target index in a VPS2 table, and the second target index is an index corresponding to the first target IP address prefix in the TCAM table in the first routing equipment; therefore, in the process of table lookup of the first routing device, a first target index can be looked up in a VPS2 table in the table lookup process of the first routing device, and the first target index is sent to the second routing device; thus, the second routing device can directly query the VPS2 table therein according to the first target index without first querying the TCAM table.
When the table entries of the adjacent upstream and downstream routing devices are not completely consistent, the scheme that the table entries cannot use the fast routing table lookup provided by the application exists in the downstream routing device. In order to enable any table entry in the downstream routing equipment to use the scheme of the rapid routing table lookup provided by the application, two methods are specifically selectable, wherein the method I is a complete prefix search tree/virtual prefix search tree advertisement method, and the method II is a static configuration prefix advertisement method.
The first method is a complete prefix search tree/virtual prefix search tree advertisement method.
Specifically, when the sizes of the complete prefix search trees in the upstream and downstream routing devices are consistent, a complete prefix search tree advertisement method is adopted; and when the sizes of the complete prefix search trees in the upstream and downstream routing equipment are consistent, adopting a virtual prefix search tree advertisement method. If the depth difference between the complete prefix search trees in the upstream and downstream routing equipment is not more than 1, the complete prefix search trees in the upstream and downstream routing equipment are consistent in scale; if the depth difference between the complete prefix search trees in the upstream and downstream routing devices is greater than 1, the complete prefix search trees in the upstream and downstream routing devices are not in the same scale. These two cases are specifically analyzed as follows:
in the first case: the complete prefix search tree has consistent scale, and a complete prefix search tree advertising method is adopted.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: the second routing equipment sends a first binary string to the first routing equipment, wherein the first binary string is obtained by coding the second complete prefix search tree; the first routing device receiving a first binary string from the second routing device; the first routing equipment obtains a third complete prefix search tree according to a second binary string and the first complete prefix search tree, wherein the second binary string is obtained after the first binary string and the third binary string are subjected to OR operation, and the third binary string is obtained by encoding the first complete prefix search tree; the first routing equipment adds table entries in the first data table according to the third complete prefix search tree; wherein a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared to the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, a position of the first target node in the third complete prefix search tree is the same as a position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node.
The IP address prefix corresponding to the second target node refers to the IP address prefix corresponding to the second target node in a second data table; the Index corresponding to the nearest ancestor node of the first target node is also the table look-up result of the first data table, and the RE Index in the first data table (RPS table) is also the Index of the routing engine table; or, the Index corresponding to the nearest ancestor node of the first target node is an Index (RE Index) of a routing engine table in the first routing device.
As shown in fig. 6, the first routing device is a routing device R1, the first data Table is an RPS Table (RPS Table) in the routing device R1, the data Table of the complete prefix search tree structure corresponding to the first complete prefix search tree in the routing device R1 is the first data Table, that is, the complete prefix search tree corresponding to the first data Table is the first complete prefix search tree; the second routing device is a routing device R2, the second data Table is an RPS Table (RPS Table) in the routing device R2, the data Table of the complete prefix search tree structure corresponding to the second complete prefix search tree in the routing device R2 is the second data Table, that is, the complete prefix search tree corresponding to the second data Table is the second complete prefix search tree. The depth of the first full prefix search tree is 3 and the depth of the second full prefix search tree is also 3, but since the position of the lower right third level of the first full prefix search tree has no node and the position of the lower left third level of the second full prefix search tree has no node, the topology of the first full prefix search tree is different from the topology of the second full prefix search tree. For example, if there is no node at the corresponding position of the first complete Prefix search tree in the node a in the second complete Prefix search tree, the node a cannot adopt the fast route table lookup scheme provided by the present application, the Prefix of the node a is 011 in the second data table, and the RE Index corresponding to the node a is 4, that is, the table entries in the second data table that include the Prefix of 011 and the RE Index of 4 cannot adopt the fast route table lookup scheme provided by the present application. In order to enable the node a to adopt the fast routing table lookup scheme provided by the present application, a node needs to exist at a position corresponding to the node a in the first complete Prefix search tree, that is, a Prefix matching the longest Prefix of 011 exists in the first data table and the Prefix in the second data table.
Wherein, the first case can be divided into the following steps:
(1) The search tree is encoded into a binary string.
In this application, a first routing device and a second routing device encode a locally stored search tree into a string of binary strings (or referred to as binary numbers), and the encoding principle is as follows: the search tree is first filled locally into a full binary tree (empty nodes are filled in places without nodes), and then encoded into a binary string, wherein nodes with Prefix are encoded into 1, and nodes without Prefix and empty nodes are encoded into 0.
In an example, the process of the second routing device encoding the second full prefix search tree includes: supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree; encoding the fifth complete prefix search tree; and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
As shown in fig. 7, the depth of the second complete prefix search tree is 3, and the second complete prefix search tree has three levels; the position of the third hierarchy at the lower left of the second complete prefix search tree has no node, and the node is supplemented to be a null node (a node indicated by a dotted line in fig. 7), so that a fifth complete prefix search tree is obtained; the node having Prefix in the fifth full Prefix search tree (the black-filled node in fig. 7) is encoded as 1, and the empty node and the node having no Prefix in the fifth full Prefix search tree (the unfilled node in fig. 7) are encoded as 0, thereby obtaining the first binary string of "0100111".
In an example, the process of the first routing device encoding the first full prefix search tree includes: supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree; encoding the fourth complete prefix search tree; the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the node codes of the empty node and the node corresponding to the non-IP address prefix in the fourth complete prefix search tree are 0.
As shown in fig. 8, the depth of the first full prefix search tree is 3, and the first full prefix search tree has three levels; a node is not located at a third level below and to the right of the first complete prefix search tree, and the node is supplemented to be a null node (a node indicated by a dotted line in fig. 8), so that a fourth complete prefix search tree is obtained; the node with Prefix in the fourth full Prefix search tree (the node filled in black in fig. 8) is encoded as 1, and the empty node and the node without Prefix in the fourth full Prefix search tree (the node without padding in fig. 8) are encoded as 0, thereby obtaining the third binary string as "0011110".
Fig. 9 shows results of the first routing device and the second routing device after encoding the respective complete prefix search trees, where in fig. 9, the first routing device is a routing device R1, and the second routing device is a routing device R2; the search tree in the routing device R1 is a fourth complete prefix search tree, and the search tree in the routing device R2 is a fifth complete prefix search tree.
In the foregoing two examples, the process of the first routing device encoding the first full prefix search tree to obtain the third binary string is as follows: the first complete prefix search tree is supplemented into a full binary tree to obtain a fourth complete prefix search tree containing supplemented empty nodes, then nodes corresponding to IP address prefixes in the fourth complete prefix search tree are coded into 1, empty nodes in the fourth complete prefix search tree and nodes corresponding to non-IP address prefixes are coded into 0, and therefore a third binary string is obtained. The process of the second routing device coding the second complete prefix search tree to obtain the first binary string is the same as the process of the first routing device coding the first complete prefix search tree to obtain the third binary string. In this way, the first binary string and the third binary string have the same length, so that the second binary string can be obtained after the first binary string and the third binary string are or-operated.
(2) And (4) interaction of binary strings.
The downstream routing device sends the binary string obtained by local coding to the upstream routing device, that is, the second routing device sends the first binary string obtained by local coding to the first routing device.
(3) And reconstructing the search tree.
After receiving the first binary string, the first routing device performs or operation (merging) on the first binary string and a third binary string obtained by local coding of the first routing device to obtain a second binary string, and then establishes a new complete prefix search tree according to the second binary string and the first complete prefix search tree, namely obtains a third complete prefix search tree; that is, the fourth complete prefix search tree and the fifth complete prefix search tree are combined to build and obtain a third complete prefix search tree.
As shown in fig. 10, the first binary string is "0100111", the third binary string is "0011110", and the second binary string resulting from or operation of the first binary string and the third binary string is "0111111"; then, compared with the first complete prefix search tree, the third complete prefix search tree constructed for "0111111" according to the second binary string is supplemented with a leaf node (e.g., a gray-filled node in fig. 10) at the lower left of the third level of the first complete prefix search tree; the supplemental leaf node has a Prefix, the Prefix of the supplemental leaf node is derived from the Prefix of the node at the same position in the fifth full Prefix search tree, and the Prefix of the node in the fifth full Prefix search tree is the Prefix of the node at the same position in the second full Prefix search tree, so that the Prefix of the supplemental leaf node is derived from the Prefix of the node at the same position in the second full Prefix search tree.
(4) And adding the table entries.
For the added node (i.e., the supplemented node) of the third complete Prefix search tree relative to the first complete Prefix search tree, the first routing device needs to add an entry in the first data table, and add the Prefix of the added node in the added entry; in addition, the RE Index needs to be added to the added entry, and the addition of the RE Index to the added entry can copy the RE Index corresponding to the nearest ancestor node of the added node.
As shown in fig. 11, the gray-filled node in fig. 11 is an added node, the Prefix of the added node is 011, an entry (the entry filled with gray in fig. 11) is added to the first data table, and the Prefix (i.e., 011) of the added node is filled therein; the Prefix of the nearest ancestor node of the added node is 01, the RE Index corresponding to the nearest ancestor node of the added node is 4, and the RE Index (i.e., 4) corresponding to the nearest ancestor node of the added node is filled in the added entry.
As shown in fig. 12, fig. 12 is a schematic diagram of a result obtained by using a complete prefix search tree advertisement method, and after node addition is performed on the first complete prefix search tree and entry addition is performed on the first data table, a corresponding entry of the node a or the node a in the second data table may use the fast route table lookup scheme provided in the present application. Specifically, the node corresponding to the node a in the first complete prefix search tree is a newly added node (gray-filled node) in the first complete prefix search tree, and the entry corresponding to the node a in the second data table has a corresponding entry (gray-filled entry) in the first data table; the fast table look-up process corresponding to the node a is as follows: the routing device R2 sends Prefix (i.e., 011) and RE Index (i.e., 4) in the corresponding entry of the node a in the second data table to the routing device R1 through the LLDP message; the routing device R1 searches the first data table according to the Prefix (i.e., 011) sent by the routing device R2, obtains the Prefix (i.e., 011) with the longest Prefix match from the newly added entry (gray-filled entry) in the first data table, and finds the RE Index (i.e., 4) corresponding to the Prefix (i.e., 011) with the longest Prefix match; the routing device R1 adds the RE Index sent by the routing device R2 (for distinction, denoted as R2 RE Index, whose value is 4) to the entry whose RE Index is 4 in its routing engine table; after receiving the first message, the routing device R1 searches the routing engine table to obtain the R2 RE Index, and places the R2 RE Index in the header of the first message as a second message to be sent to the routing device R2; and after receiving the second message, the routing device R2 obtains the R2 RE Index, and directly searches a routing engine table in the routing device R2 according to the R2 RE Index, thereby realizing quick table search.
It should be noted that, the upstream-downstream relationship of the routing device in the network may be variable, and when the upstream-downstream relationship between the routing device R1 and the routing device R2 is interchanged, that is, when the routing device R1 is a downstream routing device and the routing device R2 is an upstream routing device, as shown in fig. 6, 9, or 12, the node b in the first complete prefix search tree, the fourth complete prefix search tree, or the third complete prefix search tree in the routing device R1 cannot adopt the fast routing table lookup scheme provided in the present application; or, the table entry corresponding to the node b in the first data table and including Prefix of 000 and RE Index of 1 cannot adopt the fast routing table lookup scheme provided by the present application. Therefore, a complete prefix search tree notification method is adopted, nodes are added to the second complete prefix search tree to obtain a sixth complete prefix search tree, gray-filled nodes in the sixth complete prefix search tree are newly added nodes, and the positions of the newly added nodes in the sixth complete prefix search tree are the same as the positions of the nodes b in the first complete prefix search tree, the fourth complete prefix search tree or the third complete prefix search tree; and adding table entries to the second data table, wherein the table entries filled with gray color in the second data table are newly added aiming at the corresponding table entries containing Prefix 000 and RE Index1 in the first data table of the node b, so that the node b can also adopt the fast routing table look-up scheme provided by the application.
It should be further noted that, in the foregoing, the complete prefix search tree advertisement method is described by taking the same depth between the complete prefix search trees in the upstream and downstream routing devices as an example, it should be understood that, the same applies when the depth difference between the complete prefix search trees in the upstream and downstream routing devices is 1, and the description of the present application is not repeated.
In the embodiment of the present application, a first data table in a first routing device is a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the first data table is a first complete prefix search tree; a second data table in the second routing device is also a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the second data table is a second complete prefix search tree; if the depth of the first complete prefix search tree is the same as the depth of the second complete prefix search tree and the topology of the first complete prefix search tree is different from the topology of the second complete prefix search tree, or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1, at least one entry exists in the second data table, and no entry corresponding to the entry exists in the first data table. If at least one IP address prefix and at least one index sent to the first routing device by the second routing device are respectively the IP address prefix and the index in the second data table, for any IP address prefix in the at least one IP address prefix, the first routing device can inquire the IP address prefix matched with the longest prefix of the any IP address prefix in the first data table, and then adds the at least one index in the routing engine table of the first routing device, so as to realize the rapid routing table look-up scheme provided by the application. Since there is at least one entry in the second data table, and there is no entry corresponding to the entry in the first data table, for the IP address prefix in the at least one entry, the IP address prefix matching the longest prefix cannot be searched in the first data table, and further, the index in the at least one entry cannot be added in the routing engine table of the first routing device, so that the at least one entry cannot adopt the fast routing table lookup scheme provided by the present application. Therefore, the second routing equipment encodes the second complete prefix search tree to obtain a first binary string, and sends the first binary string to the first routing equipment; the first routing equipment also encodes the first complete prefix search tree to obtain a third binary string, performs OR operation on the received first binary string and the third binary string to obtain a second binary string, and then adds nodes in the first complete prefix search tree according to the second binary string to obtain a third complete prefix search tree; it should be understood that the entries in the data table of the complete prefix search tree structure are embodied in the complete prefix search tree, i.e., the nodes in the complete prefix search tree, so that the added nodes of the third complete prefix search tree compared to the first complete prefix search tree, i.e., the added entries in the first data table. The second target IP address prefix in the table entry added in the first data table is an IP address prefix corresponding to a first target node added in a third complete prefix search tree compared with the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to the second target node in the second complete prefix search tree, and meanwhile, the position of the first target node in the third complete prefix search tree is the same as the position of the second target node in the second complete prefix search tree; the third target index in the added entry in the first data table is the index corresponding to the nearest ancestor node of the first target node. Thus, for at least one entry in the second data table, which originally does not have an entry corresponding to the first data table in the first data table, since an entry is added to the first data table, and an IP address prefix in the entry added to the first data table is an IP address prefix in the at least one entry in the second data table; then, for the IP address prefix in the at least one table entry, the table entry corresponding to the IP address prefix exists in the first data table, that is, the added table entry is a table entry corresponding to the IP address prefix, so that the first routing device may query the IP address prefix matching the longest prefix of the at least one table entry in the first data table after the table entry is added, that is, query the at least one table entry itself, so that the first routing device may query the index in the at least one table entry in its routing engine table, and may add the index in the at least one table entry to the header of the first packet as the second packet to be sent to the second routing device, thereby implementing that the at least one table entry may also adopt the fast routing table lookup scheme provided by the present application.
In the second case: and (4) adopting a virtual prefix search tree notification method when the sizes of the complete prefix search trees are inconsistent.
Specifically, if the depth difference between the complete prefix search trees in the upstream and downstream routing devices is greater than 1, the sizes of the complete prefix search trees in the upstream and downstream routing devices are not consistent, or the size difference between the complete prefix search trees in the upstream and downstream routing devices is large, a virtual prefix search tree advertisement method is adopted in the case, so that the sizes of the virtual prefix search trees of the upstream and downstream routing devices are consistent, and therefore the index of the RPS table or the index of the VPS table is interacted between the upstream and downstream routing devices, and rapid routing table lookup is achieved.
In a possible implementation manner, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps: a fourth binary string from the second routing device to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree; the first routing device receiving a fourth binary string from the second routing device; the first routing device obtains a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, wherein the fifth binary string is obtained by performing or operation on a fourth binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; the first routing equipment adds table entries in the first data table according to the second virtual prefix search tree; a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, an IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
As shown in fig. 13, the first routing device is a routing device R1, the first data Table is an RPS Table (RPS Table) in the routing device R1, the data Table of the complete prefix search tree structure corresponding to the first complete prefix search tree in the routing device R1 is the first data Table, that is, the complete prefix search tree corresponding to the first data Table is the first complete prefix search tree; the second routing device is a routing device R2, the second data Table is an RPS Table (RPS Table) in the routing device R2, the data Table of the complete prefix search tree structure corresponding to the second complete prefix search tree in the routing device R2 is the second data Table, that is, the complete prefix search tree corresponding to the second data Table is the second complete prefix search tree. The first full prefix search tree has a depth of 1 and the second full prefix search tree has a depth of 3, so that the first full prefix search tree is different from the second full prefix search tree in scale. Therefore, the nodes at the second level and the third level in the second complete prefix search tree (for example, the nodes enclosed by the oval circles in fig. 13) cannot adopt the fast route table lookup scheme provided by the present application.
Wherein, the second case can be divided into the following steps:
(1) And generating a virtual prefix search tree.
The second routing device (i.e., the downstream routing device) virtualizes a part of the nodes in the second complete prefix search tree into one node according to the difference between the scale of the first complete prefix search tree and the scale of the second complete prefix search tree, thereby generating the first virtual prefix search tree.
As shown in fig. 13, the routing device R2 virtualizes three lower left nodes and three lower right nodes (e.g., nodes enclosed by an oval circle in a dashed line in fig. 13) in the second complete prefix search tree as one node, so as to obtain a first virtual prefix search tree, which is shown in fig. 14. In addition, the entries corresponding to the two virtual nodes in the first virtual prefix search tree are shown in the third data Table in fig. 14, where the third data Table is a data Table (VPS 1Table, that is, VPS1 Table) of the virtual prefix search tree structure; wherein, prefix in the third data table represents Prefix, and RPS Index represents Index of RPS table (i.e. table lookup result of looking up VPS1 table).
(2) The search tree is encoded into a binary string.
The first routing device encodes the first complete prefix search tree into a third binary string, and the second routing device encodes the first virtual prefix search tree into a fourth binary string, according to the encoding principle: the node with Prefix is coded as 1, and the node without Prefix and the null node are coded as 0.
As shown in fig. 14, the first full Prefix search tree has only one root node (also called a leaf node) and the node is a node having Prefix, so that the third binary string encoded by the first full Prefix search tree is "1". The first virtual Prefix search tree is provided with a root node and two leaf nodes, wherein the root node is a node without Prefix and is coded as 0; two leaf nodes are nodes with Prefix and are coded as 1; so the fourth binary string encoded by the first virtual prefix search tree is "011".
(3) And (4) interaction of binary strings.
The downstream routing device sends the binary string obtained by local coding to the upstream routing device, that is, the second routing device sends the fourth binary string obtained by local coding to the first routing device.
(4) And reconstructing the search tree.
And after receiving the fourth binary string, the first routing equipment performs OR operation (merging) on the fourth binary string and a third binary string obtained by local coding of the first routing equipment to obtain a fifth binary string, and then establishes a new second virtual prefix search tree according to the fifth binary string and the first complete prefix search tree.
As shown in fig. 15, the third binary string is "1", the fourth binary string is "011", and the fifth binary string resulting from the or operation of the third binary string and the fourth binary string is "111"; then, a second virtual prefix search tree is constructed according to the fifth binary string of "0111111" and the first complete prefix search tree, and compared with the first complete prefix search tree, the second virtual prefix search tree is supplemented with two leaf nodes (such as nodes filled with oblique lines in fig. 15) in the second level of the first complete prefix search tree; the supplemental leaf node is a node at the same position in the first virtual Prefix search tree, the supplemental leaf node has Prefix, and the Prefix of the supplemental leaf node is the Prefix of the node at the same position in the first virtual Prefix search tree.
(5) And adding the table entries.
For the added node (i.e., the supplemented node) of the second virtual Prefix search tree relative to the first complete Prefix search tree, the first routing device needs to add an entry in the first data table, and add the Prefix of the added node in the added entry; the Prefix in the added entry of the first data table is the Prefix of the virtual node added by the second virtual Prefix search tree relative to the first complete Prefix search tree, and the Prefix of the virtual node added by the second virtual Prefix search tree relative to the first complete Prefix search tree is also the Prefix in the third data table, so the Prefix in the added entry of the first data table is the Prefix in the third data table. In addition, an Index (RPS Index) needs to be added to the added entry of the first data table, and the addition of the RPS Index to the added entry can copy the RPS Index corresponding to the nearest ancestor node of the added node.
As shown in fig. 16, the second virtual prefix search tree adds two virtual nodes relative to the first full prefix search tree, so the first data table adds two entries (the gray-filled entries in fig. 16); as shown in the third data table, the Prefix of one virtual node is 00, the Prefix of the other virtual node is 01, and the prefixes of the two virtual nodes are added to the first data table (the gray-filled entry in fig. 16); in the second virtual prefix search tree, the nearest ancestor nodes of the two virtual nodes are root nodes of the second virtual prefix search tree, so that the RPS indexes added in the two entries of the first data table copy the RPS indexes corresponding to the root nodes of the second virtual prefix search tree; as shown in the first data table after the entries are added, the RPS Index corresponding to the root node of the second virtual prefix search tree is 1, and then the RPS indexes in the two entries added to the first data table are both 1.
In this case, after the virtual prefix search tree advertisement method is adopted, for nodes that are not virtualized in the second complete prefix search tree, the fast routing table lookup scheme provided by the present application may still be adopted, and the fast routing table lookup process corresponding thereto is: the routing device R2 sends the Prefix and RE Index in the corresponding table entry of the node in the second data table to the routing device R1 through LLDP message; the routing equipment R1 searches a first data table according to the Prefix sent by the routing equipment R2, obtains the Prefix matched with the longest Prefix in the first data table, and searches the RE Index corresponding to the Prefix matched with the longest Prefix; the routing device R1 adds the RE Index (for distinction, denoted as R2 RE Index) sent by the routing device R2 in the table entry where the RE Index corresponding to the Prefix matched with the longest Prefix is located in its routing engine table; after receiving the first message, the routing device R1 searches a routing engine table of the first message to obtain the R2 RE Index, and places the RE Index in the header of the first message as a second message to be sent to the routing device R2; and after receiving the second message, the routing equipment R2 obtains the R2 RE Index, and directly searches a routing engine table in the routing equipment R2 according to the R2 RE Index, thereby realizing rapid table search.
For the virtualized nodes in the second complete prefix search tree, the fast routing table lookup scheme provided by the application is also adopted, and the corresponding fast routing table lookup process is as follows: the routing device R2 sends the Prefix and the RPS Index in the corresponding table entry in the third data table to the routing device R1 through an LLDP message; the routing device R1 searches the first data table according to the Prefix sent by the routing device R2, obtains the Prefix matched with the longest Prefix in the first data table, and finds the RPS Index corresponding to the Prefix matched with the longest Prefix; the routing device R1 adds RPS Index (denoted as R2 RPS Index for distinction) sent by the routing device R2 to the entry of the RPS Index corresponding to the Prefix matching the longest Prefix in the first data table (RPS table) of the routing device R1; after receiving the first message, the routing device R1 searches a first data table (RPS table) to obtain the R2 RPS Index, and places the R2 RPS Index in the header of the first message as a second message to be sent to the routing device R2; after receiving the second packet, the routing device R2 obtains the R2 RPS Index, directly searches a second data table (RPS table) in the routing device R2 according to the R2 RPS Index to obtain a corresponding RE Index, and then searches a routing engine table according to the RE Index, thereby implementing fast table lookup.
As shown in fig. 17, for example, with Prefix of 01 and RPS Index of 2 in the third data table, the routing device R2 sends Prefix (that is, 01) and RPS Index (that is, 2) to the routing device R1 through an LLDP message; the routing device R1 looks up the first data table (RPS table) according to the Prefix (i.e. 01) sent by the routing device R2, obtains the Prefix (i.e. 01) with the longest Prefix match in the first data table, and looks up the RE Index (i.e. 1) corresponding to the Prefix (i.e. 01) with the longest Prefix match; the routing device R1 adds the RPS Index (for distinction, denoted as R2 RPS Index, whose value is 2) sent by the routing device R2 to the entry of the RE Index (i.e. 1) corresponding to the Prefix (i.e. 01) with the longest Prefix match in the first data table; after receiving the first message, the routing device R1 looks up the first data table to obtain the R2 RPS Index (the value is 2), and places the Index in the header of the first message as a second message to be sent to the routing device R2; after receiving the second packet, the routing device R2 obtains the R2 RPS Index (the value of which is 2), directly searches a second data table (RPS table) in the routing device R2 according to the R2 RPS Index (the value of which is 2) to obtain a corresponding RE Index, and then searches a routing engine table according to the RE Index, thereby implementing a fast table lookup. In addition, similar operations are performed for Prefix of 00 and RPS Index of 1 in the third data table in fig. 17.
In the embodiment of the present application, a first data table in a first routing device is a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the first data table is a first complete prefix search tree; a second data table in the second routing equipment is also a data table of a complete prefix search tree structure, and a complete prefix search tree corresponding to the second data table is a second complete prefix search tree; if the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is greater than 1, then there is at least one entry in the second data table that does not have an entry in the first data table corresponding thereto. If at least one IP address prefix and at least one index sent to the first routing device by the second routing device are respectively the IP address prefix and the index in the second data table, for any IP address prefix in the at least one IP address prefix, the first routing device can inquire the IP address prefix matched with the longest prefix of the any IP address prefix in the first data table, and then adds the at least one index in the routing engine table of the first routing device, so as to realize the rapid routing table look-up scheme provided by the application. Since there is at least one entry in the second data table, and there is no entry corresponding to the entry in the first data table, for the IP address prefix in the at least one entry, the IP address prefix matching the longest prefix cannot be searched in the first data table, and further, the index in the at least one entry cannot be added in the routing engine table of the first routing device, so that the at least one entry cannot adopt the fast routing table lookup scheme provided by the present application. For this purpose, the second routing device obtains the first virtual prefix search tree according to the second complete prefix search tree, for example, virtualizes a plurality of nodes in the second complete prefix search tree into one node, thereby obtaining the first virtual prefix search tree; then the second routing equipment encodes the first virtual prefix search tree to obtain a fourth binary string, and sends the fourth binary string to the first routing equipment; the first routing device also encodes the first complete prefix search tree to obtain a third binary string, performs or operation on a received fourth binary string and the third binary string to obtain a fifth binary string, and then adds nodes in the first complete prefix search tree according to the fifth binary string, namely adds the nodes in the first virtual prefix search tree to the first complete prefix search tree, so that a virtual prefix search tree is obtained after the nodes are added in the first complete prefix search tree, namely the second virtual prefix search tree; it should be appreciated that the added nodes of the second virtual prefix search tree as compared to the first full prefix search tree are also added entries in the first data table. The second target IP address prefix in the added table entry of the first data table is an IP address prefix corresponding to a third target node which is added in the second virtual prefix search tree and is compared with the first complete prefix search tree, the IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, meanwhile, the IP address prefix corresponding to the fourth target node is an IP address prefix in the third data table, the table look-up result of the third data table is used for looking up the second data table, and the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree; that is, the third data table is a data table of a virtual prefix search tree structure corresponding to the first virtual prefix search tree, and the first virtual prefix search tree is virtually obtained by the second complete prefix search tree, so the table look-up result of the third data table is used for looking up the second data table; in addition, the third target index in the added entry of the first data table is the index corresponding to the nearest ancestor node of the third target node. Thus, for at least one entry in the second data table for which no corresponding entry exists in the first data table originally, the second complete prefix search tree corresponding to the second data table is virtualized to obtain a first virtual prefix search tree, and the third data table corresponding to the first virtual prefix search tree can be used for searching the second data table, so that the second routing device can send the prefix and the index in the third data table to the first routing device; after receiving the first message, the first routing equipment places an index in a third data table sent to the first routing equipment by the second routing equipment in a header of the first message and sends the index to the second routing equipment; the second routing device searches the second data table quickly according to the index sent by the first routing device, and then searches the routing engine table according to the table searching result of the second data table, so that the quick routing table searching scheme provided by the application can be adopted.
In the second method, the technical key points of the prefix advertisement method for static configuration are as follows.
When the Local search trees of the adjacent routing devices are inconsistent, if the search trees of the adjacent routing devices are to be consistent, a prefix advertisement method can be configured statically, that is, the adjacent routing devices advertise Local configuration (Local Config) information (namely routing strategies or routing entries configured statically artificially) to the opposite side, because Databases (DBs) of the adjacent routing devices are consistent certainly, if the static configurations are also consistent completely, the search trees of the adjacent routing devices are consistent completely; wherein, the Database (DB) stores the route list items learned according to the route protocol; taking adjacent upstream and downstream routing devices as an example, the specific flow is as follows:
(1) When the downstream routing device sends the local routing information (the routing table entry learned according to the routing protocol) to the upstream routing device, the local configuration information is also sent to the upstream routing device, but the local configuration information is only sent to the upstream routing device, and the local configuration information is not spread across hops.
As shown in fig. 18, the routing device R2 sends its Local configuration (Local Config) information to the routing device R1 by an LLDP message, and the routing device R2 does not send its Local configuration (Local Config) information to an upstream routing device of the routing device R1.
(2) After receiving the local configuration information sent by the downstream routing device, the upstream routing device merges the local configuration information into the local search tree, that is, constructs a new search tree, but does not forward the local configuration information to other routing devices.
(3) Meanwhile, aiming at the index in the table entry corresponding to the newly generated node in the constructed new search tree, the index is copied to the nearest ancestor node of the newly generated node.
As shown in fig. 19, fig. 19 describes a case where the prefix advertisement method is statically configured so that the complete prefix search tree is consistent, and the specific procedure can be referred to the related description of the complete prefix search tree advertisement method. In addition, for the case that the sizes of the complete prefix search trees of the upstream and downstream routing devices are not consistent, the related description of the virtual prefix search tree advertisement method can be referred to.
It should be noted that the technical points and steps of the complete prefix search tree/virtual prefix search tree advertisement method and the static configuration prefix advertisement method are the same, and the difference is only that the sources of the routing policies are different, the routing policy of the complete prefix search tree/virtual prefix search tree advertisement method is the routing policy learned by the routing device according to the routing protocol, and the routing policy of the static configuration prefix advertisement method is the routing policy of artificial static configuration. That is, the entries in the data table and the routing engine table described in the present application include entries learned according to a routing protocol and entries configured artificially and statically; for example, the entries in the first data table, the second data table, and the routing engine table may be entries learned according to a routing protocol, or entries configured statically by an artificial person.
Referring to fig. 20, fig. 20 is a schematic view of a main application scenario of the embodiment of the present application, and as shown in fig. 20, the main application scenario of the embodiment of the present application includes a backbone Network, a metropolitan area Network, a campus Network, a static IP Radio Access Network (IPRAN), a wireless Network, and the like, and scenarios in which search trees in the networks are different in scale. The floor product comprises routers and gateways of a backbone network, a metropolitan area network, a campus network, an IPRAN, a wireless network and the like, and equipment needing routing table lookup.
Referring to fig. 21, fig. 21 is a schematic diagram of message forwarding according to an embodiment of the present application. As shown in fig. 21, three paths are included between the routing device R1, the routing device R2, the routing device R3, the routing device R4, and the routing device R5, which are the original Path (Path 0) of the routing device R1 to the routing device R5, the Path1 (Path 1) of the routing device R1 to the routing device R2 to the routing device R4 to the routing device R5, and the Path2 (Path 2) of the routing device R2 to the routing device R3 to the routing device R4, respectively, where the routing device R1, the routing device R2, and the routing device R5 are all routing devices with smaller search tree sizes, and the routing device R3 and the routing device R4 are routing devices with larger search tree sizes; the routing device R1, the routing device R2, the routing device R3, the routing device R4, and the routing device R5 may respectively correspond to a Long-Term Evolution (LTE) base station (eNodeB, eNB), a home base station cell or Closed Subscriber Group (CSG) device, an aggregation Gateway (ASG), a base station Controller side Gateway (RSG), and a User Plane Function (UPF) entity in a real Network. The message forwarding conditions among the routing device R1, the routing device R2, the routing device R3, the routing device R4, and the routing device R5 are as follows:
(1) The upstream and downstream routing devices interact with the local search tree to make the search trees between the upstream and downstream routing devices consistent (when the RPS scales are consistent, the RPS is completely consistent, and when the RPS scales are not consistent, the VPS is completely consistent), and this step can be omitted as required.
(2) The downstream routing equipment sends a local table look-up index to the upstream routing equipment, the indexes (RE indexes) of the routing engine tables with consistent RPS sizes and the VPS indexes or RPS indexes with inconsistent RPS sizes.
(3) When the original message reaches the routing device R1, the routing device R1 looks up a Table to know that the next hop of the original Path (Path 0) is the routing device R5, and the routing device R1 looks up the Table to obtain a Table lookup index RE index 05 of the routing device R5 in the original Path (Path 0), and the RE index 05 is used for the routing device R5 to look up a routing engine Table (RE Table) stored locally.
(4) The routing device R1 establishes a Path1 (Path 1) of the routing device R1-the routing device R5, the destination address of the Path1 is the routing device R5, the routing device R1 finds a Table look-up to know that the next hop of the Path1 (Path 1) is the routing device R2, and the routing device R1 finds a Table look-up index RE index12 of the routing device R2 in the Path1 (Path 1) by Table look-up, and the RE index12 is used for the routing device R2 to look up a routing engine Table (RE Table) stored locally.
(5) The message reaches the routing device R2 through the Path1 (Path 1), and the routing device R2 checks a routing engine Table (RE Table) stored locally according to the Table look-up index RE index12 to know that the next hop of the Path1 (Path 1) is a routing device R4; the routing equipment R2 adds the table look-up index VPS1 index 14 or RPS index 14 of the routing equipment R4 in the Path1 (Path 1) in the message, wherein the VPS1 index 14 is used for the routing equipment R4 to look up the VPS1table locally stored by the routing equipment R4, and the RPS index 14 is used for the routing equipment R4 to look up the RPS table locally stored by the routing equipment R4.
(6) Meanwhile, the routing device R2 establishes a Path2 (Path 2) between the routing device R2 and the routing device R4, the destination address of the Path2 (Path 2) is the routing device R4, and the routing device R2 looks up a table to know that the next hop of the Path2 (Path 2) is the routing device R3; the routing equipment R2 adds the table look-up index VPS1 index 23 or RPS index 23 of the routing equipment R3 in the Path2 (Path 2) in the message, wherein the VPS index 23 is used for the routing equipment R3 to look up the VPS1table locally stored in the routing equipment R3, and the RPS index 23 is used for the routing equipment R3 to look up the RPS table locally stored in the routing equipment R3.
(7) The message reaches the routing device R3 through the Path2 (Path 2), the routing device R3 knows that the next hop passing through the Path2 (Path 2) is the routing device R4 according to the VPS index 23, the routing device R3 adds a Table lookup index RE index 24 of the routing device R4 in the Path2 (Path 2) to the message, and the RE index 24 is used for the routing device R4 to lookup a routing engine Table (RE Table) stored locally.
(8) The message reaches the routing device R4 through the Path2 (Path 2), and the routing device R4 removes the header and the table look-up index of the Path2 (Path 2) message as the end point of the Path2 (Path 2).
(9) The routing equipment R4 searches a table according to the VPS index 14 to know that the next hop of the Path1 (Path 1) is the routing equipment R5, and the routing equipment R5 is the end point of the Path1 (Path 1); the routing device R4 adds a Table lookup index RE index 15 of the routing device R5 in the Path1 (Path 1) to the packet, where the RE index 15 is used for the routing device R5 to lookup its locally stored routing engine Table (RE Table).
(10) The message reaches the routing device R5 through the Path1 (Path 1), and the routing device R5 removes the header and the table lookup index of the Path1 (Path 1) message as the end point of the Path1 (Path 1).
(11) And the routing equipment R5 looks up a table according to the RE index 05 to obtain a next hop and continuously forwards the next hop.
In the embodiment, the indexes of the local search tree storage table are interacted between the downstream routing devices, after the previous-hop routing device checks the table, the message carries the table look-up index of the next-hop routing device, so that the effect of quickly looking up the table is achieved.
In summary, the present application advertises the local table lookup index of the downstream routing device, and performs fast table lookup and cross-table query through cooperative work of the upstream and downstream routing devices; the upstream and downstream routing devices perform Bitmap (Bitmap) coding on the local lookup tree to announce a search tree or announce a local configuration route (with attributes), so that the search trees of the upstream and downstream routing devices are completely consistent (RPS level is consistent or VPS level is consistent); the downstream routing equipment triggers a local table look-up index to be sent to the upstream routing equipment, the upstream routing equipment stores the table look-up index into a local corresponding table, and when the message is forwarded, the upstream routing equipment carries the table look-up index corresponding to the downstream routing equipment in the message after looking up the table and sends the message to the downstream routing equipment; the downstream routing equipment searches the table according to the table searching index sent by the upstream routing equipment quickly, and directly finds the local table entry to realize quick table searching. The method is suitable for the current network mainstream scene: wireless networks, IPRAN, backbone networks, metropolitan area networks, campus area networks, and the like. The method and the device are suitable for tunnel nesting scenes. The application can reduce LPM table look-up time delay by 80 percent, and reduce LPM table look-up time delay from 76 cycles to 16 cycles. This application can be alleviated the memory wall: a) The memory access bandwidth is reduced to 7%, from 2048 bits (class 4 ISTA) to 22 bits (RE Index), or to 22 bits (RE Index) +150 bits (VPS), and assuming that the jointly searchable traffic accounts for 50% of the total traffic, the total memory access bandwidth is reduced to 53.5%; b) The number of memory accesses is reduced by half: from 4 times (ISTA) to 1 time (RE Index), or 1 time (RE Index) plus possibly VPS, the total number of memory accesses is reduced to 75% assuming that the jointly searchable traffic is 50% of the total traffic. The memory capacity of the method is reduced by half, and the total memory occupation is reduced to 80% under the same performance on the assumption that the jointly searchable flow accounts for 50% of the total flow.
Referring to fig. 22, fig. 22 is a schematic structural diagram of a routing device according to an embodiment of the present disclosure; the routing apparatus 2200 is applied to the first routing device, and the routing apparatus 2200 includes: a receiving unit 2201, configured to receive a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, and the target message includes at least one index, where the at least one index is an index corresponding to at least one IP address prefix in the second routing device; a sending unit 2202, configured to send, after receiving a first packet, a second packet to the second routing device, where the second packet includes the first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
In one possible implementation, the target message further includes the at least one IP address prefix; the apparatus further comprises a processing unit 2203 configured to: after the target message from the second routing equipment is received, before the second message is sent to the second routing equipment; inquiring a first target data table according to any IP address prefix in the at least one IP address prefix so as to determine a first target IP address prefix matched with the longest prefix of the any IP address prefix in the first target data table; adding an index corresponding to any IP address prefix in the at least one index into a table entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table; if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the receiving unit 2201 is further configured to receive a first binary string from the second routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree; the processing unit 2203 is further configured to obtain a third complete prefix search tree according to a second binary string and the first complete prefix search tree, where the second binary string is obtained by performing an or operation on the first binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; adding table entries in the first data table according to the third complete prefix search tree; wherein a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared to the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, a position of the first target node in the third complete prefix search tree is the same as a position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node.
In one possible implementation, the encoding the first full prefix search tree includes: supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree; encoding the fourth complete prefix search tree; and the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fourth complete prefix search tree are 0.
In a possible implementation manner, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the receiving unit 2201 is further configured to receive a fourth binary string from the second routing device, where the fourth binary string is a binary string obtained by encoding a first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree; the processing unit 2203 is further configured to obtain a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, where the fifth binary string is obtained by performing an or operation on the fourth binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree; adding table entries in the first data table according to the second virtual prefix search tree; wherein, a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, the IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
It should be noted that the implementation of each unit in the embodiment of the present application may also correspond to the related description in the embodiment shown in fig. 4, and is not described herein again. Of course, the routing apparatus 2200 provided in the embodiment of the present application includes, but is not limited to, the above unit modules, for example: the routing device 2200 may further include a storage unit 2204. The storage unit 2204 may be used to store program codes and data for the routing device 2200. In addition, the beneficial effects brought by the routing apparatus 2200 described in fig. 22 can refer to the description related to the embodiment shown in fig. 4, and are not described herein again.
Referring to fig. 23, fig. 23 is a schematic structural diagram of another routing apparatus according to an embodiment of the present application, where the routing apparatus 2300 is applied to a second routing device, and the routing apparatus 2300 includes: a sending unit 2301, configured to send a target message to a first routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device; a receiving unit 2302, configured to receive a second packet from the first routing device, where the second packet includes a first packet and a first destination index, the first destination index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first destination index.
In one possible implementation, the at least one index includes at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
In a possible implementation manner, the depth of a first complete prefix search tree corresponding to a first data table is the same as the depth of a second complete prefix search tree corresponding to a second data table, and the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit 2301 is further configured to: and sending a first binary string to the first routing device, wherein the first binary string is obtained by encoding the second complete prefix search tree.
In one possible implementation, the encoding the second full prefix search tree includes: supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree; encoding the fifth complete prefix search tree; and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
In one possible implementation, the difference between the depth of the first complete prefix search tree corresponding to the first data table and the depth of the second complete prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit 2301 is further configured to: and a fourth binary string to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree.
It should be noted that the implementation of each unit in the embodiment described in fig. 23 may also correspond to the related description in the embodiment shown in fig. 4, and is not described herein again. Of course, the routing apparatus 2300 provided in the embodiment of the present application includes, but is not limited to, the above unit modules, for example: the routing device 2300 may further include a storage unit 2303. The storage unit 2303 may be used for storing program codes and data of the routing device 2300. In addition, the beneficial effects brought by the routing device 2300 illustrated in fig. 23 can be referred to the relevant description in the embodiment illustrated in fig. 4, and are not described herein again.
Referring to fig. 24, fig. 24 is a schematic structural diagram of a first routing device 2410 according to an embodiment of the present application, where the first routing device 2410 includes a processor 2411, a memory 2412 and a communication interface 2413, and the processor 2411, the memory 2412 and the communication interface 2413 are connected to each other through a bus 2414.
The memory 2412 includes, but is not limited to, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or portable read-only memory (CD-ROM), and the memory 2412 is used for storing computer programs and data. Communication interface 2413 is used to receive and transmit data.
The processor 2411 may be one or more Central Processing Units (CPUs), and in the case where the processor 2411 is one CPU, the CPU may be a single-core CPU or a multi-core CPU.
The processor 2411 in the first routing device 2410 is configured to read the computer program code stored in the memory 2412 and execute the method performed by the first routing device as illustrated in fig. 4.
It should be noted that the implementation of each unit in the embodiment described in fig. 24 may also correspond to the related description in the embodiment shown in fig. 4, and is not described herein again. In addition, the beneficial effects brought by the embodiment described in fig. 24 can refer to the related description in the embodiment shown in fig. 4, and are not repeated herein.
Referring to fig. 25, fig. 25 is a schematic structural diagram of a second routing device 2510 according to an embodiment of the present application, where the second routing device 2510 includes a processor 2511, a memory 2512, and a communication interface 2513, and the processor 2511, the memory 2512, and the communication interface 2513 are connected to each other via a bus 2514.
Memory 2512 includes, but is not limited to, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or portable read-only memory (CD-ROM), and memory 2512 is used for associated computer programs and data. Communication interface 2513 is used for receiving and transmitting data.
The processor 2511 may be one or more Central Processing Units (CPUs), and in the case that the processor 2511 is one CPU, the CPU may be a single-core CPU or a multi-core CPU.
The processor 2511 in the second routing device 2510 is configured to read the computer program code stored in the memory 2512 and execute the second routing device method shown in fig. 4.
It should be noted that the implementation of each unit in the embodiment described in fig. 25 may also correspond to the related description in the embodiment shown in fig. 4, and is not described herein again. In addition, the beneficial effects brought by the embodiment described in fig. 25 can refer to the related description in the embodiment shown in fig. 4, and are not repeated herein.
The embodiment of the present application further provides a chip, which includes at least one processor, a memory and an interface circuit, where the memory, the transceiver and the at least one processor are interconnected through a line, and the at least one memory stores a computer program; when the computer program is executed by the processor, the method flows shown in the method embodiments are implemented.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program runs on a computer, the method flows shown in the above method embodiments are implemented.
The embodiments of the present application further provide a computer program, where when the computer program runs on a computer, the method flows shown in the above method embodiments are implemented.
It should be understood that the Processor mentioned in the embodiments of the present Application may be a Central Processing Unit (CPU), and may also be other general purpose processors, digital Signal Processors (DSP), application Specific Integrated Circuits (ASIC), field Programmable Gate Arrays (FPGA) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will also be appreciated that the memory referred to in the embodiments of the application may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), enhanced Synchronous SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
It should be noted that when the processor is a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, the memory (memory module) is integrated in the processor.
It should be noted that the memory described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not imply any order of execution, and the order of execution of the processes should be determined by their functions and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The above functions, if implemented in the form of software functional units and sold or used as a separate product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a terminal device) to execute all or part of the steps of the above-described method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs. In addition, the terms and explanations in the embodiments of the present application may refer to the corresponding descriptions in the other embodiments.
The modules in the device can be merged, divided and deleted according to actual needs.
The above description, the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and these modifications or substitutions do not depart from the scope of the technical solutions of the embodiments of the present application.

Claims (26)

1. A routing method applied to a first routing device, the method comprising:
receiving a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device;
after receiving a first packet, sending a second packet to the second routing device, where the second packet includes the first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
2. The method of claim 1, wherein the at least one index comprises at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
3. The method according to claim 1 or 2, characterized in that the target message further comprises the at least one IP address prefix; after receiving the target message from the second routing device, and before sending the second packet to the second routing device, the method further includes:
inquiring a first target data table according to any IP address prefix in the at least one IP address prefix so as to determine a first target IP address prefix matched with the longest prefix of any IP address prefix in the first target data table;
adding an index corresponding to any IP address prefix in the at least one index into a table entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table;
if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
4. The method of claim 3, wherein a depth of a first full prefix search tree corresponding to a first data table is the same as a depth of a second full prefix search tree corresponding to a second data table, and wherein a topology of the first full prefix search tree is different from a topology of the second full prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps:
receiving a first binary string from the second routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree;
obtaining a third complete prefix search tree according to a second binary string and the first complete prefix search tree, wherein the second binary string is obtained after the OR operation is carried out on the first binary string and the third binary string, and the third binary string is obtained by coding the first complete prefix search tree;
adding table entries in the first data table according to the third complete prefix search tree;
wherein, a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared with the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, the position of the first target node in the third complete prefix search tree is the same as the position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node.
5. The method of claim 4, wherein encoding the first full prefix search tree comprises:
supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree;
encoding the fourth complete prefix search tree;
and the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fourth complete prefix search tree are 0.
6. The method of claim 3, wherein the difference between the depth of the first full prefix search tree corresponding to the first data table and the depth of the second full prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps:
receiving a fourth binary string from the second routing device, where the fourth binary string is obtained by encoding a first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree;
obtaining a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, wherein the fifth binary string is obtained by performing or operation on the fourth binary string and a third binary string, and the third binary string is obtained by encoding the first complete prefix search tree;
adding table entries in the first data table according to the second virtual prefix search tree;
a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, an IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
7. A routing method, applied to a second routing device, the method comprising:
sending a target message to a first routing device, wherein the second routing device is a downstream routing device of the first routing device, the target message comprises at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device;
receiving a second packet from the first routing device, where the second packet includes a first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
8. The method of claim 7, wherein the at least one index comprises at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
9. The method according to claim 7 or 8, wherein the depth of the first complete prefix search tree corresponding to the first data table is the same as the depth of the second complete prefix search tree corresponding to the second data table, and the topology of the first complete prefix search tree is different from the topology of the second complete prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps:
and sending a first binary string to the first routing device, wherein the first binary string is obtained by encoding the second complete prefix search tree.
10. The method of claim 9, wherein encoding the second full prefix search tree comprises:
supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree;
encoding the fifth complete prefix search tree;
and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
11. The method of claim 7 or 8, wherein the difference between the depth of the first full prefix search tree corresponding to the first data table and the depth of the second full prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the method further comprises the following steps:
a fourth binary string to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree.
12. A routing device, for use in a first routing apparatus, the device comprising:
a receiving unit, configured to receive a target message from a second routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device;
a sending unit, configured to send a second packet to the second routing device after receiving the first packet, where the second packet includes the first packet and a first target index, the first target index is used for the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
13. The apparatus of claim 12, wherein the at least one index comprises at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
14. The apparatus according to claim 12 or 13, wherein the target message further comprises the at least one IP address prefix; the apparatus further comprises a processing unit for:
after the target message from the second routing equipment is received, before the second message is sent to the second routing equipment;
inquiring a first target data table according to any IP address prefix in the at least one IP address prefix so as to determine a first target IP address prefix matched with the longest prefix of the any IP address prefix in the first target data table;
adding an index corresponding to any IP address prefix in the at least one index into a table entry corresponding to a second target index in a second target data table, wherein the second target index is an index corresponding to the first target IP address prefix in the first target data table;
if any IP address prefix is an IP address prefix in a data table of a complete prefix search tree structure, the first target data table is a data table of the complete prefix search tree structure, and the second target data table is a routing engine table; if any IP address prefix is an IP address prefix in a data table of a virtual prefix search tree structure, the first target data table is a data table of the virtual prefix search tree structure, and the second target data table is a data table of a complete prefix search tree structure or a data table of the virtual prefix search tree structure; and if any IP address prefix is an IP address prefix in a ternary content addressable memory table, the first target data table is a ternary content addressable memory table, and the second target data table is a data table of a virtual prefix search tree structure.
15. The apparatus of claim 14, wherein a depth of a first full prefix search tree corresponding to a first data table is the same as a depth of a second full prefix search tree corresponding to a second data table, and wherein a topology of the first full prefix search tree is different from a topology of the second full prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device;
the receiving unit is further configured to receive a first binary string from the second routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree;
the processing unit is further configured to obtain a third complete prefix search tree according to a second binary string and the first complete prefix search tree, where the second binary string is obtained by performing or operation on the first binary string and the third binary string, and the third binary string is obtained by encoding the first complete prefix search tree;
adding table entries in the first data table according to the third complete prefix search tree;
wherein a second target IP address prefix in the added entry is an IP address prefix corresponding to a first target node in the third complete prefix search tree, the first target node is a node added to the third complete prefix search tree compared to the first complete prefix search tree, the IP address prefix corresponding to the first target node is an IP address prefix corresponding to a second target node in the second complete prefix search tree, a position of the first target node in the third complete prefix search tree is the same as a position of the second target node in the second complete prefix search tree, and the IP address prefix corresponding to the second target node is an IP address prefix in the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the first target node.
16. The apparatus of claim 15, wherein the encoding the first full prefix search tree comprises:
supplementing the first complete prefix search tree into a full binary tree to obtain a fourth complete prefix search tree;
encoding the fourth complete prefix search tree;
and the node code corresponding to the IP address prefix in the fourth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fourth complete prefix search tree are 0.
17. The apparatus of claim 14, wherein a difference between a depth of a first full prefix search tree corresponding to the first data table and a depth of a second full prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device;
the receiving unit is further configured to receive a fourth binary string from the second routing device, where the fourth binary string is a binary string obtained by encoding a first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree;
the processing unit is further configured to obtain a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, where the fifth binary string is a binary string obtained by performing an or operation on the fourth binary string and a third binary string, and the third binary string is a binary string obtained by encoding the first complete prefix search tree;
adding table entries in the first data table according to the second virtual prefix search tree;
wherein, a second target IP address prefix in the added entry is an IP address prefix corresponding to a third target node in the first virtual prefix search tree, the third target node is a node added to the second virtual prefix search tree compared with the first complete prefix search tree, an IP address prefix corresponding to the third target node is an IP address prefix corresponding to a fourth target node in the first virtual prefix search tree, the position of the third target node in the second virtual prefix search tree is the same as the position of the fourth target node in the first virtual prefix search tree, the IP address prefix corresponding to the fourth target node is an IP address prefix in a third data table, and a table look-up result of the third data table is used for looking up the second data table; the third target index in the added entry is the index corresponding to the nearest ancestor node of the third target node.
18. A routing apparatus for use in a second routing device, the apparatus comprising:
a sending unit, configured to send a target message to a first routing device, where the second routing device is a downstream routing device of the first routing device, the target message includes at least one index, and the at least one index is an index corresponding to at least one IP address prefix in the second routing device;
a receiving unit, configured to receive a second packet from the first routing device, where the second packet includes a first packet and a first target index, the first target index is used by the second routing device to determine an egress port of the first packet, and the at least one index includes the first target index.
19. The apparatus of claim 18, wherein the at least one index comprises at least one of: an index of a routing engine table, an index of a data table of a full prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.
20. The apparatus according to claim 18 or 19, wherein a depth of a first full prefix search tree corresponding to a first data table is the same as a depth of a second full prefix search tree corresponding to a second data table, and a topology of the first full prefix search tree is different from a topology of the second full prefix search tree; or the difference between the depth of the first complete prefix search tree and the depth of the second complete prefix search tree is 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit is further configured to:
and sending a first binary string to the first routing device, wherein the first binary string is obtained by encoding the second complete prefix search tree.
21. The apparatus of claim 20, wherein the encoding the second full prefix search tree comprises:
supplementing the second complete prefix search tree into a full binary tree to obtain a fifth complete prefix search tree;
encoding the fifth complete prefix search tree;
and the node code corresponding to the IP address prefix in the fifth complete prefix search tree is 1, and the empty node and the node code corresponding to the node without the IP address prefix in the fifth complete prefix search tree are 0.
22. The apparatus of claim 18 or 19, wherein the difference between the depth of the first full prefix search tree corresponding to the first data table and the depth of the second full prefix search tree corresponding to the second data table is greater than 1; the first data table is a data table of a complete prefix search tree structure in the first routing device, and the second data table is a data table of a complete prefix search tree structure in the second routing device; the sending unit is further configured to:
and a fourth binary string to the first routing device, the fourth binary string being a binary string obtained by encoding a first virtual prefix search tree, the first virtual prefix search tree being obtained according to the second complete prefix search tree.
23. A first routing device comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps in the method of any of claims 1-6.
24. A second routing device comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured for execution by the processor, the programs comprising instructions for performing the steps in the method of any of claims 7-11.
25. A chip, comprising: a processor for calling and running a computer program from a memory so that a device on which the chip is installed performs the method of any one of claims 1-6 or 7-11.
26. A computer-readable storage medium, characterized in that it stores a computer program for electronic data exchange, wherein the computer program causes a computer to perform the method according to any one of claims 1-6 or 7-11.
CN202110780197.5A 2021-07-09 2021-07-09 Routing method and related equipment Pending CN115604186A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110780197.5A CN115604186A (en) 2021-07-09 2021-07-09 Routing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110780197.5A CN115604186A (en) 2021-07-09 2021-07-09 Routing method and related equipment

Publications (1)

Publication Number Publication Date
CN115604186A true CN115604186A (en) 2023-01-13

Family

ID=84840247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110780197.5A Pending CN115604186A (en) 2021-07-09 2021-07-09 Routing method and related equipment

Country Status (1)

Country Link
CN (1) CN115604186A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464703A (en) * 2002-06-19 2003-12-31 华为技术有限公司 Method for increasing IP message transferring speed
CN102857414A (en) * 2012-08-20 2013-01-02 中兴通讯股份有限公司 Forwarding table writing method and device and message forwarding method and device
CN105763454A (en) * 2016-02-25 2016-07-13 比威网络技术有限公司 Data message forwarding method and device based on two-dimensional routing policy
CN108134739A (en) * 2016-12-01 2018-06-08 深圳市中兴微电子技术有限公司 A kind of method for searching route and device based on index trie
US10230639B1 (en) * 2017-08-08 2019-03-12 Innovium, Inc. Enhanced prefix matching
CN112448887A (en) * 2019-09-04 2021-03-05 华为技术有限公司 Segmented routing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464703A (en) * 2002-06-19 2003-12-31 华为技术有限公司 Method for increasing IP message transferring speed
CN102857414A (en) * 2012-08-20 2013-01-02 中兴通讯股份有限公司 Forwarding table writing method and device and message forwarding method and device
CN105763454A (en) * 2016-02-25 2016-07-13 比威网络技术有限公司 Data message forwarding method and device based on two-dimensional routing policy
CN108134739A (en) * 2016-12-01 2018-06-08 深圳市中兴微电子技术有限公司 A kind of method for searching route and device based on index trie
US10230639B1 (en) * 2017-08-08 2019-03-12 Innovium, Inc. Enhanced prefix matching
CN112448887A (en) * 2019-09-04 2021-03-05 华为技术有限公司 Segmented routing method and device

Similar Documents

Publication Publication Date Title
US10574574B2 (en) System and method for BGP sFlow export
Waldvogel et al. Scalable high speed IP routing lookups
US9948557B2 (en) Methods and apparatuses for routing and forwarding, establishing routing table, and acquiring content
US20140003436A1 (en) Internet Protocol and Ethernet Lookup Via a Unified Hashed Trie
US9407549B2 (en) System and method for hash-based forwarding of packets with hierarchically structured variable-length identifiers
WO2018032961A1 (en) Information management method, apparatus and system
US9130887B2 (en) Hash-based forwarding of packets with hierarchically structured variable-length identifiers over ethernet
US20180019956A1 (en) Method and Apparatus for an Information-Centric MAC Layer
US8923298B2 (en) Optimized trie-based address lookup
Lee et al. Name prefix matching using bloom filter pre-searching for content centric network
WO2017190559A1 (en) Routing searching method, device, allocation node, searching node, and ingress node
CN107547407B (en) Message transmission method, device and implementation device
CN112399485A (en) CCN-based new node value and content popularity caching method in 6G
CN113726907A (en) Routing processing method, network element equipment, device and readable storage medium
US7702882B2 (en) Apparatus and method for performing high-speed lookups in a routing table
CN115604186A (en) Routing method and related equipment
Shi et al. Re-designing compact-structure based forwarding for programmable networks
US11855883B2 (en) System and methods for computing flooding topology
Chen et al. Improving NDN forwarding engine performance by rendezvous-based caching and forwarding
Sun et al. Content-based route lookup using CAMs
Lin et al. Improved IP lookup technology for trie-based data structures
Dai et al. An advanced TCAM-sram architecture for ranges towards minimizing packet classifiers
WO2017000892A1 (en) Ip routing lookup
Li et al. Scale the Internet routing table by generalized next hops of strict partial order
Chandana et al. Efficient lookup for NLAPB in named data networking

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