Decision tree updating method, device, electronic device and storage medium

By introducing a coordinated search mechanism of forwarding pointers, leaf vectors and child node pointers in the decision tree, the problem of inefficient Poptrie update is solved, and more efficient forwarding table entry updates are achieved, reducing dependence on additional storage.

CN115550142BActive Publication Date: 2025-08-19NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211176402.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-26
Publication Date
2025-08-19
Estimated Expiration
2042-09-26

AI Technical Summary

Technical Problem

In the prior art, the Poptrie of the multi-fork Radix tree needs to additional query the auxiliary storage structure when updating the forwarded table entry, resulting in increased memory footprint and inefficient updates.

Method used

The decision tree update method is adopted. By including forwarding pointers, leaf vectors, child node vectors and leaf array pointers in each hierarchy node, the matching results of these pointers and vectors are used to find the IP prefix to be updated step by step, and the forwarding pointers and leaf array pointers of the lowest hierarchy node are directly updated to avoid additional query auxiliary structures.

Benefits of technology

Improve the update efficiency of the decision tree, reduce dependence on extra memory, and improve update speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115550142B_ABST
    Figure CN115550142B_ABST
Patent Text Reader

Abstract

The present invention provides a decision tree updating method, device, electronic device, and storage medium, relating to the field of communication technology. Each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer, and a child node pointer. The forwarding pointer includes multiple forwarding sub-pointers, each of which points to a forwarding table entry. The leaf vector indicates the offset of the forwarding sub-pointer corresponding to each node in the level within the leaf array pointer. Each array element included in the leaf array pointer identifies the offset of a forwarding sub-pointer within the forwarding pointer. The method includes searching the decision tree for nodes that match the IP prefix to be updated, step by step, until the lowest level node that matches the IP prefix to be updated is found, and then updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node. This improves update efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a decision tree updating method, device, electronic device and storage medium. Background Art

[0002] Currently, network devices such as network switches and routers use a Forwarding Information Base (FIB) to guide the forwarding of Internet Protocol (IP) packets. Multi-branch Radix trees are commonly used to store forwarding entries in the FIB. However, non-leaf nodes in a multi-branch Radix tree contain a significant amount of redundant data. To conserve memory, a population count (popcnt) algorithm can be used to compress the multi-branch Radix tree. This compressed multi-branch Radix tree is called a Poptrie.

[0003] Currently, according to the longest prefix matching principle, Poptrie only records valid forwarding entries. For invalid forwarding entries, additional auxiliary storage structures are required for storage. When inserting or deleting forwarding entries in Poptrie, additional queries to the auxiliary storage structure are required, which not only takes up additional memory space but also leads to low update efficiency of Poptrie. Summary of the Invention

[0004] The purpose of the embodiments of the present invention is to provide a decision tree updating method, device, electronic device, and storage medium to improve the updating efficiency of the decision tree. The specific technical solution is as follows:

[0005] In a first aspect, an embodiment of the present application provides a decision tree updating method, wherein each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer, and a child node pointer; wherein the forwarding pointer includes multiple forwarding sub-pointers, each forwarding sub-pointer points to a forwarding table entry; the leaf vector is used to indicate the offset of the forwarding sub-pointer corresponding to each node of the level in the leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table entry corresponding to the node; each array element included in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer; the node represented by the set position in the child node vector has a node at the next level; the child node pointer is used to point to the node at the next level; the method includes:

[0006] Obtaining a forwarding table entry to be updated, wherein the forwarding table entry to be updated includes an Internet Protocol (IP) prefix to be updated;

[0007] Based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, the node that matches the IP prefix to be updated is searched level by level in the decision tree until the lowest level node that matches the IP prefix to be updated is found, and the forwarding pointer, leaf vector and leaf array pointer of the lowest level node are updated.

[0008] Optionally, the IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form;

[0009] The method further includes searching for a node matching the IP prefix to be updated in the decision tree level by level based on a matching result between the IP prefix to be updated and a child node vector and a child node pointer in each level node, until a lowest level node matching the IP prefix to be updated is found, and then updating a forwarding pointer, a leaf vector, and a leaf array pointer of the lowest level node, including:

[0010] Set the prefix length to be matched to the prefix length included in the IP prefix to be updated, and set the offset to 0;

[0011] Determine whether the length of the prefix to be matched is greater than a preset step number;

[0012] If not, determining that the current level node is the lowest level node that matches the IP prefix to be updated, and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node;

[0013] If yes, extract the preset step number of bits from the IP address starting from the offset position, and convert the extracted bits into a decimal slot value;

[0014] If the value of the slot value indication position in the child node vector of the current level node has been set, then obtaining the next level node based on the child node vector and the child node pointer of the current level node;

[0015] Take the next-level node as the current-level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

[0016] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node includes:

[0017] Adding a forwarding sub-pointer to the tail of the forwarding pointer of the lowest-level node, and setting the newly added forwarding sub-pointer to point to the forwarding table entry to be inserted;

[0018] Determine a prefix interval represented by bits in the IP address from a current offset to the prefix length to be updated;

[0019] Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted;

[0020] If the node in the prefix interval has a child node, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted;

[0021] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0022] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; after extracting the preset step number of bits from the IP address starting from the position of the offset and converting the extracted bits into a decimal slot value, the method further comprises:

[0023] If the value of the slot value indication position in the child node vector of the current level node is not set, then set the value of the slot value indication position and add a child node for the current level node;

[0024] Add a forwarding sub-pointer to the forwarding pointer of the child node, and set the added forwarding sub-pointer to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node;

[0025] Take the child node as the current level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0026] Optionally, the forwarding table entry to be updated is a forwarding table entry to be deleted, and the IP prefix to be updated is an IP prefix to be deleted; and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node includes:

[0027] Determine whether there is a forwarding sub-pointer in the forwarding sub-pointer included in the forwarding pointer of the current level node pointing to the forwarding table entry to be deleted;

[0028] If so, delete the forwarding table entry to be deleted, and determine the prefix interval represented by the bits from the current offset to the prefix length in the IP address;

[0029] Determine the longest IP prefix that exists in the decision tree and can cover the IP prefix to be deleted, and obtain a forwarding table entry corresponding to the longest IP prefix;

[0030] Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix;

[0031] Determining whether a node within the prefix interval has a child node;

[0032] If so, recursively update the forwarding table entry stored in the forwarding child pointer of the affected child node;

[0033] If not, determining whether the current level node has a child node;

[0034] If not, and the forwarding pointer of the current level node stores a default forwarding table entry and does not store other forwarding table entries, deleting the current level node;

[0035] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0036] Optionally, if the number of offsets indicated by the leaf array pointer is less than or equal to 7, then 7 bits of the highest 8 bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer; the other bit is used to indicate that the storage space occupied by the leaf array pointer includes: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer; the remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer.

[0037] In a second aspect, an embodiment of the present application provides a decision tree updating device, wherein each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer, and a child node pointer; wherein the forwarding pointer includes multiple forwarding sub-pointers, each forwarding sub-pointer points to a forwarding table entry; the leaf vector is used to indicate the offset of the forwarding sub-pointer corresponding to each node of the level in the leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table entry corresponding to the node; each array element included in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer; the node represented by the set position in the child node vector has a node at the next level; the child node pointer is used to point to the node at the next level; the device includes:

[0038] An acquisition module, configured to acquire a forwarding table entry to be updated, wherein the forwarding table entry to be updated includes an Internet Protocol IP prefix to be updated;

[0039] An update module is used to search for nodes that match the IP prefix to be updated from the decision tree level by level based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, until the lowest level node that matches the IP prefix to be updated is found, and then update the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0040] Optionally, the IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form; the updating module is specifically configured to:

[0041] Set the prefix length to be matched to the prefix length included in the IP prefix to be updated, and set the offset to 0;

[0042] Determine whether the length of the prefix to be matched is greater than a preset step number;

[0043] If not, determining that the current level node is the lowest level node that matches the IP prefix to be updated, and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node;

[0044] If yes, extract the preset step number of bits from the IP address starting from the offset position, and convert the extracted bits into a decimal slot value;

[0045] If the value of the slot value indication position in the child node vector of the current level node has been set, then obtaining the next level node based on the child node vector and the child node pointer of the current level node;

[0046] Take the next-level node as the current-level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

[0047] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; and the updating module is specifically configured to:

[0048] Adding a forwarding sub-pointer to the tail of the forwarding pointer of the lowest-level node, and setting the newly added forwarding sub-pointer to point to the forwarding table entry to be inserted;

[0049] Determine a prefix interval represented by bits in the IP address from a current offset to the prefix length to be updated;

[0050] Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted;

[0051] If the node in the prefix interval has a child node, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted;

[0052] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0053] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; and the updating module is further configured to:

[0054] If the value of the slot value indication position in the child node vector of the current level node is not set, then set the value of the slot value indication position and add a child node for the current level node;

[0055] Add a forwarding sub-pointer to the forwarding pointer of the child node, and set the added forwarding sub-pointer to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node;

[0056] Take the child node as the current level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0057] Optionally, the forwarding table entry to be updated is a forwarding table entry to be deleted, and the updating module is specifically configured to:

[0058] Determine whether there is a forwarding sub-pointer in the forwarding sub-pointer included in the forwarding pointer of the current level node pointing to the forwarding table entry to be deleted;

[0059] If so, delete the forwarding table entry to be deleted, and determine the prefix interval represented by the bits from the current offset to the prefix length in the IP address;

[0060] Determine the longest IP prefix that exists in the decision tree and can cover the IP prefix to be deleted, and obtain a forwarding table entry corresponding to the longest IP prefix;

[0061] Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix;

[0062] Determining whether a node within the prefix interval has a child node;

[0063] If so, recursively update the forwarding table entry stored in the forwarding child pointer of the affected child node;

[0064] If not, determining whether the current level node has a child node;

[0065] If not, and the forwarding pointer of the current level node stores a default forwarding table entry and does not store other forwarding table entries, deleting the current level node;

[0066] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0067] Optionally, if the number of offsets indicated by the leaf array pointer is less than or equal to 7, then 7 bits of the highest 8 bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer; the other bit is used to indicate that the storage space occupied by the leaf array pointer includes: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer; the remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer.

[0068] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0069] Memory for storing computer programs;

[0070] The processor is configured to implement any of the method steps described in the first aspect when executing a program stored in the memory.

[0071] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described in the first aspect is implemented.

[0072] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.

