JP3494028B2 - Search method - Google Patents

Search method

Info

Publication number
JP3494028B2
JP3494028B2 JP25081098A JP25081098A JP3494028B2 JP 3494028 B2 JP3494028 B2 JP 3494028B2 JP 25081098 A JP25081098 A JP 25081098A JP 25081098 A JP25081098 A JP 25081098A JP 3494028 B2 JP3494028 B2 JP 3494028B2
Authority
JP
Japan
Prior art keywords
node
search
leaf
bit
nodes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP25081098A
Other languages
Japanese (ja)
Other versions
JP2000083056A (en
Inventor
圭一 曽田
和幸 ▲か▼島
立機 市橋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP25081098A priority Critical patent/JP3494028B2/en
Publication of JP2000083056A publication Critical patent/JP2000083056A/en
Application granted granted Critical
Publication of JP3494028B2 publication Critical patent/JP3494028B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】この発明は、インターネット
の中継装置の一つであり、中継するパケットに付けられ
たInternet Protocol層の宛先アドレ
ス(宛先IPアドレス)を検査し中継先を決定するルー
タにおいて、その内部の記憶装置に格納された複数の宛
先IPアドレスで構成されるルーチングテーブルから、
中継するパケットに付けられた宛先IPアドレスを検索
するために用いられる検索方式に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention is one of the relay devices of the Internet, and in a router for inspecting the destination address (destination IP address) of the Internet Protocol layer attached to the packet to be relayed, and determining the relay destination, From the routing table composed of multiple destination IP addresses stored in the internal storage device,
The present invention relates to a search method used for searching a destination IP address attached to a packet to be relayed.

【0002】[0002]

【従来の技術】図11は、ルータ内に格納されたルーチ
ングテーブルの内容の例を示す図である。図に示される
ルーチングテーブルの各エントリにおいて、 ・1a、1b、1c等1はエントリの検索キーの一部であ
る宛先ネットワークIPアドレス、 ・2a、2b、2c等2はエントリの検索キーの一部であ
るネットワークマスク、 ・4a、4b、4c等4はエントリの情報であり、中継先
ルータを示す宛先IPアドレスで構成される。宛先ネッ
トワークIPアドレス1とネットワークマスク2の組
は、宛先IPアドレスのグループに相当する。例えば、 ・宛先ネットワークIPアドレス1b:0x80050
000 ・ネットワークマスク2b:0xFFFF0000の組
は、 ・宛先IPアドレス:0x80050000〜0x80
05FFFFのグループに相当する。各々は、 ・宛先IPアドレス & ネットワークマスク = 宛
先ネットワークIPアドレスの関係式で関係付けられ
る。
2. Description of the Related Art FIG. 11 is a diagram showing an example of the contents of a routing table stored in a router. In each entry of the routing table shown in the figure, 1a, 1b, 1c, etc. 1 is the destination network IP address that is part of the entry search key, 2a, 2b, 2c, etc. 2 is part of the entry search key 4a, 4b, 4c, etc. 4 is entry information and is composed of a destination IP address indicating a relay destination router. The set of destination network IP address 1 and network mask 2 corresponds to a group of destination IP addresses. For example, the destination network IP address 1b: 0x80050
000-Network mask 2b: 0xFFFF0000 pair: -Destination IP address: 0x80050000 to 0x80
This corresponds to a group of 05FFFF. Each is as follows: Destination IP address & Network mask = Destination network IP address.

【0003】ルータは、中継するパケットに付けられた
宛先IPアドレス、即ち検索データに対し、ルーチング
テーブルの中から、前記関係式が成り立つ宛先ネットワ
ークIPアドレス1とネットワークマスク2の組、即ち
検索キーを検索し、成り立つ組がある場合、前記検索キ
ーを持つエントリの中継先ルータを示す宛先IPアドレ
ス4、即ちエントリの情報を用いて宛先ルータへパケッ
トを中継する。
[0003] The router, for the destination IP address attached to the packet to be relayed, that is, the search data, from the routing table, the set of the destination network IP address 1 and the network mask 2 that satisfies the above relational expression, that is, the search key. If there is a pair that can be searched and holds, the packet is relayed to the destination router using the destination IP address 4 indicating the relay destination router of the entry having the search key, that is, the information of the entry.

【0004】前記検索で、検索データに対し、前記関係
式が成り立つ検索キーが複数ある場合、前記複数の検索
キーのネットワークマスク2のうち、「1」で示される
ビットの数が最も多いネットワークマスク2を持つエン
トリが求めるエントリとなる。これをロンゲストマッチ
と呼ぶ。例えば、検索データを0x80209000と
した場合、前記検索データに対し、図11に示すルーチ
ングテーブルの中で前記関係式が成り立つ検索キーは、 ・宛先ネットワークIPアドレス1aとネットワークマ
スク2aの検索キーと、 ・宛先ネットワークIPアドレス1cとネットワークマ
スク2cの検索キーと、 ・宛先ネットワークIPアドレス1eとネットワークマ
スク2eの検索キーであるが、前記検索キーのネットワ
ークマスク2うち、1で示されるビットの数が最も多い
ネットワークマスク2eを持つエントリが求めるエント
リとなる。
In the search, when there are a plurality of search keys that satisfy the above relational expression with respect to the search data, the network mask having the largest number of bits indicated by "1" among the network masks 2 of the plurality of search keys. The entry having 2 is the desired entry. This is called a longest match. For example, when the search data is 0x80209000, the search keys that satisfy the above relational expression in the routing table shown in FIG. 11 for the search data are: the search key of the destination network IP address 1a and the network mask 2a; A search key for the destination network IP address 1c and the network mask 2c, and a search key for the destination network IP address 1e and the network mask 2e, of which the number of bits indicated by 1 in the network mask 2 of the search key is the largest. The entry having the network mask 2e is the desired entry.

【0005】ルータのルーチングテーブルに対する従来
の検索方式の一つに、「A Tree−Based R
outing Table for Berkeley
Unix」(Technical Report、U
niversity ofCalifornia、 B
erkeley)に示される基数検索法を応用したPa
tricia Trieと呼ばれる検索方式がある。図
12は、前記従来の検索方式にほぼ基づいて、図11に
示されるルーチングテーブルに対し構成した検索木を示
す図である。
One of the conventional search methods for the routing table of the router is "A Tree-Based R".
outing Table for Berkeley
Unix "(Technical Report, U
diversity of California, B
erkeyley), which uses the cardinal number search method
There is a search method called tricia Trie. FIG. 12 is a diagram showing a search tree constructed for the routing table shown in FIG. 11 based on the conventional search method.

【0006】図において、 ・3a、3b、3c等の3は検索木の節であるノード、 ・5a、5b、5c等の5はリーフで、前記エントリの
宛先ネットワークIPアドレス1とネットワークマスク
2を格納する。 ・6は中継するパケットに付けられた宛先IPアドレス
である検索データ、 ・7a、7b、7c、等の7は各ノード3に付き、次の
ノード3を決定するために検索データ6に対し検査する
ビットを示すビット番号である。また、リーフ5は、図
11に示されるルーチングテーブルの各エントリの、宛
先ネットワークIPアドレス1と、ネットワークマスク
2と、中継先ルータを示す宛先IPアドレス4とからな
る。但し、図12では、簡単化のため、前記中継先ルー
タを示す宛先IPアドレス4の記述を省略している。以
降の検索木を示す図も同様である。
In the figure: 3a, 3b, 3c, etc., is a node that is a node of a search tree, 5a, 5b, 5c, etc., is a leaf, and the destination network IP address 1 and network mask 2 of the entry are Store. 6 is the search data which is the destination IP address attached to the packet to be relayed, and 7 such as 7a, 7b, 7c is attached to each node 3, and the search data 6 is inspected to determine the next node 3. It is a bit number indicating a bit to be executed. The leaf 5 is composed of the destination network IP address 1, the network mask 2, and the destination IP address 4 indicating the relay destination router of each entry of the routing table shown in FIG. However, in FIG. 12, the description of the destination IP address 4 indicating the relay destination router is omitted for simplification. The same applies to the figures showing the subsequent search trees.

【0007】図12に示される検索木は、宛先ネットワ
ークIPアドレス1のMSB側ビットから順に各ビット
を「0」と「1」に場合分けし、「0」を左、「1」を
右として、場合分けを節の分岐で表現したものである。
ノード3は、前記の節に相当し、最大1つのリーフ5お
よび下位に最大2つのノード3を持つ。ノード3とリー
フ5は、次の2つの規則に従って置かれる。 ・ルーチングテーブルの宛先ネットワークIPアドレス
1で、MSB側の値の等しいものが複数存在する場合、
1つ置く。このノード3に付くビット番号7は、前記複
数の宛先ネットワークIPアドレス1において、MSB
側から見て最初に異なるビットの番号である。 ・ルーチングテーブルのエントリに対し、1つ置く。こ
のノード3に付くビット番号7は、前記エントリのネッ
トワークマスク2において、MSB側から見て最初に0
となるビットの番号である。このノード3は、前記エン
トリの宛先ネットワークIPアドレス1とネットワーク
マスク2からなるリーフ5を持つ。なお、ビット番号7
は、MSB側から順に0より始まる。
The search tree shown in FIG. 12 divides each bit into "0" and "1" in order from the MSB side bit of the destination network IP address 1, with "0" on the left and "1" on the right. , The case is expressed by branching the clause.
The node 3 corresponds to the above-mentioned node and has a maximum of one leaf 5 and a maximum of two lower nodes 3. Node 3 and leaf 5 are placed according to the following two rules. When there are a plurality of destination network IP addresses 1 in the routing table with the same value on the MSB side,
Put one. The bit number 7 attached to this node 3 is the MSB in the plurality of destination network IP addresses 1.
It is the number of the first different bit as seen from the side. -Place one for each entry in the routing table. The bit number 7 attached to this node 3 is 0 at the beginning from the MSB side in the network mask 2 of the above entry.
Is the bit number. This node 3 has a leaf 5 consisting of the destination network IP address 1 and the network mask 2 of the entry. Bit number 7
Starts from 0 from the MSB side.

【0008】次に、図13のフローチャートを用いて、
従来のPatricia Trie検索方式による検索
の流れを説明する。フローチャートにおいて、 ・ステップ101で、出発点を頂点のノード3とし、ス
テップ102に進む。 ・ステップ102で、前記ノード3に対するリーフ5の
有無を検査する。有の場合、ステップ103に進み、無
の場合、ステップ104に進む。 ・ステップ103で、前記リーフ5の宛先ネットワーク
IPアドレス1とエントリのネットワークマスク2の組
をスタックに積み、ステップ104に進む。なお、スタ
ックとは、最後に積んだ情報を最初に取り出すことがで
きる一時的な記憶場所を指す。
Next, using the flowchart of FIG.
A flow of search by the conventional Patrice Trie search method will be described. In the flow chart: In step 101, the starting point is the vertex node 3, and the process proceeds to step 102. In step 102, the existence of the leaf 5 for the node 3 is checked. If yes, go to step 103; if no, go to step 104. In step 103, the set of the destination network IP address 1 of the leaf 5 and the network mask 2 of the entry is stacked on the stack, and the process proceeds to step 104. The stack refers to a temporary storage location where the last loaded information can be retrieved first.

【0009】・ステップ104で、検索データ6に対
し、前記ノード3のビット番号7で示されるビット値を
検査し、「0」であればステップ105に進み、「1」
であればステップ106に進む。 ・ステップ105で、前記ノード3に対する左の下位の
ノード3の有無を検査する。有の場合、ステップ107
に進み、無の場合、ステップ111に進む。 ・ステップ106で、前記ノード3に対する右の下位の
ノード3の有無を検査する。有の場合、ステップ108
に進み、無の場合、ステップ111に進む。 ・ステップ107で、前記左の下位のノード3に移動
し、ステップ102に再び戻る。 ・ステップ108で、前記右の下位のノード3に移動
し、ステップ102に再び戻る。
In step 104, the bit value indicated by the bit number 7 of the node 3 is inspected for the search data 6, and if it is "0", the process proceeds to step 105 and "1".
If so, the process proceeds to step 106. In step 105, the presence or absence of the left lower node 3 with respect to the node 3 is checked. If yes, step 107
If no, go to step 111. In step 106, the presence or absence of the right lower node 3 with respect to the node 3 is checked. If yes, step 108
If no, go to step 111. In step 107, move to the left lower node 3 and return to step 102 again. In step 108, move to the right lower node 3 and return to step 102 again.

【0010】・ステップ111で、前記スタック内の宛
先ネットワークIPアドレス1とエントリのネットワー
クマスク2の組の有無を検査する。有の場合、ステップ
112に進む。無の場合、ステップ115に進む。 ・ステップ112で、前記スタックの最後に積んだ宛先
ネットワークIPアドレス1とネットワークマスク2の
組を取り出し、ステップ113に進む。 ・ステップ113で、前記検索データ6と前記ネットワ
ークマスク2をビット毎にAND演算した結果と前記宛
先ネットワークIPアドレス1を比較する。両者が等し
い場合、ステップ114に進み、両者が異なる場合、再
びステップ111に戻る。 ・ステップ114に進んだ場合、前記ステップ113で
前記検索データ6と比較した宛先ネットワークアドレス
1とネットワークマスク2の組が求めるエントリであ
る。 ・ステップ115に進んだ場合、求めるエントリは、ル
ーチングテーブルに存在しない。
In step 111, it is checked whether or not there is a pair of the destination network IP address 1 and the network mask 2 of the entry in the stack. If yes, go to step 112. If no, go to step 115. In step 112, the set of destination network IP address 1 and network mask 2 loaded at the end of the stack is taken out, and the process proceeds to step 113. In step 113, the result of ANDing the search data 6 and the network mask 2 bit by bit is compared with the destination network IP address 1. If they are the same, the process proceeds to step 114, and if they are different, the process returns to step 111 again. When the process proceeds to step 114, the set of the destination network address 1 and the network mask 2 which is compared with the search data 6 in step 113 is the entry to be obtained. If the procedure proceeds to step 115, the desired entry does not exist in the routing table.

【0011】次に図12に示す検索木を用いて、従来の
Patricia Trie検索方式による検索の例を
示す。検索データ6を0x8020A324とする。前
記検索データ6とノード3のビット番号7との対応を以
下に2進表記で示す。 ビット番号: 0 ‥ 4 ‥ 8 ‥ 12 ‥ 検索データ: 1000 0000 0010 000
0 ‥ ‥ 16 ‥ 20 ‥ 24 ‥ 28 ‥ ‥ 1010 0011 0010 0100
Next, using the search tree shown in FIG. 12, an example of search by the conventional Patrice Trie search method will be shown. Let the search data 6 be 0x8020A324. The correspondence between the search data 6 and the bit number 7 of the node 3 is shown below in binary notation. Bit number: 0 ... 4 ... 8 ... 12 ... Search data: 1000 0000 0010 000
0 ... 16 ... 20 ... 24 ... 28 ... 1010 0011 0010 0100

【0012】以下の手順で検索が実行される。 (1)図12に示す検索木の頂点のノード3aから出発
する。 (2)前記ノード3aは、リーフ5aを持つので、前記
リーフ5aの宛先ネットワークIPアドレス1aとネッ
トワークマスク2aの組をスタックに積む。 (3)前記ノード3aのビット番号7aは0なので、前
記検索データ6のビット0を検査し、「1」なので右の
ノード3hに進む。 (4)前記ノード3hのビット番号7hは1なので、前
記検索データ6のビット1を検査し、「0」なので左の
ノード3iに進む。 (5)前記ノード3iのビット番号7iは10なので、
前記検索データ6のビット10を検査し、「1」なので
右のノード3cに進む。 (6)前記ノード3cは、リーフ5cを持つので、前記
リーフ5cの宛先ネットワークIPアドレス1cとネッ
トワークマスク2cの組をスタックに積む。
The search is executed in the following procedure. (1) Start from the node 3a at the top of the search tree shown in FIG. (2) Since the node 3a has the leaf 5a, the set of the destination network IP address 1a of the leaf 5a and the network mask 2a is stacked on the stack. (3) Since the bit number 7a of the node 3a is 0, bit 0 of the search data 6 is inspected, and since it is "1", the process proceeds to the node 3h on the right. (4) Since the bit number 7h of the node 3h is 1, the bit 1 of the search data 6 is inspected, and since it is "0", the process proceeds to the left node 3i. (5) Since the bit number 7i of the node 3i is 10,
The bit 10 of the search data 6 is checked, and since it is "1", the process proceeds to the node 3c on the right. (6) Since the node 3c has the leaf 5c, the set of the destination network IP address 1c of the leaf 5c and the network mask 2c is stacked on the stack.

