Routing method and related equipment

By exchanging index information between routing devices and optimizing the routing table structure, the problem of low routing table lookup efficiency is solved, and efficient routing table lookup in large networks is achieved, which is suitable for heterogeneous networks.

CN115604186BActive Publication Date: 2024-10-11HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110780197.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-09
Publication Date
2024-10-11
Estimated Expiration
2041-07-09

AI Technical Summary

Technical Problem

The existing routing table lookup method has low performance when the routing table grows rapidly and cannot effectively improve the routing table lookup efficiency, especially in large networks.

Method used

By exchanging index information between routing devices, using data structures such as routing engine tables, complete prefix search trees, and virtual prefix search trees, routing table entries are searched in stages, reducing search steps, improving table lookup efficiency, and through encoding and virtual prefixes Search tree technology optimizes routing table consistency.

Benefits of technology

It significantly improves the efficiency of routing table lookup, reduces the number of memory accesses and bandwidth, and reduces memory usage. It is suitable for large and heterogeneous network environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604186B_ABST
    Figure CN115604186B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a routing method and related equipment, wherein the method includes: receiving a target message from a second routing device, 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 the first message, sending a second message to the second routing device, the second message includes the first message and a first target index, the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index. The embodiment of the present application can improve the efficiency of routing table lookup.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a routing method and related equipment. Background Art

[0002] The Internet Protocol (IP) is a network layer protocol in the Transmission Control Protocol (TCP) / IP system. The purpose of designing IP is to improve the scalability of the network: first, to solve the Internet problem and realize the interconnection of large-scale, heterogeneous networks; second, to separate the coupling relationship between the top-level network application and the underlying network technology to facilitate the independent development of the two. According to the end-to-end design principle, IP only provides a connectionless, unreliable, best-effort data packet transmission service for the host. In IP network transmission or in the communication packet network built with IP, route lookup is an extremely important part. Matching the routing table entry corresponding to the target IP address at the fastest speed is the main function of route lookup, where the IP address is used to identify the communication address of a communication terminal. There are many existing routing table lookup methods, including Lulea algorithm, PBF algorithm, LC-trie algorithm used by Linux kernel and TreeBitmap algorithm used by Cisco routers. However, with the rapid growth of routing tables (annual growth of about 15%), the performance of existing routing table lookup methods is low. Summary of the invention

[0003] The embodiments of the present application provide a routing method and related devices, which can improve the efficiency of routing table lookup.

[0004] 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, 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 the first message, sending a second message to the second routing device, the second message includes the first message and a first target index, the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index. Wherein, the IP address prefix can be referred to as a prefix.

[0005] In an embodiment of the present application, the downstream second routing device sends a target message to the upstream first routing device, thereby sending at least one index corresponding to at least one IP address prefix to the upstream first routing device; after receiving the first message to be forwarded, the first routing device sends the first target index in the at least one index and the first message as the second message to the second routing device, for example, putting the first target index in the header of the first message and sending it to the second routing device as the second message; because the first target index is used by the second routing device to determine the egress port of the first message, that is, the second routing device can quickly query which specific downstream routing device needs to forward the first message to the second routing device according to the first target index, thereby improving the efficiency of the second routing device's routing table lookup.

[0006] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table (RE Table), an index of a data table of a rich prefix subtrie (RPS) structure, and an index of a data table of a virtual prefix subtrie (VPS) structure. Among them, the index of the routing engine table (RE Index in English) is used to query the routing engine table, the index of the data table of a rich prefix subtrie structure (referred to as the index of the RPS table, RPS Index in English) is used to query the data table of a rich prefix search tree structure, and the index of the data table of a virtual prefix search tree structure (VPS Index in English) is used to query the data table of a virtual prefix search tree structure. It should be understood that the search tree described in the present application is also called a search tree.

[0007] In the embodiment of the present application, since the routing table lookup is performed in stages, that is, the ternary content addressable memory (TCAM) table (TCAM table for short) is first checked, and then the data table 2 of the virtual prefix search tree structure (VPS2 table for short) is checked according to the table lookup result of the ternary content addressable memory table, and then the data table 1 of the virtual prefix search tree structure (VPS1 table for short) is checked according to the table lookup result of the VPS2 table, and then the data table of the complete prefix search tree structure (RPS table for short) is checked according to the table lookup result of the VPS1 table, and finally the routing engine table is checked according to the table lookup result of the data table of the complete prefix search tree structure, so as to find the specific routing table item. The at least one index of the present application includes at least one of the index of the routing engine table (i.e., the table lookup result of the RPS table), the index of the data table of the complete prefix search tree structure (i.e., the table lookup result of the VPS1 table), and the index of the data table of the virtual prefix search tree structure (including the index of the VPS2 table and the index of the VPS1 table, the index of the VPS2 table is also the table lookup result of the TCAM table, and the index of the VPS1 table is also the table lookup result of the VPS2 table), so the first target index can be any one of the index of the routing engine table, the index of the TCAM table, the index of the VPS1 table, the index of the VPS2 table, and the index of the RPS table. If the first target index is the index of the routing engine table, then the second routing device can directly query the routing engine table therein according to the first target index to find the egress port of the first message, thus eliminating the stage of querying the TCAM table, the VPS2 table, the VPS1 table, and the RPS table, thereby improving the efficiency of the routing table lookup of the second routing device. If the first target index is an index of the RPS table, the second routing device can directly query the RPS table according to the first target index, and then query the routing engine table according to the query result of the RPS table to find the output port of the first message. This saves the stage of querying the TCAM table, the VPS2 table, and the VPS1 table, thereby improving the efficiency of the routing table query of the second routing device.If the first target index is an index of a data table of a virtual prefix search tree structure, there are two cases: if the first target index is an index of a VPS1 table, the second routing device can directly query the VPS1 table according to the first target index, and then query the RPS table according to the table query result of the VPS1 table, and then query the routing engine table according to the table query result of the RPS table, so as to find the output port of the first message, thereby eliminating the stage of querying the TCAM table and the VPS2 table; if the first target index is an index of a VPS2 table, the second routing device can directly query the VPS2 table according to the first target index, and then query the VPS1 table according to the table query result of the VPS2 table, and query the RPS table according to the table query result of the VPS1 table, and then query the routing engine table according to the table query result of the RPS table, so as to find the output port of the first message, thereby eliminating the stage of querying the TCAM table; thereby, the efficiency of routing table query of the second routing device can also be improved.

[0008] In a 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 message to the second routing device, the method further includes: querying a first target data table according to any IP address prefix of the at least one IP address prefix, so as to determine in the first target data table a longest prefix match (LongestPrefix) with any IP address prefix; Match, LPM); add the index corresponding to any one of the IP address prefixes in the at least one index to the table item corresponding to the second target index in the second target data table, and the second target index in the first target data table is the index corresponding to the first target IP address prefix; wherein, if any one of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any one of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any one of the IP address prefixes 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 with a virtual prefix search tree structure.

[0009] In the embodiment of the present application, the second routing device may also 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 of the at least one IP address prefix to the second target data table. In this way, after receiving the first message sent by its upstream routing device, the first routing device can find the first target index in the second target data table during the routing table lookup process of searching for the egress port of the first message, and put the first target index in the header of the first message as the second message and send it to the second routing device, thereby facilitating the second routing device to quickly perform routing table lookup. Specifically, for any IP address prefix among at least one IP address prefix, if the any IP address prefix is ​​an IP address prefix in the RPS table in the second routing device, the first routing device searches the RPS table therein for a first target IP address prefix that matches the longest prefix of the any IP address prefix, and then adds the index corresponding to the any IP address prefix in the at least one index to the table entry corresponding to the second target index in the routing engine table therein, and the second target index is the index corresponding to the first target IP address prefix in the RPS table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the routing engine table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the routing engine table therein according to the first target index without first querying the TCAM table, the VPS2 table, the VPS1 table and the RPS table. If any IP address prefix is ​​an IP address prefix in the VPS1 table in the second routing device, the first routing device searches the VPS1 table therein for the first target IP address prefix that matches the longest prefix of any IP address prefix, and then adds the index corresponding to the any IP address prefix in at least one index to the table item corresponding to the second target index in the RPS table therein, and the second target index is the index corresponding to the first target IP address prefix in the VPS1 table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the RPS table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the RPS table therein according to the first target index without first querying the TCAM table, the VPS2 table and the VPS1 table.If any IP address prefix is ​​an IP address prefix in the VPS2 table in the second routing device, the first routing device searches for the first target IP address prefix that matches the longest prefix of any IP address prefix in its VPS2 table, and then adds the index corresponding to the any IP address prefix in at least one index to the table item corresponding to the second target index in its VPS1 table, and the second target index is the index corresponding to the first target IP address prefix in the VPS2 table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in its VPS1 table, and the first target index is sent to the second routing device; thereby, the second routing device can directly query its VPS1 table according to the first target index without first querying the TCAM table and the VPS2 table. If any IP address prefix is ​​an IP address prefix in the TCAM table, the first routing device searches the TCAM table therein for the first target IP address prefix that matches the longest prefix of any IP address prefix, and then adds the index corresponding to the any IP address prefix in at least one index to the table entry corresponding to the second target index in the VPS2 table therein, and the second target index is the index corresponding to the first target IP address prefix in the TCAM table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the VPS2 table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the VPS2 table therein according to the first target index without first querying the TCAM table.

[0010] In a possible implementation, 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 includes: receiving a first binary string from the second routing device, the first binary string being a binary string obtained by encoding the second complete prefix search tree; obtaining a third complete prefix search tree according to the second binary string and the first complete prefix search tree, the second binary string being a binary string obtained by performing an OR operation on the first binary string and the third binary string , the third binary string is a binary string obtained by encoding the first complete prefix search tree; a table entry is added to the first data table according to the third complete prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node. Among them, 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 lookup result of the first data table, and the RE Index in the first data table (RPS table), RE Index is also the index of the routing engine table; in other words, the index corresponding to the nearest ancestor node of the first target node is the index (RE Index) of the routing engine table in the first routing device.

[0011] In the embodiment of the present application, the first data table in the first routing device is a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the first data table is the first complete prefix search tree; the second data table in the second routing device is also a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the second data table is the 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree, or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 1, then there is at least one table entry in the second data table, and there is no corresponding table entry in the first data table. If the at least one IP address prefix and at least one index sent by the second routing device to the first routing device are the IP address prefix and index in the second data table, respectively, then for any IP address prefix in the at least one IP address prefix, the first routing device will query the IP address prefix in the first data table that matches the longest prefix of any IP address prefix, and then add the at least one index to the routing engine table of the first routing device, so as to implement the fast routing table lookup solution provided by the present application. Since there is at least one table entry in the second data table, and there is no corresponding table entry in the first data table, for the IP address prefix in the at least one table entry, the IP address prefix with the longest prefix match cannot be found in the first data table, and then the index in the at least one table entry cannot be added to the routing engine table of the first routing device, so the at least one table entry cannot use the fast routing table lookup solution provided by the present application. To this end, the second routing device encodes the second complete prefix search tree to obtain the first binary string, and sends the first binary string to the first routing device; the first routing device also encodes the first complete prefix search tree to obtain the third binary string, and performs an OR operation on the received first binary string and the third binary string to obtain the second binary string, and then adds nodes to the first complete prefix search tree according to the second binary string, thereby obtaining the third complete prefix search tree; it should be understood that the table entries in the data table of the complete prefix search tree structure are reflected in the complete prefix search tree, that is, the nodes in the complete prefix search tree, so the nodes added to the third complete prefix search tree compared to the first complete prefix search tree are also the table entries added in the first data table. Among them, the second target IP address prefix in the table item 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, and 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 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 table item added in the first data table is the index corresponding to the nearest ancestor node of the first target node.In this way, for at least one table entry in the second data table that originally did not have a corresponding table entry in the first data table, since a table entry is added to the first data table, and the IP address prefix in the table entry added in the first data table is the IP address prefix in the at least one table entry in the second data table; then, for the IP address prefix in the at least one table entry, there is a corresponding table entry in the first data table, that is, the added table entry is the corresponding table entry, so the first routing device can query the IP address prefix that matches the longest prefix of the at least one table entry in the first data table after the table entry is added, that is, find the at least one table entry itself, so that the first routing device can find the index in the at least one table entry in its routing engine table, and can add the index in the at least one table entry to the header of the first message as the second message to the second routing device, and the implementation of the at least one table entry can also adopt the fast routing table lookup solution provided by the present application.