[0073] Adopt technique scheme, because the decision tree among the embodiment of the present application comprises leaf array pointer, each array element that leaf array pointer comprises represents the offset of a forwarding sub-pointer in forwarding pointer, and leaf vector is used for indicating the offset of the forwarding sub-pointer that each node of place's hierarchy is corresponding at the offset of leaf array pointer, and the forwarding sub-pointer that each node is corresponding points to the forwarding table item of this node corresponding.Promptly coordinate the storage location of the forwarding table item that determines each node corresponding by leaf vector and leaf array pointer, rather than directly determine the storage location of the forwarding table item that each node is corresponding by leaf vector, like this, make forwarding pointer can point to more forwarding table items by forwarding sub-pointer, thereby make ineffective forwarding table items can be accommodated in the decision tree, can avoid using extra auxiliary storage structure.Like this, after obtaining forwarding table item to be updated, can be based on the matching result of sub-node vector and sub-node pointer in IP prefix to be updated and each hierarchy node, from decision tree, search the lowest level node that is matched with forwarding table item to be updated, and forwarding pointer, leaf vector and leaf array pointer of lowest level node are updated, need not to query extra auxiliary structure, also need not back-track query to root node, can improve update efficiency.

[0074] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0076] Figure 1a An exemplary schematic diagram of a simple Radix tree provided in an embodiment of the present application;

[0077] Figure 1b An exemplary schematic diagram of a Radix tree for a compression path provided in an embodiment of the present application;

[0078] Figure 1c This is another exemplary schematic diagram of a simple Radix tree provided in an embodiment of the present application;

[0079] Figure 2a An exemplary schematic diagram of a Radix tree for another compression path provided in an embodiment of the present application;

[0080] Figure 2b This is an exemplary schematic diagram of the overall structure of a simple Radix tree provided in an embodiment of the present application;

[0081] Figure 3aAn exemplary schematic diagram of a multi-branch tree provided in an embodiment of the present application;

[0082] Figure 3b Another exemplary schematic diagram of a multi-branch tree provided in an embodiment of the present application;

[0083] Figure 4 Another exemplary schematic diagram of a multi-branch tree provided in an embodiment of the present application;

[0084] Figure 5 A schematic diagram of a Popcint trie structure provided in an embodiment of the present application;

[0085] Figure 6a An exemplary schematic diagram of a quadtree provided in an embodiment of the present application;

[0086] Figure 6b A schematic diagram of a Popcint trie storage structure corresponding to a quadtree provided in an embodiment of the present application;

[0087] Figure 6c Another exemplary schematic diagram of a quadtree provided in an embodiment of the present application;

[0088] Figure 7a Another Popcint trie structure diagram provided in an embodiment of the present application;

[0089] Figure 7b A schematic diagram of a storage method of a leaf array pointer provided in an embodiment of the present application;

[0090] Figure 8 A schematic diagram of another Popcint trie structure provided in an embodiment of the present application;

[0091] Figure 9 A flow chart of the first decision tree updating method provided in an embodiment of the present application;

[0092] Figure 10 A flow chart of the second decision tree updating method provided in an embodiment of the present application;

[0093] Figure 11a An exemplary schematic diagram of an IP prefix length update provided in an embodiment of the present application;

[0094] Figure 11b Another exemplary schematic diagram of updating the IP prefix length provided in an embodiment of the present application;

[0095] Figure 12 An exemplary flow chart of inserting a forwarding table entry provided in an embodiment of the present application;

[0096] Figure 13a-13f1. It is an exemplary schematic diagram of the change process of Radix tree and Popcint trie tree during the process of inserting forwarding entries;

[0097] Figure 14a-14h 1. It is another exemplary schematic diagram of the change process of Radix tree and Popcint trie tree in the process of inserting forwarding entries;

[0098] Figure 15 An exemplary flowchart of deleting a forwarding table entry provided in an embodiment of the present application;

[0099] Figure 16a-16h 1. It is an exemplary schematic diagram of the change process of the Radix tree and the Popcint trie tree in the process of deleting a forwarding entry;

[0100] Figure 17a-17b 1. It is an exemplary schematic diagram of a process of changing a Popcnt trie tree during the process of deleting a forwarding entry;

[0101] Figure 18 An exemplary flow chart of a decision tree search algorithm provided in an embodiment of the present application;

[0102] Figure 19 A schematic diagram of the structure of a decision tree updating device provided in an embodiment of the present application;

[0103] Figure 20 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0104] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of the present invention.

[0105] To facilitate understanding, relevant concepts involved in the embodiments of the present disclosure are first introduced.

[0106] 1. FIB entry

[0107] FIB entries guide the forwarding of IPv4 / IPv6 / NDN packets. The core structure of a FIB entry is: prefix / prefix length+outgoing interface. The prefix length indicates which part of the prefix is a valid match.

[0108] For example, the IPv4 FIB contains two entries:

[0109] Entry 1: IP prefix: 10.0.0.0 / 8 Outgoing interface: Interface 2.

[0110] Entry 2: IP prefix: 10.20.0.0 / 16 Outbound interface: Interface 3.

[0111] In "10.0.0.0 / 8", "10.0.0.0" is the IP address and "8" is the prefix length. This means that if the destination address of a received IP packet matches "10." in the IP prefix, the packet is forwarded through interface 2.

[0112] In "10.20.0.0 / 16", "10.20.0.0" is the IP address and "16" is the prefix length. This means that if the destination address of a received packet matches "10.20." in the IP prefix, the packet is forwarded through interface 3.

[0113] In addition, the longest match principle is followed when matching packets with IP prefixes. That is, if the destination address of a packet matches multiple IP prefixes, the outbound interface corresponding to the IP prefix with the longest prefix length among the matched IP prefixes is selected.

[0114] For example, assuming that the destination IP address of the received IP packet is 10.0.0.1, this destination IP address can only match the above Entry 1, so the network device will select outbound interface 2 in Entry 1 as the forwarding interface for the IP packet.

[0115] For another example, suppose the destination IP address of the received packet is 10.20.0.1. This destination IP address matches both Entry 1 and Entry 2. However, the prefix length 16 of Entry 2 is longer than the prefix length 8 of Entry 1. Therefore, the network device selects outbound interface 3 in Entry 2 as the forwarding interface for the packet.

[0116] 2. Radix tree.

[0117] Currently, forwarding table entries can be stored using a Radix tree or a variant of the Radix tree. A simple Radix tree is a binary tree that forks a node based on each bit of the inserted key. If the inserted bit is 0, the bit is inserted into the left branch of the current node; if the inserted bit is 1, the bit is inserted into the right branch of the current node.

[0118] For example, if the IP prefix is 10.0.0.0 / 8 (binary representation is 00001010.0.0.0), the naive Radix tree generated based on the IP prefix is as follows: Figure 1a As shown. The valid information corresponding to 10.0.0.0 / 8 is stored in Figure 1a Nodes with a grid background, for example, valid information is outbound interface information.

[0119] Optionally, unnecessary bifurcations can be reduced by compressing the public path. Taking the IP prefix 10.0.0.0 / 8 as an example, the compressed Radix tree is as follows: Figure 1b As shown in the figure, since the first bit of the compressed 00001010 is 0, the left branch of the root node is entered and 8 bits are matched at once. If the destination address of the message does not match the IP prefix, the system backtracks to the parent node to obtain the valid information stored in the root node.

[0120] exist Figure 1a On the basis of , assuming that in addition to the forwarding table entry with IP prefix 10.0.0.0 / 8, there is also a forwarding table entry with IP prefix 15.0.0.0 / 8 (binary 00001111.0.0.0), then the simple Radix tree is as follows Figure 1c As shown, the valid information of these two forwarding entries is stored in the two nodes with grid background at the bottom. At this time, there is a common path between the two IP prefixes, and the common path between the two IP prefixes can be compressed. The compressed Radix tree is as follows Figure 2a As shown, valid information is stored in the two nodes with grid background at the bottom.

[0121] In addition, when IP prefixes are distributed more and more densely, the Radix tree will consume more memory. For example, the IP prefixes include 1.0.0.0 / 8, 2.0.0.0 / 8, 3.0.0.0 / 8, ..., 255.0.0.0 / 8, a total of 256 IP prefixes. The Radix tree at this time is as follows: Figure 2b shown.

[0122] At this point, the Radix tree has a total of 2^9-1 nodes, or 511 nodes. Each node contains an IP address, a mask, and pointers to two child nodes. Because the nodes in this Radix tree lack a common path, it cannot be compressed. Therefore, when prefixes of the same length are densely packed, the binary Radix tree will contain many auxiliary nodes, meaning that these nodes do not actually store forwarding entries. Furthermore, since compression is impossible, the binary Radix tree is tall, resulting in more memory accesses and lower access performance.

[0123] In order to reduce the height of the Radix tree, the binary Radix tree can be expanded to a multi-branch Radix tree. Still taking the above forwarding table entry with the IP prefix 10.0.0.0 / 8 as an example, the structure of the quad Radix tree is as follows Figure 3aAs shown in Figure 2, compared to the binary Radix tree, the tree height is reduced from 8 layers to 4 layers. If the forwarding table entry with the IP prefix 15.0.0.0 / 8 is added, the structure of the quad Radix tree is as follows: Figure 3b shown.

[0124] Each node is an array of size 4. When a two-bit binary number is inserted, if the first bit is 0, it enters the left branch of the current node. If the first bit is 1, it enters the right branch of the current node.

[0125] Using a multi-branch Radix tree structure can reduce the height of the tree, but the memory consumption is still serious. Figure 3b The memory occupied by the quad-radix tree shown is as follows Figure 4 As shown, each non-leaf node requires an array of size 4 to store the information of the next level node. Figure 4 Only two nodes with grid backgrounds store forwarding entries.

[0126] Poptrie

[0127] Because non-leaf nodes in a quadradix tree contain a significant amount of redundant data, to conserve memory, the quadradix tree can be compressed using the bit-1 counting Popcnt instruction to create a Popcnt trie, hereinafter referred to as Poptrie. The Popcnt instruction counts the number of 1s in a binary representation. For example, for the binary number 0001010, Popcnt returns 2.

[0128] like Figure 5 As shown, Figure 5 Figure 1 shows the Poptrie structure. Each non-leaf node (POP_Node) contains two bitmaps: a leaf vector (LeafVec) and a child vector (DirVec). Each bitmap is 64 bits long. Furthermore, each non-leaf node contains two pointers: a forwarding pointer (FIB_Entry*) and a child node pointer (POP_Node*).

[0129] FIB_Entry* is used to store the effective forwarding entry corresponding to the current node, and POP_Node* points to child nodes. LeafVec is used to cooperate with Popcnt to search the effective forwarding entry corresponding to the current node in FIB_Entry*. DirVec is used to indicate whether a node has child nodes.