【0013】(7)前記ノード3cのビット番号7cは
16なので、前記検索データ6のビット16を検査し、
「1」なので右のノード3kに進む。 (8)前記ノード3kのビット番号7kは19なので、
前記検索データ6のビット19を検査し、「0」なので
左のノード3dに進む。 (9)前記ノード3dは、リーフ5dを持つので、前記
リーフ5dの宛先ネットワークIPアドレス1dとネッ
トワークマスク2dの組をスタックに積む。 (10)前記ノード3dのビット番号7kは20なの
で、前記検索データ6のビット20を検査し、「0」な
ので左のノード3に進もうとするが、存在しないので、
ノード3dで検索木のなぞりを終える。このときのスタ
ックの内容を以下に示す。 宛先ネットワークIPアドレス/ネットワークマスク 最後に積んだ内容: 0x80208000/xFFFFF000 最後から2番目に積んだ内容: 0x80200000/xFFFF0000 最初に積んだ内容: 0x00000000/x00000000
(7) Since the bit number 7c of the node 3c is 16, the bit 16 of the search data 6 is inspected,
Since it is "1", proceed to the node 3k on the right. (8) Since the bit number 7k of the node 3k is 19,
The bit 19 of the search data 6 is checked, and since it is "0", the process proceeds to the node 3d on the left. (9) Since the node 3d has the leaf 5d, the set of the destination network IP address 1d of the leaf 5d and the network mask 2d is stacked on the stack. (10) Since the bit number 7k of the node 3d is 20, the bit 20 of the search data 6 is inspected, and since it is "0", the node 3d tries to proceed to the node 3 on the left, but since it does not exist,
Finish tracing the search tree at node 3d. The contents of the stack at this time are shown below. Destination network IP address / network mask Last loaded content: 0x80208000 / xFFFFF000 Second-to-last loaded content: 0x80200000 / xFFFF0000 First loaded content: 0x0000000000 / x0000000000

【0014】(11)スタックの最後に積んだ宛先ネッ
トワークIPアドレス1dとネットワークマスク2dの
組を取り出し、前記検索データ6と前記ネットワークマ
スク2dをビット毎にAND演算した結果と前記宛先ネ
ットワークIPアドレス1dを比較する。 (12)(0x8020A324)&(0xFFFFF
000)≠0x80208000 前記式の結果から、スタックの最後から2番目に積んだ
宛先ネットワークIPアドレス1cとネットワークマス
ク2cの組を取り出し、前記検索データ6と前記ネット
ワークマスク2cをビット毎にAND演算した結果と前
記宛先ネットワークIPアドレス1cを比較する。 (13)(0x8020A324)&(0xFFFF0
000)=0x80200000 前記式の結果から、前記宛先ネットワークIPアドレス
1cと前記ネットワークマスク2cの組が、求めるエン
トリであり、検索を終了する。
(11) The set of the destination network IP address 1d and the network mask 2d stacked at the end of the stack is taken out, and the result of ANDing the search data 6 and the network mask 2d bit by bit and the destination network IP address 1d. To compare. (12) (0x8020A324) & (0xFFFFF
000) ≠ 0x80208000 From the result of the above formula, the set of the destination network IP address 1c and the network mask 2c stacked second from the end of the stack is extracted, and the result of ANDing the search data 6 and the network mask 2c bit by bit And the destination network IP address 1c. (13) (0x8020A324) & (0xFFFF0
000) = 0x80200000 From the result of the above expression, the set of the destination network IP address 1c and the network mask 2c is the desired entry, and the search is ended.

【0015】前記の従来のPatricia Trie
検索方式による検索において、検索木のなぞりを終えた
後、スタックに積んだエントリを、後に積んだエントリ
から順に取り出し、検索データ6と比較することによ
り、ロンゲストマッチが実現される。
The above-mentioned conventional Patrice Trie
In the search by the search method, after tracing the search tree, the entries stacked on the stack are sequentially extracted from the stacked entries later and compared with the search data 6, whereby the longest match is realized.

【0016】[0016]

【発明が解決しようとする課題】従来のPatrici
a Trie検索方式による検索は、以上のように実行
されるので、検索に要する時間の最大値は、検索木の長
さの最大値(図12の例では、5)に比例する。また、
ルーチングテーブルのエントリの内容に関わらず、検索
木の長さの最大値は、検索データのビット数(前記の例
では、32)を超えることはない。従って、ルーチング
テーブルのエントリの内容に関わらず、検索に要する時
間の最大値は、検索データのビット数で規定することが
できる。
[Patent Document 1] Conventional Patrici
Since the search by the a Trie search method is executed as described above, the maximum value of the time required for the search is proportional to the maximum value of the length of the search tree (5 in the example of FIG. 12). Also,
The maximum length of the search tree does not exceed the number of bits of the search data (32 in the above example) regardless of the contents of the routing table entry. Therefore, the maximum value of the time required for the search can be defined by the number of bits of the search data regardless of the content of the entry in the routing table.

【0017】しかし、逆に言えば、検索データのビット
数が多くなると、検索に要する時間の最大値は、これに
比例して長くなる。前記の例では、IPアドレスはバー
ジョン4で規定される32ビットのアドレスであった
が、次世代のバージョン6で規定されるIPアドレスは
128ビットである。このため、前記バージョン6のI
Pアドレスに対し、従来のPatricia Trie
検索方式を適用すると、検索に要する時間の最大値は、
前記バージョン4のIPアドレスに対して検索に要する
時間の最大値の4倍となり、ルータの中継遅延、中継ス
ループット等の性能が低下する問題があった。
Conversely, conversely, as the number of bits of the search data increases, the maximum value of the time required for the search increases in proportion to this. In the above example, the IP address is a 32-bit address defined by version 4, but the IP address defined by the next-generation version 6 is 128 bits. Therefore, the version 6 I
For the P address, the conventional Patrice Trie
When the search method is applied, the maximum time required for the search is
There is a problem that the maximum time required for the search for the version 4 IP address is four times, and the performance of the router such as relay delay and relay throughput deteriorates.

【0018】一方、基数検索法を応用したものに、ノー
ドにおいて、検索データのビットを一度に複数検査する
マルチウェイ基数検索法がある。前記マルチウェイ基数
検索法では、検索時間の最大値を短縮できることが知ら
れている。しかし、前記マルチウェイ基数検索法には、
前記の例に示した可変長のネットワークマスクに対応で
きない問題があり、また前記のロンゲストマッチに対応
できない問題があった。
On the other hand, an application of the radix search method is a multi-way radix search method in which a plurality of bits of search data are inspected at one time in a node. It is known that the maximum search time can be shortened in the multi-way radix search method. However, in the multi-way radix search method,
There is a problem that the variable length network mask shown in the above example cannot be dealt with, and there is a problem that the longest match cannot be dealt with.

【0019】この発明は上記のような問題を解決するた
めになされたもので、検索時間の最大値を短縮しつつ、
可変長のネットワークマスクに対応し、ロンゲストマッ
チに対応する検索方式を得ることを目的とする。また、
以上の目的を達成すると共に、検索に用いる検索木を、
ルータ等、検索を実行する装置内のメモリ等の記憶装置
上に構成した場合、記憶装置上のできるだけ少ない領域
で検索木を構成する検索方式を得ることを目的とする。
The present invention has been made to solve the above problems, and shortens the maximum search time,
The objective is to obtain a search method for longest matches that corresponds to variable length network masks. Also,
In addition to achieving the above objectives, the search tree used for search is
An object of the present invention is to obtain a search method that configures a search tree in as few areas as possible on the storage device when it is configured on a storage device such as a memory in a device that executes a search such as a router.

【0020】[0020]

【課題を解決するための手段】第1の発明に関わる検索
方式は、検索テーブルの可変長の検索キーを格納するリ
ーフと、前記リーフを持たず次のノードと接続されるノ
ードと、前記リーフを持ち次のノードと接続されないノ
ードとで探索木を構成し、前記ノードに対し、次のノー
ドを特定するために検査する検索データのビット番号を
付け、各ノードで一度に検査するビット数をNビット
(N≧2)にし、可変長の検索キーを格納するリーフの
うち、長さがNビットの整数倍の検索キーを格納するリ
ーフに対して、ノードを1個置き、長さがNビットの整
数倍でない検索キーを格納するリーフに対して、ノード
を2の(N−M)乗個、(ただし、Mは検索キーの長さ
をNで除した余り)置いた検索木を構成し、この検索木
を用いて、基数検索を行うものである。
A search method according to a first aspect of the present invention is a leaf for storing a variable-length search key of a search table, a node not having the leaf and connected to a next node, and the leaf. Form a search tree with the next node and a node that is not connected, assign the bit number of the search data to be inspected to identify the next node to the node, and set the number of bits to be inspected at one time in each node. Of the leaves that store N-bit (N ≧ 2) and variable-length search keys, one node is placed for a leaf that stores a search key whose length is an integral multiple of N bits, and the length is N. Construct a search tree with 2 (N−M) power nodes (where M is the remainder of the search key length divided by N) for leaves that store search keys that are not an integral multiple of bits Then, using this search tree, the radix search Is performed.

【0021】第2の発明に関わる検索方式は、検索テー
ブルの可変長の検索キーを格納するリーフと、前記リー
フを持たず次のノードと接続されるノードと、前記リー
フを持ち次のノードと接続されるノードと、前記リーフ
を持ち次のノードと接続されないノードとで検索木を構
成し、前記ノードに対し、次のノードを特定するために
検査する検索データのビット番号を付け、各ノードで一
度に検査するビット数をNビット(N≧2)にし、可変
長の検索キーを格納するリーフのうち、長さがNビット
の整数倍の検索キーを格納するリーフに対して、ノード
を1個置き、長さがNビットの整数倍でない検索キーを
格納するリーフに対して、ノードを2の(N−M)乗
個、(ただし、Mは検索キーの長さをNで除した余り)
置き、前記ノードが、他のリーフに対するノードと重複
する場合、より短い検索キーを格納するリーフに対する
ノードを置かず、より長い検索キーを格納するリーフに
対するノードを置いた検索木を用いて、基数検索を行う
ものである。
A search method according to a second aspect of the present invention includes a leaf for storing a variable-length search key of a search table, a node which is connected to a next node without the leaf, and a next node which has the leaf. A search tree is composed of nodes that are connected and nodes that have the leaf and are not connected to the next node, and the node is given a bit number of search data to be checked to identify the next node. The number of bits to be checked at once with N is set to N bits (N ≧ 2), and among the leaves that store search keys of variable length, the node is selected for the leaves that store search keys whose length is an integral multiple of N bits. For every leaf that stores a search key whose length is not an integer multiple of N bits, put 2 (N−M) power nodes (where M is the search key length divided by N). remainder)
If the node overlaps with a node for another leaf, then using a search tree that does not put a node for a leaf that stores a shorter search key and puts a node for a leaf that stores a longer search key It is a search.

【0022】第3の発明に関わる検索方式は、1個のリ
ーフに対し、ノードを1個置く場合、リーフを記憶する
記憶装置に、前記リーフを1個格納し、前記1個のノー
ドと、前記リーフの格納位置を特定する記憶装置のアド
レス値を共に格納し、1個のリーフに対し、ノードを複
数個置く場合、記憶装置に前記リーフを1個格納し、前
記複数のノードと、前記の各々に前記リーフの格納位置
を特定する記憶装置のアドレス値を共に格納することに
よって検索木を構成し、この検索木を用いて、基数検索
を行うものである。
In the search method according to the third aspect of the present invention, when one node is placed for one leaf, the leaf is stored in a storage device for storing the leaf, and the one node is stored. When the address value of the storage device that specifies the storage position of the leaf is stored together and a plurality of nodes are provided for one leaf, one leaf is stored in the storage device, and the plurality of nodes and the A search tree is formed by storing the address value of the storage device that specifies the storage position of the leaf in each of the above, and the radix search is performed using this search tree.

【0023】第4の発明に関わる検索方式は、1個のリ
ーフに対し、ノードを1個置く場合、前記記憶装置に前
記リーフを1個格納し、前記1個のノードと、前記リー
フの格納位置を特定する記憶装置のアドレス値を共に格
納し、1個のリーフに対し、ノードを複数個置く場合、
前記記憶装置に前記リーフを1個格納すると共に、前記
複数のノードが、全て次のノードと接続されるノードの
場合、前記複数のノードと、前記の各々に前記リーフの
格納位置を特定する記憶装置のアドレス値を共に格納
し、前記複数のノードに、次のノードと接続されるノー
ドと次のノードと接続されないノードが含まれる場合、
前記次のノードと接続されるノードと、前記の各々に前
記リーフの格納位置を特定する記憶装置のアドレス値を
共に格納し、前記次のノードと接続されないノードを、
前記次のノードと接続されるノードのいずれかで代用
し、
In the search method according to the fourth aspect of the present invention, when one node is placed for one leaf, one leaf is stored in the storage device, and the one node and the leaf are stored. When the address value of the storage device for specifying the position is stored together and a plurality of nodes are placed for one leaf,
A storage for storing one of the leaves in the storage device, and in the case where the plurality of nodes are all nodes connected to the next node, the plurality of nodes and a storage for specifying the storage position of the leaf in each of the nodes. If the address value of the device is stored together, and the plurality of nodes include a node connected to the next node and a node not connected to the next node,
A node that is connected to the next node and a node that stores the address value of the storage device that specifies the storage position of the leaf in each of the nodes, and that is not connected to the next node,
Substitute with one of the nodes connected to the next node,

【0024】前記複数個のノードが、全て次のノードと
接続されないノードの場合、前記次のノードと接続され
ない複数のノードを共通に1個格納し、前記ノードと共
に、前記リーフの格納位置を特定する記憶装置のアドレ
ス値を格納することによって検索木を構成し、この検索
木を用いて、基数検索を行うものである。
When all of the plurality of nodes are not connected to the next node, one common node not connected to the next node is stored in common and the storage position of the leaf is specified together with the node. A search tree is configured by storing the address value of the storage device, and the radix search is performed using this search tree.

【0025】第5の発明に関わる検索方式は、検索中に
到着するノード毎に、ノードに付けたビット番号に該当
する検索データのビットの検査を行なうと共に、前記ノ
ードがリーフを持つ場合、前記リーフと前記検索データ
の比較を逐次または並行して行い、前記比較で、以前に
一度比較済みの前記検索データのビットを比較の対象か
ら除いて基数検索を行うものである。
In the search method according to the fifth aspect of the invention, for each node that arrives during the search, the bit of the search data corresponding to the bit number assigned to the node is checked, and when the node has a leaf, The leaf and the search data are compared sequentially or in parallel, and in the comparison, the radix search is performed by removing the bits of the search data that have already been compared once from the comparison target.

【0026】第6の発明に関わる検索方式は、検索テー
ブルの可変長の検索キーを格納するリーフと、前記リー
フを持たず次のノードと接続されるノードと、前記リー
フを持ち次のノードと接続されないノードと、で検索木
を構成し、前記ノードに対し、次のノードを決定するた
めに検査する検索データのビット番号を付け、各ノード
で一度に検査するビット数を1ビットにし、検索中に到
着するノード毎にノードに付けたビット番号に該当する
検索データのビットの検査を行なうと共に、前記ノード
がリーフを持つ場合、前記リーフと前記検索データの比
較とを逐次または並行して行い、前記比較で、以前に一
度比較済みの前記検索データのビットを比較の対象から
除いて基数検索を行うものである。
According to a sixth aspect of the present invention, there is provided a search method in which a leaf storing a variable-length search key of a search table, a node which is connected to a next node without the leaf, and a next node which has the leaf. A search tree is constructed with unconnected nodes, the bit number of the search data to be inspected to determine the next node is given to the node, and the number of bits to be inspected at one time at each node is set to 1 bit, and the search is performed. For each node that arrives inside, the bit of the search data corresponding to the bit number given to the node is checked, and if the node has a leaf, the leaf and the search data are compared sequentially or in parallel. In the comparison, the radix search is performed by excluding the bit of the search data that has already been compared once from the comparison target.

【0027】第7の発明に関わる検索方式は、検索中に
到着するノード毎に、ノードに付けたビット番号に該当
する検索データのビットの検査を行なうと共に、前記ノ
ードがリーフを持つ場合、前記リーフと前記検索データ
の比較、または、前記ノードがリーフを持たない場合、
その下位のいずれかのノードが持つリーフと前記検索デ
ータの前記ノードに付けたビット番号までの比較、を逐
次または並行して行い、前記比較で、以前に一度比較済
みの前記検索データのビットを比較の対象から除いて基
数検索を行うものである。
In the search method according to the seventh aspect of the invention, for each node that arrives during the search, the bit of the search data corresponding to the bit number assigned to the node is checked, and when the node has a leaf, Comparing leaf with the search data, or if the node has no leaf,
The leaf of any one of the lower nodes is compared with the bit number assigned to the node of the search data, sequentially or in parallel, and in the comparison, the bits of the search data that have already been compared once are The radix search is performed excluding the object of comparison.

【0028】第8の発明に関わる探索方式は、検索テー
ブルの可変長の検索キーを格納するリーフと、前記リー
フを持たず次のノードと接続されるノードと、前記リー
フを持ち次のノードと接続されるノードと、前記リーフ
を持ち次のノードと接続されないノードとで検索木を構
成し、前記ノードに対し、次のノードを決定するために
検査する検索データのビット番号を付け、各ノードで一
度に検査するビット数を1ビットにし、検索中に到着す
るノード毎に、ノードに付けたビット番号に該当する検
索データのビットの検査を行なうと共に、前記ノードが
リーフを持つ場合、前記リーフと前記検索データの比
較、または、前記ノードがリーフを持たない場合、その
下位のいずれかのノードが持つリーフと前記検索データ
の前記ノードに付けたビット番号までの比較、を逐次ま
たは並行して行い、前記比較で、以前に一度比較済みの
前記検索データのビットを比較の対象から除いて、基数
検索を行うものである。
A search method according to an eighth aspect of the present invention includes a leaf storing a variable-length search key of a search table, a node that is connected to a next node without the leaf, and a next node that has the leaf. A search tree is composed of nodes that are connected and nodes that have the leaf and are not connected to the next node, and the node is given a bit number of search data to be checked to determine the next node. The number of bits to be inspected at once is set to 1 bit, and the bit of the search data corresponding to the bit number given to the node is inspected for each node that arrives during the search, and if the node has a leaf, the leaf And the search data, or if the node does not have a leaf, attach it to the leaf of any of its subordinate nodes and the node of the search data. Comparison to the bit number, the performed sequentially or in parallel, in the comparison, excluded from the scope of the previously once compare bits of the comparison already the search data, and performs radix search.