[0012] In a possible implementation, encoding the first complete 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; wherein, nodes in the fourth complete prefix search tree corresponding to IP address prefixes are encoded as 1, and empty nodes in the fourth complete prefix search tree and nodes corresponding to no IP address prefixes are encoded as 0.

[0013] In the 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: first, the first complete prefix search tree is supplemented as a full binary tree to obtain a fourth complete prefix search tree containing the supplemented empty nodes, and then the nodes corresponding to the IP address prefix in the fourth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the IP address prefix in the fourth complete prefix search tree are encoded as 0, thereby obtaining the third binary string. The process of the second routing device encoding the second complete prefix search tree to obtain the first binary string is the same as the process of the first routing device encoding the first complete prefix search tree to obtain the third binary string. In this way, the length of the first binary string is the same as that of the third binary string, which is conducive to obtaining the second binary string after the first binary string and the third binary string are ORed.

[0014] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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 includes: receiving a fourth binary string from the second 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; obtaining a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, the fifth binary string being a binary string obtained by performing an OR operation on the fourth binary string and a third binary string, the third binary string being a binary string obtained by encoding the first complete prefix search tree. string; adding a table entry in the first data table according to the second virtual prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look up the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the third target node.

[0015] In an embodiment of the present application, the first data table in the first routing device is a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the first data table is the first complete prefix search tree; the second data table in the second routing device is also a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the second data table is the 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 table entry in the second data table, and there is no corresponding table entry in the first data table. If the at least one IP address prefix and at least one index sent by the second routing device to the first routing device are the IP address prefix and index in the second data table, respectively, then for any IP address prefix in the at least one IP address prefix, the first routing device will query the IP address prefix in the first data table that matches the longest prefix of any IP address prefix, and then add the at least one index to the routing engine table of the first routing device, so as to implement the fast routing table lookup solution provided by the present application. Since there is at least one table entry in the second data table and there is no corresponding table entry in the first data table, for the IP address prefix in the at least one table entry, the IP address prefix with the longest prefix match cannot be found in the first data table, and then the index in the at least one table entry cannot be added to the routing engine table of the first routing device, so the at least one table entry cannot adopt the fast routing table lookup solution provided by the present application. To this end, the second routing device obtains a first virtual prefix search tree according to the second complete prefix search tree, for example, multiple nodes in the second complete prefix search tree are virtualized into one node, thereby obtaining a first virtual prefix search tree; then the second routing device encodes the first virtual prefix search tree to obtain a fourth binary string, and sends the fourth binary string to the first routing device; the first routing device also encodes the first complete prefix search tree to obtain a third binary string, and performs an OR operation on the received fourth binary string and the third binary string to obtain a fifth binary string, and then adds a node to the first complete prefix search tree according to the fifth binary string, that is, the node in the first virtual prefix search tree is added to the first complete prefix search tree, so that the first complete prefix search tree after adding nodes is a virtual prefix search tree, that is, the second virtual prefix search tree; it should be understood that the nodes added to the second virtual prefix search tree compared to the first complete prefix search tree are also the table entries added in the first data table.Among them, the second target IP address prefix in the table item added to the first data table is the IP address prefix corresponding to the third target node added in the second virtual prefix search tree compared to the first complete prefix search tree, and the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the fourth target node in the first virtual prefix search tree, and the IP address prefix corresponding to the fourth target node is the IP address prefix in the third data table, and the table lookup result of the third data table is used to look 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 lookup result of the third data table is used to look up the second data table; in addition, the third target index in the table item added to the first data table is the index corresponding to the nearest ancestor node of the third target node. In this way, for at least one table entry in the second data table that originally did not have a corresponding table entry in the first data table, since the second complete prefix search tree corresponding to the second data table is virtualized to obtain the first virtual prefix search tree, the third data table corresponding to the first virtual prefix search tree can be used to query the second data table, then the second routing device can send the prefix and index in the third data table to the first routing device; after receiving the first message, the first routing device puts the index in the third data table sent by the second routing device to the first routing device in the header of the first message and sends it to the second routing device; the second routing device quickly queries the second data table according to the index sent by the first routing device, and then queries its routing engine table according to the query result of the second data table, so that the fast routing table query solution provided by the present application can also be adopted.

[0016] 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, the second routing device is a downstream routing device of the first routing device, and 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; receiving a second message from the first routing device, the second message includes a first message and a first target index, the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index.

[0017] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

[0018] In a possible implementation, the depth of a first complete prefix search tree corresponding to the first data table is the same as the depth of a second complete prefix search tree corresponding to the 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 depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 includes: sending a first binary string to the first routing device, the first binary string being a binary string obtained by encoding the second complete prefix search tree.

[0019] In a possible implementation, encoding the second complete 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; wherein the nodes corresponding to the IP address prefix in the fifth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fifth complete prefix search tree are encoded as 0.

[0020] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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 includes: providing 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, and the first virtual prefix search tree being obtained according to the second complete prefix search tree.

[0021] It should be noted that the beneficial effects of the second aspect of the present application can be referred to the relevant description of the first aspect of the present application and will not be repeated here.

[0022] In a third aspect, an embodiment of the present application provides a routing device, which is applied to a first routing device, and the device includes: a receiving unit, which is used 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, 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, which is used to send a second message to the second routing device after receiving the first message, and the second message includes the first message and a first target index, and the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index.

[0023] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

[0024] In a possible implementation, the target message also includes the at least one IP address prefix; the device also includes a processing unit, which is used to: after receiving the target message from the second routing device and before sending the second message to the second routing device; query the first target data table according to any IP address prefix in the at least one IP address prefix to determine in the first target data table a first target IP address prefix that matches the longest prefix of any IP address prefix; add 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 the second target data table, where the second target index is a first target IP address prefix in the first target data table. corresponding index; wherein, if any of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any of the IP address prefixes 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 with a virtual prefix search tree structure.

[0025] In a possible implementation, 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 used to receive a first binary string from the second routing device, the first binary string being a binary string obtained by encoding the second complete prefix search tree; the processing unit is further used to obtain a third complete prefix search tree according to the second binary string and the first complete prefix search tree, the second binary string being obtained by performing an OR operation on the first binary string and the third binary string. a binary string, the third binary string being a binary string obtained by encoding the first complete prefix search tree; and adding a table entry in the first data table according to the third complete prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node.

[0026] In a possible implementation, encoding the first complete 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; wherein, nodes in the fourth complete prefix search tree corresponding to IP address prefixes are encoded as 1, and empty nodes in the fourth complete prefix search tree and nodes corresponding to no IP address prefixes are encoded as 0.

[0027] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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 used to receive a fourth binary string from the second routing device, the fourth binary string being a binary string obtained by encoding the 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 used to obtain a second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, the fifth binary string being a binary string obtained by performing an OR operation on the fourth binary string and a third binary string, and the third binary string being a binary string obtained by encoding the first complete prefix search tree. the binary string obtained; and adding a table entry in the first data table according to the second virtual prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look up the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the third target node.

[0028] It should be noted that the beneficial effects of the third aspect of the present application can be referred to the relevant description of the first aspect of the present application and will not be repeated here.

[0029] In a fourth aspect, an embodiment of the present application provides a routing device, which is applied to a second routing device, and the device includes: a sending unit, which is used to send a target message to a first routing device, and the second routing device is a downstream routing device of the first routing device, and 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, which is used to receive a second message from the first routing device, and the second message includes a first message and a first target index, and the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index.

[0030] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

[0031] In a possible implementation, the depth of a first complete prefix search tree corresponding to the first data table is the same as the depth of a second complete prefix search tree corresponding to the 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 depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 used to: send a first binary string to the first routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree.

[0032] In a possible implementation, encoding the second complete 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; wherein the nodes corresponding to the IP address prefix in the fifth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fifth complete prefix search tree are encoded as 0.

[0033] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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 used to: send 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, and the first virtual prefix search tree is obtained according to the second complete prefix search tree.

[0034] It should be noted that the beneficial effects of the fourth aspect of the present application can be referred to the relevant description of the first aspect of the present application and will not be repeated here.

[0035] In a fifth aspect, an embodiment of the present application provides a first routing device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps in the method described in any one of the first aspects.

[0036] In a sixth aspect, an embodiment of the present application provides a second routing device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps in the method as described in any one of the second aspects.

[0037] In a seventh aspect, an embodiment of the present application provides a chip, comprising: a processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as described in any one of the first or second aspects above.

[0038] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute a method as described in any one of the first or second aspects above.

[0039] In a ninth aspect, an embodiment of the present application provides a computer program, which enables a computer to execute a method as described in any one of the first or second aspects above. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the phased routing table lookup.

[0041] Figure 2 It is a schematic diagram of the route table lookup of adjacent routing devices in the same network.

[0042] Figure 3 It is a schematic diagram of clue-based routing table lookup.

[0043] Figure 4 It is a flowchart of a routing method provided in an embodiment of the present application.

[0044] Figure 5 It is a schematic diagram of a fast routing table lookup provided in an embodiment of the present application.

[0045] Figure 6 It is a schematic diagram of a complete prefix search tree notification method provided in an embodiment of the present application.

[0046] Figure 7 It is a schematic diagram of a search tree encoded as a binary string provided in an embodiment of the present application.

[0047] Figure 8 It is a schematic diagram of another search tree encoding as a binary string provided in an embodiment of the present application.

[0048] Fig. 9 It is a schematic diagram of another complete prefix search tree notification method provided in an embodiment of the present application.

[0049] Fig.10 It is a schematic diagram of constructing a complete prefix search tree provided in an embodiment of the present application.

[0050] Fig.11 This is a schematic diagram of adding a table entry provided in an embodiment of the present application.

[0051] Fig.12 It is a schematic diagram of another complete prefix search tree notification method provided in an embodiment of the present application.

[0052] Fig.13 It is a schematic diagram of a virtual prefix search tree notification method provided in an embodiment of the present application.

[0053] Fig.14 It is a schematic diagram of another virtual prefix search tree notification method provided in an embodiment of the present application.

[0054] Fig.15 It is a schematic diagram of constructing a virtual prefix search tree provided in an embodiment of the present application.

[0055] Fig.16 It is a schematic diagram of another virtual prefix search tree notification method provided in an embodiment of the present application.

[0056] Fig.17 It is a schematic diagram of another fast routing table lookup provided in an embodiment of the present application.

[0057] Fig.18 It is a schematic diagram of a static configuration prefix notification method provided in an embodiment of the present application.

[0058] Fig.19 It is a schematic diagram of another static configuration prefix notification method provided in an embodiment of the present application.

[0059] Fig. 20 It is a schematic diagram of an application scenario of the fast routing table lookup solution provided in an embodiment of the present application.