[0130] Taking a 4-way Radix tree as an example, assuming there is a default forwarding entry with an IP prefix of 0.0.0.0 / 0 and a forwarding entry with an IP prefix of 1011 / 4, the generated 4-way Radix tree is as follows: Figure 6a As shown, below the root node are the nodes of the first level (level 1), level 1 includes 00, 01, 10, 11, and below level 1 are the nodes of the second level (level 2) of node 10 in level 1, level 2 includes 00, 01, 10, 11.

[0131] Figure 6a The corresponding Poptrie is as follows Figure 6b shown.

[0132] Among them, the first level node (POP_Node level 1) corresponds to Figure 6a Level 1 in POP_Node level 2 corresponds to Figure 6a Level 2 in the.

[0133] In POP_Node level 1, LeafVec is 0001, DirVec is 0100, POP_Node* includes a pointer pointing to the second-level node (POP_Node level 2), and FIB_Entry* includes a pointer pointing to the default forwarding table entry.

[0134] In POP_Node level 2, LeafVec is 1001, DirVec is 0000, POP_Node* is empty, and FIB_Entry* includes two pointers, pointing to the default forwarding table entry and the forwarding table entry with the IP prefix 1011 / 4.

[0135] The following uses the search for the forwarding table entry corresponding to binary 1011 as an example to introduce the process of using popcnt with LeafVec and DirVec to search for forwarding entries in Poptrie.

[0136] First, extract the first two bits "10" of the number 1011 to be searched, and convert the binary 10 to decimal 2, which corresponds to the third branch of Level 1 in the quaternary tree. It also corresponds to the third bit of DirVec(0100) in Level 1. It can be seen that the third bit in DirVec(0100) is set, indicating that node 10 has a child node.

[0137] Furthermore, after knowing that node 10 in POP_Node level 1 has a child node, we need to calculate which child node in Level 2 to enter. The calculation method is: mask all bits higher than the third bit in DirVec(0100). After masking, the remaining binary number is 100. Perform Popcint on 100. If Popcint returns 1, it means that the child node is the first node in POP_Node*, that is, POP_Node level 2, and continue searching in POP_Node level 2.

[0138] After matching POP_Node level 2, all bits of DirVec(0000) in POP_Node level 2 are not set, indicating that POP_Node level 2 has no child nodes. Then, LeafVec(1001) in POP_Node level 2 is used to calculate the offset of the forwarding table entry to be found in FIB_Entry*. The calculation method is: extract the last two bits "11" of 1011 to be found, convert binary 11 to decimal 3, which corresponds to the fourth branch of Level 2 in the quadtree, mask all bits above the fourth bit in LeafVec, and obtain 1001. Popcint is performed on the binary number 1001, and Popcint returns 2, indicating that the offset in FIB_Entry* is 2. The forwarding table entry with the IP prefix 1011 / 4 can be obtained from the offset 2 of FIB_Entry*.

[0139] If you need to delete or insert a forwarding entry in the Poptrie, you must match the default forwarding entry with the default IP prefix 0 / 0 according to the longest prefix match principle to update the forwarding entry for the affected node. However, according to the current Poptrie information, the default IP prefix cannot be directly obtained. You must search the root node level by level to obtain the forwarding entry for the default IP prefix, resulting in low efficiency in updating the Poptrie.

[0140] Assume that there are 7 forwarding entries, with IP prefixes of 00** / 2, 01** / 2, 11** / 2, 1000 / 4, 1001 / 4, 101* / 3 and the default IP prefix 0 / 0. The corresponding 4-way Radix tree is as follows: Figure 6c As shown, the nodes with a grid background are the nodes that store the above forwarding entries. By default, the forwarding entry for IP prefix 0 / 0 is stored in the root node.

[0141] If you need to delete the forwarding entry for the IP prefix 1001 / 4, you need to search the Poptrie for the longest IP prefix that can cover 1001 / 4, and modify the forwarding entry corresponding to the longest IP prefix found. According to the longest prefix matching principle, you need to check whether there is a forwarding entry for the IP prefix 100* / 3. If not, you need to check whether there is a forwarding entry for the IP prefix 10** / 2. If it still does not exist, you need to further check whether there is a forwarding entry for the IP prefix 1*** / 1. If not, continue to search for the default forwarding entry for the IP prefix 0 / 0 and determine that the default forwarding entry for the IP prefix 0 / 0 is the effective forwarding entry.

[0142] Furthermore, if there is a forwarding entry with an IP prefix of 10** / 2, but according to the longest prefix match principle, the forwarding entry with an IP prefix of 10** / 2 is invalid, because the number of forwarding entries stored in the Poptrie cannot exceed 64, the Poptrie does not record the invalid forwarding entry, and an additional storage structure is required to store the forwarding entry. When deleting the forwarding entry with an IP prefix of 1001 / 4, it is also necessary to search the additional storage structure for the forwarding entry with an IP prefix of 10** / 2 and add it to the Poptrie, resulting in low update efficiency for the Poptrie and requiring additional memory space.

[0143] In order to solve the above problems, an embodiment of the present application provides a decision tree updating method. Each level node of the decision tree in the embodiment of the present application includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer and a child node pointer.

[0144] The forwarding pointer includes multiple forwarding sub-pointers, and each forwarding sub-pointer is used to point to a forwarding table entry.

[0145] Each forwarding sub-pointer may point to a valid forwarding table entry or an invalid forwarding table entry.

[0146] The leaf vector indicates the offset of the forwarding sub-pointer corresponding to each node in the leaf array pointer. Each forwarding sub-pointer corresponding to each node points to the corresponding forwarding table entry. Each array element in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer.

[0147] For example, if the slot value of a node at the current level is calculated to be 0 based on the leaf vector, then it can be determined that the offset of the forwarding sub-pointer corresponding to the node in the leaf array pointer is 0. If the leaf array pointer includes [1][0][2], then the array element with an offset of 0 can be obtained from the leaf array pointer, that is, [1]. [1] indicates that the offset of the forwarding sub-pointer in the forwarding pointer is 1, and then it can be determined that the forwarding table entry corresponding to the node is the forwarding table entry pointed to by the forwarding sub-pointer with an offset of 1 in the forwarding pointer.

[0148] The node represented by the set position in the child node vector has a next-level node.

[0149] The child node pointer is used to point to the next level node.

[0150] like Figure 7a As shown, the decision tree in the embodiment of the present application can be called POPTZ Trie, and each level node in POPTZ Trie can be called POPTZ_Node. Each level POPTZ_Node includes FIB_Entry**, LeafVec, DirVec, CHAR*LeafArray and POPTZ_Node*.

[0151] Among them, FIB_Entry** is a forwarding pointer. FIB_Entry** can include FIB_Entry*, which is a forwarding sub-pointer. Each FIB_Entry* points to a valid forwarding entry or an invalid forwarding entry. The first FIB_Entry* in each FIB_Entry** points to the default forwarding entry.

[0152] LeafVec is a leaf vector, which is used to represent the offset of the FIB_Entry* corresponding to the matched node in the CHAR*LeafArray.

[0153] CHAR*LeafArray is a leaf array pointer, which is a character type variable. Each character type variable (CHAR) included in CHAR*LeafArray is used to represent the offset of a FIB_Entry* in FIB_Entry**.

[0154] Optionally, when the number of offsets indicated by the leaf array pointer is less than or equal to 7, that is, when the number of arrays included in CHAR*LeafArray is less than or equal to 7, the leaf array pointer is stored as follows:

[0155] Seven bits of the highest eight bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer, that is, the number of array elements included in the leaf array pointer.

[0156] Another bit is used to indicate that the storage space occupied by the leaf array pointer has embedded storage: the offset of the forwarding sub-pointer corresponding to each node of the level in the forwarding pointer. In other words, another bit is used to indicate that the storage space occupied by the leaf array pointer has embedded storage of array elements. For example, if the value of this bit is 1, it means that the storage space occupied by the leaf array pointer has embedded storage of array elements. If the value of this bit is not 1, it means that the array elements are not stored embedded.

[0157] The remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node in the level in the forwarding pointer, that is, it is used to store array elements.

[0158] If the electronic device uses a 64-bit CPU, the CHAR*LeafArray pointer itself requires 8 bytes. The top 8 bits typically do not store valid data. Therefore, in the embodiment of the present application, the top 8 bits can be used to indicate the storage mode is embedded storage and the number of stored offsets, and the remaining 7 bytes are used to store the actual offsets. This eliminates the need to set up additional memory space for the offsets, saving memory space.

[0159] As an example, Figure 7b As shown, it is assumed that the offsets of the forwarding sub-pointers corresponding to the nodes in the same level in the forwarding pointer are [1][0][2] respectively. In one embodiment, Figure 7b The storage method of the upper part, that is, CHAR*LeafArray points to the extra memory space, and [1][0][2] is stored in the extra memory space. In order to save memory space, you can use Figure 7b The storage method of the lower part is to embed [1][0][2] in CHAR*LeafArray. Figure 7b Each small cell in represents 1 byte, or 8 bits. Figure 7b In the highest byte, 1<<6 means shifting 1 to the left by 6 bits, that is, the 7th bit is set to 1, indicating that the embedded storage method is currently used. "3" means that the number of stored offsets is 3, and the subsequent 7 bytes store the offsets [1][0][2].

[0160] DirVec is a child node vector, and the node represented by the set position has a node at the next level.

[0161] The above LeafVec and DirVec are both in the form of bitmaps.

[0162] POPTZ_Node* is used to indicate the POPTZ_Node of the next level. The structure of POPTZ_Node of each level is the same. Figure 7a One of the levels is used as an example to illustrate.

[0163] The structure of the decision tree provided in the embodiment of the present application is explained below with reference to a specific example.

[0164] For example, if there is a FIB as shown in Table 1, Table 1 shows 7 forwarding entries. For the convenience of subsequent description, the forwarding entries are numbered on the right side of Table 1. In actual implementation, the forwarding entry numbers may not be included in the FIB. If stored in the form of a Radix tree, the structure of the Radix tree can refer to the structure of the Radix tree described in the above embodiment. Figure 6a If stored in the manner of POPTZ Trie provided in the embodiment of the present application, the structure of POPTZ Trie is as follows: Figure 8 shown.

[0165] Table 1

[0166]

[0167]

[0168] See also Figure 8 , then in the first-level node (POPTZ_Node level1), FIB_Entry** has two elements, pointing to the default forwarding entry and forwarding entry 1 respectively.