【0029】[0029]

【発明の実施の形態】実施の形態1.本実施の形態によ
る検索方式は、各エントリのネットワークマスクが可変
長であるが、いかなるエントリの組み合わせについて
も、ロンゲストマッチの関係にないエントリからなるル
ーチングテーブル対し適用しようとするものである。宛
先ネットワークIPアドレスの割り当て方によっては、
ロンゲストマッチの関係にないエントリからなるルーチ
ングテーブルを構成できる。図1は、本実施の形態によ
るルーチングテーブルの例を示す。なお、各エントリの
ネットワークマスクは可変長であるが、いかなるエント
リの組み合わせについても、ロンゲストマッチの関係に
ない。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiment 1. Although the search method according to the present embodiment has a variable length network mask, it is intended to apply any combination of entries to a routing table having entries that are not in longest match relationship. Depending on how the destination network IP address is assigned,
You can configure a routing table with entries that are not related to longest matches. FIG. 1 shows an example of a routing table according to this embodiment. Although the network mask of each entry has a variable length, there is no longest match relationship for any combination of entries.

【0030】図2は、本実施の形態1による検索方式に
基づいて、図1に示されるルーチングテーブルの内容に
対して、検索木を構成した例を示す図である。図におい
て、1p、1q、1r、等1は宛先ネットワークIPアド
レス、2p、2q、2r、等2はネットワークマスク、6
は検索データ、 ・ 13o、13p、13q、等13は検索木の節であるノ
ード、 ・ 5p、5q、5r、等5はリーフ、 ・17o、17p、17q、等17はビット番号で、各ノ
ード13に付き、次のノード13を決定するために検索
データ6に対し一度に検査する連続するNビット(図2
の例ではN=2)のうち、先頭のビットを示す。
FIG. 2 is a diagram showing an example in which a search tree is constructed for the contents of the routing table shown in FIG. 1 based on the search method according to the first embodiment. In the figure, 1p, 1q, 1r, etc. 1 is a destination network IP address, 2p, 2q, 2r, etc. 2 is a network mask, 6
Is search data, 13o, 13p, 13q, etc. 13 is a node of a search tree, 5p, 5q, 5r, etc. 5 is a leaf, 17o, 17p, 17q, etc. 17 is a bit number, and each node is 13 consecutive N bits (see FIG. 2) that are checked at once for the search data 6 to determine the next node 13.
In the example, the first bit of N = 2) is shown.

【0031】図2に示される検索木は、宛先ネットワー
クIPアドレス1のMSB側ビットから順に各ビットを
「00」、「01」、「10」、「11」に場合分け
し、前記場合分けを節の左から右への4分岐で表現した
ものである。ノード13は、前記の節に相当し、最大1
つのリーフ5または下位に最大4つのノード13を持
つ。
In the search tree shown in FIG. 2, each bit is classified into "00", "01", "10", and "11" in order from the MSB side bit of the destination network IP address 1, and the case classification is performed. It is expressed by four branches from left to right of the clause. The node 13 corresponds to the above-mentioned section and has a maximum of 1
It has one leaf 5 or a maximum of four nodes 13 at the lower level.

【0032】次に、ノード13とリーフ5の置き方につ
いて説明する。まず、ルーチングテーブルの各エントリ
の宛先ネットワークIPアドレス1とネットワークマス
ク2を先頭からNビット(図2の例ではN=2)単位に
区切る。ここでは、前記Nビットの単位をNビット単位
と呼ぶ。ノード13とリーフ5は、次の3つの規則に従
って置かれる。
Next, how to place the node 13 and the leaf 5 will be described. First, the destination network IP address 1 and the network mask 2 of each entry in the routing table are divided into N bits (N = 2 in the example of FIG. 2) from the beginning. Here, the unit of N bits is called an N bit unit. The node 13 and the leaf 5 are placed according to the following three rules.

【0033】・ 規則1:ルーチングテーブルの宛先ネ
ットワークIPアドレス1で、あるNビット単位を境
に、MSB側の値の等しいものが複数存在する場合、ノ
ード13を1つ置く。このノード13には、ビット番号
17として、前記複数の宛先ネットワークIPアドレス
1で、MSB側から見て最初に異なるビットが含まれる
Nビット単位の先頭のビットの番号を付ける。このノー
ド13には、リーフ5を置かない。
Rule 1: If a plurality of destination network IP addresses 1 in the routing table have the same value on the MSB side across a certain N-bit unit, one node 13 is placed. To this node 13, as the bit number 17, the number of the leading bit in N-bit units including the first different bit from the MSB side in the plurality of destination network IP addresses 1 is given. The leaf 5 is not placed in this node 13.

【0034】・規則2:ルーチングテーブルのネットワ
ークマスク2で、1で示されるビットの数をNで除した
余りが0のエントリに対し、ノード13を1つ置く。こ
のノード13には、ビット番号17として、前記ネット
ワークマスク2で、MSB側から見て最初に0となるビ
ットの番号を付ける。このノード13には、前記エント
リの情報からなるリーフ5を置く。
Rule 2: In the network mask 2 of the routing table, one node 13 is placed for an entry with a remainder of 0 obtained by dividing the number of bits indicated by 1 by N. A bit number 17, which is the first bit to be 0 when viewed from the MSB side in the network mask 2, is added to the node 13 as the bit number 17. In this node 13, a leaf 5 including the information of the entry is placed.

【0035】・規則3:ルーチングテーブルのネットワ
ークマスク2で、1で示されるビットの数をNで除した
余りがM(1≦M<N)のエントリに対し、まず、ノー
ド13を1個置く(ノードAとする)。ノードAには、
ビット番号17として、前記ネットワークマスク2で、
MSB側から見て最初に0となるビットが含まれるNビ
ット単位の先頭のビットの番号を付ける。ノードAに
は、リーフ5を置かない。ノードAと、他のエントリに
対し置いたノード13が重複する(同一の位置に置く必
要がある)場合、両ノード13の役割を合わせ持つノー
ド13を1個置く。さらに、前記ノードAの下位に、ノ
ード13を2のN−M乗個置く。これらのノード13に
は、ビット番号17として、前記ノードAに付けたビッ
ト番号+Nのビット番号を付ける。これらのノード13
には、前記エントリの情報からなるリーフ5を各ノード
13毎に置く。なお、ビット番号17は、MSB側から
順に0より始まる。
Rule 3: In the network mask 2 of the routing table, first place one node 13 for an entry in which the remainder obtained by dividing the number of bits indicated by 1 by N is M (1≤M <N). (Set as node A). Node A has
As the bit number 17, in the network mask 2,
The number of the leading bit in N-bit units including the bit that becomes 0 first when viewed from the MSB side is added. The leaf 5 is not placed in the node A. When the node A and the node 13 placed for another entry overlap (need to be placed at the same position), one node 13 having the roles of both nodes 13 is placed. Further, 2 nodes of the number N−M are placed below the node A. As the bit number 17, a bit number + N assigned to the node A + N is assigned to these nodes 13. These nodes 13
, A leaf 5 including the information of the entry is placed for each node 13. The bit number 17 starts from 0 in order from the MSB side.

【0036】N=2とした図2の例では、ノード13
o、13vは、前記規則1に該当し、ノード13p、1
3q、13s、13tは、前記規則2に該当し、ノード
13r、13uは、前記規則3に該当する。なお、ノー
ド13oについては、宛先ネットワークIPアドレス1
の先頭のNビット単位の前に、さらにNビット単位が存
在し、前記2つのNビット単位を境に、MSB側の値の
等しいものが複数存在すると見なし、規則1を適用す
る。また、前記ノード13rが持つリーフ5rの宛先ネ
ットワークIPアドレス1r、ネットワークマスク2r
は、前記ノード13uが持つリーフ5uの宛先ネットワ
ークIPアドレス1u、ネットワークマスク2uと、各
々同一である。
In the example of FIG. 2 with N = 2, node 13
o and 13v correspond to the rule 1 and nodes 13p and 1v
3q, 13s and 13t correspond to the rule 2, and the nodes 13r and 13u correspond to the rule 3. For the node 13o, the destination network IP address 1
There is an N-bit unit further before the first N-bit unit, and it is considered that there are a plurality of MSB-side values having the same value, and rule 1 is applied. Also, the destination network IP address 1r and the network mask 2r of the leaf 5r possessed by the node 13r.
Are the same as the destination network IP address 1u and the network mask 2u of the leaf 5u of the node 13u.

【0037】図3は、この実施の形態1による検索手順
をフローチャートで示したもので、検索は、図2に示す
検索木を用いた。図3において、ステップ101で、出
発点を頂点のノード3とし、ステップ102に進む。ス
テップ102で、前記ノード3に対するリーフ5の有無
を検査する。有の場合、ステップ103に進み、無の場
合、ステップ206に進む。ステップ103で、前記リ
ーフ5の宛先ネットワークIPアドレス1とエントリの
ネットワークマスク2の組をスタック(図示せず)に積
み、ステップ206に進む。なお、スタックとは、最後
に積んだ情報を最初に取り出すことができる一時的な記
憶場所を指す。
FIG. 3 is a flow chart showing the search procedure according to the first embodiment, and the search uses the search tree shown in FIG. In FIG. 3, in step 101, the starting point is the vertex node 3, and the process proceeds to step 102. In step 102, the existence of the leaf 5 for the node 3 is checked. If yes, go to step 103; if no, go to step 206. In step 103, the set of the destination network IP address 1 of the leaf 5 and the network mask 2 of the entry is stacked on the stack (not shown), and the process proceeds to step 206. The stack refers to a temporary storage location where the last loaded information can be retrieved first.

【0038】ステップ206で、検索データ6に対し、
前記ノード3のビット番号7で示されるビット値を検査
し、「00」であれば最左のノードの有無を検査する
(ステップ207)。最左のノードがあれば、最左のノ
ードに移動したあとステップ102に再び戻る。最左の
ノードがなければ、ステップ111に進む。「01」で
あれば左から2番目のノードの有無を検査する。左から
2番目のノードがあれば、左から2番目のノードに移動
したあとステップ102に再び戻る。左から2番目のノ
ードがなければ、ステップ111に進む。「10」であ
れば右から2番目のノードの有無を検査する。右から2
番目のノードがあれば、右から2番目のノードに移動し
たあとステップ102に再び戻る。右から2番目のノー
ドがなければ、ステップ111に進む。「11」であれ
ば最も右のノードの有無を検査する(ステップ20
8)。最右のノードがあれば、最右のノードに移動(ス
テップ210)したあとステップ102に再び戻る。最
右のノードがなければ、ステップ111に進む。
At step 206, for the search data 6,
The bit value indicated by the bit number 7 of the node 3 is checked, and if it is "00", the presence or absence of the leftmost node is checked (step 207). If there is a leftmost node, it moves to the leftmost node and then returns to step 102 again. If there is no leftmost node, the process proceeds to step 111. If it is "01", the presence or absence of the second node from the left is inspected. If there is a second node from the left, it moves to the second node from the left and then returns to step 102 again. If there is no second node from the left, go to step 111. If "10", the presence or absence of the second node from the right is inspected. 2 from the right
If there is a th node, move to the second node from the right and then return to step 102 again. If there is no second node from the right, go to step 111. If it is "11", the presence or absence of the rightmost node is inspected (step 20).
8). If there is a rightmost node, it moves to the rightmost node (step 210) and returns to step 102 again. If there is no rightmost node, the process proceeds to step 111.

【0039】ステップ111で、前記スタック内の宛先
ネットワークIPアドレス1とエントリのネットワーク
マスク2の組の有無を検査する。有の場合、ステップ1
12に進む。無の場合、ステップ115に進む。ステッ
プ112で、前記スタックの最後に積んだ宛先ネットワ
ークIPアドレス1とネットワークマスク2の組を取り
出し、ステップ113に進む。ステップ113で、前記
検索データ6と前記ネットワークマスク2をビット毎に
AND演算した結果と前記宛先ネットワークIPアドレ
ス1を比較する。両者が等しい場合、ステップ114に
進み、両者が異なる場合、再びステップ111に戻る。
ステップ114に進んだ場合、前記ステップ113で前
記検索データ6と比較した宛先ネットワークアドレス1
とネットワークマスク2の組が求めるエントリである。
ステップ115に進んだ場合、求めるエントリは、ルー
チングテーブルに存在しない。次に、図2に示す検索木
を用いて、この実施の形態1による検索の例を示す。検
索データ6を0xD0000000とする。
In step 111, it is checked whether or not there is a pair of the destination network IP address 1 and the network mask 2 of the entry in the stack. If yes, step 1
Proceed to 12. If no, go to step 115. In step 112, the set of destination network IP address 1 and network mask 2 loaded at the end of the stack is taken out, and the process proceeds to step 113. In step 113, the result of ANDing the search data 6 and the network mask 2 bit by bit is compared with the destination network IP address 1. If they are the same, the process proceeds to step 114, and if they are different, the process returns to step 111 again.
If the process proceeds to step 114, the destination network address 1 compared with the search data 6 in step 113
And the network mask 2 are the entries required.
If step 115 is reached, the desired entry does not exist in the routing table. Next, an example of the search according to the first embodiment will be shown using the search tree shown in FIG. Let the search data 6 be 0xD0000000.

【0040】以下の手順で検索が実行される。 (1)図2に示す検索木の頂点のノード13oから出発
する。 (2)前記ノード13oのビット番号17oは0なの
で、前記検索データ6のビット0とビット1を検査し、
「11」なので最も右のノード13vに進む。 (3)前記ノード13vのビット番号17vは2なの
で、前記検索データ6のビット2とビット3を検査し、
「01」なので左から2番目のノード13uに進む。
The search is executed according to the following procedure. (1) Start from the node 13o at the top of the search tree shown in FIG. (2) Since the bit number 17o of the node 13o is 0, bit 0 and bit 1 of the search data 6 are inspected,
Since it is "11", the process proceeds to the rightmost node 13v. (3) Since the bit number 17v of the node 13v is 2, the bits 2 and 3 of the search data 6 are inspected,
Since it is "01", the process proceeds to the second node 13u from the left.

【0041】(4)前記ノード13uは、リーフ5uを
持つので、前記リーフ5uの宛先ネットワークIPアド
レス1uとネットワークマスク2uの組をスタックに積
む。 (5)前記ノード13uのビット番号17uは4なの
で、前記検索データ6のビット4とビット5を検査し、
「00」なので最も左のノード13に進もうとするが、
存在しないので、ノード13uで検索木のなぞりを終え
る。 (6)スタックの最後に積んだ宛先ネットワークIPア
ドレス1uとネットワークマスク2uの組を取り出し、
前記検索データ6と前記ネットワークマスク2uをビッ
ト毎にAND演算した結果と前記宛先ネットワークIP
アドレス1uを比較する。 (7)(0xD0000000)&(0xE00000
00)=0xC0000000 前記式の結果から前記宛先ネットワークIPアドレス1
uと前記ネットワークマスク2uの組が、求めるエント
リであり、検索を終了する。
(4) Since the node 13u has the leaf 5u, the set of the destination network IP address 1u of the leaf 5u and the network mask 2u is stacked on the stack. (5) Since the bit number 17u of the node 13u is 4, the bits 4 and 5 of the search data 6 are inspected,
Since it is "00", I try to move to the leftmost node 13,
Since it does not exist, the tracing of the search tree is finished at the node 13u. (6) The set of the destination network IP address 1u and the network mask 2u stacked at the end of the stack is taken out,
The result of ANDing the search data 6 and the network mask 2u bit by bit and the destination network IP
The address 1u is compared. (7) (0xD00000000) & (0xE00000)
00) = 0xC0000000 From the result of the above expression, the destination network IP address 1
The combination of u and the network mask 2u is the desired entry, and the search is terminated.

【0042】この実施の形態1による検索方式は、以上
のように実行される。図2に示すこの実施の形態1によ
る検索木の長さは、最大2であり、検索に要する時間の
最大値は、この検索木の長さに比例する。ここで、検索
木の長さとは、頂点のノードから端のノードまでなぞる
際に、経由するノードの数(端のノードを含む)を指
す。例えば、図2において、ノード13oからノード1
3tまでの長さは2である。経由する各ノード毎の処理
量はほぼ等しいため、全体の検索に要する時間は、経由
するノードの数にほぼ比例する。
The search method according to the first embodiment is executed as described above. The maximum length of the search tree according to the first embodiment shown in FIG. 2 is 2, and the maximum time required for the search is proportional to the length of this search tree. Here, the length of the search tree refers to the number of nodes (including end nodes) that pass through when tracing from a node at the apex to a node at the end. For example, in FIG. 2, node 13o to node 1
The length up to 3t is 2. Since the processing amount of each passing node is almost the same, the time required for the entire search is almost proportional to the number of passing nodes.