[0060] Fig.21 This is a schematic diagram of message forwarding provided in an embodiment of the present application.

[0061] Fig. 22 It is a structural diagram of a routing device provided in an embodiment of the present application.

[0062] Fig.23 It is a structural diagram of another routing device provided in an embodiment of the present application.

[0063] Fig.24 It is a structural diagram of a first routing device provided in an embodiment of the present application.

[0064] Fig.25It is a structural diagram of a second routing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0066] The terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0067] Reference to "embodiments" in this specification means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this specification may be combined with other embodiments.

[0068] In order to facilitate the understanding of the embodiments of the present application, the technical problems to be specifically solved by the present application are further analyzed and proposed. Currently, there are many technical solutions for implementing route lookup, and two of them are exemplarily listed below.

[0069] Solution 1: Iterative Shrinkage-Thresholding Algorithm (ISTA) solution.

[0070] To solve the problem of slow table lookup, academia and industry have proposed many solutions to solve this problem. Among them, for large-scale routing table lookups that require multiple physical tables to store, the industry has proposed the hierarchical table lookup ISTA solution, which is also the table lookup solution for mainstream equipment today.

[0071] like Figure 1As shown, the root routing table is mainly stored in a ternary content addressable memory (TCAM), which can be called a TCAM table. The routing table lookup process of the ISTA scheme is: first, the index of the data table 2 (VPS2 table for short) of the virtual prefix search tree (VPS) structure is queried in the root routing table (also known as the TCAM table); then the VPS2 table is queried according to the index of the VPS2 table to obtain the index of the data table 1 (VPS1 table for short) of the virtual prefix search tree structure; then the VPS1 table is queried according to the index of the VPS1 table to obtain the index of the data table (RPS table for short) of the complete prefix search tree (RichPrefix Subtrie, RPS) structure; then the RPS table is queried according to the index of the RPS table to obtain the index (RE Index) of the routing engine table (Routing Engine Table, RE Table); finally, the RE Table is queried according to the REIndex to obtain specific routing table items, such as forwarding information (Forwarding Info), etc. It can be seen that the ISTA solution must go through at least 5-6 stages for one routing table lookup.

[0072] like Figure 2 As shown, there are two IP address prefixes, namely "010" and "110". For the routing device R1 of the same network, for example, the IP address prefix "010", the query starts from the nodes of the first level of the search tree, that is, from the root node (Root Node) to the nodes of the second level. The first bit from left to right in the IP address prefix "010" is "0", so when the nodes of the first level query the nodes of the second level, it searches down to the left of the search tree; the second bit from left to right in the IP address prefix "010" is "1", so when the nodes of the second level query the nodes of the third level, it searches down to the right of the search tree; the third bit from left to right in the IP address prefix "010" is "0", so when the nodes of the third level query the nodes of the fourth level, it searches down to the left of the search tree, and thus finds the leaf node (Leaf Node) P1. For example, the IP address prefix is ​​"110". The first bit from left to right in the IP address prefix "110" is "1". Therefore, when the node at the first level queries the node at the second level, it searches down to the right of the search tree; the second bit from left to right in the IP address prefix "110" is "1". Therefore, when the node at the second level queries the node at the third level, it searches down to the right of the search tree; the third bit from left to right in the IP address prefix "110" is "0". Therefore, when the node at the third level queries the node at the fourth level, it searches down to the left of the search tree, and thus finds the leaf node P2. In addition, by Figure 2It can be seen that, for the routing device R2 in the same network, its routing table lookup process is similar to that of its routing device R1.

[0073] Disadvantages of Solution 1: Each address table lookup needs to go through 5-6 stages, which consumes a lot of resources. In addition, the routing tables of adjacent routing devices within the same network are very similar, because the routing prefixes are learned from the same Interior Gateway Protocol (IGP) and Border Gateway Protocol (BGP) routing announcements, with only slight differences in the local configuration (Local Config) strategy. For the same part, the table lookup operation of the upstream routing device requires the downstream routing device to undergo exactly the same lookup operation, which greatly affects the efficiency of the table lookup.

[0074] Option 2: Routing with a clue.

[0075] The routing with a clue scheme proposed by the academic community aims to establish a fast index in the downstream routing device by using the table lookup result of the forward adjacent routing device, so as to establish a fast index table in the downstream routing device for fast table lookup.

