Storage method, search method, device and system of routing table entries

A routing and table entry technology, applied in the computer field, can solve problems such as low search speed and large storage space

CN102904812AActive Publication Date: 2013-01-30HUAWEI TECH CO LTD
4 Cites 6 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Publication Date
2013-01-30

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a storage method, a search method, a device and a system of routing table entries, belonging to the computer field. The search method comprises the following steps of: dividing a search address into at least two address fields; searching a head address field matched with the head address field of the search address in a first binary tree according to the head address field of the search address; taking the address suffix of the head address field found out as the address prefix of the tail address field of the search address; according to the address prefix of the tail address field of the search address and the tail address field, searching the matched address prefix of the tail address field and the matched tail address field in a second binary tree; and obtaining the search result according to the obtained address prefix of the tail address field and the tail address field. The method saves storage space compared with the prior art by sectionally storing and searching the routing address, thus being flexibly suitable for storing and searching the routing addresses of various bit widths; and the search rate is increased.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the field of computers, in particular to a storage method, search method, device and system for routing table items. Background technique

[0002] During network data transmission, routers forward data according to the lookup results of routing table entries. In order to reduce the storage of network devices, usually the direct lookup result of the routing table entry is not the forwarding action, but the index of the search result, and the forwarding action is finally obtained by performing a linear table lookup according to the index. With the rapid development of the network, the number of routing table entries is increasing, the bit width is getting longer and longer, and the types are also increasing, which puts forward higher requirements on the storage space and search speed of routing table entries.

[0003] In the prior art, a method for storing and searching routing table items based on a binary tree is usually used....

Examples

Embodiment 1

[0151] This embodiment provides a method for storing routing table items. The method saves the storage space of the binary tree for storing routing addresses and realizes flexible storage of routing table items by means of segmented storage. see figure 1 , the flow of the storage method of the routing entry provided in this embodiment is as follows:

[0152] 101: Divide each routing address of the routing table entry into at least two address segments according to a preset length;

[0153] 102: Assign a corresponding address suffix to the first address segment of each routing address, and use the address suffix of the first address segment of each routing address as the address prefix of the next address segment;

[0154] 103: Store the first address segment of each routing address in a node of the first binary tree, and store the address suffix corresponding to the first address segment of each routing address;

[0155] 104: If the next address segment is the tail address s...

Embodiment 2

[0164] This embodiment provides a method for storing routing entries. Combining the storage content of the routing entries provided in the first embodiment above, for the convenience of description, this embodiment stores the 16-bit routing addresses A to I in the routing entries as As an example, the method for storing routing entries provided in this embodiment is illustrated. Among them, routing addresses A to I are as follows:

[0165] Routing address A: 1001001001000011

[0166] Routing address B: 1001001010010111

[0167] Routing address C: 1001001110001010

[0168] Routing address D: 1001001111011101

[0169] Routing address E: 1011011010101100

[0170] Routing address F: 1011011010101111

[0171] Routing address G: 1101011110001100

[0172] Routing address H: 1101101110011010

[0173] Routing address I: 1110010110111101

[0174] see image 3 , when the storage method of the routing entry provided in this embodiment stores the above-mentioned routing addresses ...

Embodiment 3

[0229] This embodiment provides a method for searching a routing table entry, combined with the method for searching a routing table entry provided in the first embodiment above, to find the query address in the routing table entry of the 16-bit routing address stored in the second embodiment above The search results corresponding to a, b, c, and d are taken as an example to illustrate the method for searching routing table entries provided in this embodiment. Among them, query addresses a, b, c, d are as follows:

[0230] Query address a: 1001001110001011

[0231] Query address b: 1011011010101100

[0232] Query address c: 1011011010111100

[0233] Query address d: 1100101110011010

[0234] see Figure 6 When the search method for routing table entries provided in this embodiment searches for the search results corresponding to the above query addresses a to d, the method flow is specifically as follows:

[0235] 601: Divide the query address into at least two address se...