【0043】一方、図12は、従来のPatricia
Trie検索方式に基づいて、図11に示されるルー
チングテーブルに対し構成した検索木を示す図である。
図12に示す従来の検索木の長さは、最大5であり、検
索に要する時間の最大値は、この検索木の長さに比例す
る。従って、図1に示されるルーチングテーブルによれ
ば、この実施の形態1による検索に要する時間の最大値
は、従来の検索方式の検索に要する時間の最大値に比較
し、半分である。
On the other hand, FIG. 12 shows a conventional Patricia.
FIG. 12 is a diagram showing a search tree configured for the routing table shown in FIG. 11 based on the Trie search method.
The maximum length of the conventional search tree shown in FIG. 12 is 5, and the maximum value of the time required for the search is proportional to the length of this search tree. Therefore, according to the routing table shown in FIG. 1, the maximum value of the time required for the search according to the first embodiment is half that of the conventional search method.

【0044】以上を一般的に考えた場合、従来の検索方
式の検索に要する時間の最大値は、ルーチングテーブル
のエントリの内容に関わらず、検索データ6のビット数
で規定されるが、この実施の形態1による検索方式に要
する時間の最大値は、検索データ6のビット数/N(図
2の例ではN=2)で規定され、従来の検索方式に比較
し、1/Nに削減される。また、この実施の形態1によ
る検索方式は、以上に示したように、可変長のネットワ
ークマスクに対応することが可能である。なお、以上で
は、N=2の例を示したが、この実施の形態1による検
索方式は、N≧3の場合についても同様に適用可能であ
り、同様の効果を奏する。
When the above is generally considered, the maximum value of the time required for the search of the conventional search method is defined by the number of bits of the search data 6 regardless of the content of the entry of the routing table. The maximum value of the time required for the search method according to the first mode is defined by the number of bits of the search data 6 / N (N = 2 in the example of FIG. 2), which is reduced to 1 / N as compared with the conventional search method. It Further, the search method according to the first embodiment can deal with a variable length network mask as described above. Although an example of N = 2 has been shown above, the search method according to the first embodiment can be similarly applied to the case of N ≧ 3 and has the same effect.

【0045】実施の形態2.この実施の形態2による検
索方式は、各エントリのネットワークマスクが可変長で
あり、ロンゲストマッチの関係にあるエントリを1組以
上含むルーチングテーブルに対し適用しようとするもの
である。図4は、この実施の形態2によるルーチングテ
ーブルの例を示す。このルーチングテーブルでは、各エ
ントリのネットワークマスクが可変長であり、ロンゲス
トマッチの関係にあるエントリを1組以上含む。
Embodiment 2. The search method according to the second embodiment is intended to be applied to a routing table in which each entry has a variable network mask and one or more entries having a longest match relationship. FIG. 4 shows an example of the routing table according to the second embodiment. In this routing table, the network mask of each entry has a variable length, and includes one or more sets of entries having a longest match relationship.

【0046】図5は、この実施の形態2による検索方式
に基づいて、図4に示されるルーチングテーブルに対し
構成した検索木を示す図である。なお、図5における各
構成要素に付与された符号は、実施の形態1の図2に示
す各構成要素に付与された符号と同一で説明を省く。ま
た、図5の例でも、次のノード13を決定するために検
索データ6に対し一度に検査する連続するNビットとし
て、N=2の場合を示している。
FIG. 5 is a diagram showing a search tree constructed for the routing table shown in FIG. 4 based on the search method according to the second embodiment. The reference numerals given to the respective constituent elements in FIG. 5 are the same as the reference numerals given to the respective constituent elements shown in FIG. Also in the example of FIG. 5, the case where N = 2 is shown as the continuous N bits to be inspected at once for the search data 6 in order to determine the next node 13.

【0047】この実施の形態2による図5に示される検
索木も、実施の形態1と同様に、宛先ネットワークIP
アドレス1のMSB側ビットから順に各ビットを「0
0」、「01」、「10」、「11」に場合分けし、前
記場合分けを節の左から右への4分岐で表現したもので
ある。ノード13は、前記の節に相当し、最大1つのリ
ーフ5および下位に最大4つのノード13を持つ。
As with the first embodiment, the search tree shown in FIG. 5 according to the second embodiment also has the destination network IP.
Set each bit to "0" in order from the MSB side of address 1.
The case is divided into 0, “01”, “10”, and “11”, and the case is expressed by four branches from left to right of the clause. The node 13 corresponds to the above-mentioned node and has one leaf 5 at the maximum and four nodes 13 at the lower level.

【0048】この実施の形態2によるノード13とリー
フ5は、実施の形態1で述べた規則1〜3に加え、以下
の2つの規則に従って置かれる。 ・規則4:あるエントリに対し実施の形態1で述べた規
則1に従って置いたノード13と、他のエントリに対し
規則2または規則3に従って置いたノード13が重複す
る(同一の位置に置く必要がある)場合、両ノード13
の役割を合わせ持つノード13を1個置く。このノード
13には、後者のエントリに対するリーフ5を置く。 ・規則5:あるエントリに対し実施の形態1で述べた規
則2または規則3に従って置いたノード13と、他のエ
ントリに対し規則3に従って置いたノード13が複数個
重複する場合、重複している前記ノード13の中から、
ネットワークマスク2の1の数が最も多いエントリに対
する前記ノード13を置き、他のエントリに対する前記
ノード13を置かない。このノード13には、前者のエ
ントリに対するリーフ5を置く。なお、実施の形態1で
は、規則4、規則5が該当する場合はない。
The node 13 and the leaf 5 according to the second embodiment are placed according to the following two rules in addition to the rules 1 to 3 described in the first embodiment. Rule 4: The node 13 placed according to the rule 1 described in the first embodiment for a certain entry and the node 13 placed according to the rule 2 or the rule 3 for another entry overlap (need to be placed at the same position. Yes), both nodes 13
Put one node 13 that also has the role of. In this node 13, the leaf 5 for the latter entry is placed. Rule 5: When a plurality of nodes 13 placed according to the rule 2 or the rule 3 described in the first embodiment with respect to a certain entry and a plurality of nodes 13 placed according to the rule 3 with respect to another entry are duplicated, they are duplicated. From the node 13,
The node 13 for the entry having the largest number of 1's in the network mask 2 is placed, and the node 13 for other entries is not placed. The leaf 5 for the former entry is placed in this node 13. In the first embodiment, rule 4 and rule 5 do not apply.

【0049】N=2とした図5の例では、ノード13v
は、前記規則4に該当し、ノード13p、13q、13
s、13tは、実施の形態1で述べた規則2に該当し、
ノード13rは、実施の形態1で述べた規則3に該当
し、ノード13wは、前記規則5に該当する。ノード1
3wについては、ネットワークマスク2wに対するノー
ド13とネットワークマスク2rに対するノード13が
重複するが、1の数がより多いネットワークマスク2w
に対し、ノード13wを置いたものである。
In the example of FIG. 5 with N = 2, the node 13v
Corresponds to the above-mentioned rule 4, and the nodes 13p, 13q, 13
s and 13t correspond to the rule 2 described in the first embodiment,
The node 13r corresponds to the rule 3 described in the first embodiment, and the node 13w corresponds to the rule 5. Node 1
For 3w, the node 13 for the network mask 2w and the node 13 for the network mask 2r overlap, but the number of 1 is larger than the network mask 2w.
On the other hand, the node 13w is placed.

【0050】図5に示すこの実施の形態2による検索木
を用いた検索手順については、実施の形態1で述べた検
索手順と同様である。
The search procedure using the search tree according to the second embodiment shown in FIG. 5 is the same as the search procedure described in the first embodiment.

【0051】次に、図5に示す検索木を用いて、この実
施の形態2による検索の例を示す。検索データ6を0x
D0000000とする。以下の手順で検索が実行され
る。 (1)図5に示す検索木の頂点のノード13oから出発
する。 (2)前記ノード13oのビット番号17oは0なの
で、前記検索データ6のビット0とビット1を検査し、
「11」なので最も右のノード13vに進む。 (3)前記ノード13vは、リーフ5vを持つので、前
記リーフ5vの宛先ネットワークIPアドレス1vとネ
ットワークマスク2vの組をスタックに積む。 (4)前記ノード13vのビット番号17vは2なの
で、前記検索データ6のビット2とビット3を検査し、
「01」なので左から2番目のノード13wに進む。
Next, an example of the search according to the second embodiment will be shown using the search tree shown in FIG. Search data 6 0x
Set to D0000000. The search is executed in the following procedure. (1) Start from the node 13o at the top of the search tree shown in FIG. (2) Since the bit number 17o of the node 13o is 0, bit 0 and bit 1 of the search data 6 are inspected,
Since it is "11", the process proceeds to the rightmost node 13v. (3) Since the node 13v has the leaf 5v, the set of the destination network IP address 1v of the leaf 5v and the network mask 2v is stacked on the stack. (4) Since the bit number 17v of the node 13v is 2, the bits 2 and 3 of the search data 6 are inspected,
Since it is "01", the process proceeds to the second node 13w from the left.

【0052】(5)前記ノード13wは、リーフ5wを
持つので、前記リーフ5wの宛先ネットワークIPアド
レス1wとネットワークマスク2wの組をスタックに積
む。 (6)前記ノード13wのビット番号17wは4なの
で、前記検索データ6のビット4とビット5を検査し、
「00」なので最も左のノード13に進もうとするが、
存在しないので、ノード13wで検索木のなぞりを終え
る。 (7)スタックの最後に積んだ宛先ネットワークIPア
ドレス1wとネットワークマスク2wの組を取り出し、
前記検索データ6と前記ネットワークマスク2wをビッ
ト毎にAND演算した結果と前記宛先ネットワークIP
アドレス1wを比較する。 (8)(0xD0000000)&(0xF00000
00)=0xD0000000 前記式の結果から前記宛先ネットワークIPアドレス1
wと前記ネットワークマスク2wの組が、求めるエント
リであり、検索を終了する。
(5) Since the node 13w has the leaf 5w, the set of the destination network IP address 1w of the leaf 5w and the network mask 2w is stacked on the stack. (6) Since the bit number 17w of the node 13w is 4, the bits 4 and 5 of the search data 6 are inspected,
Since it is "00", I try to move to the leftmost node 13,
Since it does not exist, the trace of the search tree ends at node 13w. (7) The set of the destination network IP address 1w and the network mask 2w stacked at the end of the stack is taken out,
The result of ANDing the search data 6 and the network mask 2w bit by bit and the destination network IP
The address 1w is compared. (8) (0xD00000000) & (0xF00000)
00) = 0xD0000000 From the result of the above expression, the destination network IP address 1
The combination of w and the network mask 2w is the desired entry, and the search is completed.

【0053】前記検索キー6に対し、 ・リーフ5vの宛先ネットワークIPアドレス1vとネ
ットワークマスク2vの組、 ・リーフ5rの宛先ネットワークIPアドレス1rとネ
ットワークマスク2rの組、 ・リーフ5wの宛先ネットワークIPアドレス1wとネ
ットワークマスク2wの組、の3組で比較条件を満足す
るが、前記検索では、1で示される数が最も多いネット
ワークマスク2wからなるリーフ5wを検索することが
できた。このように、この実施の形態2による検索方法
は、ロンゲストマッチに対応している。
For the search key 6, a set of the destination network IP address 1v and the network mask 2v of the leaf 5v, a set of the destination network IP address 1r and the network mask 2r of the leaf 5r, and a destination network IP address of the leaf 5w Three sets of 1w and a network mask 2w satisfy the comparison condition, but in the above search, the leaf 5w composed of the network mask 2w having the largest number of 1 could be searched. As described above, the search method according to the second embodiment corresponds to the longest match.

【0054】この実施の形態2による検索方式は、以上
のように実行されるので、実施の形態1と同様に、検索
方式に要する時間の最大値は、検索データ6のビット数
/N(図5の例ではN=2)で規定され、従来の検索方
式に比較し、1/Nに削減される。また、この実施の形
態2による検索方式は、以上に示したように、可変長の
ネットワークマスクに対応すると共に、ロンゲストマッ
チに対応することが可能である。
Since the retrieval method according to the second embodiment is executed as described above, the maximum value of the time required for the retrieval method is the number of bits of the retrieval data 6 / N (see FIG. In the example of No. 5, N = 2), which is reduced to 1 / N as compared with the conventional search method. Further, as described above, the search method according to the second embodiment can cope with the variable length network mask and the longest match.

【0055】なお、以上では、N=2の例を示したが、
この実施の形態2による検索方式は、N≧3の場合につ
いても同様に適用可能であり、同様の効果を奏する。
Although an example of N = 2 is shown above,
The search method according to the second embodiment can be similarly applied to the case of N ≧ 3, and has the same effect.

【0056】実施の形態3.この実施の形態3による検
索方式は、リ−フの共通化を計りリーフの数を削減する
ものである。また、各エントリのネットワークマスクが
可変長であるが、いかなるエントリの組み合わせについ
ても、ロンゲストマッチの関係にないエントリからなる
ルーチングテーブル、および各エントリのネットワーク
マスクが可変長であり、ロンゲストマッチの関係にある
エントリを1組以上含むルーチングテーブル、のどちら
に対しても適用しようとするものである。図6は、この
実施の形態3を説明するために用いるルーチングテーブ
ルの内容の例を示す図である。図6に示すルーチングテ
ーブルでは、各エントリのネットワークマスクが可変長
であり、ロンゲストマッチの関係にあるエントリを1組
以上含む。
Embodiment 3. The search method according to the third embodiment is to reduce the number of leaves by standardizing leaves. Also, the network mask of each entry is variable, but for any combination of entries, the routing table consisting of entries that are not related to longest match, and the network mask of each entry are variable length, It is intended to be applied to both a routing table including one or more sets of related entries. FIG. 6 is a diagram showing an example of the contents of a routing table used to describe the third embodiment. In the routing table shown in FIG. 6, the network mask of each entry has a variable length and includes one or more sets of entries having a longest match relationship.

【0057】図7は、この実施の形態3による検索木構
成方式に基づいて、図6に示されるルーチングテーブル
に対し構成した検索木を示す図である。なお、図7にお
ける各構成要素に付与された符号は、実施の形態1の図
2に示す各構成要素に付与された符号と同一で説明を省
く。また、図7の例でも、次のノード13を決定するた
めに検索データ6に対し一度に検査する連続するNビッ
トとして、N=2の場合を示している。
FIG. 7 is a diagram showing a search tree constructed for the routing table shown in FIG. 6 based on the search tree constructing method according to the third embodiment. Note that the reference numerals given to the respective constituent elements in FIG. 7 are the same as the reference numerals given to the respective constituent elements shown in FIG. 2 of the first embodiment, and a description thereof will be omitted. The example of FIG. 7 also shows a case where N = 2 as consecutive N bits to be inspected at one time with respect to the search data 6 to determine the next node 13.

【0058】この実施の形態3によるノード13とリー
フ5は、実施の形態1で述べた規則1〜3、および実施
の形態2で述べた規則4、5に従って置かれる。但し、
実施の形態1で述べた規則3に示すリーフ5の置き方を
以下のように変形する。 ・規則3の変形:ノード13の置き方、ビット番号17
の付け方は規則3と同様。この1つのエントリに対する
複数のノード13には、前記エントリの情報からなるリ
ーフ5を各ノード間で共通に1個置く。
The node 13 and the leaf 5 according to the third embodiment are placed according to the rules 1 to 3 described in the first embodiment and the rules 4 and 5 described in the second embodiment. However,
The placement of the leaf 5 shown in Rule 3 described in the first embodiment is modified as follows. -Modification of rule 3: placement of node 13, bit number 17
How to attach is the same as Rule 3. In each of the plurality of nodes 13 for this one entry, one leaf 5 consisting of the information of the entry is placed in common among the respective nodes.

【0059】N=2とした図7の例では、ノード13r
と13uが、実施の形態1で述べた規則3に該当し、リ
ーフ5rを共通に1個持つ。図7に示すこの実施の形態
3による検索木を用いた検索手順については、実施の形
態1で述べた検索手順と同様である。
In the example of FIG. 7 with N = 2, the node 13r
And 13u correspond to the rule 3 described in the first embodiment and have one leaf 5r in common. The search procedure using the search tree according to the third embodiment shown in FIG. 7 is the same as the search procedure described in the first embodiment.

【0060】この実施の形態3による検索木構成方式
は、以上のように実行されるので、検索木を構成するリ
ーフの数は、ルーチングテーブルのエントリ数に等しく
なり、実施の形態1または実施の形態2による検索木構
成方式に比較し、検索木を構成するリーフの数を削減す
ることが可能である。
Since the search tree construction method according to the third embodiment is executed as described above, the number of leaves forming the search tree is equal to the number of entries in the routing table, and the number of leaves in the routing table is the same as in the first or the third embodiment. It is possible to reduce the number of leaves forming the search tree as compared with the search tree construction method according to the second aspect.

【0061】なお、以上では、N=2の例を示したが、
この実施の形態3による検索方式は、N≧3の場合につ
いても同様に適用可能であり、同様の効果を奏する。
Although an example of N = 2 has been shown above,
The search method according to the third embodiment can be similarly applied to the case of N ≧ 3, and has the same effect.