[0169] LeafVec is 1101; DirVec is 0100; LeafArray is [1][0][1]; POPTZ_Node* has a child node pointer pointing to the second-level node (POPTZ_Node Level2).

[0170] In the second-level node (POPTZ_Node Level2), FIB_Entry** has four elements, pointing to the default forwarding entry, forwarding entry 4, forwarding entry 5, and forwarding entry 6 respectively.

[0171] LeafVec is 0111; DirVec is 0000; LeafArray is [1][2][3]; POPTZ_Node* is empty, that is, there is no child node.

[0172] Based on the above decision tree, if Figure 9 As shown, the method provided in the embodiment of the present application includes:

[0173] S901: Obtain a forwarding table entry to be updated, where the forwarding table entry to be updated includes an IP prefix to be updated.

[0174] The IP prefix to be updated includes the IP address and prefix length, and the forwarding table entry to be updated also includes the outbound interface information corresponding to the IP prefix to be updated.

[0175] S902. Based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, search the decision tree for nodes that match the IP prefix to be updated step by step until the lowest level node that matches the IP prefix to be updated is found, and then update the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node.

[0176] Among them, we can start from the root node of the decision tree and search level by level. For example, Figure 8 In the POPTZ, you can first search in the first-level nodes (POPTZ_Node Level 1), and then search in the second-level nodes (POPTZ_Node Level 2), until you find the lowest-level node that matches the IP prefix to be updated.

[0177] Adopt this method, because the decision tree among the embodiment of the present application comprises leaf array pointer, each array element that leaf array pointer comprises represents the offset of a forwarding sub-pointer in forwarding pointer, and leaf vector is used for indicating the offset of the forwarding sub-pointer corresponding to each node of place's level at the offset of leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table item corresponding to this node. Namely, by leaf vector and leaf array pointer, cooperate and determine the storage location of the forwarding table item corresponding to each node, rather than directly determining the storage location of the forwarding table item corresponding to each node by leaf vector, like this, make forwarding pointer point to more forwarding table items by forwarding sub-pointer, thereby make ineffective forwarding table items can be accommodated in the decision tree, can avoid using extra auxiliary storage structure. Like this, after obtaining forwarding table item to be updated, can be based on the matching result of child node vector and child node pointer in IP prefix to be updated and each level node, from decision tree, search the lowest level node that matches with forwarding table item to be updated, and the forwarding pointer, leaf vector and leaf array pointer of lowest level node are updated, need not to query extra auxiliary structure, also need not backtrack to query to root node, can improve update efficiency.

[0178] In another embodiment of the present application, the IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form. Figure 10 As shown, the above S902 can be specifically implemented as follows:

[0179] S9021. Set the prefix length to be matched to the prefix length included in the IP prefix to be updated, and set the offset to 0.

[0180] The offset is the offset of the IP address in the IP prefix to be matched. The initial offset is 0, which means that no offset is performed initially, that is, matching starts from the highest bit of the IP address.

[0181] S9022: Determine whether the length of the prefix to be matched is greater than the preset step number. If not, execute S9023; if so, execute S9024.

[0182] Among them, the preset step number (PopcntMaxBit) represents the number of steps when extracting bits from the IP address. The value of the preset step number is related to the number of forks in the decision tree. The specific value is the number of bits in each node in the decision tree. For example, the preset step number of a 64-fork decision tree is 6 (2^6=64). In the embodiments of this application, 4 forks are used as an example, that is, the preset step number is 2 (2^2=4).

[0183] S9023: Determine that the current level node is the lowest level node that matches the IP prefix to be updated, and update the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node. After S9023, the process ends.

[0184] It can be understood that if the length of the prefix to be matched is less than or equal to the preset step number, it means that only bits less than the preset step number are left unmatched in the IP address to be matched, so the unmatched bits are all in the current level node, and there must be no node in the next level node that matches the IP address to be matched, so it can be determined that the current level node is the lowest level node that matches the IP prefix to be updated.

[0185] S9024. Starting from the offset position, extract a preset number of bits from the IP address, and convert the extracted bits into a decimal slot value.

[0186] If the length of the prefix to be matched is greater than the preset number of steps, it means that after matching the first preset number of bits of the IP address with the current level node, the subsequent bits of the IP address need to be matched with the next level node.

[0187] When matching with the current level node, you can first extract the preset step number of bits. For example, the preset step number is 2 and the IP address is 1011. Since the offset is 0 at this time, the first two bits "10" of the IP address are extracted and converted to decimal to obtain a slot value of 2.

[0188] S9025. If the value of the slot value indication position in the child node vector of the current level node has been set, obtain the next level node based on the child node vector and the child node pointer of the current level node.

[0189] Continuing with the example from the previous step, after determining that the slot value is 2, we can determine whether bit 2 in the DirVec of the current level node is set. For example, if DirVec is 0100, 0, 1, 0, and 0 correspond to bits 3, 2, 1, and 0, respectively. Therefore, bit 2 is 1, meaning it is set, indicating that the current level node has a next-level node. We can then retrieve the next-level node from the POPTZ_Node* of the current level node.

[0190] S9026. Take the next-level node as the current-level node, subtract the preset number of steps from the length to be matched, add the preset number of steps to the offset, and re-execute S9022 until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

[0191] After obtaining the next-level node, the matching method for the next-level node is the same as the matching method for the current-level node, that is, the next-level node can be used as the current-level node.

[0192] In addition, if the current length to be matched is 4, the offset is 0, and the preset step number is 2, then the length to be matched is updated to 2, the offset is updated to 2, and S9022 is executed again.

[0193] By adopting this method, the IP address included in the IP prefix to be matched can be matched with the nodes of each level layer by layer according to the prefix length and the preset step number of the IP prefix to be matched, until the last preset step number of bits of the IP address are matched, and then the lowest level node in the decision tree can be matched. Because the lowest level node also stores the default forwarding table items and the ineffective forwarding table items, the decision tree can be directly updated based on the lowest level node without updating the additional storage structure or backtracking to query the root node, which can improve the update efficiency.

[0194] In the embodiment of the present application, updating the decision tree includes two cases: one is inserting a forwarding entry into the decision tree, and the other is deleting an existing forwarding entry in the decision tree. These two cases are introduced below.

[0195] First, the method of inserting forwarding table entries into the decision tree is introduced.

[0196] If a forwarding table entry needs to be inserted into the decision tree, the forwarding table entry to be updated in the above embodiment is the forwarding table entry to be inserted.

[0197] Accordingly, in the above S9023, updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node can be specifically implemented as follows:

[0198] Step 1: Add a forwarding sub-pointer to the end of the forwarding pointer of the lowest-level node, and set the newly added forwarding sub-pointer to point to the forwarding table entry to be inserted.

[0199] Step 2: Determine the prefix range represented by the bits from the current offset to the prefix length to be updated in the IP address.

[0200] Because the prefix length to be updated can be any value between 0 and 128, it may not be divisible by the preset step size. Therefore, the IP prefix to be inserted into the forwarding table entry may affect IP prefixes within a prefix range. All IP prefixes within a prefix range are affected, so the prefix range is also called the prefix impact range.

[0201] Taking the 64-ary tree as an example, for the IP prefix 0001** / 4, the corresponding prefix range is 000100 to 000111, which is converted to slot values 4-7. That is, all nodes with slot values 4-7 are affected.

[0202] Step 3: Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted.

[0203] Alternatively, since the forwarding sub-pointers involved in the array elements included in the leaf array pointer only point to the effective forwarding table items, the forwarding table items pointed to by the forwarding sub-pointers of some nodes in the prefix interval may not need to be updated. For example, if the current level node includes other IP prefixes such as Figure 11a In the first two lines of , there is a node with an IP prefix of length 9 and an IP prefix of length 11. The actual IP prefix of the node is the IP prefix of length 11, that is, the actual IP prefix is as follows Figure 11a As shown in the last line of .

[0204] Assume that the prefix length of the current forwarding table entry to be inserted is 10, and the prefix interval of the forwarding table entry to be inserted is Figure 11a The 3rd to 5th IP prefixes in the list are as follows: Figure 11b As shown in the last line of , the forwarding sub-pointers corresponding to the 4th and 5th nodes need to be changed to point to the forwarding table entry to be inserted.

[0205] Step 4: If the node in the prefix interval has child nodes, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted.

[0206] If the longest matching prefix of a node within the prefix interval changes, that is, the effective forwarding entries corresponding to these nodes change, and if the node has child nodes, the forwarding entries pointed to by the forwarding sub-pointers corresponding to the child nodes must be updated accordingly. Similarly, if the updated child node has child nodes at the next level, the forwarding entries pointed to by the forwarding sub-pointers corresponding to the child nodes at the next level must be updated, until all forwarding entries pointed to by the forwarding sub-pointers corresponding to the affected child nodes are updated.

[0207] When calculating the affected child nodes, you can perform an AND operation on the bit indicated by the slot value of the affected node (BitVec) and DirVec, then use the TZCNT instruction to calculate the slot value. After updating the affected slot, clear the corresponding bit to 0, and perform TZCNT again to calculate the next affected slot. TZCNT returns the number of 0s in a number from the lowest bit to the first 1 bit. For example, for the binary number 0010 0000, TZCNT will return 5 (00100000, i.e. 5 zeros).

[0208] For example, if the slot corresponding to the affected node is 0 and DirVec is 0001, the slot is represented as BitVec 0000, and 0000 and 0001 are ANDed to get 0001. Then, the TZCNT instruction can be used to calculate the slot value to be 0. Based on DirVec0001, it can be determined that the value of the position indicated by slot0 is 1, and the first node indicated by the child node pointer is determined to be the affected child node. Then, the bit indicated by slot 0 in DirVec0001 is cleared to zero, and the next affected slot is calculated. After clearing the bit indicated by slot 0 in DirVec0001, 0000 is obtained, which means that there is no child node, indicating that there are no other affected child nodes.

[0209] Optionally, the embodiment of the present application can also be implemented using the LZCNT instruction, which is used to calculate the number of 0s between the highest bit and the first bit that is 1.

[0210] Step 5: Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0211] By adopting this method, after inserting the to-be-forwarded table entry into the decision tree, the prefix interval can be quickly determined by means of TZCNT, so as to quickly find the affected child node, and update the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the affected node in the lowest-level node found, as well as the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the child node of the affected node, without backtracking to the root node or searching for an additional storage structure, thereby improving the insertion efficiency.