[0076] like Figure 3 As shown in the figure, the main approach of this solution is that routing device R1 carries a 5-bit clue in the header, that is, it sends a clue hash table (Clue's Hash Table) to routing device R2. Routing device R2 performs fast IP lookup based on the clue, which is similar to the rate of label switching, but saves more memory. This mechanism avoids repeated calculations and table lookups, and distributes the entire table lookup process to all routing devices along the way. Each routing device can help downstream routing devices perform initial table lookups, so this solution can play a big role in homogeneous IP networks.

[0077] The disadvantages of Solution 2 are: it is only applicable to homogeneous networks and requires the establishment of an additional hash table. If the network is large, the size of the hash table will also be large, and the final size will be similar to the full linear table. It is not suitable for large networks.

[0078] Based on the analysis of the existing solutions, the main technical problems to be solved by this application are: to address the problems of low efficiency and slow speed of existing routing table lookup solutions and the problem that existing routing table lookup solutions are not suitable for large networks, and to propose a fast and efficient routing table lookup solution that does not take up too much storage space and is effectively applicable to homogeneous and various heterogeneous networks.

[0079] See also Figure 4 , Figure 4This is a flow chart of a routing method provided by an embodiment of the present application, which includes but is not limited to the following steps:

[0080] 401. A second routing device sends 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, where the at least one index is an index corresponding to at least one IP address prefix in the second routing device.

[0081] The first routing device may be the routing device R1 in the present application, and the second routing device may be the routing device R2 in the present application. The target message may be a Link Layer Discovery Protocol (LLDP) message. 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 can be found by looking up the table according to the at least one IP address prefix.

[0082] In this application, the IP address prefix can be referred to as prefix (English name is Prefix).

[0083] 402. The first routing device receives a target message from the second routing device.

[0084] 403. After receiving the first message, the first routing device sends a second message to the second routing device, where the second message includes the first message and a first target index, where the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index.

[0085] The first routing device receives the first message from the upstream routing device of the first routing device, and then sends the first message and the first target index as the second message to the second routing device, for example, the first target index can be added to the header of the first message to obtain the second message. The first target index is used by the second routing device to determine the egress port of the first message, which means that the second routing device can determine which downstream routing device or devices of the second routing device to send the first message to based on the first target index.

[0086] 404. The second routing device receives a second message from the first routing device.

[0087] 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 devices of the second routing device to send the first message to according to the first target index, and sends the first message to the determined downstream routing device.

[0088] In an embodiment of the present application, the downstream second routing device sends a target message to the upstream first routing device, thereby sending at least one index corresponding to at least one IP address prefix to the upstream first routing device; after receiving the first message to be forwarded, the first routing device sends the first target index in the at least one index and the first message as the second message to the second routing device, for example, putting the first target index in the header of the first message and sending it to the second routing device as the second message; because the first target index is used by the second routing device to determine the egress port of the first message, that is, the second routing device can quickly query which specific downstream routing device needs to forward the first message to the second routing device according to the first target index, thereby improving the efficiency of the second routing device's routing table lookup.

[0089] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure. Among them, the index of the routing engine table (English name is RE Index) is used to query the routing engine table, the index of the data table of a complete prefix search tree structure (abbreviated as the index of the RPS table, English name is RPS Index) is used to query the data table of the complete prefix search tree structure, and the index of the data table of a virtual prefix search tree structure (abbreviated as the index of the VPS table, English name is VPS Index) is used to query the data table of the virtual prefix search tree structure. It should be understood that the search tree described in this application is also called a search tree.

[0090] In the embodiment of the present application, since the routing table lookup is performed in stages, that is, the ternary content addressable memory table (TCAM table for short) is first checked, and then the data table 2 of the virtual prefix search tree structure (VPS2 table for short) is checked according to the table lookup result of the ternary content addressable memory table, and then the data table 1 of the virtual prefix search tree structure (VPS1 table for short) is checked according to the table lookup result of the VPS2 table, and then the data table of the complete prefix search tree structure (RPS table for short) is checked according to the table lookup result of the VPS1 table, and finally the routing engine table is checked according to the table lookup result of the data table of the complete prefix search tree structure, so as to find the specific routing table item. The at least one index of the present application includes at least one of the index of the routing engine table (i.e., the table lookup result of the RPS table), the index of the data table of the complete prefix search tree structure (i.e., the table lookup result of the VPS1 table), and the index of the data table of the virtual prefix search tree structure (including the index of the VPS2 table and the index of the VPS1 table, the index of the VPS2 table is also the table lookup result of the TCAM table, and the index of the VPS1 table is also the table lookup result of the VPS2 table), so the first target index can be any one of the index of the routing engine table, the index of the TCAM table, the index of the VPS1 table, the index of the VPS2 table, and the index of the RPS table. If the first target index is the index of the routing engine table, then the second routing device can directly query the routing engine table therein according to the first target index to find the egress port of the first message, thus eliminating the stage of querying the TCAM table, the VPS2 table, the VPS1 table, and the RPS table, thereby improving the efficiency of the routing table lookup of the second routing device. If the first target index is an index of the RPS table, the second routing device can directly query the RPS table according to the first target index, and then query the routing engine table according to the query result of the RPS table to find the output port of the first message. This saves the stage of querying the TCAM table, the VPS2 table, and the VPS1 table, thereby improving the efficiency of the routing table query of the second routing device. If the first target index is an index of a data table of a virtual prefix search tree structure, there are two cases: if the first target index is an index of a VPS1 table, the second routing device can directly query the VPS1 table according to the first target index, and then query the RPS table according to the table query result of the VPS1 table, and then query the routing engine table according to the table query result of the RPS table, so as to find the output port of the first message, thereby eliminating the stage of querying the TCAM table and the VPS2 table; if the first target index is an index of a VPS2 table, the second routing device can directly query the VPS2 table according to the first target index, and then query the VPS1 table according to the table query result of the VPS2 table, and query the RPS table according to the table query result of the VPS1 table, and then query the routing engine table according to the table query result of the RPS table, so as to find the output port of the first message, thereby eliminating the stage of querying the TCAM table; thereby, the efficiency of routing table query of the second routing device can also be improved.

[0091] In a possible implementation, the target message also includes the at least one IP address prefix; after receiving the target message from the second routing device and before sending the second message to the second routing device, the method further includes: the first routing device queries a first target data table according to any IP address prefix among the at least one IP address prefix to determine in the first target data table a first target IP address prefix that matches the longest prefix of any IP address prefix; the first routing device 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 the second target data table, where the second target index is the first target IP address prefix in the first target data table. suffix; wherein, if any of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any of the IP address prefixes 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 with a virtual prefix search tree structure.

[0092] For example, see Figure 5 , Figure 5 A schematic diagram of a fast routing table lookup provided in an embodiment of the present application. Figure 5 As shown in FIG. 1 , the table entry of the VPS2 table includes a prefix (Prefix) and an output port (Val), wherein Val represents an index pointing to the next level table lookup; for example, Val is 0, which means that the next level table lookup is performed. Figure 5 In the VP1 table on the left, Val is 0, which means that the next level of table lookup Figure 5 The VPS1 table on the left. The table entries of the VPS1 table include Prefix and Val, where Val represents the index pointing to the next level of table lookup; for example, for one of the VPS1 tables, Val is 00, which means that the next level of table lookup Figure 5 In the RPS table on the left, Val is 01, which means the next level table is checked. Figure 5The RPS table on the left. The entries of the RPS table include Prefix, Val and the index of the routing engine table (RE Index). The entries of the routing engine table (RE Table) include RE Index and OutPort, where OutPort 1 indicates OutPort 1, and OutPort 2 indicates OutPort 2. Figure 5 The diagram shows a situation 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 of the routing device R2, as follows:

[0093] (1) Routing device R2 sends the prefix in the locally stored RPS table and the RE Index corresponding to the prefix to routing device R1 through an LLDP message.

[0094] (2) Routing device R1 performs a local table lookup for the Prefix sent by routing device R2, that is, it looks up the RPS table stored locally by routing device R1, and finds the Prefix with the longest prefix match in the RPS table stored locally by routing device R1, where the Prefix with the longest prefix match may be completely consistent with the Prefix sent by routing device R2; then, an R2 RE Index table entry is added to the RE Table stored locally by routing device R1, because the RE Index in the RETable stored locally by routing device R1 is the RE Index in the RPS table stored locally by routing device R1, and the RE Index corresponding to the Prefix with the longest prefix match in the RPS table stored locally by routing device R1 is also in the RE Table stored locally by routing device R1, so the RE Index sent by routing device R2 is added to the position corresponding to the RE Index corresponding to the Prefix with the longest prefix match in the R2 RE Index table entry. For example, see Figure 5 In the gray filled part, the RE Index sent by routing device R2 is 1, the Prefix with the longest prefix matching the Prefix sent by routing device R2 in the RPS table stored locally by routing device R1 is 010, and the RE Index corresponding to the Prefix with the longest prefix matching (that is, 010) in the RPS table and RE Table stored locally by routing device R1 is 1, then the RE Index (that is, 1) sent by routing device R2 is added to the same column position of the RE Index (1) corresponding to the Prefix with the longest prefix matching (that is, 010) in the R2RE Index table entry.

[0095] (3) When routing device R1 receives the message, it searches the RE Table stored locally in routing device R1 to find that the outbound port corresponding to the message is routing device R2. It also searches the RE Table stored locally in routing device R1 to find the R2 REIndex. It then puts the R2 RE Index in the header of the message and sends it to routing device R2.

[0096] (4) Routing device R2 receives the RE Index (i.e., R2 RE Index) sent by routing device R1, and directly searches the RE Table stored locally in routing device R2, thereby eliminating the multi-stage table search process from the root table (TCAM table) to the RPS table. Similarly, if there is a routing device R3 downstream of routing device R2, routing device R2 adds the REIndex (i.e., R3 RE Index) of routing device R3 found locally to the header and sends it to routing device R3 as auxiliary information for routing device R3 to search the table, so that routing device R3 can also quickly search the table. It should be understood that all downstream routing devices after routing device R3 can repeat this process.

[0097] Similarly, when at least one IP address prefix sent by routing device R2 to routing device R1 is an IP address prefix in the VPS1 table in routing device R2, at least one index sent by routing device R2 to routing device R1 is an index of the RPS table stored locally by routing device R2; in this case, routing device R1 searches the VPS1 table stored locally in routing device R1 for the Prefix sent by routing device R2, finds the Prefix with the longest prefix match in the VPS1 table stored locally in routing device R1, and then searches the VPS1 table stored locally in routing device R1 for the Prefix that matches the longest prefix. An item is added to the RPS table of the routing device R2 for adding at least one index sent by the routing device R2 to the routing device R1; when the routing device R1 receives the message, it searches the RPS table stored locally in the routing device R1 to obtain any one of the at least one index sent by the routing device R2 to the routing device R1, and puts any one of the indexes into the header of the message and sends it to the routing device R2; when the routing device R2 receives the any one of the indexes sent by the routing device R1, it directly searches the RPS table stored locally in the routing device R2, thereby eliminating the multi-stage table search process from the root table (TCAM table) to the VPS1 table.

[0098] Similarly, when at least one IP address prefix sent by routing device R2 to routing device R1 is an IP address prefix in the VPS2 table in routing device R2, at least one index sent by routing device R2 to routing device R1 is an index of the VPS1 table stored locally by routing device R2; in this case, routing device R1 searches the VPS2 table stored locally by routing device R1 for the Prefix sent by routing device R2, finds the Prefix with the longest prefix match in the VPS2 table stored locally by routing device R1, and then searches the VPS1 table stored locally by routing device R1 for the Prefix sent by routing device R2. An item is added to the VPS1 table for adding at least one index sent by routing device R2 to routing device R1; when routing device R1 receives the message, it searches the VPS1 table stored locally in routing device R1 to obtain any one of the at least one index sent by routing device R2 to routing device R1, and puts any one of the indexes in the header of the message to carry and send it to routing device R2; routing device R2 receives the any one of the indexes sent by routing device R1, and directly searches the VPS1 table stored locally in routing device R2, thereby eliminating the multi-stage table search process from the root table (TCAM table) to the VPS2 table.

[0099] Similarly, when at least one IP address prefix sent by routing device R2 to routing device R1 is an IP address prefix (Prefix) in the TCAM table of routing device R2, at least one index sent by routing device R2 to routing device R1 is an index of the VPS2 table stored locally by routing device R2; in this case, routing device R1 searches the TCAM table stored locally by routing device R1 for the Prefix sent by routing device R2, finds the Prefix with the longest prefix match in the TCAM table stored locally by routing device R1, and then searches the VPS2 table in routing device R1 for the Prefix sent by routing device R2. An item is added to the locally stored VPS2 table for adding at least one index sent by routing device R2 to routing device R1; when routing device R1 receives the message, it searches the locally stored VPS2 table to obtain any one of the at least one index sent by routing device R2 to routing device R1, and puts any one of the indexes in the header of the message to carry and send it to routing device R2; routing device R2 receives the any one of the indexes sent by routing device R1, and directly searches the locally stored VPS2 table of routing device R2, thereby eliminating the root table (TCAM table) search process.

[0100] In the embodiment of the present application, the second routing device may also 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 of the at least one IP address prefix to the second target data table. In this way, after receiving the first message sent by its upstream routing device, the first routing device can find the first target index in the second target data table during the routing table lookup process of searching for the egress port of the first message, and put the first target index in the header of the first message as the second message and send it to the second routing device, thereby facilitating the second routing device to quickly perform routing table lookup. Specifically, for any IP address prefix among at least one IP address prefix, if the any IP address prefix is ​​an IP address prefix in the RPS table in the second routing device, the first routing device searches the RPS table therein for a first target IP address prefix that matches the longest prefix of the any IP address prefix, and then adds the index corresponding to the any IP address prefix in the at least one index to the table entry corresponding to the second target index in the routing engine table therein, and the second target index is the index corresponding to the first target IP address prefix in the RPS table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the routing engine table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the routing engine table therein according to the first target index without first querying the TCAM table, the VPS2 table, the VPS1 table and the RPS table. If any IP address prefix is ​​an IP address prefix in the VPS1 table in the second routing device, the first routing device searches the VPS1 table therein for the first target IP address prefix that matches the longest prefix of any IP address prefix, and then adds the index corresponding to the any IP address prefix in at least one index to the table item corresponding to the second target index in the RPS table therein, and the second target index is the index corresponding to the first target IP address prefix in the VPS1 table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the RPS table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the RPS table therein according to the first target index without first querying the TCAM table, the VPS2 table and the VPS1 table.If any IP address prefix is ​​an IP address prefix in the VPS2 table in the second routing device, the first routing device searches for the first target IP address prefix that matches the longest prefix of any IP address prefix in its VPS2 table, and then adds the index corresponding to the any IP address prefix in at least one index to the table item corresponding to the second target index in its VPS1 table, and the second target index is the index corresponding to the first target IP address prefix in the VPS2 table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in its VPS1 table, and the first target index is sent to the second routing device; thereby, the second routing device can directly query its VPS1 table according to the first target index without first querying the TCAM table and the VPS2 table. If any IP address prefix is ​​an IP address prefix in the TCAM table, the first routing device searches the TCAM table therein for the first target IP address prefix that matches the longest prefix of any IP address prefix, and then adds the index corresponding to the any IP address prefix in at least one index to the table entry corresponding to the second target index in the VPS2 table therein, and the second target index is the index corresponding to the first target IP address prefix in the TCAM table in the first routing device; in this way, during the routing table lookup process of the first routing device, the first target index can be found in the VPS2 table therein, and the first target index is sent to the second routing device; thereby, the second routing device can directly query the VPS2 table therein according to the first target index without first querying the TCAM table.

[0101] When the table entries of adjacent upstream and downstream routing devices are not completely consistent, it will cause the table entries in the downstream routing device to be unable to use the fast routing table lookup solution provided by this application. In order to enable any table entry in the downstream routing device to use the fast routing table lookup solution provided by this application, there are two specific methods to choose from: method one is the complete prefix search tree / virtual prefix search tree notification method, and method two is the static configuration prefix notification method.

[0102] Method 1: Complete prefix search tree / virtual prefix search tree notification method.

[0103] Specifically, when the scale of the complete prefix search tree in the upstream and downstream routing devices is consistent, the complete prefix search tree notification method is used; when the scale of the complete prefix search tree in the upstream and downstream routing devices is consistent, the virtual prefix search tree notification method is used. Among them, if the depth difference between the complete prefix search trees in the upstream and downstream routing devices is not greater than 1, the scale of the complete prefix search trees in the upstream and downstream routing devices is consistent; if the depth difference between the complete prefix search trees in the upstream and downstream routing devices is greater than 1, the scale of the complete prefix search trees in the upstream and downstream routing devices is inconsistent. The following is a detailed analysis of these two situations:

[0104] The first case: The scale of the complete prefix search tree is consistent, and the complete prefix search tree notification method is used.

[0105] In a possible implementation, 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 includes: the second routing device sends a first binary string to the first routing device, the first binary string is a binary string obtained by encoding the second complete prefix search tree; the first routing device receives the first binary string from the second routing device; the first routing device obtains a third complete prefix search tree according to the second binary string and the first complete prefix search tree, the second binary string is a binary string obtained by encoding the first binary string and the third a binary string obtained by performing an OR operation on a binary string, wherein the third binary string is a binary string obtained by encoding the first complete prefix search tree; the first routing device adds a table entry in the first data table according to the third complete prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; and the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node.

[0106] Among them, 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 lookup result of the first data table, and the RE Index in the first data table (RPS table), RE Index is also the index of the routing engine table; in other words, the index corresponding to the nearest ancestor node of the first target node is the index (REIndex) of the routing engine table in the first routing device.

[0107] like Figure 6As shown, the first routing device is routing device R1, the first data table is the RPS table (RPS Table) in routing device R1, and the data table of the complete prefix search tree structure corresponding to the first complete prefix search tree in 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 routing device R2, the second data table is the RPS table (RPS Table) in routing device R2, and the data table of the complete prefix search tree structure corresponding to the second complete prefix search tree in 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 complete prefix search tree is 3, and the depth of the second complete prefix search tree is also 3, but because there is no node at the third level of the lower right of the first complete prefix search tree, and there is no node at the third level of the lower left of the second complete prefix search tree, the topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree. For example, if there is no node at the corresponding position of node a in the second complete prefix search tree in the first complete prefix search tree, node a cannot use the fast routing table lookup solution provided by the present application. The Prefix of node a is 011 in the second data table, and the RE Index corresponding to node a is 4, that is, the table entry in the second data table containing Prefix 011 and RE Index 4 cannot use the fast routing table lookup solution provided by the present application. In order for node a to use the fast routing table lookup solution provided by the present application, it is necessary to make the node exist at the position corresponding to node a in the first complete prefix search tree, that is, it is necessary to make the first data table have a prefix that matches the longest prefix of Prefix 011 in the second data table.

[0108] The first case can be divided into the following steps:

[0109] (1) The search tree is encoded into a binary string.

[0110] In the present application, the first routing device and the second routing device encode the locally stored search tree into a binary string (or called a binary number). The encoding principle is: first fill the local search tree into a full binary tree (fill empty nodes where there are no nodes), and then encode it into a binary string, where nodes with a prefix are encoded as 1, and nodes without a prefix and empty nodes are encoded as 0.

[0111] In one example, the process of encoding the second complete prefix search tree by the second routing device 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; wherein, the nodes corresponding to the IP address prefixes in the fifth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefixes in the fifth complete prefix search tree are encoded as 0.

[0112] like Figure 7 As shown, the depth of the second complete prefix search tree is 3, and the second complete prefix search tree has three levels; there is no node at the third level from the lower left of the second complete prefix search tree, and it is supplemented with an empty node ( Figure 7 The nodes represented by dotted lines in the figure) are used to obtain the fifth complete prefix search tree; the fifth complete prefix search tree has a node of Prefix ( Figure 7 The nodes filled in black in the middle are coded as 1, the empty nodes in the fifth complete prefix search tree and the nodes without Prefix ( Figure 7 The nodes without padding in the string are encoded as 0, resulting in the first binary string being "0100111".

[0113] In one example, the process of encoding the first complete prefix search tree by the first routing device 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; wherein, the nodes corresponding to the IP address prefix in the fourth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the no IP address prefix in the fourth complete prefix search tree are encoded as 0.

[0114] like Figure 8 As shown, the depth of the first complete prefix search tree is 3, and the first complete prefix search tree has three levels; there is no node at the third level in the lower right corner of the first complete prefix search tree, and it is supplemented with an empty node ( Figure 8 The nodes represented by dotted lines in the figure) are used to obtain the fourth complete prefix search tree; the fourth complete prefix search tree has a node of Prefix ( Figure 8 The nodes filled in black in the fourth complete prefix search tree are encoded as 1, and the empty nodes and nodes without Prefix in the fourth complete prefix search tree are encoded as 1. Figure 8 The nodes without padding in the string are encoded as 0, resulting in a third binary string of "0011110".

[0115] The results of the first routing device and the second routing device encoding their respective complete prefix search trees are as follows: Fig. 9 As shown, in Fig. 9In the example, the first routing device is routing device R1, and the second routing device is routing device R2; the search tree in routing device R1 is the fourth complete prefix search tree, and the search tree in routing device R2 is the fifth complete prefix search tree.

[0116] In the above two examples, the process of the first routing device encoding the first complete prefix search tree to obtain the third binary string is: first, the first complete prefix search tree is supplemented into a full binary tree to obtain a fourth complete prefix search tree containing the supplemented empty nodes, and then the nodes corresponding to the IP address prefix in the fourth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the IP address prefix in the fourth complete prefix search tree are encoded as 0, thereby obtaining the third binary string. The process of the second routing device encoding the second complete prefix search tree to obtain the first binary string is the same as the process of the first routing device encoding the first complete prefix search tree to obtain the third binary string. In this way, the length of the first binary string is the same as that of the third binary string, which is conducive to obtaining the second binary string after the first binary string and the third binary string are ORed.

[0117] (2) Interaction of binary strings.

[0118] The downstream routing device sends the binary string obtained by local encoding to the upstream routing device, that is, the second routing device sends the first binary string obtained by local encoding to the first routing device.

[0119] (3) Reconstruct the search tree.

[0120] After receiving the first binary string, the first routing device performs an OR operation (combination) on the first binary string and the third binary string obtained by local encoding of the first routing device to obtain a second binary string, and then establishes a new complete prefix search tree based on the second binary string and the first complete prefix search tree, that is, obtains a third complete prefix search tree; that is, merges the fourth complete prefix search tree and the fifth complete prefix search tree to establish a third complete prefix search tree.

[0121] like Fig.10 As shown, the first binary string is "0100111", the third binary string is "0011110", and the second binary string obtained by the 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 based on the second binary string "0111111" adds a leaf node (such as Fig.10Nodes filled in medium gray); the supplemented leaf node has a Prefix, and the Prefix of the supplemented leaf node comes from the Prefix of the node at the same position in the fifth complete prefix search tree, and the Prefix of the node in the fifth complete prefix search tree is the Prefix of the node at the same position in the second complete prefix search tree, so the Prefix of the supplemented leaf node comes from the Prefix of the node at the same position in the second complete prefix search tree.

[0122] (4) Add table entries.

[0123] For the nodes added to the third complete prefix search tree relative to the first complete prefix search tree (i.e., the supplementary nodes), the first routing device needs to add an entry to the first data table, and add the Prefix of the added node to the added entry; in addition, it is also necessary to add the RE Index 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.

[0124] like Fig.11 As shown, Fig.11 The nodes filled with medium gray are added nodes. The prefix of the added nodes is 011. An entry is added to the first data table ( Fig.11 The table entry filled with medium gray) is filled with the Prefix of the added node (that is, 011); the Prefix of the added node’s nearest ancestor node is 01*, and the RE Index corresponding to the added node’s nearest ancestor node is 4, and the RE Index corresponding to the added node’s nearest ancestor node (that is, 4) is filled in the added table entry.

[0125] like Fig.12 As shown, Fig.12This is a schematic diagram of the result obtained by using the complete prefix search tree notification method. After adding nodes to the first complete prefix search tree and adding entries to the first data table, node a or the corresponding entry of node a in the second data table can use the fast routing table lookup solution provided by this application. Specifically, the node corresponding to node a in the first complete prefix search tree is a newly added node in the first complete prefix search tree (a node filled in gray), and the table item corresponding to node a in the second data table has a corresponding table item (a table item filled in gray) in the first data table; the fast table lookup process corresponding to node a is as follows: routing device R2 sends the Prefix (i.e., 011) and RE Index (i.e., 4) in the table item corresponding to node a in the second data table to routing device R1 through an LLDP message; routing device R1 looks up the first data table according to the Prefix (i.e., 011) sent by routing device R2, obtains the Prefix (i.e., 011) with the longest prefix match in the newly added table item (the table item filled in gray) in the first data table, and finds the REIndex (i.e., 4) corresponding to the Prefix (i.e., 011) with the longest prefix match; routing device R1 adds the RE Index (represented as R2 RE Index for distinction, and its value is 4) sent by routing device R2 to the table item with RE Index 4 in its routing engine table; after receiving the first message, routing device R1 looks up its routing engine table to obtain the R2 RE Index, and put it in the header of the first message as the second message to the routing device R2; after receiving the second message, the routing device R2 obtains the R2 RE Index, and directly searches the routing engine table in the routing device R2 according to the R2 RE Index, thereby realizing fast table search.

[0126] It should be noted that the upstream and downstream relationship of the routing devices in the network can be changed. When the upstream and downstream relationship between the routing devices R1 and R2 is exchanged, that is, the routing device R1 is the downstream routing device and the routing device R2 is the upstream routing device, such as Figure 6 or Fig. 9 or Fig.12As shown, 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 solution provided by the present application; or in other words, the table entry containing Prefix 000 and RE Index 1 corresponding to the node b in the first data table cannot adopt the fast routing table lookup solution provided by the present application. To this end, the complete prefix search tree notification method is adopted to add nodes to the second complete prefix search tree to obtain the sixth complete prefix search tree, and the gray-filled nodes in the sixth complete prefix search tree are the newly added nodes, and the position of the newly added nodes in the sixth complete prefix search tree is the same as the position of the node b in the first complete prefix search tree, the fourth complete prefix search tree, or the third complete prefix search tree; the table entry is added to the second data table, and the gray-filled table entry in the second data table is the newly added table entry for the table entry containing Prefix 000 and REIndex 1 corresponding to the node b in the first data table, so that the node b can also adopt the fast routing table lookup solution provided by the present application.

[0127] It should be further explained that the above is an example of introducing the complete prefix search tree notification method by taking the depth of the complete prefix search trees in the upstream and downstream routing devices as the same. It should be understood that the situation where the depth difference between the complete prefix search trees in the upstream and downstream routing devices is 1 is also the same, and this application will not repeat the description.

[0128] In the embodiment of the present application, the first data table in the first routing device is a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the first data table is the first complete prefix search tree; the second data table in the second routing device is also a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the second data table is the 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree, or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 1, then there is at least one table entry in the second data table, and there is no corresponding table entry in the first data table. If the at least one IP address prefix and at least one index sent by the second routing device to the first routing device are the IP address prefix and index in the second data table, respectively, then for any IP address prefix in the at least one IP address prefix, the first routing device will query the IP address prefix in the first data table that matches the longest prefix of any IP address prefix, and then add the at least one index to the routing engine table of the first routing device, so as to implement the fast routing table lookup solution provided by the present application. Since there is at least one table entry in the second data table, and there is no corresponding table entry in the first data table, for the IP address prefix in the at least one table entry, the IP address prefix with the longest prefix match cannot be found in the first data table, and then the index in the at least one table entry cannot be added to the routing engine table of the first routing device, so the at least one table entry cannot use the fast routing table lookup solution provided by the present application. To this end, the second routing device encodes the second complete prefix search tree to obtain the first binary string, and sends the first binary string to the first routing device; the first routing device also encodes the first complete prefix search tree to obtain the third binary string, and performs an OR operation on the received first binary string and the third binary string to obtain the second binary string, and then adds nodes to the first complete prefix search tree according to the second binary string, thereby obtaining the third complete prefix search tree; it should be understood that the table entries in the data table of the complete prefix search tree structure are reflected in the complete prefix search tree, that is, the nodes in the complete prefix search tree, so the nodes added to the third complete prefix search tree compared to the first complete prefix search tree are also the table entries added in the first data table. Among them, the second target IP address prefix in the table item 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, and 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 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 table item added in the first data table is the index corresponding to the nearest ancestor node of the first target node.In this way, for at least one table entry in the second data table that originally did not have a corresponding table entry in the first data table, since a table entry is added to the first data table, and the IP address prefix in the table entry added in the first data table is the IP address prefix in the at least one table entry in the second data table; then, for the IP address prefix in the at least one table entry, there is a corresponding table entry in the first data table, that is, the added table entry is the corresponding table entry, so the first routing device can query the IP address prefix that matches the longest prefix of the at least one table entry in the first data table after the table entry is added, that is, find the at least one table entry itself, so that the first routing device can find the index in the at least one table entry in its routing engine table, and can add the index in the at least one table entry to the header of the first message as the second message to the second routing device, and the implementation of the at least one table entry can also adopt the fast routing table lookup solution provided by the present application.

[0129] The second case: the scale of the complete prefix search tree is inconsistent, and the virtual prefix search tree notification method is used.

[0130] Specifically, if the depth difference between the complete prefix search trees in the upstream and downstream routing devices is greater than 1, the scales of the complete prefix search trees in the upstream and downstream routing devices are inconsistent, or the scales of the complete prefix search trees in the upstream and downstream routing devices are greatly different, in this case, the virtual prefix search tree notification method is adopted to make the scales of the virtual prefix search trees of the upstream and downstream routing devices consistent, so that the upstream and downstream routing devices exchange the index of the RPS table or the index of the VPS table to realize fast routing table lookup.

[0131] In a 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 the complete prefix search tree structure in the first routing device, and the second data table is a data table of the complete prefix search tree structure in the second routing device; the method further includes: the second routing device sends a fourth binary string to the first routing device, the fourth binary string is a binary string obtained by encoding the first virtual prefix search tree, and the first virtual prefix search tree is obtained according to the second complete prefix search tree; the first routing device receives the fourth binary string from the second routing device; the first routing device obtains the second virtual prefix search tree according to a fifth binary string and the first complete prefix search tree, the fifth binary string is a binary string obtained by performing an OR operation on the fourth binary string and the third binary string, and the third binary string is a binary string obtained by performing an OR operation on the first complete prefix search tree. the first routing device adds an entry in the first data table according to the second virtual prefix search tree; wherein the second target IP address prefix in the added entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look 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.

[0132] like Fig.13As shown, the first routing device is routing device R1, the first data table is the RPS table (RPS Table) in routing device R1, and the data table of the complete prefix search tree structure corresponding to the first complete prefix search tree in 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 routing device R2, the second data table is the RPS table (RPS Table) in routing device R2, and the data table of the complete prefix search tree structure corresponding to the second complete prefix search tree in 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 complete prefix search tree is 1, and the depth of the second complete prefix search tree is also 3, so the scale of the first complete prefix search tree is different from that of the second complete prefix search tree. Therefore, the nodes of the second level and the third level (such as Fig.13 The nodes enclosed by the dotted ellipse in the middle) cannot use the fast routing table lookup solution provided by the present application.

[0133] The second situation can be divided into the following steps:

[0134] (1) Generate a virtual prefix search tree.

[0135] The second routing device (ie, the downstream routing device) virtualizes some nodes in the second complete prefix search tree into one node according to the difference between the sizes of the first complete prefix search tree and the second complete prefix search tree, thereby generating a first virtual prefix search tree.

[0136] like Fig.13 As shown, routing device R2 places the lower left three nodes and the lower right three nodes (such as Fig.13 The nodes enclosed by the dotted ellipse are each virtualized as a node, thereby obtaining a first virtual prefix search tree. The first virtual prefix search tree is as follows: Fig.14 In addition, the table entries corresponding to the two virtual nodes in the first virtual prefix search tree are as follows Fig.14 As shown in the third data table, the third data table is a data table of a virtual prefix search tree structure (VPS1Table, also known as VPS1 table); wherein Prefix in the third data table represents a prefix, and RPS Index represents an index of the RPS table (that is, a table lookup result of looking up the VPS1 table).

[0137] (2) The search tree is encoded into a binary string.

[0138] 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. The encoding principle is: nodes with prefixes are encoded as 1, and nodes without prefixes and empty nodes are encoded as 0.

[0139] like Fig.14 As shown, the first complete prefix search tree has only one root node (also a leaf node), and this node is a node with a prefix, so the third binary string encoded by the first complete prefix search tree is "1". The first virtual prefix search tree has one root node and two leaf nodes, where the root node is a node without a prefix and is encoded as 0; the two leaf nodes are nodes with a prefix and are encoded as 1; therefore, the fourth binary string encoded by the first virtual prefix search tree is "011".

[0140] (3) Interaction of binary strings.

[0141] The downstream routing device sends the binary string obtained by local encoding to the upstream routing device, that is, the second routing device sends the fourth binary string obtained by local encoding to the first routing device.

[0142] (4) Reconstruct the search tree.

[0143] After receiving the fourth binary string, the first routing device performs an OR operation (combination) on the fourth binary string and the third binary string obtained by local encoding of the first routing device to obtain a fifth binary string, and then establishes a new second virtual prefix search tree based on the fifth binary string and the first complete prefix search tree.

[0144] like Fig.15 As shown, the third binary string is "1", the fourth binary string is "011", and the fifth binary string obtained by the OR operation of the third binary string and the fourth binary string is "111". Then, according to the fifth binary string "0111111" and the first complete prefix search tree, a second virtual prefix search tree is constructed. Compared with the first complete prefix search tree, the second virtual prefix search tree adds two leaf nodes (such as Fig.15 The supplemented leaf node is the node at the same position in the first virtual prefix search tree, and the supplemented leaf node has a Prefix, and the Prefix of the supplemented leaf node is the Prefix of the node at the same position in the first virtual prefix search tree.

[0145] (5) Add table entries.

[0146] For the nodes added to the second virtual prefix search tree relative to the first complete prefix search tree (i.e., the supplemented nodes), the first routing device needs to add an entry to the first data table, and add the prefix of the added node to the added entry; the prefix in the entry added to the first data table is the prefix of the virtual node added to the second virtual prefix search tree relative to the first complete prefix search tree, and the prefix of the virtual node added to 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 entry added to the first data table is the prefix in the third data table. In addition, it is also necessary to add an index (RPS Index) to the entry added to the first data table, and the addition of the RPS Index in the added entry can copy the RPS Index corresponding to the nearest ancestor node of the added node.

[0147] like Fig.16 As shown, the second virtual prefix search tree adds two virtual nodes relative to the first complete prefix search tree, so the first data table adds two entries ( Fig.16 As shown in the third data table, the prefix of one virtual node is 00*, and the prefix of the other virtual node is 01*. The prefixes of these two virtual nodes are added to the first data table ( Fig.16 Items filled in medium gray); in the second virtual prefix search tree, the nearest ancestor nodes of the two virtual nodes are both the root nodes of the second virtual prefix search tree, so the RPSIndex in the two items added to the first data table both copy the RPS Index corresponding to the root node of the second virtual prefix search tree; as shown in the first data table after adding the item, the RPS Index corresponding to the root node of the second virtual prefix search tree is 1, so the RPS Index in the two items added to the first data table are both 1.

[0148] In this case, after adopting the virtual prefix search tree announcement method, for the nodes that have not been virtualized in the second complete prefix search tree, the fast routing table lookup solution provided by the present application can still be adopted, and the corresponding fast table lookup process is: the routing device R2 sends the Prefix and RE Index in the table item corresponding to the node 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 sent by the routing device R2, obtains the Prefix with the longest prefix match in the first data table, and finds the RE Index corresponding to the Prefix with the longest prefix match; the routing device R1 adds the RE Index sent by the routing device R2 (for distinction) to the table item where the RE Index corresponding to the Prefix with the longest prefix match is located in its routing engine table; after receiving the first message, the routing device R1 searches its routing engine table to obtain the R2 RE Index, and puts it in the header of the first message as the second message and sends it to the routing device R2; after receiving the second message, the routing device R2 obtains the R2 RE Index, and according to the R2 RE Index directly queries the routing engine table in routing device R2, thereby achieving fast table lookup.

[0149] For the virtualized nodes in the second complete prefix search tree, the fast routing table lookup scheme provided by the present application is also adopted, and the corresponding fast table lookup process is as follows: the routing device R2 sends the Prefix and RPS Index in the corresponding table item in the third data table to the routing device R1 through the LLDP message; the routing device R1 searches the first data table according to the Prefix sent by the routing device R2, obtains the Prefix with the longest prefix match in the first data table, and finds the RPS Index corresponding to the Prefix with the longest prefix match; the routing device R1 adds the RPS Index sent by the routing device R2 (for distinction, it is marked as R2 RPSIndex) to the table item where the RPS Index corresponding to the Prefix with the longest prefix match in its first data table (RPS table) is located; after the routing device R1 receives the first message, it searches the first data table (RPS table) to obtain the R2 RPS Index, and puts it in the header of the first message as the second message and sends it to the routing device R2; after the routing device R2 receives the second message, it obtains the R2 RPS Index, and according to the R2 RPS The second data table (RPS table) in the routing device R2 is directly searched by the RE Index to obtain the corresponding RE Index, and then the routing engine table is searched according to the RE Index, thereby realizing fast table search.

[0150] like Fig.17As shown, taking the Prefix as 01* and the RPS Index as 2 in the third data table as an example, the routing device R2 sends the Prefix (that is, 01*) and the RPS Index (that is, 2) to the routing device R1 through the LLDP message; the routing device R1 searches the first data table (RPS table) according to the Prefix (that is, 01*) sent by the routing device R2, obtains the Prefix with the longest prefix match (that is, 01*) in the first data table, and finds the REIndex (that is, 1) corresponding to the Prefix with the longest prefix match (that is, 01*); the routing device R1 adds the RPS Index sent by the routing device R2 to the entry where the REIndex (that is, 1) corresponding to the Prefix with the longest prefix match (that is, 01*) in the first data table is located (for distinction, it is marked as R2 RPSIndex, and its value is 2); after receiving the first message, the routing device R1 searches the first data table to obtain the R2 RPS Index (whose value is 2), and put it in the header of the first message as the second message to the routing device R2; after receiving the second message, the routing device R2 obtains the R2 RPS Index (whose value is 2), and directly searches the second data table (RPS table) in the routing device R2 according to the R2 RPS Index (whose value is 2) to obtain the corresponding RE Index, and then searches the routing engine table according to the RE Index, thereby realizing fast table search. In addition, for Fig.17 The Prefix in the third data table is 00* and the RPS Index is 1, and the operation is similar.

[0151] In an embodiment of the present application, the first data table in the first routing device is a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the first data table is the first complete prefix search tree; the second data table in the second routing device is also a data table of a complete prefix search tree structure, and the complete prefix search tree corresponding to the second data table is the 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 table entry in the second data table, and there is no corresponding table entry in the first data table. If the at least one IP address prefix and at least one index sent by the second routing device to the first routing device are the IP address prefix and index in the second data table, respectively, then for any IP address prefix in the at least one IP address prefix, the first routing device will query the IP address prefix in the first data table that matches the longest prefix of any IP address prefix, and then add the at least one index to the routing engine table of the first routing device, so as to implement the fast routing table lookup solution provided by the present application. Since there is at least one table entry in the second data table and there is no corresponding table entry in the first data table, for the IP address prefix in the at least one table entry, the IP address prefix with the longest prefix match cannot be found in the first data table, and then the index in the at least one table entry cannot be added to the routing engine table of the first routing device, so the at least one table entry cannot adopt the fast routing table lookup solution provided by the present application. To this end, the second routing device obtains a first virtual prefix search tree according to the second complete prefix search tree, for example, multiple nodes in the second complete prefix search tree are virtualized into one node, thereby obtaining a first virtual prefix search tree; then the second routing device encodes the first virtual prefix search tree to obtain a fourth binary string, and sends the fourth binary string to the first routing device; the first routing device also encodes the first complete prefix search tree to obtain a third binary string, and performs an OR operation on the received fourth binary string and the third binary string to obtain a fifth binary string, and then adds a node to the first complete prefix search tree according to the fifth binary string, that is, the node in the first virtual prefix search tree is added to the first complete prefix search tree, so that the first complete prefix search tree after adding nodes is a virtual prefix search tree, that is, the second virtual prefix search tree; it should be understood that the nodes added to the second virtual prefix search tree compared to the first complete prefix search tree are also the table entries added in the first data table.Among them, the second target IP address prefix in the table item added to the first data table is the IP address prefix corresponding to the third target node added in the second virtual prefix search tree compared to the first complete prefix search tree, and the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the fourth target node in the first virtual prefix search tree, and the IP address prefix corresponding to the fourth target node is the IP address prefix in the third data table, and the table lookup result of the third data table is used to look 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 lookup result of the third data table is used to look up the second data table; in addition, the third target index in the table item added to the first data table is the index corresponding to the nearest ancestor node of the third target node. In this way, for at least one table entry in the second data table that originally did not have a corresponding table entry in the first data table, since the second complete prefix search tree corresponding to the second data table is virtualized to obtain the first virtual prefix search tree, the third data table corresponding to the first virtual prefix search tree can be used to query the second data table, then the second routing device can send the prefix and index in the third data table to the first routing device; after receiving the first message, the first routing device puts the index in the third data table sent by the second routing device to the first routing device in the header of the first message and sends it to the second routing device; the second routing device quickly queries the second data table according to the index sent by the first routing device, and then queries its routing engine table according to the query result of the second data table, so that the fast routing table query solution provided by the present application can also be adopted.

[0152] Method 2: Static configuration prefix advertisement method. The technical points are as follows.

[0153] When the local search trees of adjacent routing devices are inconsistent, in order to make the search trees of adjacent routing devices consistent, you can also statically configure the prefix notification method, that is, the adjacent routing devices notify the local configuration (Local Config) information (that is, the routing policy or routing entry configured statically by humans) to each other, because the databases (DB) of adjacent routing devices must be consistent. If the static configuration is also completely consistent, the search trees of adjacent routing devices must be completely consistent; the database (DB) stores the routing table items learned according to the routing protocol; taking the adjacent upstream and downstream routing devices as an example, the specific process is as follows:

[0154] (1) When a downstream routing device sends local routing information (routing table entries learned from the routing protocol) to an upstream routing device, it also sends local configuration information to the upstream routing device, but it must be marked as local configuration information and sent only to its upstream routing device without cross-hop propagation.

[0155] like Fig.18 As shown, routing device R2 sends its local configuration (Local Config) information to routing device R1 through LLDP message, and routing device R2 does not send its local configuration (Local Config) information to the upstream routing device of routing device R1.

[0156] (2) After receiving the local configuration information from the downstream routing device, the upstream routing device will merge it into the local search tree, that is, build a new search tree, but will not forward the local configuration information to other routing devices.

[0157] (3) At the same time, the index in the table entry corresponding to the newly generated node in the constructed new search tree is copied to the nearest ancestor node of the newly generated node.

[0158] like Fig.19 As shown, Fig.19 This describes the situation where the static configuration prefix advertisement method makes the complete prefix search tree consistent. For the specific process, please refer to the relevant description of the complete prefix search tree advertisement method. In addition, for the situation where the complete prefix search tree scales of upstream and downstream routing devices are inconsistent, please refer to the relevant description of the virtual prefix search tree advertisement method.

[0159] It should be noted that the technical points and steps of the complete prefix search tree / virtual prefix search tree announcement method and the static configuration prefix announcement method are the same. The only difference is the source of the routing policy. The routing policy of the complete prefix search tree / virtual prefix search tree announcement method is the routing policy learned by the routing device according to the routing protocol, and the routing policy of the static configuration prefix announcement method is the routing policy manually statically configured. That is, the table items in the data table and routing engine table described in this application include table items learned according to the routing protocol and table items manually statically configured; for example, the table items in the aforementioned first data table, second data table, and routing engine table can be table items learned according to the routing protocol, or can be table items manually statically configured.

[0160] See also Fig. 20 , Fig. 20 It is a schematic diagram of the main application scenarios of the embodiments of the present application, such as Fig. 20 As shown, the main application scenarios of the embodiments of the present application include backbone networks, metropolitan area networks, campus networks, static IP radio access networks (Internet Protocol Radio Access Network, IPRAN), wireless networks, etc., as well as scenarios where the scale of search trees in each network is different. The products implemented in this application include routers and gateways of backbone networks, metropolitan area networks, campus networks, IPRAN, wireless networks, etc., and other devices that require routing table lookup.

[0161] See also Fig.21 , Fig.21 Schematic diagram of a message forwarding provided by an embodiment of the present application. Fig.21 As shown, there are three paths between routing device R1, routing device R2, routing device R3, routing device R4 and routing device R5, which are the original path (Path0) of routing device R1-routing device R5, path 1 (Path1) of routing device R1-routing device R2-routing device R4-routing device R5, and path 2 (Path2) of routing device R2-routing device R3-routing device R4. Among them, routing device R1, routing device R2 and routing device R5 are routing devices with smaller search tree scales, and routing device R3 and routing device R4 are routing devices with larger search tree scales; routing device R1, routing device R2, routing device R3, routing device R4 and routing device R5 can correspond to Long-Term Evolution (LTE) base station (eNodeB, eNB), home base station cell or closed subscriber group (CSG) device, aggregation side gateway (Aggregate Site Sateway, ASG), base station controller side gateway (Radio Network Controller Site The packet forwarding between routing devices R1, R2, R3, R4 and R5 is as follows:

[0162] (1) The upstream and downstream routing devices exchange local search trees to make the search trees between the upstream and downstream routing devices consistent (when the RPS scales are consistent, the RPSs are made completely consistent; when the RPS scales are inconsistent, the VPSs are made completely consistent). This step can be omitted as needed.

[0163] (2) The downstream routing device sends the local table lookup index to the upstream routing device. If the RPS scale is consistent, the routing engine table index (RE index) is sent; if the RPS scale is inconsistent, the VPS index or RPS index is sent.

[0164] (3) When the original message reaches routing device R1, routing device R1 looks up the table and finds that the next hop of the original path (Path0) is routing device R5. Routing device R1 also looks up the table and obtains the table index REindex 05 of routing device R5 in the original path (Path0). RE index 05 is used by routing device R5 to look up its locally stored routing engine table (RE Table).

[0165] (4) Routing device R1 establishes path 1 (Path1) from routing device R1 to routing device R5. The destination address of path 1 is routing device R5. Routing device R1 looks up the table and finds that the next hop of path 1 (Path1) is routing device R2. Routing device R1 also looks up the table to obtain the table index RE index 12 of routing device R2 in path 1 (Path1). RE index 12 is used by routing device R2 to look up the routing engine table (RE Table) stored locally.

[0166] (5) The message reaches routing device R2 through path 1. Routing device R2 searches its locally stored routing engine table (RE Table) according to the table lookup index REindex12 and learns that the next hop of path 1 is routing device R4. Routing device R2 adds the table lookup index VPS1 index 14 or RPSindex 14 of routing device R4 in path 1 to the message. VPS1 index 14 is used by routing device R4 to search its locally stored VPS1 table, and RPS index 14 is used by routing device R4 to search its locally stored RPS table.

[0167] (6) At the same time, routing device R2 establishes path 2 (Path2) from routing device R2 to routing device R4. The destination address of path 2 (Path2) is routing device R4. Routing device R2 queries the table and finds that the next hop of path 2 (Path2) is routing device R3. Routing device R2 adds the table index VPS1 index 23 or RPSindex 23 of routing device R3 in path 2 (Path2) to the message. VPS index 23 is used by routing device R3 to query the VPS1 table stored locally, and RPS index 23 is used by routing device R3 to query the RPS table stored locally.

[0168] (7) The message reaches routing device R3 through path 2. Routing device R3 learns from VPS index 23 that the next hop through path 2 is routing device R4. Routing device R3 adds the table lookup index RE index 24 of routing device R4 in path 2 to the message. RE index 24 is used by routing device R4 to look up its locally stored routing engine table (RE Table).

[0169] (8) The message arrives at routing device R4 via path 2. Routing device R4 is the end point of path 2 and removes the header and table index of the message on path 2.

[0170] (9) Routing device R4 finds out from the table based on VPS index 14 that the next hop of path 1 (Path1) is routing device R5, and routing device R5 is the end point of path 1 (Path1); routing device R4 adds the table index RE index 15 of routing device R5 in path 1 (Path1) to the message. RE index 15 is used by routing device R5 to look up the routing engine table (RE Table) stored locally.

[0171] (10) The message arrives at routing device R5 via path 1. Routing device R5 is the end point of path 1 and removes the header and table index of the message on path 1.

[0172] (11) Routing device R5 looks up the table based on RE index 05 to obtain the next hop and continues forwarding.

[0173] The above-mentioned embodiment achieves the effect of fast table lookup by exchanging local search tree storage table indexes between downstream routing devices. After the previous-hop routing device looks up the table, the message carries the table lookup index of the next-hop routing device. The present application adds table lookup index information between downstream routing devices in the message, thereby optimizing the table lookup speed.

[0174] In summary, this application notifies the local table lookup index of the downstream routing device, and performs fast table lookup and cross-table query through the collaborative work of upstream and downstream routing devices; the upstream and downstream routing devices bitmap (Bitmap) encode the local search tree and announce the search tree, or announce the local configuration route (with attributes), so that the search trees of the upstream and downstream routing devices are completely consistent (RPS level consistent or VPS level consistent); the downstream routing device sends the local table lookup index to the upstream routing device, and the upstream routing device stores the table lookup index to the local corresponding table item. When forwarding the message, the upstream routing device looks up the table and carries the corresponding table lookup index of the downstream routing device in the message to the downstream routing device; the downstream routing device quickly looks up the table according to the table lookup index sent by the upstream routing device, directly finds the local table item, and realizes fast table lookup. This application is applicable to mainstream scenarios of existing networks: wireless networks, IPRAN, backbone networks, metropolitan area networks, campus networks, etc. This application is applicable to tunnel nesting scenarios. This application can reduce 80% of the LPM table lookup delay, from 76Cycle to 16Cycle. This application can alleviate the memory wall: a) Memory access bandwidth is reduced to 7%, from 2048bit (4-level ISTA) to 22bit (RE Index), or to 22bit (RE Index) + 150bit (VPS). Assuming that the traffic that can be jointly searched 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 possible VPS. Assuming that the traffic that can be jointly searched accounts for 50% of the total traffic, the total number of memory accesses is reduced to 75%. This application reduces the memory capacity by half. Assuming that the traffic that can be jointly searched accounts for 50% of the total traffic, the total memory usage is reduced to 80% under the same performance.

[0175] See also Fig. 22 , Fig. 22 A structural schematic diagram of a routing device provided for an embodiment of the present application; the routing device 2200 is applied to a first routing device, and the routing device 2200 includes: a receiving unit 2201, used to receive a target message from a second routing device, the second routing device is a downstream routing device of the first routing device, and 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 2202, used to send a second message to the second routing device after receiving the first message, the second message includes the first message and a first target index, the first target index is used by the second routing device to determine the egress port of the first message, and the at least one index includes the first target index.

[0176] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

[0177] In a possible implementation, the target message also includes the at least one IP address prefix; the apparatus also includes a processing unit 2203, which is used to: after receiving the target message from the second routing device and before sending the second message to the second routing device; query the first target data table according to any IP address prefix in the at least one IP address prefix to determine in the first target data table a first target IP address prefix that matches the longest prefix of any IP address prefix; add 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 the second target data table, where the second target index is the first target IP address prefix in the first target data table. suffix; wherein, if any of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any of the IP address prefixes 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 with a virtual prefix search tree structure.

[0178] In a possible implementation, 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 used to receive a first binary string from the second routing device, the first binary string being a binary string obtained by encoding the second complete prefix search tree; the processing unit 2203 is further used to obtain a third complete prefix search tree according to the second binary string and the first complete prefix search tree, the second binary string being the first binary string and the third binary string subjected to an OR operation the binary string obtained after the operation, the third binary string is the binary string obtained by encoding the first complete prefix search tree; and a table entry is added in the first data table according to the third complete prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node.

[0179] In a possible implementation, encoding the first complete 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; wherein, nodes in the fourth complete prefix search tree corresponding to IP address prefixes are encoded as 1, and empty nodes in the fourth complete prefix search tree and nodes corresponding to no IP address prefixes are encoded as 0.

[0180] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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, the fourth binary string being a binary string obtained by encoding the 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, the fifth binary string being a binary string obtained by performing an OR operation on the fourth binary string and a third binary string, and the third binary string being a binary string obtained by performing an OR operation on the first complete prefix search tree a binary string obtained by row encoding; and adding a table entry in the first data table according to the second virtual prefix search tree; wherein the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look up the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the third target node.

[0181] It should be noted that the implementation of each unit in the embodiment of the present application can also refer to Figure 4 The relevant descriptions in the illustrated embodiments are not repeated here. Of course, the routing device 2200 provided in the embodiment of the present application includes but is not limited to the above-mentioned unit modules, for example: the routing device 2200 may also include a storage unit 2204. The storage unit 2204 may be used to store the program code and data of the routing device 2200. In addition, Fig. 22 The beneficial effects brought by the described routing device 2200 can be referred to Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0182] See also Fig.23 , Fig.23A structural schematic diagram of another routing device provided for an embodiment of the present application, the routing device 2300 is applied to a second routing device, and the routing device 2300 includes: a sending unit 2301, used to send a target message to a first routing device, 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, used to receive a second message from the first routing device, the second message includes a first message and a first target index, the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index.

[0183] In a possible implementation, the at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

[0184] In a possible implementation, the depth of a first complete prefix search tree corresponding to the first data table is the same as the depth of a second complete prefix search tree corresponding to the 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 depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 used to: send a first binary string to the first routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree.

[0185] In a possible implementation, encoding the second complete 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; wherein the nodes corresponding to the IP address prefix in the fifth complete prefix search tree are encoded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fifth complete prefix search tree are encoded as 0.

[0186] In a possible implementation, a difference between a depth of a first complete prefix search tree corresponding to the first data table and a depth of a 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 used to: send 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, and the first virtual prefix search tree is obtained based on the second complete prefix search tree.

[0187] It should be noted that Fig.23 The implementation of each unit in the described embodiment can also refer to Figure 4 The relevant descriptions in the illustrated embodiments are not repeated here. Of course, the routing device 2300 provided in the embodiment of the present application includes but is not limited to the above-mentioned unit modules, for example: the routing device 2300 may also include a storage unit 2303. The storage unit 2303 may be used to store the program code and data of the routing device 2300. In addition, Fig.23 The beneficial effects brought by the described routing device 2300 can be referred to Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0188] See also Fig.24 , Fig.24 24 is a schematic diagram of the structure of a first routing device 2410 provided in an embodiment of the present application. The first routing device 2410 includes a processor 2411, a memory 2412 and a communication interface 2413. The processor 2411, the memory 2412 and the communication interface 2413 are interconnected via a bus 2414.

[0189] The memory 2412 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a portable read-only memory (CD-ROM), and the memory 2412 is used for related computer programs and data. The communication interface 2413 is used to receive and send data.

[0190] The processor 2411 may be one or more central processing units (CPUs). When the processor 2411 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.

[0191] The processor 2411 in the first routing device 2410 is used to read the computer program code stored in the memory 2412 and execute Figure 4 The method shown is performed by a first routing device.

[0192] It should be noted that Fig.24 The implementation of each unit in the described embodiment can also refer to Figure 4 The relevant descriptions in the embodiments shown are not repeated here. Fig.24 The beneficial effects brought by the described embodiments can be referred to Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0193] See also Fig.25 , Fig.25 25 is a schematic diagram of the structure of a second routing device 2510 provided in an embodiment of the present application. The second routing device 2510 includes a processor 2511, a memory 2512 and a communication interface 2513. The processor 2511, the memory 2512 and the communication interface 2513 are interconnected via a bus 2514.

[0194] The 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 the memory 2512 is used for related computer programs and data. The communication interface 2513 is used to receive and send data.

[0195] The processor 2511 may be one or more central processing units (CPUs). When the processor 2511 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.

[0196] The processor 2511 in the second routing device 2510 is used to read the computer program code stored in the memory 2512 and execute Figure 4 The method shown is by a second routing device.

[0197] It should be noted that Fig.25 The implementation of each unit in the described embodiment can also refer to Figure 4 The relevant descriptions in the embodiments shown are not repeated here. Fig.25 The beneficial effects brought by the described embodiments can be referred to Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0198] An embodiment of the present application also provides a chip, which includes at least one processor, a memory and an interface circuit, wherein the memory, the transceiver and the at least one processor are interconnected via lines, and a computer program is stored in the at least one memory; when the computer program is executed by the processor, the method flow shown in the method embodiment is implemented.

[0199] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the method flow shown in the above method embodiment is implemented.

[0200] The embodiment of the present application also provides a computer program. When the computer program is run on a computer, the method flow shown in the method embodiment is implemented.

[0201] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or 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, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0202] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. 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 dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).

[0203] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor.

[0204] It should be noted that the memory described herein is intended to include, but not be limited to, these and any other suitable types of memory.

[0205] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0206] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0207] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0208] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0209] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0210] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0211] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or terminal device, etc.) to perform all or part of the steps of the above methods in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0212] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. In addition, the terms and explanations in each embodiment of the present application can refer to the corresponding descriptions in other embodiments.