【0062】実施の形態4.この実施の形態4による検
索方式は、ノードの共通化を計りノードの数を削減する
ものである。また、各エントリのネットワークマスクが
可変長であるが、いかなるエントリの組み合わせについ
ても、ロンゲストマッチの関係にないエントリからなる
ルーチングテーブル、または各エントリのネットワーク
マスクが可変長であり、ロンゲストマッチの関係にある
エントリを1組以上含むルーチングテーブル、のどちら
に対しても適用しようとするものである。
Fourth Embodiment The search method according to the fourth embodiment reduces the number of nodes by standardizing the nodes. In addition, the network mask of each entry is variable, but for any combination of entries, the routing table that consists of entries that are not related to longest match, or the network mask of each entry is variable, It is intended to be applied to both a routing table including one or more sets of related entries.

【0063】図8は、この実施の形態4による検索木構
成方式に基づいて、図6に示されるルーチングテーブル
に対し構成した検索木を示す図である。なお、図8にお
ける各構成要素に付与された符号は、実施の形態1の図
2に示す各構成要素に付与された符号と同一で説明を省
く。また、図8の例でも、次のノード13を決定するた
めに検索データ6に対し一度に検査する連続するNビッ
トとして、N=2の場合を示している。
FIG. 8 is a diagram showing a search tree constructed for the routing table shown in FIG. 6 based on the search tree constructing method according to the fourth embodiment. The reference numerals given to the respective constituent elements in FIG. 8 are the same as the reference numerals given to the respective constituent elements shown in FIG. The example of FIG. 8 also shows the case where N = 2 as consecutive N bits to be inspected at once for the search data 6 to determine the next node 13.

【0064】この実施の形態4によるノード13とリー
フ5は、実施の形態1で述べた規則1〜3、および実施
の形態2で述べた規則4、5に従って置かれる。さら
に、以下の規則に従って置かれる。1つのエントリに対
し、実施の形態1で述べた規則3、または実施の形態2
で述べた規則4または規則5に従って置いた複数のノー
ド13が、 ・規則6:全て次のノードと接続されているノード(内
部ノード)からなる場合、前記各内部ノードには、前記
エントリの情報からなるリーフ5を前記内部ノード間で
共通に1個置く。 ・規則7:内部ノードと次のノードと接続されているノ
ード(外部ノード)からなる場合、 −前記内部ノードには、前記エントリの情報からなるリ
ーフ5を前記内部ノード間で共通に1個置き、−前記外
部ノードを、前記内部ノードのいずれか1個で代用す
る。 ・規則8:全て外部ノードからなる場合、 −前記外部ノードを、前記外部ノードのいずれか1個で
代表し、 −前記外部ノードの代表には、前記エントリの情報から
なるリーフ5を1個置く。
The node 13 and the leaf 5 according to the fourth embodiment are placed according to the rules 1 to 3 described in the first embodiment and the rules 4 and 5 described in the second embodiment. In addition, they are placed according to the following rules. For one entry, the rule 3 described in the first embodiment or the second embodiment
The plurality of nodes 13 placed according to the rule 4 or the rule 5 described in the above: Rule 6: When all the nodes are connected to the next node (internal node), the information of the entry is stored in each of the internal nodes. One leaf 5 consisting of is placed between the internal nodes in common. -Rule 7: When it is composed of an internal node and a node (external node) connected to the next node-In the internal node, one leaf 5 consisting of the information of the entry is placed in common between the internal nodes , -Replace the external node with any one of the internal nodes. -Rule 8: When all of the external nodes are included: -The external node is represented by any one of the external nodes; -The representative of the external node is provided with one leaf 5 including the information of the entry. .

【0065】N=2とした図8の例では、ノード13r
が前記の規則7に該当し、図7に示す実施の形態3によ
る検索木のノード13uが、図8に示す実施の形態4に
よる検索木のノード13rで代用される。図8に示すこ
の実施の形態4による検索木を用いた検索手順について
は、実施の形態1で述べた検索手順と同様である。
In the example of FIG. 8 in which N = 2, the node 13r
Corresponds to the above rule 7, and the node 13u of the search tree according to the third embodiment shown in FIG. 7 is substituted by the node 13r of the search tree according to the fourth embodiment shown in FIG. The search procedure using the search tree according to the fourth embodiment shown in FIG. 8 is the same as the search procedure described in the first embodiment.

【0066】次に、図8に示す検索木を用いて、実施の
形態4による検索の例を示す。検索データ6を0xD0
000000とする。以下の手順で検索が実行される。 (1)図8に示す検索木の頂点のノード13oから出発
する。 (2)前記ノード13oのビット番号17oは0なの
で、前記検索データ6のビット0とビット1を検査し、
「11」なので最も右のノード13vに進む。 (3)前記ノード13vのビット番号17vは2なの
で、前記検索データ6のビット2とビット3を検査し、
「01」なので最も左のノード13rに進む。 (4)前記ノード13rは、リーフ5rを持つので、前
記リーフ5rの宛先ネットワークIPアドレス1rとネ
ットワークマスク2rの組をスタックに積む。
Next, an example of the search according to the fourth embodiment will be shown using the search tree shown in FIG. Search data 6 to 0xD0
Set to 000000. The search is executed in the following procedure. (1) Start from the node 13o at the top of the search tree shown in FIG. (2) Since the bit number 17o of the node 13o is 0, bit 0 and bit 1 of the search data 6 are inspected,
Since it is "11", the process proceeds to the rightmost node 13v. (3) Since the bit number 17v of the node 13v is 2, the bits 2 and 3 of the search data 6 are inspected,
Since it is "01", the process proceeds to the leftmost node 13r. (4) Since the node 13r has the leaf 5r, the set of the destination network IP address 1r of the leaf 5r and the network mask 2r is stacked on the stack.

【0067】(5)前記ノード13rのビット番号17
rは4なので、前記検索データ6のビット4とビット5
を検査し、「00」なので最も左のノード13zに進
む。 (6)前記ノード13zは、リーフ5zを持つので、前
記リーフ5zの宛先ネットワークIPアドレス1zとネ
ットワークマスク2zの組をスタックに積む。 (7)前記ノード13zのビット番号17zは6なの
で、前記検索データ6のビット6とビット7を検査し、
「00」なので最も左のノード13に進もうとするが、
存在しないので、ノード13zで検索木のなぞりを終え
る。 (8)スタックの最後に積んだ宛先ネットワークIPア
ドレス1zとネットワークマスク2zの組を取り出し、
前記検索データ6と前記ネットワークマスク2zをビッ
ト毎にAND演算した結果と前記宛先ネットワークIP
アドレス1zを比較する。
(5) Bit number 17 of the node 13r
Since r is 4, bit 4 and bit 5 of the search data 6
Is checked, and since it is "00", the process proceeds to the leftmost node 13z. (6) Since the node 13z has the leaf 5z, the set of the destination network IP address 1z of the leaf 5z and the network mask 2z is stacked on the stack. (7) Since the bit number 17z of the node 13z is 6, the bits 6 and 7 of the search data 6 are inspected,
Since it is "00", I try to move to the leftmost node 13,
Since it does not exist, the tracing of the search tree ends at node 13z. (8) The set of the destination network IP address 1z and the network mask 2z stacked at the end of the stack is taken out,
The result of ANDing the search data 6 and the network mask 2z bit by bit and the destination network IP
Address 1z is compared.

【0068】(9)(0xD0000000)&(0x
FC000000)≠0xC0000000 前記式の結果から、スタックの最後から2番目に積んだ
宛先ネットワークIPアドレス1rとネットワークマス
ク2rの組を取り出し、前記検索データ6と前記ネット
ワークマスク2rをビット毎にAND演算した結果と前
記宛先ネットワークIPアドレス1rを比較する。 (10)(0xD0000000)&(0xE0000
000)=0xC0000000 前記式の結果から、前記宛先ネットワークIPアドレス
1rと前記ネットワークマスク2rの組が、求めるエン
トリであり、検索を終了する。
(9) (0xD0000000) & (0x
FC000000) ≠ 0xC0000000 From the result of the above equation, the set of the destination network IP address 1r and the network mask 2r stacked second from the last in the stack is taken out, and the result of bitwise ANDing the search data 6 and the network mask 2r And the destination network IP address 1r. (10) (0xD0000000) & (0xE0000)
000) = 0xC0000000 From the result of the above expression, the set of the destination network IP address 1r and the network mask 2r is the desired entry, and the search is terminated.

【0069】この実施の形態4による検索木構成方式
は、以上のように実行されるので、実施の形態1〜3の
いずれかによる検索木構成方式に比較し、検索木を構成
するノードの数を削減することが可能である。
Since the search tree construction method according to the fourth embodiment is executed as described above, the number of nodes forming the search tree is larger than that of the search tree construction method according to any of the first to third embodiments. Can be reduced.

【0070】なお、以上では、N=2の例を示したが、
この実施の形態4による検索方式は、N≧3の場合につ
いても同様に適用可能であり、同様の効果を奏する。
Although an example of N = 2 has been shown above,
The search method according to the fourth embodiment can be similarly applied to the case of N ≧ 3, and has the same effect.

【0071】実施の形態5.この実施の形態5による検
索方式は、検索時間の短縮、メモリアクセス回数の削減
およびビット幅の削減を計るものである。また、各エン
トリのネットワークマスクが可変長であり、ロンゲスト
マッチの関係にあるエントリを1組以上含むルーチング
テーブルに対し適用しようとするものである。例えば、
図4に示すルーチングテーブルに対し、この実施の形態
5における検索方式に基づき構成した検索木は、N=2
の場合、図5に示す検索木と同様である。
Fifth Embodiment The search method according to the fifth embodiment aims to shorten the search time, reduce the number of memory accesses, and reduce the bit width. Further, the network mask of each entry is variable in length, and it is intended to be applied to a routing table including one or more sets of entries having a longest match relationship. For example,
In contrast to the routing table shown in FIG. 4, the search tree constructed based on the search method according to the fifth embodiment has N = 2.
In the case of, the search tree is similar to that shown in FIG.

【0072】次に、図9のフローチャートを用いて、こ
の実施の形態5による検索方式の流れを説明する。 な
お、図9は、N=2の場合の例である。フローチャート
において、ステップ201で、出発点を頂点のノード1
3とし、ステップ202に進む。ステップ202で、前
記ノード13に対するリーフ5の有無を検査する。有の
場合、ステップ203に進み、無の場合、ステップ20
6に進む。ステップ203で、検索データ6と前記リー
フ5の宛先ネットワークIPアドレス1を、以前比較済
みのビットの次のビット、すなわち前回比較時に使用し
たネットワークマスク2のMSB側から見て最初に0とな
るビットから、前記リーフ5のネットワークマスク2の
MSB側から見て最後に1となるビットまで比較する。両
者が等しい場合、ステップ204に進み、両者が異なる
場合、ステップ211に進む。
Next, the flow of the search method according to the fifth embodiment will be described with reference to the flowchart of FIG. Note that FIG. 9 is an example in the case of N = 2. In the flowchart, in step 201, the starting point is the node 1 of the vertex.
Then, the process proceeds to step 202. In step 202, the existence of the leaf 5 for the node 13 is checked. If yes, go to step 203, otherwise go to step 20.
Go to 6. In step 203, the search data 6 and the destination network IP address 1 of the leaf 5 are the bit next to the previously compared bit, that is, the bit that becomes 0 first when viewed from the MSB side of the network mask 2 used at the time of the previous comparison. From the network mask 2 of the leaf 5
Compare up to the last bit to be 1 when viewed from the MSB side. If they are the same, the process proceeds to step 204, and if they are different, the process proceeds to step 211.

【0073】ここで、前回比較時に使用したネットワー
クマスク2については、ネットワークマスク格納用レジ
スタ(レジスタ1とし、図示せず)に一時的に記憶して
あるものを使用する(下記ステップ204参照)。この
レジスタ1の初期値は、0x00000000である。
ステップ204で、前記リーフ5のネットワークマスク
2をレジスタ1に格納し、ステップ205に進む。ステ
ップ205で、前記リーフ5の内容をリーフ格納用レジ
スタ(レジスタ2とする)に格納し、ステップ206に
進む。ステップ206で、検索データ6に対し、前記ノ
ード13のビット番号17が含まれる2ビット単位のビ
ットの値全てを検査し、「00」でればステップ207
に進む。ステップ207で、前記ノード13に対する最
も左の下位のノード13の有無を検査する。有の場合、
ステップ209に進み、無の場合、ステップ211に進
む。
Here, as the network mask 2 used in the previous comparison, the one temporarily stored in the network mask storage register (register 1 and not shown) is used (see step 204 below). The initial value of this register 1 is 0x00000000.
In step 204, the network mask 2 of the leaf 5 is stored in the register 1, and the process proceeds to step 205. At step 205, the contents of the leaf 5 are stored in the leaf storage register (referred to as register 2), and the routine proceeds to step 206. In step 206, the search data 6 is inspected for all the bit values in 2-bit units including the bit number 17 of the node 13, and if it is "00", step 207
Proceed to. In step 207, the existence of the leftmost lower node 13 with respect to the node 13 is checked. If yes,
Proceed to step 209, and if none, proceed to step 211.

【0074】ステップ209で、前記最も左の下位のノ
ード13に移動し、ステップ202に再び戻る。以上の
ステップ206、207、209は、2ビット単位のビ
ットの値が「00」の場合を述べたが、「01」、「1
0」、「11」の場合もそのビットの値に応じて、同様
な手順を踏む。ステップ211で、レジスタ2にリーフ
5が格納されているか検査する。有の場合、ステップ2
12に進む。無の場合、ステップ213に進む。ステッ
プ212に進んだ場合、前記レジスタ2に格納されたリ
ーフ5が求めるエントリである。ステップ213に進ん
だ場合、求めるエントリは、ルーチングテーブルに存在
しない。
At step 209, the node is moved to the leftmost lower node 13 and the process returns to step 202 again. The above steps 206, 207, and 209 have described the case where the bit value of the 2-bit unit is "00".
In the case of "0" and "11", the same procedure is performed according to the value of the bit. In step 211, it is checked whether or not the leaf 5 is stored in the register 2. If yes, step 2
Proceed to 12. If no, go to step 213. When the process proceeds to step 212, the leaf 5 stored in the register 2 is the desired entry. If step 213 is reached, the desired entry does not exist in the routing table.

【0075】なお、前記ステップ205では、レジスタ
2にリーフ5の内容を格納したが、検索木を例えばルー
タ等検索を実行する装置内のメモリ等の記憶装置上に構
成した場合、レジスタ2に、前記リーフ5の内容の代わ
りに、リーフ5が格納されている記憶装置上のアドレス
情報を格納してもよい。
In step 205, the contents of the leaf 5 are stored in the register 2. However, when the search tree is constructed on a storage device such as a memory in a device for executing a search such as a router, the register 2 stores Instead of the contents of the leaf 5, address information on the storage device in which the leaf 5 is stored may be stored.

【0076】次に、図5に示す検索木を用いて、この実
施の形態5による検索の例を示す。検索データ6を0x
D0000000とする。以下の手順で検索が実行され
る。 (1)図5に示す検索木の頂点のノード13oから出発
する。 (2)前記ノード13oのビット番号17oは0なの
で、前記検索データ6のビット0とビット1を検査し、
「11」なので最も右のノード13vに進む。 (3)前記ノード13vは、リーフ5vを持つので、検
索データ6と前記リーフ5vの宛先ネットワークIPア
ドレス1vを、以前比較済みのビットの次のビット(今
回初めての比較なのでビット0)から、前記リーフ5v
のネットワークマスク2vのMSB側から見て最後に1と
なるビット(ビット1)まで比較する。 (4)前記の結果、両者は「11」と一致するので、前
記ネットワークマスク2vをレジスタ1に格納し、前記
リーフ5vをレジスタ2に格納する。
Next, an example of the search according to the fifth embodiment will be shown using the search tree shown in FIG. Search data 6 0x
Set to D0000000. The search is executed in the following procedure. (1) Start from the node 13o at the top of the search tree shown in FIG. (2) Since the bit number 17o of the node 13o is 0, bit 0 and bit 1 of the search data 6 are inspected,
Since it is "11", the process proceeds to the rightmost node 13v. (3) Since the node 13v has the leaf 5v, the search data 6 and the destination network IP address 1v of the leaf 5v are transferred from the bit next to the previously compared bit (bit 0 since this is the first comparison) to Leaf 5v
The bits up to the last bit (bit 1) which is 1 when viewed from the MSB side of the network mask 2v are compared. (4) As a result of the above, since both match with “11”, the network mask 2v is stored in the register 1 and the leaf 5v is stored in the register 2.