[0212] In addition, after obtaining the slot value in S9024, if it is determined that the value of the slot value indicating position in the child node vector of the current level node is not set, the value of the slot value indicating position can be set, and a child node is added to the current level node. Then, a forwarding sub-pointer is added to the forwarding pointer of the child node, and the added forwarding sub-pointer is set to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node. It is understandable that, because there is no forwarding sub-pointer in the forwarding pointer of the newly added child node, the forwarding sub-pointer added above is the first forwarding sub-pointer in the forwarding pointer of the child node, which is equivalent to the first forwarding sub-pointer in the child node inheriting the forwarding table entry of the current level node.

[0213] That is, if the current level node does not include a next level node that matches the IP prefix to be inserted into the forwarding table entry, a next level node needs to be created and made to inherit the default forwarding table entry of the current level node.

[0214] After adding the next level node, it is necessary to use the child node as the current level node, subtract the preset step number from the length to be matched, add the preset step number to the offset, and re-execute the above S9022 until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0215] It can be seen that in the process of inserting a forwarding table entry into the decision tree, if there is no child node in the decision tree that matches the IP address in the forwarding table entry to be inserted, a child node can be added to the decision tree, and the child node can inherit the default forwarding table entry of the parent level, and the default forwarding table entry can be used as the default forwarding table entry for the child-level node. In this way, the first forwarding sub-pointer of each level node can point to the default forwarding table entry of the level node, and the default forwarding table entry can be stored at the location pointed to by the first forwarding sub-pointer, which can make deleting or updating the default forwarding table entry faster.

[0216] The following combination Figure 12 The process shown in the figure introduces the method of inserting forwarding entries into the decision tree, such as Figure 12 As shown, the following steps are included:

[0217] S1201. Obtain the IP address, prefix length, and outbound interface information of the forwarding entry to be inserted.

[0218] S1202 : Set the remaining prefix length Remain=prefix length, and the offset offset=0.

[0219] The remaining prefix length is the prefix length to be matched in the above embodiment, and the initial value of the remaining prefix length is the prefix length to be inserted into the forwarding table entry.

[0220] S1203: Determine whether Remain is greater than the preset step number PopcintMaxBit.

[0221] If yes, execute S1204; if no, execute S1209.

[0222] S1204 . Extract PopcntMaxBit bits from the offset position of the IP address, and convert the extracted bits into slot values.

[0223] The slot value refers to the decimal value of the extracted bit. For example, when PopcntMaxBit is 6, the slot value range is 0-63, which corresponds to 000000-111111 in binary. For another example, when PopcntMaxBit is 2, the slot value range is 0-3, which corresponds to 00-11 in binary.

[0224] S1205: Determine whether the position indicated by the slot value in DirVec is set. If so, it indicates that there is a node at the next level of the extracted bit in the decision tree, and then execute S1026; if not, it indicates that there is no node at the next level of the extracted bit in the decision tree, and then execute S1027.

[0225] S1206: Use Popcnt to calculate the offset of the next level node in POPTZ_Node* and enter the next level node. After S1206, S1208 can be executed.

[0226] S1207, adding a child node: expanding POPTZ_Node*, setting the position indicated by the slot value, and the child node inherits the effective forwarding table entry corresponding to the slot value of the parent node, and enters the child node.

[0227] The child node inherits the effective forwarding entry corresponding to the slot value of the parent node, which means that the first FIB_Entry* included in the FIB_Entry** of the child node points to the effective forwarding entry corresponding to the slot value in the parent node. That is, the child node can inherit the default forwarding entry of the parent node.

[0228] It should be noted that the first forwarding sub-pointer of each level node in the decision tree in the embodiment of the present application points to the default forwarding table entry. The default forwarding table entries of nodes at different levels are determined based on the longest prefix matching principle, and the default forwarding table entries of each level can be the same or different.

[0229] S1208. Set Remain=Remain-PopcntMaxBit, set offset=offset-PopcntMaxBit, and return to S1203.

[0230] That is, the remaining prefix length Remain is subtracted by the preset step number PopcntMaxBit, and the offset offset is added by the preset step number. It can also be expressed as offset+=PopcntMaxBit, offset-=PopcntMaxBit.

[0231] S1209: Insert the forwarding entry to be inserted into the tail of FIB_Entry**.

[0232] Because the length of the prefix to be matched is less than the preset step number, it indicates that the forwarding table entry to be inserted needs to be stored in the level where the current node is located, that is, a new FIB_Entry* is added to the end of the FIB_Entry** of the current level node, and the newly added FIB_Entry* points to the forwarding table entry to be inserted.

[0233] S1210: Expand the bits from the offset to the prefix length in the IP address into an influence range, and replace the forwarding table entries corresponding to the nodes in the influence range with the forwarding table entry to be inserted.

[0234] The impact range can be represented by the prefix interval described in the above embodiment.

[0235] S1211. Update LeafVec and LeafArray.

[0236] S1212: Determine whether the updated node has child nodes.

[0237] If yes, execute S1213; if no, the process is completed.

[0238] S1213. Recursively update the forwarding table entry corresponding to the child node.

[0239] S1214, completed.

[0240] The above process is explained below with reference to specific examples.

[0241] Take the example of inserting the forwarding entries of 0010 / 4, 0*** / 1 and 00** / 2 into the quad POPTZ Trie in sequence, and represent the initial state of POPTZ Trie as a Radix tree. The structure of the Radix tree is as follows: Figure 13a As shown, the initial state of the POPTZ Trie is as follows Figure 13b shown.

[0242] First, let's introduce the process of inserting 0010 / 4:

[0243] The prefix length of the IP prefix is 4, the remaining prefix length Remain is 4, the offset offset=0, and the preset step number PopcintMaxBit is 2.

[0244] Therefore, starting from offset = 0, the first two bits "00" in 0010 are extracted, and the binary 00 is converted to decimal 0, that is, the slot value is 0.

[0245] Then determine whether the position indicated by the slot value in DirVec is set. Since DirVec is 0000, the bit corresponding to slot0 is not set, which means that node 00 has no child node. Therefore, a child node is added to node 00 in the current level node, and the bit corresponding to slot0 is set, that is, DirVec = 0001.

[0246] Then set the first FIB_Entry* of the child node's FIB_Entry** to point to the parent node's default forwarding entry, that is, the child node can inherit the parent node's default forwarding entry. At this point, the Radix tree and POPTZ Trie are updated to Figure 13c and Figure 13d .

[0247] After adding the child node, set Remain=2 and offset=2.

[0248] At this time, Remain = PopcintMaxBit, so the forwarding table entry 0010 / 4 is added to the FIB_Entry** of the child node, and the affected slot is calculated. 0010 is extracted starting from offset = 2, that is, the last two digits 10 of 0010 are extracted, and the binary 10 is converted to decimal 2 to obtain the affected slot 2.

[0249] Then query the forwarding table entry currently corresponding to the affected slot2. According to LeafVec(1000), it can be determined that the offset of the forwarding sub-pointer corresponding to slot2 in LeafArray is 0. Then, the forwarding table entry with an offset of 0 is obtained from FIB_Entry**. It can be determined that the forwarding table entry is the default forwarding table entry. The prefix length included in the default forwarding table entry is 0. It can be determined that the current prefix length corresponding to slot2 is 0, which is less than the currently inserted prefix length 4. Therefore, the forwarding sub-pointer corresponding to the node needs to be modified to point to the newly inserted 0010 / 4 forwarding table entry.

[0250] Since the effective forwarding entries stored in the decision tree have changed, it is necessary to recalculate the LeafArray and LeafVec of each level of POP_Node. At this time, the Radix tree and POPTZ Trie are updated to Figure 13e and Figure 13f At this point, the insertion of 0010 / 4 is completed.

[0251] After that, the process of inserting 0*** / 1 is introduced:

[0252] The prefix length of 0*** / 1 is 1, then Remain=1, offset=0, Rmain is less than PopcintMaxBit, then 0*** / 1 can be added to the FIB_Entry** of the current level node.

[0253] Then calculate the affected slots. Since Remain = 1, which is less than PopcntMaxBit, two bits cannot be extracted. Therefore, the 0 in 0*** is shifted left by one bit to fill the two bits, that is, 0*. The corresponding affected range of 0* is node 00 and node 01. Convert 00 and 01 to decimal as 0 and 1, and the affected slots are slot 0 and slot 1.

[0254] According to LeafVec(1000), it can be determined that the forwarding entries corresponding to slot0 and slot1 are both default forwarding entries. The prefix length of the default forwarding entry is less than the prefix length of 0*** / 1, so the forwarding sub-pointers corresponding to the affected nodes 00 (slot0) and 01 (slot1) are modified to point to the inserted forwarding entry of 0*** / 1. Then, LeafArray and LeafVec are updated. At this time, the Radix tree and POPTZ Trie are updated to Figure 14a and Figure 14b .

[0255] It is also necessary to check whether nodes 00 and 01 have child nodes. Since node 00 has child nodes, the first FIB_Entry* of node 00's child node (i.e. level 2) is modified to point to 0*** / 1. After modifying the node in level 2, it is necessary to further check whether the modified node in level 2 has child nodes. Since Dirvec in level 2 is 0000, there are no child nodes. At this point, the insertion of 0*** / 1 is completed. At this point, the Radix tree and POPTZ Trie are updated to Figure 14c and Figure 14d . Figure 14c The dotted line in the figure indicates that the forwarding table entry corresponding to node 00 (the forwarding table entry of 0*** / 1) is not effective.

[0256] Then, the process of inserting 00** / 2 is introduced:

[0257] Since Remain=2=PopcntMaxBit, the forwarding entry of 00** / 2 can be added to the FIB_Entry** of the current level node. Then calculate the affected nodes, starting from offset=0, extract the first two bits 00 of 00**, convert 00 to decimal 0, and get the affected slot0. Since the current effective forwarding entry of slot0 is the forwarding entry of 0*** / 1, the prefix length 1 of 0*** / 1 is less than the prefix length 2 of the inserted 00** / 2, so the forwarding sub-pointer corresponding to node 00 is modified to point to the forwarding entry of 00** / 2. Then update LeafArray and LeafVec. At this time, the Radix tree and POPTZ Trie are updated as follows: Figure 14e and Figure 14f . Figure 14e The dotted line in the figure indicates that the forwarding table entry corresponding to node 00 (the forwarding table entry of 00** / 2) is not effective.

[0258] Then check whether node 00 has child nodes. Since node 00 has child nodes, the first FIB_Entry* of the child node (Level2) points to 00** / 2, and the insertion of 00** / 2 is completed. At this time, the Radix tree and POPTZ Trie are updated as follows: Figure 14g and Figure 14h . Figure 14g The dotted line in the figure indicates that the forwarding table entry corresponding to node 00 (the forwarding table entry of 00** / 2) is not effective.