[0213] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0214] The above description and the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A routing method, characterized in that: Applied to a first routing device, 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 comprising 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; After receiving the first message, send a second message to the second routing device, where the second message includes the first message and a first target index, where the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index; The target message also includes the at least one IP address prefix; after receiving the target message from the second routing device and before sending the second message to the second routing device, the method further includes: According to any IP address prefix of the at least one IP address prefix, query a first target data table to determine in the first target data table a first target IP address prefix that matches the longest prefix of any IP address prefix; Adding an index corresponding to any one of the IP address prefixes in the at least one index to an entry corresponding to a second target index in the second target data table, where the second target index is an index corresponding to the first target IP address prefix in the first target data table; Among them, if any of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any of the IP address prefixes 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 with a virtual prefix search tree structure.

2. The method according to claim 1, characterized in that The at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete 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 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 includes: 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; Obtain 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 a binary string obtained by performing an OR operation on the first binary string and the third binary string, and the third binary string is a binary string obtained by encoding the first complete prefix search tree; Adding an entry in the first data table according to the third complete prefix search tree; Among them, the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node.

4. The method according to claim 3, characterized in that The encoding of the first complete 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; The nodes corresponding to the IP address prefix in the fourth complete prefix search tree are coded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fourth complete prefix search tree are coded as 0.