【0077】(5)前記ノード13vのビット番号17
vは2なので、前記検索データ6のビット2とビット3
を検査し、「01」なので左から2番目のノード13w
に進む。 (6)前記ノード13wは、リーフ5wを持つので、検
索データ6と前記リーフ5wの宛先ネットワークIPア
ドレス1wを、前回比較時に使用したネットワークマス
ク2vのMSB側から見て最初に0となるビット(ビット
2)から、前記リーフ5wのネットワークマスク2wの
MSB側から見て最後に1となるビット(ビット3)まで
比較する。 (7)前記の結果、両者は「01」と一致するので、前
記ネットワークマスク2wをレジスタ1に格納し、前記
リーフ5wをレジスタ2に格納する。 (8)前記ノード13wのビット番号17wは4なの
で、前記検索データ6のビット4とビット5を検査し、
「00」なので最も左のノード13に進もうとするが、
存在しないので、ノード13wで検索木のなぞりを終え
る。 (9)レジスタ2のリーフ5の有無を検査し、リーフ5
wがあるので、リーフ5wが、求めるエントリであり、
検索を終了する。
(5) Bit number 17 of the node 13v
Since v is 2, bit 2 and bit 3 of the search data 6 are
Is checked and it is "01", so the second node 13w from the left is
Proceed to. (6) Since the node 13w has the leaf 5w, the search data 6 and the destination network IP address 1w of the leaf 5w are initially set to 0 when viewed from the MSB side of the network mask 2v used in the previous comparison ( From bit 2) from the network mask 2w of the leaf 5w
Compare up to the last bit (bit 3) that becomes 1 when viewed from the MSB side. (7) As a result of the above, since both match "01", the network mask 2w is stored in the register 1 and the leaf 5w is stored in the register 2. (8) Since the bit number 17w of the node 13w is 4, the bits 4 and 5 of the search data 6 are inspected,
Since it is "00", I try to move to the leftmost node 13,
Since it does not exist, the trace of the search tree ends at node 13w. (9) Check for the presence of leaf 5 in register 2
Since there is w, leaf 5w is the desired entry,
Finish the search.

【0078】この実施の形態5による検索方式は、図9
に示す処理をハードウェアで実行した場合、ステップ2
02〜205の処理とステップ206〜210の処理を
並行して実施することが可能であり、従来の検索方式に
比較し、検索時間を短縮することが可能である。また、
この実施の形態5による検索方式は、リーフ5を持つノ
ード13を経由する毎に、以前比較済みのビットを比較
の対象としないため、比較処理毎のメモリアクセス回数
の削減および検索木を格納するメモリビット幅の削減で
き、さらに検索時間の短縮およびハードウェア規模の縮
小を図ることができる。
The search method according to the fifth embodiment is shown in FIG.
If the processing shown in is executed by hardware, step 2
It is possible to perform the processing of 02-205 and the processing of steps 206-210 in parallel, and it is possible to shorten the search time as compared with the conventional search method. Also,
In the search method according to the fifth embodiment, each time the node 13 having the leaf 5 is passed through, the previously compared bits are not targeted for comparison, so that the memory access count is reduced and the search tree is stored for each comparison process. The memory bit width can be reduced, the search time can be shortened, and the hardware scale can be reduced.

【0079】メモリアクセス回数の削減およびメモリビ
ット幅の削減の例を以下に示す。例えば、128ビット
の検索データ6を対象とした検索を実行する場合、以前
ビット0〜95を比較済みならば、次の比較では、ビッ
ト96〜127を比較すれば良い。また、検索木を構成
するメモリを32ビット幅で構成した場合、前記図9の
ステップ203で前記ビット96〜127の比較に要す
る前記メモリのリード回数は、リーフ5の宛先ネットワ
ークIPアドレス1のビット96〜127に対し、1
回、リーフ5のネットワークマスク2のビット96〜1
27に対し、1回、合計2回である。もしも、前記図9
のステップ203に進む毎に、全128ビットを比較し
た場合は、リーフ5の宛先ネットワークIPアドレス1
のビット0〜127に対し、4回、リーフ5のネットワ
ークマスク2のビット0〜127に対し、4回、合計8
回であり、後者のメモリアクセス回数は、前者に比較し
4倍である。
An example of reducing the number of memory accesses and reducing the memory bit width is shown below. For example, when performing a search for the 128-bit search data 6, if bits 0 to 95 have been compared before, bits 96 to 127 may be compared in the next comparison. When the memory forming the search tree has a 32-bit width, the number of times of reading the memory required to compare the bits 96 to 127 in step 203 of FIG. 9 is the bit of the destination network IP address 1 of the leaf 5. 1 to 96-127
Times, bits 96 to 1 of network mask 2 of leaf 5
Against 27, once, twice. If the above
When all 128 bits are compared each time the process proceeds to step 203, the destination network IP address 1 of leaf 5
4 times for bits 0 to 127 of 4 and 4 times for bits 0 to 127 of network mask 2 of leaf 5.
The number of memory accesses of the latter is four times that of the former.

【0080】一方、後者の場合で、前記メモリのリード
回数を前者と同等にしようとすると、検索木を構成する
メモリを128ビット幅で構成する必要がある。
On the other hand, in the latter case, in order to make the number of reads of the memory equal to that of the former, it is necessary to configure the memory forming the search tree to have a 128-bit width.

【0081】以上のように、この実施の形態5による検
索方式は、全体の検索時間の短縮および全体のハードウ
ェア規模の縮小を同時に図ることが可能である。また、
前記メモリアクセス回数の削減やメモリのビット幅の削
減は、前記図9に示す処理をソフトウェアで実行した場
合にも得られる効果である。
As described above, the search method according to the fifth embodiment can simultaneously reduce the overall search time and the overall hardware scale. Also,
The reduction of the number of times of memory access and the reduction of the bit width of the memory are the effects obtained even when the processing shown in FIG. 9 is executed by software.

【0082】なお、以上では、N=2の例を示したが、
この実施の形態5による検索方式は、N≧3の場合につ
いても同様に適用可能であり、同様の効果を奏する。ま
た、この実施の形態5による検索方式は、N=1の場合
についても同様に適用可能であり、同様の効果を奏す
る。
Although an example of N = 2 has been shown above,
The search method according to the fifth embodiment can be similarly applied to the case of N ≧ 3, and has the same effect. In addition, the search method according to the fifth embodiment can be similarly applied to the case where N = 1, and has the same effect.

【0083】実施の形態6.この実施の形態6による検
索方式は、メモリアクセス回数を減らし検索時間を短く
するものである。また、各エントリのネットワークマス
クが可変長であるが、いかなるエントリの組み合わせに
ついても、ロンゲストマッチの関係にないエントリから
なるルーチングテーブル、または、各エントリのネット
ワークマスクが可変長であり、ロンゲストマッチの関係
にあるエントリを1組以上含むルーチングテーブル、の
どちらに対しても適用しようとするものである。
Sixth Embodiment The search method according to the sixth embodiment reduces the number of memory accesses and shortens the search time. Although the network mask of each entry is variable, for any combination of entries, the routing table is made up of entries that are not related to longest match, or the network mask of each entry is variable and the longest match The present invention is intended to be applied to any of routing tables including one or more sets of entries having the relationship of.

【0084】例えば、図1に示すルーチングテーブルに
対し、この実施の形態6による検索方式に基づき構成し
た検索木は、N=2の場合、図2に示す検索木と同様で
あり、また、例えば、図4に示すルーチングテーブルに
対し、この実施の形態6による検索方式に基づき構成し
た検索木は、N=2の場合、図5に示す検索木と同様で
ある。
For example, in the case where N = 2, the search tree constructed based on the search method according to the sixth embodiment with respect to the routing table shown in FIG. 1 is similar to the search tree shown in FIG. The search tree configured based on the search method according to the sixth embodiment with respect to the routing table shown in FIG. 4 is similar to the search tree shown in FIG. 5 when N = 2.

【0085】次に、図10のフローチャートを用いて、
この実施の形態6による検索方式の流れを説明する。な
お、図10は、N=2の場合の例である。フローチャー
トにおいて、ステップ221で、ネットワークマスク2
として、現在のノード13のビット番号17を展開した
値を記憶し、 宛先ネットワークIPアドレス1とし
て、現在のノード13よりも下位のノード13のいずれ
かが持つリーフ5の宛先ネットワークIPアドレス1を
記憶し、ステップ203に進む。
Next, using the flowchart of FIG.
The flow of the search method according to the sixth embodiment will be described. Note that FIG. 10 is an example in the case of N = 2. In the flowchart, in step 221, the network mask 2
Stores the expanded value of the bit number 17 of the current node 13, and stores the destination network IP address 1 of the leaf 5 owned by one of the nodes 13 lower than the current node 13 as the destination network IP address 1. Then, the process proceeds to step 203.

【0086】前記の展開とは、前記ビット番号17の値
だけ、MSB側から1を並べ、それ以降0を並べたネッ
トワークマスク2を作成することを指す。例えば、前記
ビット番号17が2の場合、ネットワークマスク2は0
xC000000となる。次に、ステップ222で、前
記ノード13に対するリーフ5の有無を検査する。有の
場合、ステップ205に進み、無の場合、ステップ20
6に進む。なお、その他のステップは、図9に示される
実施の形態5の検索の流れを示すフローチャートで、同
一番号が付けられるステップと同一である。但し、図9
と図10では、ステップ202とステップ204の進む
先が異なる。
The above-mentioned expansion refers to creating a network mask 2 in which 1s are arranged from the MSB side by the value of the bit number 17 and 0s are arranged thereafter. For example, when the bit number 17 is 2, the network mask 2 is 0.
xC000000. Next, in step 222, the presence or absence of the leaf 5 for the node 13 is inspected. If yes, go to step 205; otherwise, step 20.
Go to 6. The other steps are the same as the steps to which the same numbers are given in the flowchart showing the flow of the search of the fifth embodiment shown in FIG. However, FIG.
In FIG. 10, the destinations of step 202 and step 204 are different.

【0087】次に、図2に示す検索木を用いて、この実
施の形態6による検索の例を示す。検索データ6を0x
D0000000とする。以下の手順で検索が実行され
る。 (1)図2に示す検索木の頂点のノード13oから出発
する。 (2)前記ノード13oは、リーフ5を持たないので、
ネットワークマスク2として、前記ノード13oに付く
ビット番号17oを展開した0x00000000を使
用し、宛先ネットワークIPアドレス1として、例え
ば、ノード13rが持つリーフ5rの宛先ネットワーク
IPアドレス1rを使用し、検索データ6と前記リーフ
5rの宛先ネットワークIPアドレス1rを、以前比較
済みの次のビット(今回初めての比較なのでビット0)
から、前記ノード13oに付くビット番号17oを展開
したネットワークマスク2のMSB側から見て最後に1と
なるビットまで比較する。
Next, an example of the search according to the sixth embodiment will be shown using the search tree shown in FIG. Search data 6 0x
Set to D0000000. The search is executed in the following procedure. (1) Start from the node 13o at the top of the search tree shown in FIG. (2) Since the node 13o does not have the leaf 5,
As the network mask 2, 0x00000000, which is the expanded bit number 17o attached to the node 13o, is used, and as the destination network IP address 1, for example, the destination network IP address 1r of the leaf 5r of the node 13r is used, and the search data 6 is obtained. The destination network IP address 1r of the leaf 5r is compared with the next bit (bit 0 because this is the first comparison).
From the MSB side of the expanded network mask 2 of the bit number 17o attached to the node 13o, the bits up to 1 at the end are compared.

【0088】但し、前記ネットワークマスク2の値は全
て0なので、比較するビットはない。従って、両者は無
条件に一致すると見なす。 (3)前記の結果、前記ネットワークマスク2をレジス
タ1に格納する。 (4)前記ノード13oのビット番号17oは0なの
で、前記検索データ6のビット0とビット1を検査し、
「11」なので最も右のノード13vに進む。
However, since the values of the network mask 2 are all 0, there is no bit to compare. Therefore, they are considered to match unconditionally. (3) As a result, the network mask 2 is stored in the register 1. (4) Since the bit number 17o of the node 13o is 0, bit 0 and bit 1 of the search data 6 are inspected,
Since it is "11", the process proceeds to the rightmost node 13v.

【0089】(5)前記ノード13vは、リーフ5を持
たないので、ネットワークマスク2として、前記ノード
13vに付くビット番号17vを展開した0xC000
0000を使用し、宛先ネットワークIPアドレス1と
して、例えば、ノード13tが持つリーフ5tの宛先ネ
ットワークIPアドレス1tを使用し、検索データ6と
前記リーフ5tの宛先ネットワークIPアドレス1t
を、前回比較時に使用したネットワークマスク2のMSB
側から見て最初に0となるビット(ビット0)から、前
記ノード13vに付くビット番号17vを展開したネッ
トワークマスク2のMSB側から見て最後に1となるビッ
ト(ビット1)まで比較する。
(5) Since the node 13v does not have the leaf 5, 0xC000 is obtained by expanding the bit number 17v attached to the node 13v as the network mask 2.
0000 is used as the destination network IP address 1, for example, the destination network IP address 1t of the leaf 5t held by the node 13t is used, and the search data 6 and the destination network IP address 1t of the leaf 5t are used.
Is the MSB of network mask 2 used in the previous comparison
From the bit which becomes 0 first when viewed from the side (bit 0), the bit which becomes 1 at the end when viewed from the MSB side of the network mask 2 in which the bit number 17v attached to the node 13v is expanded (bit 1) is compared.

【0090】(6)前記の結果、両者は「11」と一致
するので、前記ネットワークマスク2をレジスタ1に格
納する。 (7)前記ノード13vのビット番号17vは2なの
で、前記検索データ6のビット2とビット3を検査し、
「01」なので左から2番目のノード13uに進む。 (8)前記ノード13uは、リーフ5uを持つので、検
索データ6と前記リーフ5uの宛先ネットワークIPア
ドレス1uを、前回比較時に使用したネットワークマス
ク2のMSB側から見て最初に0となるビット(ビット
2)から、前記リーフ5uのネットワークマスク2uの
MSB側から見て最後に1となるビット(ビット2)ま
で、すなわちビット2を比較する。
(6) As a result of the above, since both match "11", the network mask 2 is stored in the register 1. (7) Since the bit number 17v of the node 13v is 2, the bits 2 and 3 of the search data 6 are inspected,
Since it is "01", the process proceeds to the second node 13u from the left. (8) Since the node 13u has the leaf 5u, the search data 6 and the destination network IP address 1u of the leaf 5u are initially set to 0 when viewed from the MSB side of the network mask 2 used in the previous comparison ( Bit 2) from the network mask 2u of the leaf 5u
From the MSB side, bits up to 1 (bit 2) at the end, that is, bit 2 are compared.

【0091】(9)前記の結果、両者は「0」と一致す
るので、前記ネットワークマスク2uをレジスタ1に格
納し、前記リーフ5uをレジスタ2に格納する。 (10)前記ノード13uのビット番号17uは4なの
で、前記検索データ6のビット4とビット5を検査し、
「00」なので最も左のノード13に進もうとするが、
存在しないので、ノード13uで検索木のなぞりを終え
る。 (11)レジスタ2のリーフ5の有無を検査し、リーフ
5uがあるので、リーフ5u(リーフ5rと同内容)
が、求めるエントリであり、検索を終了する。
(9) As a result of the above, since both match "0", the network mask 2u is stored in the register 1 and the leaf 5u is stored in the register 2. (10) Since the bit number 17u of the node 13u is 4, the bits 4 and 5 of the search data 6 are inspected,
Since it is "00", I try to move to the leftmost node 13,
Since it does not exist, the tracing of the search tree is finished at the node 13u. (11) The presence or absence of the leaf 5 of the register 2 is inspected, and the leaf 5u is present. Therefore, the leaf 5u (same content as the leaf 5r)
Is the desired entry, and the search ends.

【0092】この実施の形態6による検索方式は、前記
図10に示す処理をハードウェアで実行した場合、ステ
ップ202〜205および221、222の処理とステ
ップ206〜210の処理を並行して実施することが可
能であり、従来の検索方式に比較し、検索時間を短縮す
ることが可能である。また、この実施の形態6による検
索方式では、前記ステップ203に進む毎に、ノード1
3がリーフ5を持つか持たないかに関わらず、比較を実
施し、以前比較済みのビットを比較の対象としないた
め、図10に示す処理をハードウェアで実行した場合、
比較処理毎のメモリアクセス回数の削減および検索木を
格納するメモリビット幅の削減が可能となり、さらに検
索時間の短縮およびハードウェア規模の縮小を図ること
が可能である。
In the search method according to the sixth embodiment, when the processing shown in FIG. 10 is executed by hardware, the processing of steps 202 to 205 and 221, 222 and the processing of steps 206 to 210 are executed in parallel. It is possible to shorten the search time as compared with the conventional search method. In the search method according to the sixth embodiment, the node 1
When the processing shown in FIG. 10 is executed by hardware, the comparison is performed regardless of whether 3 has the leaf 5 or not, and the previously compared bits are not targeted for comparison.
The number of memory accesses for each comparison process and the memory bit width for storing the search tree can be reduced, and the search time and the hardware scale can be shortened.

【0093】比較処理毎のメモリアクセス回数の削減お
よびメモリビット幅の削減の例を以下に示す。この実施
の形態6による検索方式と実施の形態5による検索方式
において、検索木を構成するメモリに対し、検索データ
6の比較処理に要するリード回数を比較する。例えば、
128ビットの検索データ6を対象とした検索を実行
し、検索木を構成するメモリを32ビット幅で構成し、
ある検索データ6に対し、検索を開始してから、リーフ
5を持たないビット番号7が32、64、96の各ノー
ド13を経由し、最後に、リーフ5を持つビット番号7
が128のノード13に到達した場合を想定する。
An example of reducing the number of memory accesses and reducing the memory bit width for each comparison process is shown below. In the search method according to the sixth embodiment and the search method according to the fifth embodiment, the number of reads required for the comparison process of the search data 6 is compared with the memory forming the search tree. For example,
A search is performed on the 128-bit search data 6, and the memory forming the search tree is configured with a 32-bit width.
After the search is started for a certain search data 6, the bit number 7 having no leaf 5 passes through each node 13 of 32, 64, and 96, and finally the bit number 7 having the leaf 5
Assume that the node has reached 128 node 13.