[0259] Next, the method of deleting the existing forwarding table entries in the decision tree is introduced.

[0260] If needs delete forwarding table item, then the forwarding table item to be updated in the above-described embodiment is forwarding table item to be deleted, and IP prefix to be updated is IP prefix to be deleted. In this case, among above-mentioned S9023, forwarding pointer, leaf vector and leaf array pointer of lowest level node are updated and specifically can be implemented as following steps:

[0261] Step 1: Determine whether there is a forwarding sub-pointer pointing to a forwarding table entry to be deleted among the forwarding sub-pointers included in the forwarding pointer of the current level node.

[0262] If yes, execute step 2; if no, it means that there is no forwarding table entry to be deleted in the decision tree, and the process ends.

[0263] Step 2: Delete the forwarding table entry to be deleted and determine the prefix range represented by the bits from the current offset to the prefix length in the IP address.

[0264] The forwarding entry to be deleted includes the IP prefix to be deleted and the outgoing interface information, and the IP prefix to be deleted includes the IP address and the prefix length. The method for determining the prefix interval can refer to the relevant description in the above embodiment and will not be repeated here.

[0265] Step 3: Determine the longest IP prefix in the decision tree that can cover the IP prefix to be deleted, and obtain the forwarding table entry corresponding to the longest IP prefix.

[0266] Step 4: Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix.

[0267] It can be understood that according to the longest prefix matching principle, after the IP prefix to be deleted is deleted, the nodes within the prefix interval of the IP prefix to be deleted will match the above-mentioned longest IP prefix, and the forwarding sub-pointers of these nodes can be pointed to the forwarding table entry corresponding to the longest IP prefix.

[0268] Step 5: Determine whether the node in the prefix interval has child nodes.

[0269] If yes, go to step 6; if no, go to step 7.

[0270] Step 6: Recursively update the forwarding table entry indicated by the forwarding child pointer of the affected child node.

[0271] Step 7: Determine whether the current level node has child nodes.

[0272] If yes, the deletion is determined to be successful and the process ends; if no, proceed to step 8.

[0273] Step 8: If the forwarding table entry indicated by the forwarding pointer of the current level node stores a default forwarding table entry and does not store other forwarding table entries, the current level node is deleted.

[0274] If a node in a hierarchy contains only default forwarding entries inherited from its parent node and has no child nodes, the node is deleted. Deleting the node may cause its parent node to also contain only default forwarding entries. In this case, the parent node must also be deleted. This recursive operation continues until the parent node of the deleted node contains other forwarding entries besides the default forwarding entries.

[0275] Step 9: Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0276] It can be seen that in the above process, after deleting the to-be-forwarded entry, the nodes in the prefix interval can be searched from the hierarchical node where the deleted to-be-forwarded entry is located, and the child nodes of the nodes in the interval can be further recursively updated without backtracking to query the root node, which can improve the deletion efficiency.

[0277] The following combination Figure 15 The process shown in FIG. 1 introduces the method of deleting the forwarding table entries to be deleted in the decision tree, such as Figure 15 As shown, the following steps are included:

[0278] S1501. Obtain the IP address and prefix length of the forwarding table entry to be deleted.

[0279] S1502 : Set the remaining prefix length Remain=prefix length, and the offset offset=0.

[0280] The remaining prefix length is the prefix length to be matched in the above embodiment, and the initial value of the remaining prefix length is the prefix length to be inserted into the forwarding table entry.

[0281] S1503: Determine whether Remain is greater than the preset step number PopcintMaxBit.

[0282] If yes, execute S1504; if no, execute S1509.

[0283] S1504. Extract PopcntMaxBit bits from the offset position of the IP address, and convert the extracted bits into slot values.

[0284] The slot value refers to the decimal value of the extracted bit. For example, when PopcntMaxBit is 6, the slot value range is 0-63, which corresponds to 000000-111111 in binary. For another example, when PopcntMaxBit is 2, the slot value range is 0-3, which corresponds to 00-11 in binary.

[0285] S1505: Determine whether the position indicated by the slot value in DirVec is set. If so, it indicates that the next-level node of the extracted bit exists in the decision tree, and then S1507 is executed; if not, it indicates that the next-level node of the extracted bit does not exist in the decision tree, that is, the IP prefix to be deleted does not exist in the decision tree, and then S1506 is executed.

[0286] S1506: If there is no IP prefix to be deleted, the deletion result is directly returned. After executing S1506, the process ends.

[0287] The deletion result may be a successful deletion or a prompt message indicating that the IP prefix to be deleted does not exist.

[0288] S1507. Use Popcnt to calculate the offset of the next-level node in POPTZ_Node*, and enter the next-level node.

[0289] S1508. Set Remain=Remain-PopcntMaxBit, set offset=offset-PopcntMaxBit, and return to S1503.

[0290] S1509: Determine whether the forwarding entry to be deleted exists in FIB_Entry**.

[0291] If yes, execute S1511; if no, execute S1510.

[0292] S1510: If the value does not exist, the deletion result is directly returned. After executing S1510, the process ends.

[0293] The deletion result may be a successful deletion or a prompt message indicating that there is no forwarding entry to be deleted.

[0294] S1511. Expand the bits from the offset to the prefix length in the IP address into a prefix interval, modify the forwarding table entries of the nodes in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix, and update LeafVec.

[0295] The longest IP prefix is the longest prefix in the decision tree that can cover the IP prefix to be deleted.

[0296] After deleting the IP prefix to be deleted, traverse the other IP prefixes of the affected node and use the IP prefix with the longest prefix length as the IP prefix of the affected node after deleting the IP prefix to be deleted.

[0297] S1512: Determine whether the affected node has any child nodes.

[0298] If yes, execute S1513; if no, execute S1515.

[0299] S1513. Recursively update the forwarding table entry corresponding to the child node.

[0300] S1514: Return a result indicating that the deletion is successful. After executing S1514, the process ends.

[0301] S1515: Determine whether the current level node has any child nodes.

[0302] If yes, execute S1516; if no, execute S1517.

[0303] S1516: Return the result of successful deletion. After executing S1516, the process ends.

[0304] S1517: Determine whether, after deleting the forwarding table entry to be deleted, only the default forwarding table entry inherited from the parent node remains in the current level node.

[0305] If so, execute S1518; if not, execute S1519.

[0306] S1518: Delete the current level node and recursively update the parent node of the current level node.

[0307] It is understandable that after deleting the current level node, the parent node may only have the default forwarding table entries inherited from the previous level node. In this case, the parent node needs to be deleted and the previous level node needs to be recursively updated until a certain level node traced back includes other forwarding table entries in addition to the default forwarding table entries, or also includes other child nodes.

[0308] S1519. Return the result of successful deletion.

[0309] The following describes a method for deleting a forwarding entry in a decision tree with reference to a specific example.

[0310] The initial state of the quadrilateral POPTZ Trie is Figure 14h , deleting the forwarding table entries with IP prefixes 00** / 2 and 0010 / 4 in sequence is used as an example.

[0311] First, let's introduce the process of deleting 00** / 2:

[0312] At this time, Remain=2, offset=0, which shows that Remain is less than PopcintMaxBit, and further determination results in that the forwarding entry 00** / 2 is stored in FIB_Entry** in Level 1.

[0313] Then, by calculating the prefix interval, we can extract the first two bits of 00**, 00, and convert the binary 00 to decimal 0 to obtain the affected slot 0. At this point, Level 1 stores three forwarding entries: the default forwarding entry, the forwarding entry for 0*** / 1, and the forwarding entry for 00** / 2.

[0314] After deleting 00** / 2 in Level 1, it can be determined that the longest IP prefix that can cover 00** / 2 in the decision tree is 0*** / 1. Then, the forwarding table entry corresponding to the affected slot0 can be updated to the forwarding table entry of 0*** / 1, and LeafVec can be recalculated.

[0315] At this time, the Radix tree and POPTZ Trie are updated as Figure 16a and Figure 16b .

[0316] Since the affected slot0 has a child node, the first FIB_Entry* of the child node needs to be updated to 0*** / 1. At this point, the deletion of IP prefix 00** / 2 is completed. At this point, the Radix tree and POPTZ Trie are updated to Figure 16c and Figure 16d .

[0317] After that, the process of deleting 0010 / 4 is:

[0318] Based on 0010, it is determined that Remain=4 and offset=0. It can be seen that Remain is greater than PopcintMaxBit, so the first two bits 00 of 0010 are extracted, and the binary 00 is converted to decimal 0 to obtain slot 0.

[0319] The bit at the slot0 position in DirVec(0001) in Level1 is set, indicating that node 00 has a child node. Therefore, the offset of the next-level child node (Level2) in POP_Node can be calculated, and then Level2 can be entered.

[0320] At this time, Remain=2. It can be seen that Remain is equal to PopcintMaxBit. After judgment, it is determined that the forwarding table entry 0010 / 4 to be deleted exists in the FIB_Entry** of Level 2.

[0321] Then calculate the prefix interval. You can extract the last two digits 10 of 0010 from offset = 2, convert the binary 10 to decimal 2, delete the forwarding entry 0010 / 4 corresponding to slot 2, and recalculate LeafVec. At this time, the Radix tree and POPTZ Trie are updated as follows: Figure 16eand Figure 16f .

[0322] Then we need to further determine whether the node corresponding to slot0 has child nodes. Since there are no child nodes, we need to further determine whether level2 has child nodes. Since level2 has no child nodes and there is only one default forwarding table entry in level2, we can delete level2 and update Level1.

[0323] Since Level 1 includes other forwarding entries in addition to the default forwarding entry, it does not meet the deletion conditions, so there is no need to delete Level 1. At this point, the forwarding entry for 0010 / 4 is deleted. At this point, the Radix tree and POPTZ Trie are updated to Figure 16g and Figure 16h .

[0324] In another example, if Figure 8 Insert a forwarding table entry based on: IP prefix is 10** / 2, outgoing interface is E, then Table 1 is updated to Table 2, Figure 8 Updated to Figure 17a .

[0325] Table 2

[0326]

[0327]

[0328] It is understandable that, due to the existence of 1000 / 4, 1001 / 4, and 101* / 3, according to the longest prefix matching principle, the newly inserted forwarding entry 7 is not effective.

[0329] Figure 17a In the first-level node (POPTZ_Node level1), FIB_Entry** has three elements, pointing to the default forwarding entry, forwarding entry 1, and forwarding entry 7 respectively.

[0330] LeafVec is 1101; DirVec is 0100; LeafArray is [1][2][1]; POPTZ_Node* has a child node pointer pointing to the second-level node (POPTZ_Node Level2).

[0331] In the second-level node (POPTZ_Node Level2), FIB_Entry** has four elements, pointing to forwarding entry 7, forwarding entry 4, forwarding entry 5, and forwarding entry 6 respectively.

[0332] LeafVec is 0111; DirVec is 0000; LeafArray is [1][2][3]; POPTZ_Node* is empty, that is, there is no child node.

[0333] At this time, if you need to delete forwarding table entry 5, the IP prefix is 1001 / 4 and the outgoing interface is C.

[0334] The introduction of LeafArray breaks through the limitations of the original Poptrie, allowing the decision tree to store ineffective forwarding entries. Therefore, it is only necessary to search for the forwarding entry (i.e., forwarding entry 7) that can cover the IP prefix of this node in the hierarchical node where forwarding entry 5 is located and modify it, without backtracking to the root node or searching for additional storage structures.

[0335] After deleting forwarding entry 5, Figure 17a Updated to Figure 17b .

[0336] Figure 17b In the second-level node (POPTZ_Node Level2), FIB_Entry** has three elements, pointing to forwarding entry 7, forwarding entry 4, and forwarding entry 6 respectively.

[0337] LeafVec is 0111; DirVec is 0000; LeafArray is [1][0][2]; POPTZ_Node* is empty, that is, there is no child node.

[0338] It can be understood that the decision tree in the embodiment of the present application can store each forwarding table entry in the FIB. After receiving a message that needs to be forwarded, the forwarding table entry that matches the message can be obtained by searching the decision tree, and the message can be forwarded according to the outgoing interface information in the forwarding table entry.

[0339] The following is an introduction to the method of finding a decision tree. Figure 18 As shown, the specific steps include:

[0340] S1801. Obtain the IP address to be queried.

[0341] The IP address to be queried may be the destination IP address of the message.

[0342] S1802: Set the offset to 0, extract a preset step number of bits from the IP address to be queried starting from the offset, convert the extracted bits into slot values, and use the root node of the decision tree as the current node.

[0343] S1803: Determine whether the bit indicating the slot value in Dirvec in the current node is set.

[0344] If so, it indicates that the current node has child nodes, and step S1804 is executed; if not, it indicates that the current node does not have child nodes, and step S1805 is executed.

[0345] S1804: Take the child node corresponding to the slot value as the current node, add 2 to the offset, extract the preset step number of bits from the IP address to be queried starting from this offset, and convert the extracted bits into a slot value. Then return to S1803.

[0346] Among them, the child node corresponding to the slot value is: popcnt(((2<<slot)–1)&DirVec)–1.

[0347] S1805: Calculate the offset of the node corresponding to the slot value in the forwarding pointer of the current level nodes, and obtain the forwarding table entry corresponding to the IP address to be queried from the forwarding pointer based on the calculated offset.

[0348] Among them, the method for calculating the offset of the node corresponding to the slot value in the forwarding pointer of the current level nodes is:

[0349] First, calculate the offset in leafvec: offset = popcnt(((2<<slot)–1)&LeafVec)–1. Among them, "<< " is the left shift operator, and 2<<slot means that after converting 2 to binary, it is shifted left by slot bits.

[0350] Based on the offset in leafvec, obtain the offset of the forwarding sub-pointer pointing to the forwarding table entry to be queried in LeafArray: FIBOffset = LeafArray[offset].

[0351] Then, obtain the forwarding table entry to be queried based on the offset of the forwarding sub-pointer pointing to the forwarding table entry to be queried in LeafArray, that is, FIB_ENTRY = FIB_ENTRY[fibOffset].

[0352] The method for querying the forwarding table entry is described below with a specific example.

[0353] Taking the initial state of this POPTZ Trie as Figure 14h , an example of looking up 0010 is used for illustration.

[0354] With offset 0, we can extract the two most significant bits (bits 00) of 0010 and convert the binary 00 to decimal 0 to get slot 0. Taking Leavel1 as the current node, we determine whether the DirVec bit corresponding to slot 0 is set. Since DirVec = 0001, the position corresponding to slot 0 is set. The offset of the child node in POP_Node is calculated to be 0, and we then enter the child node (Level 2) with offset 0.

[0355] Then update offset to 2, get the lower 2 bits bit 10 of 0010, convert binary 10 to decimal 2, get slot 2, and determine whether the DirVec corresponding to slot 2 in Level 2 is set. DirVec in Leavel2 = 0000, that is, it is not set. Then, the forwarding table entry pointed to by the forwarding sub-pointer corresponding to 0010 can be found from Level 2.

[0356] Experiments have shown that the decision tree provided by the embodiments of this application uses 1 / 7 to 1 / 3 the memory consumption of a binary Radix tree, significantly reducing memory usage and saving memory space. Furthermore, when searching for forwarding entries using the decision tree provided by the embodiments of this application, the search performance is 200% to 300% that of a binary Radix tree.

[0357] In the above embodiment, the leaf vector LeafVec is used to represent the offset of the FIB_Entry* corresponding to the effective forwarding entry of the matched node in the CHAR*LeafArray. Therefore, after the forwarding entry in the decision tree is updated, LeafVec needs to be updated.

[0358] LeafVec can be generated by:

[0359] First, initialize four variables:

[0360] Last = -1, where Last is the forwarding table entry. Since the offset of LeafArray cannot be negative, the initial value is -1.

[0361] Compressed size CompressSize = 0, the compressed size is used to indicate the size after compression;

[0362] Compressed array CompressArray = empty; CompressArray is used to store the compressed LeafArray;

[0363] The compressed leaf vector CompressLeafVec=0, where CompressLeafVec refers to the updated LeafVec.

[0364] When updating LeafVec, first traverse each element in the uncompressed LeafArray in the updated node level.

[0365] If Last is not equal to the element in the current uncompressed LeafArray, then the following update is done:

[0366] CompressArray[ComrpessSize] = the element of the current uncompressed LeafArray (i.e. the element in the LeafArray currently traversed);

[0367] CompressLeafVec = 1 << offset of the current uncompressed LeafArray element;

[0368] ComrpessSize += 1;

[0369] Last = the element of the current uncompressed LeafArray.

[0370] For example, taking an octree as an example, assume that the uncompressed LeafArray includes: [3], [3], [0], [0], [1], [1], [1], [1].

[0371] First, traverse the first element [3] in the uncompressed LeafArray. Since Last = -1 at this time, the value of Last is different from the value of the first element [3]. Therefore, change CompressArray to [3], CompressLeafVec to 1, ComrpessSize to 1, and Last to 3.

[0372] Then traverse the second element [3] in the uncompressed LeafArray. Since it has the same value as Last, it can be skipped directly.

[0373] Then traverse the third element [0] in the uncompressed LeafArray. Since Last = 3 at this time, the value of Last is different from the third element [0]. Therefore, change CompressArray to [3][0], change CompressLeafVec to 101, change ComrpessSize to 2, and change Last to 0.

[0374] Then traverse the fourth element [0] in the uncompressed LeafArray. Since it has the same value as Last, it can be skipped directly.

[0375] Then traverse the fifth element [1] in the uncompressed LeafArray. Since Last = 0 at this time, the value of Last is different from the value of the fifth element [1]. Therefore, change CompressArray to [3][0][1], change CompressLeafVec to 10101, change ComrpessSize to 3, and change Last to 1.

[0376] Then traverse the fourth and fifth elements in the uncompressed LeafArray [1]. Since they have the same value as Last, they can be skipped directly.

[0377] Finally, the updated LeafVec is 10101, and the compressed LeafArray is [3][0][1].

[0378] Based on the same inventive concept, an embodiment of the present application also provides a decision tree updating device, wherein each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer and a child node pointer; wherein the forwarding pointer includes multiple forwarding sub-pointers, each forwarding sub-pointer points to a forwarding table entry; the leaf vector is used to indicate the offset of the forwarding sub-pointer corresponding to each node of the level in the leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table entry corresponding to the node; each array element included in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer; the node represented by the set position in the child node vector has a node at the next level; the child node pointer is used to point to the node at the next level; such as Figure 19 As shown, the device includes:

[0379] An acquisition module 1901 is configured to acquire a forwarding table entry to be updated, wherein the forwarding table entry to be updated includes an IP prefix to be updated;

[0380] Update module 1902 is used to search for nodes that match the IP prefix to be updated in the decision tree step by step based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, until the lowest level node that matches the IP prefix to be updated is found, and then update the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0381] Optionally, the IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form; the updating module 1902 is specifically configured to:

[0382] Set the prefix length to be matched to the prefix length of the IP prefix to be updated, and set the offset to 0;

[0383] Determine whether the length of the prefix to be matched is greater than the preset step number;

[0384] If not, determine that the current level node is the lowest level node that matches the IP prefix to be updated, and update the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node;

[0385] If so, extract a preset number of bits from the IP address starting from the offset position and convert the extracted bits into a decimal slot value;

[0386] If the value of the slot value indicated in the child node vector of the current level node has been set, then based on the child node vector and the child node pointer of the current level node, obtain the next level node;

[0387] Take the next-level node as the current-level node, subtract the preset number of steps from the length of the prefix to be matched, add the preset number of steps to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset number of steps, until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

[0388] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; the updating module 1902 is specifically configured to:

[0389] Add a new forwarding sub-pointer to the end of the forwarding pointer of the lowest-level node, and set the new forwarding sub-pointer to point to the forwarding table entry to be inserted;

[0390] Determine the prefix range represented by the bits in the IP address from the current offset to the prefix length to be updated;

[0391] Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted;

[0392] If the node in the prefix interval has child nodes, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted;

[0393] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0394] Optionally, the forwarding table entry to be updated is a forwarding table entry to be inserted; the updating module 1902 is further configured to:

[0395] If the value at the slot value position in the child node vector of the current level node is not set, then set the value at the slot value position and add a child node to the current level node;

[0396] Add a forwarding sub-pointer to the forwarding pointer of the child node, and set the added forwarding sub-pointer to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node;

[0397] Take the child node as the current level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

[0398] Optionally, the forwarding table entry to be updated is a forwarding table entry to be deleted, and the updating module 1902 is specifically configured to:

[0399] Determine whether there is a forwarding sub-pointer pointing to a forwarding table entry to be deleted among the forwarding sub-pointers included in the forwarding pointer of the current level node;

[0400] If so, delete the forwarding table entry to be deleted and determine the prefix range represented by the bits from the current offset to the prefix length in the IP address;

[0401] Determine the longest IP prefix in the decision tree that can cover the IP prefix to be deleted, and obtain the forwarding table entry corresponding to the longest IP prefix;

[0402] Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix;

[0403] Determine whether the node in the prefix interval has child nodes;

[0404] If so, recursively update the forwarding table entry stored in the forwarding child pointer of the affected child node;

[0405] If not, determine whether the current level node has child nodes;

[0406] If not, and the forwarding pointer of the current level node stores the default forwarding table entry and does not store other forwarding table entries, then delete the current level node;

[0407] Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

[0408] Optionally, if the number of offsets indicated by the leaf array pointer is less than or equal to 7, then 7 bits of the highest 8 bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer; the other bit is used to indicate that the storage space occupied by the leaf array pointer includes: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer; the remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer.

[0409] The embodiment of the present invention further provides an electronic device, such as Figure 20 As shown, it includes a processor 2001, a communication interface 2002, a memory 2003 and a communication bus 2004, wherein the processor 2001, the communication interface 2002, and the memory 2003 communicate with each other through the communication bus 2004.

[0410] Memory 2003, used for storing computer programs;

[0411] The processor 2001 is configured to implement any decision tree updating method in the above embodiments when executing the program stored in the memory 2003 .

[0412] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0413] The communication interface is used for communication between the above electronic device and other devices.

[0414] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0415] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0416] In another embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned decision tree updating methods are implemented.

[0417] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer is enabled to execute any decision tree updating method in the above embodiments.

[0418] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0419] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0420] Each embodiment in this specification is described in a related manner. Similar portions between the embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, refer to the description of the method embodiments.

[0421] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A decision tree updating method, characterized in that: Each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer, and a child node pointer; wherein the forwarding pointer includes multiple forwarding sub-pointers, each forwarding sub-pointer points to a forwarding table entry; the leaf vector is used to indicate the offset of the forwarding sub-pointer corresponding to each node of the level in the leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table entry corresponding to the node; each array element included in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer; the node represented by the set position in the child node vector has a node at the next level; the child node pointer is used to point to the node at the next level; the method includes: Obtaining a forwarding table entry to be updated, wherein the forwarding table entry to be updated includes an Internet Protocol (IP) prefix to be updated; Based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, the node that matches the IP prefix to be updated is searched level by level in the decision tree until the lowest level node that matches the IP prefix to be updated is found, and the forwarding pointer, leaf vector and leaf array pointer of the lowest level node are updated.

2. The method according to claim 1, characterized in that The IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form; The method further includes searching for a node matching the IP prefix to be updated in the decision tree level by level based on a matching result between the IP prefix to be updated and a child node vector and a child node pointer in each level node, until a lowest level node matching the IP prefix to be updated is found, and then updating a forwarding pointer, a leaf vector, and a leaf array pointer of the lowest level node, including: Set the prefix length to be matched to the prefix length included in the IP prefix to be updated, and set the offset to 0; Determine whether the length of the prefix to be matched is greater than a preset step number; If not, determining that the current level node is the lowest level node that matches the IP prefix to be updated, and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node; If yes, extract the preset step number of bits from the IP address starting from the offset position, and convert the extracted bits into a decimal slot value; If the value of the slot value indication position in the child node vector of the current level node has been set, then obtaining the next level node based on the child node vector and the child node pointer of the current level node; Take the next-level node as the current-level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

3. The method according to claim 2, characterized in that The forwarding table entry to be updated is a forwarding table entry to be inserted; and the updating of the forwarding pointer, the leaf vector, and the leaf array pointer of the lowest level node includes: Adding a forwarding sub-pointer to the tail of the forwarding pointer of the lowest-level node, and setting the newly added forwarding sub-pointer to point to the forwarding table entry to be inserted; Determine a prefix interval represented by bits of a prefix length from a current offset to the IP prefix to be updated in the IP address; Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted; If the node in the prefix interval has a child node, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted; Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

4. The method according to claim 2, characterized in that The forwarding table entry to be updated is a forwarding table entry to be inserted; after extracting the preset step number of bits from the IP address starting from the position of the offset and converting the extracted bits into a decimal slot value, the method further includes: If the value at the position indicated by the slot value in the child node vector of the current level node is not set, then the value at the position indicated by the slot value is set, and a child node is added to the current level node; Add a forwarding sub-pointer to the forwarding pointer of the child node, and set the added forwarding sub-pointer to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node; Take the child node as the current level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

5. The method according to claim 2, characterized in that The forwarding table entry to be updated is a forwarding table entry to be deleted, and the IP prefix to be updated is an IP prefix to be deleted; and the updating of the forwarding pointer, the leaf vector, and the leaf array pointer of the lowest-level node includes: Determine whether there is a forwarding sub-pointer in the forwarding sub-pointer included in the forwarding pointer of the current level node pointing to the forwarding table entry to be deleted; If so, delete the forwarding table entry to be deleted, and determine the prefix interval represented by the bits from the current offset to the prefix length in the IP address; Determine the longest IP prefix that exists in the decision tree and can cover the IP prefix to be deleted, and obtain a forwarding table entry corresponding to the longest IP prefix; Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix; Determining whether a node within the prefix interval has a child node; If so, recursively update the forwarding table entry stored in the forwarding child pointer of the affected child node; If not, determining whether the current level node has a child node; If not, and the forwarding pointer of the current level node stores a default forwarding table entry and does not store other forwarding table entries, deleting the current level node; Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

6. The method according to claim 1, characterized in that If the number of offsets indicated by the leaf array pointer is less than or equal to 7, then 7 bits of the highest 8 bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer; the other bit is used to indicate that the storage space occupied by the leaf array pointer has embedded storage of: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer; the remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer.

7. A decision tree updating device, characterized in that: Each level node of the decision tree includes a forwarding pointer, a leaf vector, a child node vector, a leaf array pointer, and a child node pointer; wherein the forwarding pointer includes multiple forwarding sub-pointers, each forwarding sub-pointer points to a forwarding table entry; the leaf vector is used to indicate the offset of the forwarding sub-pointer corresponding to each node of the level in the leaf array pointer, and the forwarding sub-pointer corresponding to each node points to the forwarding table entry corresponding to the node; each array element included in the leaf array pointer represents the offset of a forwarding sub-pointer in the forwarding pointer; the node represented by the set position in the child node vector has a node at the next level; the child node pointer is used to point to the node at the next level; the device includes: An acquisition module, configured to acquire a forwarding table entry to be updated, wherein the forwarding table entry to be updated includes an Internet Protocol IP prefix to be updated; An update module is used to search for nodes that match the IP prefix to be updated from the decision tree level by level based on the matching results between the IP prefix to be updated and the child node vectors and child node pointers in each level node, until the lowest level node that matches the IP prefix to be updated is found, and then update the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

8. The device according to claim 7, characterized in that The IP prefix to be updated includes an IP address and a prefix length, and the IP address is in binary form; the updating module is specifically configured to: Set the prefix length to be matched to the prefix length included in the IP prefix to be updated, and set the offset to 0; Determine whether the length of the prefix to be matched is greater than a preset step number; If not, determining that the current level node is the lowest level node that matches the IP prefix to be updated, and updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest level node; If yes, extract the preset step number of bits from the IP address starting from the offset position, and convert the extracted bits into a decimal slot value; If the value of the slot value indication position in the child node vector of the current level node has been set, then obtaining the next level node based on the child node vector and the child node pointer of the current level node; Take the next-level node as the current-level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current-level node is the lowest-level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector, and leaf array pointer of the lowest-level node.

9. The device according to claim 8, characterized in that The forwarding table entry to be updated is a forwarding table entry to be inserted; the updating module is specifically configured to: Adding a forwarding sub-pointer to the tail of the forwarding pointer of the lowest-level node, and setting the newly added forwarding sub-pointer to point to the forwarding table entry to be inserted; Determine a prefix interval represented by bits of a prefix length from a current offset to the IP prefix to be updated in the IP address; Modify the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry to be inserted; If the node in the prefix interval has a child node, the forwarding sub-pointer of the affected child node is modified to point to the forwarding table entry to be inserted; Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

10. The device according to claim 8, characterized in that The forwarding table entry to be updated is a forwarding table entry to be inserted; the updating module is further configured to: If the value at the position indicated by the slot value in the child node vector of the current level node is not set, then the value at the position indicated by the slot value is set, and a child node is added to the current level node; Add a forwarding sub-pointer to the forwarding pointer of the child node, and set the added forwarding sub-pointer to point to the forwarding table entry pointed to by the forwarding sub-pointer corresponding to the slot value of the current level node; Take the child node as the current level node, subtract the preset step number from the length of the prefix to be matched, add the preset step number to the offset, and re-execute the step of determining whether the length of the prefix to be matched is greater than the preset step number, until it is determined that the current level node is the lowest level node that matches the IP prefix to be updated, and stop after updating the forwarding pointer, leaf vector and leaf array pointer of the lowest level node.

11. The device according to claim 8, characterized in that The forwarding table entry to be updated is a forwarding table entry to be deleted, and the IP prefix to be updated is an IP prefix to be deleted; and the updating module is specifically configured to: Determine whether there is a forwarding sub-pointer in the forwarding sub-pointer included in the forwarding pointer of the current level node pointing to the forwarding table entry to be deleted; If so, delete the forwarding table entry to be deleted, and determine the prefix interval represented by the bits from the current offset to the prefix length in the IP address; Determine the longest IP prefix that exists in the decision tree and can cover the IP prefix to be deleted, and obtain a forwarding table entry corresponding to the longest IP prefix; Set the forwarding sub-pointer of the node in the prefix interval to point to the forwarding table entry corresponding to the longest IP prefix; Determining whether a node within the prefix interval has a child node; If so, recursively update the forwarding table entry stored in the forwarding child pointer of the affected child node; If not, determining whether the current level node has a child node; If not, and the forwarding pointer of the current level node stores a default forwarding table entry and does not store other forwarding table entries, deleting the current level node; Update the leaf vectors and leaf array pointers of the nodes at each level based on the updated nodes at each level.

12. The device according to claim 7, characterized in that If the number of offsets indicated by the leaf array pointer is less than or equal to 7, then 7 bits of the highest 8 bits of the storage space occupied by the leaf array pointer are used to store the number of offsets indicated by the leaf array pointer; the other bit is used to indicate that the storage space occupied by the leaf array pointer has embedded storage of: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer; the remaining storage space occupied by the leaf array pointer is used to store: the offset of the forwarding sub-pointer corresponding to each node at the level in the forwarding pointer.

13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 6 when executing a program stored in a memory.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for traversing multi-branch Trie tree

    CN101277252A

  • Method and device for matching longest prefix based on tree form data structure

    CN101577662A