5. The method according to claim 1 or 2, characterized in that: 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 includes: receiving 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, where the first virtual prefix search tree is obtained according to the second complete prefix search tree; Obtain 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 a binary string obtained by performing an OR operation on the fourth binary string and the third binary string, and the third binary string is a binary string obtained by encoding the first complete prefix search tree; Adding an entry in the first data table according to the second virtual prefix search tree; The second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look up the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the third target node.

6. A routing method, characterized in that: Applied to a second routing device, the method includes: Sending 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; receiving a second message from the first routing device, where the second message includes the first message and a first target index, where the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index; 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 includes: A first binary string is sent to the first routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree.

7. The method according to claim 6, characterized in that The at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

8. The method according to claim 6 or 7, characterized in that: The encoding of the second complete 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; The nodes corresponding to the IP address prefix in the fifth complete prefix search tree are coded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fifth complete prefix search tree are coded as 0.

9. The method according to claim 6 or 7, characterized in that: 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 includes: A fourth binary string is sent to the first routing device, where the fourth binary string is a binary string obtained by encoding a first virtual prefix search tree, where the first virtual prefix search tree is obtained according to the second complete prefix search tree.

10. A routing device, characterized in that: Applied to a first routing device, the apparatus comprises: 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, wherein 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, configured to send a second message to the second routing device after receiving the first message, wherein the second message includes the first message and a first target index, wherein the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index; The target message further includes the at least one IP address prefix; the device further includes a processing unit, configured to: After receiving the target message from the second routing device and before sending the second message to the second routing device; According to any IP address prefix of the at least one IP address prefix, query a first target data table to determine in the first target data table a first target IP address prefix that matches the longest prefix of any IP address prefix; Adding an index corresponding to any one of the IP address prefixes in the at least one index to an entry corresponding to a second target index in the second target data table, where the second target index is an index corresponding to the first target IP address prefix in the first target data table; Among them, if any of the IP address prefixes is an IP address prefix in a data table with a complete prefix search tree structure, the first target data table is a data table with a complete prefix search tree structure, and the second target data table is a routing engine table; if any of the IP address prefixes is an IP address prefix in a data table with a virtual prefix search tree structure, the first target data table is a data table with a virtual prefix search tree structure, and the second target data table is a data table with a complete prefix search tree structure or a data table with a virtual prefix search tree structure; if any of the IP address prefixes 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 with a virtual prefix search tree structure.

11. The device according to claim 10, characterized in that The at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

12. The device according to claim 10 or 11, characterized in that 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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, wherein the second binary string is a binary string obtained by performing an OR operation on the first binary string and the third binary string, and the third binary string is a binary string obtained by encoding the first complete prefix search tree; and adding an entry in the first data table according to the third complete prefix search tree; Among them, the second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 the IP address prefix corresponding to the 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 the IP address prefix in the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the first target node.

13. The device according to claim 12, characterized in that The encoding of the first complete 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; The nodes corresponding to the IP address prefix in the fourth complete prefix search tree are coded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fourth complete prefix search tree are coded as 0.

14. The device according to claim 10 or 11, characterized in that 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 a binary string obtained by encoding the first virtual prefix search tree, where 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, wherein the fifth binary string is a binary string obtained by performing an OR operation on the fourth binary string and the third binary string, and the third binary string is a binary string obtained by encoding the first complete prefix search tree; and adding an entry in the first data table according to the second virtual prefix search tree; The second target IP address prefix in the added table entry is the IP address prefix corresponding to the 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 to the first complete prefix search tree, the IP address prefix corresponding to the third target node is the IP address prefix corresponding to the 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 the IP address prefix in the third data table, and the lookup result of the third data table is used to look up the second data table; the third target index in the added table entry is the index corresponding to the nearest ancestor node of the third target node.

15. A routing device, characterized in that: Applied to a second routing device, the apparatus comprises: 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, 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 receiving unit, configured to receive a second message from the first routing device, wherein the second message includes the first message and a first target index, wherein the first target index is used by the second routing device to determine an egress port of the first message, and the at least one index includes the first target index; 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 topological structure of the first complete prefix search tree is different from the topological structure of the second complete prefix search tree; or the depth of the first complete prefix search tree differs from the depth of the second complete prefix search tree by 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 used for: A first binary string is sent to the first routing device, where the first binary string is a binary string obtained by encoding the second complete prefix search tree.

16. The device according to claim 15, characterized in that The at least one index includes at least one of the following: an index of a routing engine table, an index of a data table of a complete prefix search tree structure, and an index of a data table of a virtual prefix search tree structure.

17. The device according to claim 15 or 16, characterized in that The encoding of the second complete 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; The nodes corresponding to the IP address prefix in the fifth complete prefix search tree are coded as 1, and the empty nodes and the nodes corresponding to the non-IP address prefix in the fifth complete prefix search tree are coded as 0.

18. The device according to claim 15 or 16, characterized in that 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 used to: A fourth binary string is sent to the first routing device, where the fourth binary string is a binary string obtained by encoding a first virtual prefix search tree, where the first virtual prefix search tree is obtained according to the second complete prefix search tree.

19. A first routing device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method as described in any one of claims 1 to 5.

20. A second routing device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method as described in any one of claims 6 to 9.

21. A chip, characterized in that: include: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as described in any one of claims 1-5 or 6-9.

22. A computer-readable storage medium, characterized in that: It stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute the method as claimed in any one of claims 1-5 or 6-9.