【0094】この実施の形態6による検索方式では、各
ノード13を経由する毎に、比較処理を行うため、ビッ
ト32のノード13で、ビット128のノードが持つリ
ーフ5の宛先ネットワークIPアドレス1のビット0〜
31に対し、1回、ビット64のノード13で、前記宛
先ネットワークIPアドレス1のビット32〜63に対
し、1回、ビット96のノード13で、前記宛先ネット
ワークIPアドレス1のビット64〜95に対し、1
回、ビット128のノード13で、前記宛先ネットワー
クIPアドレス1のビット96〜127に対し、1回、
前記ノード13で、前記リーフ5のネットワークマスク
2のビット96〜127に対し、1回、合計5回リード
する。
In the search method according to the sixth embodiment, since the comparison process is performed every time when each node 13 is passed through, the node 13 of bit 32 has the destination network IP address 1 of the leaf 5 held by the node of bit 128. Bits 0-
31 to the node 13 having the bit 64 once, to the bits 32 to 63 of the destination network IP address 1, once to the node 13 having the bit 96 to the bits 64 to 95 of the destination network IP address 1. On the other hand, 1
Once, in the node 13 of bit 128, once for the bits 96 to 127 of the destination network IP address 1,
The node 13 reads the bits 96 to 127 of the network mask 2 of the leaf 5 once, five times in total.

【0095】一方、実施の形態5による検索方式では、
ビット128のノード13に到達したときのみ比較処理
を行うため、ビット128のノード13で、前記ノード
13が持つリーフ5の宛先ネットワークIPアドレス1
のビット0〜127に対し、4回、前記ノード13で、
前記リーフ5のネットワークマスク2のビット0〜12
7に対し、4回、合計8回リードする。
On the other hand, in the search method according to the fifth embodiment,
Since the comparison processing is performed only when the node 13 having the bit 128 is reached, the destination network IP address 1 of the leaf 5 held by the node 13 at the node 13 having the bit 128 is 1
For bits 0 to 127 of 4 times, at the node 13,
Bits 0 to 12 of the network mask 2 of the leaf 5
7 leads 4 times, a total of 8 times.

【0096】以上のように、前者のメモリアクセス回数
の方が、後者に比較し少ない。また、前者では、検索処
理中にリードが分散するが、後者では、検索処理の最後
にリードが集中するので、ハードウェア処理により、ノ
ードのなぞりと前記比較処理に要するリードを並行して
実施すれば、前者の全体の検索時間は、後者の全体の検
索時間に比較しさらに短縮される。
As described above, the former number of memory accesses is smaller than that of the latter. In the former, the leads are distributed during the search process, but in the latter, the reads are concentrated at the end of the search process, so that the hardware process can execute the node trace and the read required for the comparison process in parallel. For example, the total search time of the former is further shortened as compared with the total search time of the latter.

【0097】一方、後者の場合で、リードが集中しても
検索時間を前者と同等にしようとすると、検索木を構成
するメモリを128ビット幅で構成する必要があり、ハ
ードウェア規模が増大する。
On the other hand, in the latter case, if the search time is made equal to that of the former even if reads are concentrated, it is necessary to configure the memory forming the search tree to have a 128-bit width, which increases the hardware scale. .

【0098】さらに、前者は、後者に比較し、比較の結
果が不一致の場合に、検索結果を早期に知ることがで
き、平均検索時間が短縮される。
Further, in the former case, the retrieval result can be known at an early stage when the comparison result does not match, and the average retrieval time can be shortened.

【0099】以上のように、この実施の形態6による検
索方式は、全体の検索時間の短縮および全体のハードウ
ェア規模の縮小を同時に図ることが可能である。
As described above, the search method according to the sixth embodiment can simultaneously reduce the overall search time and the overall hardware scale.

【0100】なお、以上では、N=2の例を示したが、
この実施の形態6による検索方式は、N≧3の場合につ
いても同様に適用可能であり、同様の効果を奏する。ま
た、この実施の形態6による検索方式は、N=1の場合
についても同様に適用可能であり、同様の効果を奏す
る。
Although an example of N = 2 has been shown above,
The search method according to the sixth embodiment can be similarly applied to the case of N ≧ 3, and has the same effect. Further, the search method according to the sixth embodiment can be similarly applied to the case of N = 1, and the same effect can be obtained.

【0101】[0101]

【発明の効果】以上のように第1の発明によれば、ネッ
トワークマスクが可変長で、全てロンゲストマッチの関
係にないエントリからなるルーチングテーブル対し、各
ノードで一度に検査するビット数をNビット(N≧2)
にし、可変長のネットワークマスクを格納するリーフの
うち、長さがNビットの整数倍でないネットワークマス
クを格納するリーフに対して、ノードを複数個置いた検
索木を用いて、基数検索を行うようにしたので、可変長
のネットワークマスクに対応することが可能であると共
に、検索に要する時間の最大値が、 検索データのビット数/N で規定され、従来の検索方式に比較し、1/Nに削減す
ることができ、ルータ等の検索を実行する装置の中継性
能を向上できる。
As described above, according to the first aspect of the present invention, the number of bits to be inspected at each node at a time is N with respect to the routing table having the variable length network mask and all entries not in the relation of longest match. Bit (N ≧ 2)
Then, among leaves that store variable-length network masks, a radix search is performed using a search tree in which multiple nodes are placed for leaves that store network masks whose length is not an integer multiple of N bits. Therefore, it is possible to deal with a variable length network mask, and the maximum value of the search time is defined by the number of bits of search data / N, which is 1 / N compared with the conventional search method. Therefore, the relay performance of a device such as a router that executes a search can be improved.

【0102】第2の発明によれば、ネットワークマスク
が可変長で、ロンゲストマッチの関係にあるエントリを
1組以上含むルーチングテーブルに対し、各ノードで一
度に検査するビット数をNビット(N≧2)にし、可変
長のネットワークマスクを格納するリーフのうち、長さ
がNビットの整数倍でないネットワークマスクを格納す
るリーフに対して、ノードを複数個置き、前記ノード
が、他のリーフに対するノードと重複する場合、より短
いネットワークマスクを格納するリーフに対するノード
を置かず、より長いネットワークマスクを格納するリー
フに対するノードを置いた検索木を用いて、基数検索を
行うようにしたので、ロンゲストマッチに対応すること
が可能であり、ルータ等の検索を実行する装置の機能を
向上できる。
According to the second aspect of the present invention, the number of bits to be inspected at each node at once is N bits (N bits) for a routing table having a variable length network mask and including one or more sets of entries having a longest match relationship. ≧ 2), and among the leaves that store the variable-length network mask, a plurality of nodes are placed for the leaves that store the network mask whose length is not an integer multiple of N bits, and the node is for other leaves. When overlapping with a node, the radix search is performed by using the search tree that does not put the node for the leaf that stores the shorter network mask, but puts the node for the leaf that stores the longer network mask. It is possible to deal with a match, and the function of a device that executes a search such as a router can be improved.

【0103】第3の発明によれば、ネットワークマスク
が可変長で、全てロンゲストマッチの関係にないエント
リからなるルーチングテーブル、または、ネットワーク
マスクが可変長で、ロンゲストマッチの関係にあるエン
トリを1組以上含むルーチングテーブルに対し、各ノー
ドで一度に検査するビット数をNビット(N≧2)に
し、1個のリーフに対し、ノードを複数個置く場合、リ
ーフを記憶する記憶装置に、前記リーフを1個格納し、
前記複数のノードと、前記の各々に前記リーフの格納位
置を特定する記憶装置のアドレス値を共に格納するよう
にしたので、検索木を構成するリーフの数を削減するこ
とができ、ルータ等の検索を実行する装置に搭載される
メモリ等の記憶装置の規模を縮小できる。
According to the third invention, a routing table consisting of entries whose network mask has a variable length and is not in the relation of longest match, or entries whose network mask is a variable length and in the relation of longest match are set. For a routing table including one or more sets, the number of bits to be checked at one time in each node is set to N bits (N ≧ 2), and when a plurality of nodes are provided for one leaf, a storage device that stores the leaves, Store one leaf,
Since the address value of the storage device that specifies the storage position of the leaf is stored together in each of the plurality of nodes, it is possible to reduce the number of leaves that form the search tree. It is possible to reduce the scale of a storage device such as a memory mounted on a device that executes a search.

【0104】第4の発明によれば、ネットワークマスク
が可変長で、全てロンゲストマッチの関係にないエント
リからなるルーチングテーブルに対し、または、ネット
ワークマスクが可変長で、ロンゲストマッチの関係にあ
るエントリを1組以上含むルーチングテーブルに対し、
各ノードで一度に検査するビット数をNビット(N≧
2)にし、1個のリーフに対し、ノードを複数個置き、
前記複数のノードに、次のノードと接続されるノード
(内部ノード)と次のノードと接続されないノード(外
部ノード)が含まれる場合、記憶装置に、 ・前記リーフを1個格納すると共に、 ・前記内部ノードと、前記の各々に前記リーフの格納位
置を特定する記憶装置のアドレス値を共に格納し、 ・前記外部ノードを、前記内部ノードのいずれかで代用
するようにしたので、検索木を構成するノードの数を削
減でき、ルータ等の検索を実行する装置に搭載されるメ
モリ等の記憶装置の規模を縮小できる。
According to the fourth aspect of the invention, the network mask has a variable length and all have routing entries that are not in a longest match relationship, or the network mask has a variable length and a longest match relationship. For a routing table that contains one or more entries,
The number of bits to be checked at one time in each node is N bits (N ≧
2) and put multiple nodes for one leaf,
When the plurality of nodes include a node connected to the next node (internal node) and a node not connected to the next node (external node), the storage device stores: -one leaf; The address value of the storage device that specifies the storage position of the leaf is stored together in each of the internal node, and the external node is substituted by one of the internal nodes. The number of nodes to be configured can be reduced, and the scale of a storage device such as a memory mounted on a device that executes a search such as a router can be reduced.

【0105】第5の発明によれば、ネットワークマスク
が可変長で、ロンゲストマッチの関係にあるエントリを
1組以上含むルーチングテーブルに対し、各ノードで一
度に検査するビット数をNビット(N≧2)にし、検索
中に到着するノード毎に ・ノードに付けたビット番号に該当する検索データのビ
ットの検査と、 ・前記ノードがリーフを持つ場合、前記リーフと前記検
索データの比較を逐次または並行して行い、前記比較
で、以前に一度比較済みの前記検索データのビットを比
較の対象から除くようにしたので、ルータ等の検索を実
行する装置に搭載されるメモリ等の記憶装置のアクセス
回数の削減、およびメモリ等の記憶装置のアクセスビッ
ト幅の削減が可能となり、全体の検索時間の短縮、およ
び全体のハードウェア規模の縮小を図ることができる。
また、ルータ等の検索を実行する装置の中継性能を向上
できる。
According to the fifth invention, the number of bits to be inspected at each node at one time is N bits (N bits) for a routing table having a variable length network mask and including one or more sets of entries in a longest match relationship. ≧ 2), and for each node that arrives during the search, • check the bits of the search data corresponding to the bit number attached to the node, and • if the node has a leaf, compare the leaf and the search data sequentially Alternatively, since the bits of the search data that have already been compared once are excluded from the comparison target in the comparison in parallel, a storage device such as a memory mounted in a device that executes a search, such as a router, can be used. It is possible to reduce the number of access times and the access bit width of storage devices such as memory, reducing the overall search time and the overall hardware scale. Can be planned.
In addition, the relay performance of a device that executes a search, such as a router, can be improved.

【0106】第6の発明によれば、ネットワークマスク
が可変長で、ロンゲストマッチの関係にあるエントリを
1組以上含むルーチングテーブルに対し、各ノードで一
度に検査するビット数を1ビットにし、検索中に到着す
るノード毎に ・ノードに付けたビット番号に該当する検索データのビ
ットの検査と、 ・前記ノードがリーフを持つ場合、前記リーフと前記検
索データの比較を逐次または並行して行い、前記比較
で、以前に一度比較済みの前記検索データのビットを比
較の対象としないようにしたので、ルータ等の検索を実
行する装置に搭載されるメモリ等の記憶装置のアクセス
回数の削減、およびメモリ等の記憶装置のアクセスビッ
ト幅の削減が可能となり、全体の検索時間の短縮、およ
び全体のハードウェア規模の縮小を図ることができる。
また、ルータ等の検索を実行する装置の中継性能を向上
できる。
According to the sixth aspect of the present invention, the number of bits to be inspected at each node at one time is set to 1 bit for a routing table having a variable length network mask and including one or more sets of entries in a longest match relationship. For each node that arrives during the search: -Check the bits of the search data corresponding to the bit number given to the node-If the node has leaves, compare the leaves and the search data sequentially or in parallel In the comparison, since the bits of the search data that have already been compared once are not included in the comparison, the number of accesses to the storage device such as the memory mounted in the device that executes the search such as the router is reduced. It is possible to reduce the access bit width of a storage device such as a memory and a memory, thereby shortening the overall search time and reducing the overall hardware scale. it can.
In addition, the relay performance of a device that executes a search, such as a router, can be improved.

【0107】第7の発明によれば、 ・ネットワークマスクが可変長で、全てロンゲストマッ
チの関係にないエントリからなるルーチングテーブルに
対し、または、ネットワークマスクが可変長で、ロンゲ
ストマッチの関係にあるエントリを1組以上含むルーチ
ングテーブルに対し、各ノードで一度に検査するビット
数をNビット(N≧2)にし、検索中に到着するノード
毎に ・ノードに付けたビット番号に該当する検索データのビ
ットの検査と、 ・以下のいずれか −前記ノードがリーフを持つ場合、前記リーフと前記検
索データの比較 −前記ノードがリーフを持たない場合、その下位のいず
れかのノードが持つリーフと前記検索データの前記ノー
ドに付けたビット番号までの比較を逐次または並行して
行い、前記比較で、以前に一度比較済みの前記検索デー
タのビットを比較の対象としないようにしたので、さら
に、ルータ等の検索を実行する装置に搭載されるメモリ
等の記憶装置に対し、前記比較処理毎のアクセス回数の
削減が可能となり、ルータ等の検索を実行する装置の中
継性能を向上できる。
According to the seventh aspect of the present invention: -For a routing table consisting of entries whose network masks are of variable length and are not all in longest match relation, or in which the network mask is of variable length and longest match relation. For a routing table containing one or more sets of entries, set the number of bits to be checked at each node at one time to N bits (N ≧ 2), and for each node that arrives during the search ・ Search corresponding to the bit number given to the node Check the bits of the data, and-any of the following-if the node has a leaf, compare the leaf with the search data-if the node does not have a leaf, then the leaf that any of its subordinate nodes has The search data up to the bit number assigned to the node is compared sequentially or in parallel, and the comparison has already been performed once. Since the bits of the search data of No. 1 are not included in the comparison, it is possible to further reduce the number of accesses for each comparison process to a storage device such as a memory mounted in a device that executes a search such as a router. Therefore, it is possible to improve the relay performance of a device that executes a search such as a router.

【0108】第8の発明によれば、 ・ネットワークマスクが可変長で、全てロンゲストマッ
チの関係にないエントリからなるルーチングテーブルに
対し、または、 ・ネットワークマスクが可変長で、ロンゲストマッチの
関係にあるエントリを1組以上含むルーチングテーブル
に対し、各ノードで一度に検査するビット数を1ビット
にし、検索中に到着するノード毎に ・ノードに付けたビット番号に該当する検索データのビ
ットの検査と、・以下のいずれか −前記ノードがリーフを持つ場合、前記リーフと前記検
索データの比較 −前記ノードがリーフを持たない場合、その下位のいず
れかのノードが持つリーフと前記検索データの前記ノー
ドに付けたビット番号までの比較を逐次または並行して
行い、前記比較で、以前に一度比較済みの前記検索デー
タのビットを比較の対象としないようにしたので、さら
に、ルータ等の検索を実行する装置に搭載されるメモリ
等の記憶装置に対し、前記比較処理毎のアクセス回数の
削減が可能となり、ルータ等の検索を実行する装置の中
継性能を向上できる。
According to the eighth aspect of the present invention: -For a routing table consisting of entries whose network mask has a variable length and is not in a longest match relationship, or-A network mask has a variable length and a longest match relationship In the routing table containing one or more sets of entries in, the number of bits to be checked at each node at one time is set to 1 bit, and for each node that arrives during the search And one of the following-if the node has a leaf, compare the leaf with the search data-if the node does not have a leaf, the leaf of any of its subordinate nodes and the search data The comparison up to the bit number assigned to the node is performed sequentially or in parallel, and in the comparison, the comparison is performed once before. Since the bits of the search data are not included in the comparison, it is possible to further reduce the number of accesses for each comparison process with respect to a storage device such as a memory mounted in a device that executes a search such as a router. It is possible to improve the relay performance of a device that executes a search such as a router.

【図面の簡単な説明】[Brief description of drawings]

【図1】 実施の形態1による検索方式の説明で用いる
ルーチングテーブルの例である。
FIG. 1 is an example of a routing table used in the description of a search method according to the first embodiment.

【図2】 実施の形態1による検索木の構成の例であ
る。
FIG. 2 is an example of a configuration of a search tree according to the first embodiment.

【図3】 実施の形態1による検索手順をフローチャー
トで示した例である。
FIG. 3 is an example showing a flow chart of a search procedure according to the first embodiment.

【図4】 実施の形態2による検索方式の説明で用いる
ルーチングテーブルの例である。
FIG. 4 is an example of a routing table used in the description of the search method according to the second embodiment.

【図5】 実施の形態2による検索木の構成の例であ
る。
FIG. 5 is an example of a configuration of a search tree according to the second embodiment.

【図6】 実施の形態3による検索方式の説明で用いる
ルーチングテーブルの例である。
FIG. 6 is an example of a routing table used in the description of the search method according to the third embodiment.

【図7】 実施の形態3による検索木の構成の例であ
る。
FIG. 7 is an example of the configuration of a search tree according to the third embodiment.

【図8】 実施の形態4による検索木の構成の例であ
る。
FIG. 8 is an example of the configuration of a search tree according to the fourth embodiment.

【図9】 実施の形態5による検索手順をフローチャー
トで示した例である。
FIG. 9 is an example showing a flow chart of a search procedure according to the fifth embodiment.

【図10】 実施の形態6による検索手順を示すフロー
チャートで示した例である。
FIG. 10 is an example shown in a flowchart showing a search procedure according to the sixth embodiment.

【図11】 従来の検索方式の説明で用いるルーチング
テーブルの例である。
FIG. 11 is an example of a routing table used in the description of a conventional search method.

【図12】 従来の検索方式で用いる検索木の構成の例
である。
FIG. 12 is an example of the structure of a search tree used in a conventional search method.

【図13】 従来の検索方式の検索の流れを示すフロー
チャートである。
FIG. 13 is a flowchart showing a search flow of a conventional search method.

【符号の説明】[Explanation of symbols]

1、1a〜1z 宛先ネットワーク
IPアドレス、2、2a〜2z ネ
ットワークマスク、3、3a〜3z、13a〜13z
ノード、4、4a〜4z 中継先
ルータの宛先IPアドレス、5、5a〜5z
リーフ、6
検索データ、7、7a〜7z ビ
ット番号
1, 1a to 1z Destination network IP address, 2, 2a to 2z Network mask, 3, 3a to 3z, 13a to 13z
Nodes 4, 4a-4z Destination IP address of relay destination router 5, 5a-5z
Leaf, 6
Search data, 7, 7a-7z bit number

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特許3284064(JP,B2) 曽田 他2名,マルチウェイ化ツリー によるIPルーチングテーブルの高速検 索方式,1998年電子情報通信学会通信ソ サイエティ大会 講演論文集2,1998年 9月 7日,B−7−124 鹿島 他4名,IPルーチングテーブ ルのハードウェアによる高速検索方式, 1998年電子情報通信学会通信ソサイエテ ィ大会 講演論文集2,1998年 9月 7日,B−7−123 (58)調査した分野(Int.Cl.7,DB名) H04L 12/56 100 G06F 17/30 419 ─────────────────────────────────────────────────── ─── Continuation of the front page (56) Reference Patent 3284064 (JP, B2) Soda et al., 2 people, High-speed IP routing table search method using multi-way tree, 1998 IEICE Communications Society Conference Lecture Paper Vol.2, Sept. 7, 1998, B-7-124 Kashima et al., 4 people, High-speed retrieval method by hardware of IP routing table, 1998 Proceedings of IEICE Communication Society Conference, Vol.2, 1998 9 B-7-123 (58) Fields investigated (Int.Cl. 7 , DB name) H04L 12/56 100 G06F 17/30 419

Claims (8)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 検索テーブルの可変長の検索キーを格納
するリーフと、 前記リーフを持たず次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されないノードとで
探索木を構成し、 前記ノードに対し、次のノードを特定するために検査す
る検索データのビット番号を付け、 各ノードで一度に検査するビット数をNビット(N≧
2)にし、 可変長の検索キーを格納するリーフのうち、長さがNビ
ットの整数倍の検索キーを格納するリーフに対して、ノ
ードを1個置き、 長さがNビットの整数倍でない検索キーを格納するリー
フに対して、ノードを2の(N−M)乗個、(ただし、
Mは検索キーの長さをNで除した余り)置いた検索木を
構成し、この検索木を用いて、基数検索を行うことを特
徴とする検索方式。
1. A search tree is composed of a leaf that stores a variable-length search key of a search table, a node that does not have the leaf and is connected to a next node, and a node that has the leaf and is not connected to the next node. The node is provided with a bit number of search data to be inspected to identify the next node, and the number of bits to be inspected at one time at each node is N bits (N ≧
2), among the leaves that store the variable-length search key, place one node for the leaf that stores the search key whose length is an integer multiple of N bits, and the length is not an integer multiple of N bits. For the leaf that stores the search key, 2 (N−M) power nodes, (however,
A search method characterized in that M is a search tree in which the length of the search key is divided by N) and a radix search is performed using this search tree.
【請求項2】 検索テーブルの可変長の検索キーを格納
するリーフと、 前記リーフを持たず次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されないノードとで
検索木を構成し、 前記ノードに対し、次のノードを特定するために検査す
る検索データのビット番号を付け、各ノードで一度に検
査するビット数をNビット(N≧2)にし、 可変長の検索キーを格納するリーフのうち、長さがNビ
ットの整数倍の検索キーを格納するリーフに対して、ノ
ードを1個置き、 長さがNビットの整数倍でない検索キーを格納するリー
フに対して、ノードを2の(N−M)乗個、(ただし、
Mは検索キーの長さをNで除した余り)置き、前記ノー
ドが、他のリーフに対するノードと重複する場合、より
短い検索キーを格納するリーフに対するノードを置か
ず、より長い検索キーを格納するリーフに対するノード
を置いた検索木を用いて、基数検索を行うことを特徴と
する検索方式。
2. A leaf that stores a variable-length search key of a search table, a node that does not have the leaf and is connected to the next node, a node that has the leaf and is connected to the next node, and the leaf. Form a search tree with a node that is not connected to the next node and has a bit number of search data to be checked to identify the next node for the node, and sets the number of bits to be checked at one time in each node. Of the leaves that store N-bit (N ≧ 2) variable-length search keys, one node is placed for the leaf that stores search keys whose length is an integer multiple of N bits, and the length is N. For a leaf that stores a search key that is not an integer multiple of bits, 2 (N−M) power nodes,
M is the remainder of the length of the search key divided by N), and if the node overlaps with a node for another leaf, store a longer search key without placing a node for the leaf that stores the shorter search key A search method characterized by performing a radix search using a search tree in which nodes are placed for each leaf.
【請求項3】 1個のリーフに対し、ノードを1個置く
場合、リーフを記憶する記憶装置に、前記リーフを1個
格納し、 前記1個のノードと、前記リーフの格納位置を特定する
記憶装置のアドレス値を共に格納し、 1個のリーフに対し、ノードを複数個置く場合、記憶装
置に前記リーフを1個格納し、 前記複数のノードと、前記の各々に前記リーフの格納位
置を特定する記憶装置のアドレス値を共に格納すること
によって検索木を構成し、 この検索木を用いて、基数検索を行うことを特徴とする
請求項1または請求項2に記載の検索方式。
3. When one node is placed for one leaf, one leaf is stored in a storage device that stores the leaf, and the one node and the storage position of the leaf are specified. When the address values of the storage device are stored together, and when a plurality of nodes are placed for one leaf, one of the leaves is stored in the storage device, and the storage positions of the leaf in the plurality of nodes and each of the storage nodes. 3. The search method according to claim 1, wherein a search tree is configured by storing together the address value of a storage device that specifies the search index, and the radix search is performed using this search tree.
【請求項4】 1個のリーフに対し、ノードを1個置く
場合、前記記憶装置に前記リーフを1個格納し、 前記1個のノードと、前記リーフの格納位置を特定する
記憶装置のアドレス値を共に格納し、 1個のリーフに対し、ノードを複数個置く場合、前記記
憶装置に前記リーフを1個格納すると共に、 前記複数のノードが、全て次のノードと接続されるノー
ドの場合、前記複数のノードと、前記の各々に前記リー
フの格納位置を特定する記憶装置のアドレス値を共に格
納し、 前記複数のノードに、次のノードと接続されるノードと
次のノードと接続されないノードが含まれる場合、前記
次のノードと接続されるノードと、前記の各々に前記リ
ーフの格納位置を特定する記憶装置のアドレス値を共に
格納し、前記次のノードと接続されないノードを、前記
次のノードと接続されるノードのいずれかで代用し、 前記複数個のノードが、全て次のノードと接続されない
ノードの場合、前記次のノードと接続されない複数のノ
ードを共通に1個格納し、前記ノードと共に、前記リー
フの格納位置を特定する記憶装置のアドレス値を格納す
ることによって検索木を構成し、この検索木を用いて、
基数検索を行うことを特徴とする請求項1または請求項
2に記載の検索方式。
4. When one node is placed for one leaf, one leaf is stored in the storage device, and the address of the storage device that specifies the storage position of the one node and the leaf When values are stored together and a plurality of nodes are placed for one leaf, one leaf is stored in the storage device and all the plurality of nodes are connected to the next node. , The plurality of nodes and the storage device address value that specifies the storage position of the leaf are stored in each of the plurality of nodes, and the plurality of nodes are connected to the next node and are not connected to the next node. When a node is included, the node connected to the next node and the address value of the storage device that specifies the storage position of the leaf are stored together in each of the nodes, and the node not connected to the next node is stored. Is replaced by any of the nodes connected to the next node, and when all of the plurality of nodes are nodes not connected to the next node, the plurality of nodes not connected to the next node are shared by 1 Individual pieces, and together with the node, a search tree is configured by storing an address value of a storage device that specifies the storage position of the leaf, and using this search tree,
3. The search method according to claim 1, wherein a radix search is performed.
【請求項5】 検索中に到着するノード毎に、ノードに
付けたビット番号に該当する検索データのビットの検査
を行なうと共に、 前記ノードがリーフを持つ場合、前記リーフと前記検索
データの比較を逐次または並行して行い、 前記比較で、以前に一度比較済みの前記検索データのビ
ットを比較の対象から除いて基数検索を行うことを特徴
とする請求項2に記載の検索方式。
5. For each node that arrives during the search, the bit of the search data corresponding to the bit number assigned to the node is checked, and if the node has a leaf, the leaf and the search data are compared. 3. The search method according to claim 2, wherein the radix search is performed by sequentially or in parallel, and removing bits of the search data that have already been compared once from the comparison target in the comparison.
【請求項6】 検索テーブルの可変長の検索キーを格納
するリーフと、 前記リーフを持たず次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されないノードと、
で検索木を構成し、 前記ノードに対し、次のノードを決定するために検査す
る検索データのビット番号を付け、各ノードで一度に検
査するビット数を1ビットにし、 検索中に到着するノード毎にノードに付けたビット番号
に該当する検索データのビットの検査を行なうと共に、 前記ノードがリーフを持つ場合、前記リーフと前記検索
データの比較とを逐次または並行して行い、 前記比較で、以前に一度比較済みの前記検索データのビ
ットを比較の対象から除いて基数検索を行うことを特徴
とする検索方式。
6. A leaf that stores a variable-length search key of a search table, a node that does not have the leaf and is connected to a next node, and a node that has the leaf and is not connected to the next node,
A search tree is constructed with, the bit number of the search data to be inspected for determining the next node is given to the above node, and the number of bits to be inspected at one time at each node is set to 1 While checking the bits of the search data corresponding to the bit number assigned to each node, if the node has a leaf, the leaf and the search data is compared sequentially or in parallel, in the comparison, A search method characterized in that a radix search is performed by excluding bits of the search data that have already been compared once from the comparison target.
【請求項7】 検索中に到着するノード毎に、ノードに
付けたビット番号に該当する検索データのビットの検査
を行なうと共に、 前記ノードがリーフを持つ場合、前記リーフと前記検索
データの比較、または、前記ノードがリーフを持たない
場合、その下位のいずれかのノードが持つリーフと前記
検索データの前記ノードに付けたビット番号までの比
較、を逐次または並行して行い、 前記比較で、以前に一度比較済みの前記検索データのビ
ットを比較の対象から除いて基数検索を行うことを特徴
とする請求項1または請求項2に記載の検索方式。
7. The node of the search data corresponding to the bit number given to the node is checked for each node that arrives during the search, and when the node has a leaf, the leaf is compared with the search data. Alternatively, if the node does not have a leaf, the leaf of any one of the nodes below it is compared with the bit number assigned to the node of the search data, sequentially or in parallel, and in the comparison, 3. The search method according to claim 1, wherein the radix search is performed by removing the bit of the search data that has already been compared once from the comparison target.
【請求項8】 検索テーブルの可変長の検索キーを格納
するリーフと、 前記リーフを持たず次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されるノードと、 前記リーフを持ち次のノードと接続されないノードとで
検索木を構成し、 前記ノードに対し、次のノードを決定するために検査す
る検索データのビット番号を付け、各ノードで一度に検
査するビット数を1ビットにし、 検索中に到着するノード毎に、ノードに付けたビット番
号に該当する検索データのビットの検査を行なうと共
に、 前記ノードがリーフを持つ場合、前記リーフと前記検索
データの比較、または、前記ノードがリーフを持たない
場合、その下位のいずれかのノードが持つリーフと前記
検索データの前記ノードに付けたビット番号までの比
較、を逐次または並行して行い、 前記比較で、以前に一度比較済みの前記検索データのビ
ットを比較の対象から除いて、基数検索を行うことを特
徴とする検索方式。
8. A leaf that stores a variable-length search key of a search table, a node that does not have the leaf and is connected to the next node, a node that has the leaf and is connected to the next node, and the leaf. Form a search tree with a node that is not connected to the next node, attaches a bit number of search data to be checked to determine the next node to the node, and sets the number of bits to be checked at one time at each node. 1 bit is set, and for each node that arrives during the search, the bit of the search data corresponding to the bit number given to the node is checked, and if the node has a leaf, the leaf is compared with the search data, or , If the node does not have a leaf, compare the leaf of any of its subordinate nodes with the bit number given to the node of the search data, A search method characterized in that a radix search is performed by sequentially or in parallel and removing bits of the search data that have already been compared once from the comparison target in the comparison.
JP25081098A 1998-09-04 1998-09-04 Search method Expired - Fee Related JP3494028B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25081098A JP3494028B2 (en) 1998-09-04 1998-09-04 Search method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25081098A JP3494028B2 (en) 1998-09-04 1998-09-04 Search method

Publications (2)

Publication Number Publication Date
JP2000083056A JP2000083056A (en) 2000-03-21
JP3494028B2 true JP3494028B2 (en) 2004-02-03

Family

ID=17213396

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25081098A Expired - Fee Related JP3494028B2 (en) 1998-09-04 1998-09-04 Search method

Country Status (1)

Country Link
JP (1) JP3494028B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4755175B2 (en) * 2004-04-19 2011-08-24 ザ・リージェンツ・オブ・ザ・ユニバーシティ・オブ・カリフォルニア Programmable hardware for deep packet filtering
US7508771B2 (en) * 2005-04-01 2009-03-24 International Business Machines Corporation Method for reducing latency in a host ethernet adapter (HEA)
CN115509996A (en) * 2022-11-10 2022-12-23 北京搜狐新动力信息技术有限公司 Tree structure node retrieval method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
曽田 他2名,マルチウェイ化ツリーによるIPルーチングテーブルの高速検索方式,1998年電子情報通信学会通信ソサイエティ大会 講演論文集2,1998年 9月 7日,B−7−124
鹿島 他4名,IPルーチングテーブルのハードウェアによる高速検索方式,1998年電子情報通信学会通信ソサイエティ大会 講演論文集2,1998年 9月 7日,B−7−123

Also Published As

Publication number Publication date
JP2000083056A (en) 2000-03-21

Similar Documents

Publication Publication Date Title
US6594655B2 (en) Wildcards in radix- search tree structures
EP1623347B1 (en) Comparison tree data structures and lookup operations
JP3735471B2 (en) Packet relay device and LSI
US7415472B2 (en) Comparison tree data structures of particular use in performing lookup operations
US6934252B2 (en) Methods and systems for fast binary network address lookups using parent node information stored in routing table entries
US7787474B2 (en) Method and apparatus for deep packet processing
US7274697B2 (en) Fast IP route lookup with 16/K and 16/Kc compressed data structures
US7702630B2 (en) Longest prefix match lookup using hash function
JP2002530011A (en) Router and method for optimal routing table compression
US20090077076A1 (en) Database and database processing methods
JP2002207771A (en) Fast and flexible search engine for longest prefix match
JP3881663B2 (en) Packet classification apparatus and method using field level tree
EP2074534B1 (en) Method, device, computer program product and system for representing a partition of n w-bit intervals associated to d-bit data in a data communications network
Wuu et al. A longest prefix first search tree for IP lookup
US7633886B2 (en) System and methods for packet filtering
CN106789727B (en) Message classification method and device
JP3494028B2 (en) Search method
US8166536B1 (en) Transformation of network filter expressions to a content addressable memory format
JP2002325091A (en) Device and method for searching flow identification
Lin et al. Improved IP lookup technology for trie-based data structures
US20040042463A1 (en) Method and apparatus for address lookup
Lee et al. Packet classification using diagonal-based tuple space search
JP3443356B2 (en) Packet classifier
JP2002185510A (en) Datagram transfer system
Wang et al. A fast table update scheme for high-performance IP forwarding

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20071121

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081121

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081121

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091121

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091121

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101121

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111121

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees