JPH1188427A - Routing table retrieving device - Google Patents

Routing table retrieving device

Info

Publication number
JPH1188427A
JPH1188427A JP24153797A JP24153797A JPH1188427A JP H1188427 A JPH1188427 A JP H1188427A JP 24153797 A JP24153797 A JP 24153797A JP 24153797 A JP24153797 A JP 24153797A JP H1188427 A JPH1188427 A JP H1188427A
Authority
JP
Japan
Prior art keywords
address
routing table
search
entry
registered
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP24153797A
Other languages
Japanese (ja)
Inventor
Hiroyuki Fujiwara
弘之 藤原
Akira Toyoshima
鑑 豊島
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone 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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP24153797A priority Critical patent/JPH1188427A/en
Publication of JPH1188427A publication Critical patent/JPH1188427A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a reouting table retrieving device by which a routing table retrieval processing is executed at high speed and also a retrieval error due to that a sub-net mask is provided with variable length is prevented. SOLUTION: This device is provided with a routing table storing memory 3 for storing a routing table 2 consisting of plural sorted entries, a matching comparing part 13 for comparing the sizes of a retrieval IP address and a register IP address without executing a sub-net mask in the retrieval IP address, a matching comparing part 12 for respectively executing the AND operations of one register IP address and the variable length sub-net mask and the other register IP address and the variable length sub-net mask in two entries which directly pinch the retrieval IP address by bit, and a control part 14 for retrieving the register IP address matched with the retrieval IP address.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、コンピュータ間通
信等において、IP(Internet Protocol)パケットを
受信してデータ等を転送する場合に、大量に高速で入力
するIPパケットを受信した後、瞬時に、宛先につなが
る方路へIPパケットを出力するルータに適用され、I
Pアドレスをキーとした宛先情報検索で利用されるルー
ティングテーブル検索装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for receiving an IP (Internet Protocol) packet and transferring data or the like in an inter-computer communication. Is applied to a router that outputs an IP packet to a route connected to a destination.
The present invention relates to a routing table search device used in destination information search using a P address as a key.

【0002】[0002]

【従来の技術】従来より、コンピュータ間通信等におい
ては、IPパケットを予め登録された対地に転送するた
めに、ルータと呼ばれる装置が用いられている。このル
ータは、マイクロプロセッサと該マイクロプロセッサで
実行されるソフトウェアとによって、入力したIPパケ
ットに記載されているIPアドレスに基づいて、登録す
べき複数の登録IPアドレスが登録されたルーティング
テーブルを検索して、そこから得られた転送宛先情報に
基づいて宛先につながる方路へ該IPパケットを出力す
る。
2. Description of the Related Art Conventionally, in computer-to-computer communication, a device called a router has been used to transfer an IP packet to a destination registered in advance. This router searches a routing table in which a plurality of registered IP addresses to be registered are registered by a microprocessor and software executed by the microprocessor based on an IP address described in an input IP packet. Then, the IP packet is output to a route connected to the destination based on the transfer destination information obtained therefrom.

【0003】上記ソフトウェアが行う探索アルゴリズム
は、例えば文献「Interconnections−ブリッジとルータ
について」(Radis Perlman著、加藤朗監訳)で紹介さ
れているように、ツリーアルゴリズムやバイナリサーチ
といった最も一致している(一致しているビット数が一
番多い)登録IPアドレスをルーティングテーブル内か
ら見つけ出すものである。
The search algorithm performed by the above software has the best agreement, such as a tree algorithm or a binary search, as introduced in, for example, the document "Interconnections-Bridges and Routers" (by Radis Perlman, translated by Akira Kato). This is to find a registered IP address having the largest number of matching bits in the routing table.

【0004】また、別の構成のルータとしては、入力さ
れたIPパケット(以下、入力IPパケットと称する)
から得られるIPアドレスを検索キーとして、予め登録
された複数のIPアドレス(以下、登録IPアドレスと
称する)を有するルーティングテーブルを検索して、そ
こから得られた転送宛先情報に基づいて宛先につながる
方路へIPパケットを出力する装置がある。
[0004] As another router having a different configuration, an input IP packet (hereinafter referred to as an input IP packet) is used.
Is searched for a routing table having a plurality of pre-registered IP addresses (hereinafter, referred to as registered IP addresses) using the IP address obtained from the IP address as a search key, and a destination is connected based on the transfer destination information obtained from the routing table. There is a device that outputs an IP packet to a route.

【0005】ここで、上記入力および登録IPアドレス
は、周知のようにネットワークのアドレスを示すネット
ワークアドレス、該ネットワークの中に存在するサブネ
ットのアドレスを示すサブネットアドレス、および該サ
ブネットに接続されているホストのアドレスを示すホス
トアドレスからなる都合32ビットで表現される。
Here, the input and registered IP addresses are, as is well known, a network address indicating a network address, a subnet address indicating an address of a subnet existing in the network, and a host connected to the subnet. The address is represented by 32 bits, which is composed of a host address indicating the address.

【0006】また、ルータには、記憶部に予め記憶され
たルーティングテーブルを高速で検索する機能を有する
ルーティングテーブル検索装置が用いられている。ここ
で、上記ルーティングテーブルは、登録IPアドレス
(32ビット)とサブネットマスク(32ビット)と、
IPパケットの送信先情報とをひとまとめにして1エン
トリとした場合に、複数のエントリから構成されてい
る。
Further, a router uses a routing table search device having a function of searching a routing table stored in a storage unit in advance at a high speed. Here, the routing table includes a registered IP address (32 bits), a subnet mask (32 bits),
When the destination information of the IP packet is put together into one entry, it is composed of a plurality of entries.

【0007】また、ルーティングテーブルにおいては、
複数の登録IPアドレスを数値と見なして、各エントリ
が昇順(または降順)にソートされている。上記登録I
Pアドレスにおいて、ホストアドレスの部分は、オー
ル”0”とされている。ここで、サブネットマスクにお
いては、上述した入力IPパケットから得られるIPア
ドレスにおけるネットワークアドレスおよびサブネット
マスクに対応するビットが”1”とされており、かつホ
ストアドレスに対応するビットが”0”とされている。
また、サブネットマスクにおいて、”1”ビット部分の
長さは固定長とされている。
In the routing table,
Each entry is sorted in ascending order (or descending order) by regarding a plurality of registered IP addresses as numerical values. Registration I above
In the P address, the portion of the host address is all “0”. Here, in the subnet mask, the bit corresponding to the network address and the subnet mask in the IP address obtained from the input IP packet described above is set to “1”, and the bit corresponding to the host address is set to “0”. ing.
In the subnet mask, the length of the “1” bit portion is fixed.

【0008】上記構成において、入力IPパケットがル
ーティングテーブル検索装置に入力されると、該ルーテ
ィングテーブル検索装置は、入力IPパケットから得ら
れるIPアドレスとサブネットマスクとをビット毎にA
ND演算する。この演算結果(以下、入力IPアドレス
と称する)は、入力IPパケットから得られるIPアド
レスにおける、ホストアドレス以外のアドレス、すなわ
ちネットワークアドレスおよびサブネットアドレスであ
る。
In the above configuration, when an input IP packet is input to the routing table search device, the routing table search device converts the IP address and subnet mask obtained from the input IP packet into bits for each bit.
Perform ND operation. The operation result (hereinafter, referred to as an input IP address) is an address other than the host address in the IP address obtained from the input IP packet, that is, a network address and a subnet address.

【0009】次に、ルーティングテーブル検索装置は、
ルーティングテーブルにおいて、先頭エントリと末尾エ
ントリとの中央(以下、第1の中央と称する)に位置す
るエントリ(以下、第1の中央エントリと称する)のア
ドレスを求める。そして、ルーティングテーブル検索装
置は、入力IPアドレスと第1の中央エントリの登録I
Pアドレスとを照合して、この照合結果に基づいて各種
処理を行う。
[0009] Next, the routing table search device,
In the routing table, an address of an entry (hereinafter, referred to as a first center entry) located at the center (hereinafter, referred to as a first center) between the head entry and the tail entry is obtained. Then, the routing table search apparatus registers the input IP address and the registration I of the first central entry.
The P address is collated and various processes are performed based on the collation result.

【0010】すなわち、上述した入力IPアドレスと第
1の中央エントリの登録IPアドレスとが一致している
場合、ルーティングテーブル検索装置は、照合結果を一
致とした後、該登録IPアドレスに対応する送信先情報
を当該方路へ出力する。
That is, if the input IP address and the registered IP address of the first central entry match, the routing table search device determines that the matching result matches, and then determines the transmission corresponding to the registered IP address. The destination information is output to the corresponding route.

【0011】一方、入力IPアドレスが登録IPアドレ
スより小である場合、ルーティングテーブル検索装置
は、第1の中央を新しい末尾エントリとして、該末尾エ
ントリと先頭エントリとの中央(以下、第2の中央と称
する)に位置するエントリ(以下、第2の中央エントリ
と称する)のアドレスを求める。以下、ルーティングテ
ーブル検索装置は、上述した動作と同様にして、入力I
Pアドレスと第2の中央エントリの登録IPアドレスと
を照合して、この照合結果により各種処理を行う。そし
て、入力IPアドレスと第2の中央エントリの登録IP
アドレスとが一致しない場合、再び第3の中央エントリ
を求める。すなわち、照合処理においては、ルーティン
グテーブルにおける検索範囲が順次、半分にしぼりこま
れるのである。
On the other hand, if the input IP address is smaller than the registered IP address, the routing table search apparatus sets the first center as a new tail entry and sets the center between the tail entry and the head entry (hereinafter, the second center). ) (Hereinafter referred to as a second central entry). Thereafter, the routing table search device performs the input I
The P address is collated with the registered IP address of the second central entry, and various processes are performed based on the collation result. Then, the input IP address and the registered IP of the second central entry
If the address does not match, the third central entry is again sought. That is, in the matching process, the search range in the routing table is sequentially narrowed down to half.

【0012】他方、入力IPアドレスが登録IPアドレ
スより大である場合、ルーティングテーブル検索装置
は、第1の中央を新しい先頭エントリとして、該先頭エ
ントリと末尾エントリとの中央(以下、第4の中央と称
する)に位置するエントリ(以下、第4の中央エントリ
と称する)のアドレスを求める。以下、ルーティングテ
ーブル検索装置は、上述した動作と同様にして、入力I
Pアドレスと第4の中央エントリの登録IPアドレスと
を照合して、この照合結果により各種処理を行う。そし
て、入力IPアドレスと第4の中央エントリの登録IP
アドレスとが一致しない場合、再び第5の中央エントリ
を求める。すなわち、照合処理においては、ルーティン
グテーブルにおける検索範囲が順次、半分にしぼりこま
れるのである。
On the other hand, if the input IP address is larger than the registered IP address, the routing table search device sets the first center as a new head entry and sets the center between the head entry and the tail entry (hereinafter referred to as a fourth center). ) (Hereinafter referred to as a fourth central entry). Thereafter, the routing table search device performs the input I
The P address is collated with the registered IP address of the fourth central entry, and various processes are performed based on the collation result. Then, the input IP address and the registered IP of the fourth central entry
If the address does not match, the fifth center entry is determined again. That is, in the matching process, the search range in the routing table is sequentially narrowed down to half.

【0013】[0013]

【発明が解決しようとする課題】ところで、上述した従
来のソフトウェアによるルータにおいては、IPアドレ
スをキーとしたIPパケットの転送宛先情報の検索処理
を、マイクロプロセッサ上でソフトウェアによって実行
しているため、おのずと処理能力に限界があった。従っ
て、上述した従来のルータにおいては、大量に高速で入
力するIPパケットを受信して瞬時に宛先につながる方
路へIPパケットを出力することが困難であるという問
題があった。
By the way, in the above-mentioned conventional software router, a process of searching for transfer destination information of an IP packet using an IP address as a key is executed by software on a microprocessor. Naturally, the processing capacity was limited. Therefore, the above-mentioned conventional router has a problem that it is difficult to receive a large amount of input IP packets at high speed and to output the IP packets to a route to a destination instantly.

【0014】他方、従来のルーティングテーブル検索装
置においては、固定長のサブネットマスクを使用してい
るため、サブネットマスクが可変長のものである場合、
次の理由により検索誤りが発生するという欠点があっ
た。今、ルーティングテーブルは、少なくとも、次の2
つのサブネットNA、NBに対応する2つのエントリAお
よびBを有し、かつ各エントリは、登録IPアドレスお
よび可変長のサブネットマスクから構成されているもの
とする。 ・エントリA(サブネットNA)→登録IPアドレスAA
(32ビット)、第1の長さ(20ビット)のサブネッ
トマスクSA ・エントリB(サブネットNB)→登録IPアドレスAB
(32ビット)、第2の長さ(24ビット)のサブネッ
トマスクSB
On the other hand, since the conventional routing table search apparatus uses a fixed-length subnet mask, if the subnet mask is of variable length,
There is a disadvantage that a search error occurs for the following reasons. Now, the routing table has at least the following 2
It is assumed that there are two entries A and B corresponding to one subnet NA and NB, and each entry is composed of a registered IP address and a variable-length subnet mask.・ Entry A (subnet NA) → registered IP address AA
(32 bits), subnet mask SA of first length (20 bits) Entry B (subnet NB) → registered IP address AB
(32 bits), subnet mask SB of second length (24 bits)

【0015】ここで、サブネットNAとサブネットNBと
の各ネットワーク空間の大きさの関係は、サブネットN
A>サブネットNBとされている。また、サブネットNB
は、サブネットNAの中に含まれているものとする。従
って、登録IPアドレスABの20ビット分は、登録I
PアドレスAAの20ビット分と同一である。
Here, the relationship between the sizes of the respective network spaces of the subnets NA and NB is as follows.
A> Subnet NB. Also, subnet NB
Is included in the subnet NA. Therefore, the 20 bits of the registered IP address AB correspond to the registered I
It is the same as the 20 bits of the P address AA.

【0016】上記条件において、ルーティングテーブル
の中の登録IPアドレスABが検索対象である場合に、
入力IPパケットがルーティングテーブル検索装置に入
力されたものとする。これにより、ルーティングテーブ
ル検索装置は、ルーティングテーブルの中から上述した
方法により1つの検索対象たるエントリを選択する。今
の場合、検索対象のエントリとして、エントリBが選択
されたものとする。
Under the above conditions, if the registered IP address AB in the routing table is to be searched,
It is assumed that an input IP packet has been input to the routing table search device. Thus, the routing table search device selects one entry to be searched from the routing table by the above-described method. In this case, it is assumed that the entry B is selected as the entry to be searched.

【0017】従って、ルーティングテーブル検索装置
は、まず、IPパケットから得られるIPアドレスと、
エントリBに対応するサブネットマスクSB(24ビッ
ト)とをビット毎にAND演算する。これにより、上記
IPアドレスから、都合24ビットからなるネットワー
クアドレスおよびサブネットアドレス(入力IPアドレ
ス)が抽出される。
Therefore, the routing table search device firstly obtains the IP address obtained from the IP packet,
An AND operation is performed on the subnet mask SB (24 bits) corresponding to the entry B for each bit. As a result, a network address and a subnet address (input IP address) each consisting of 24 bits are extracted from the IP address.

【0018】次に、ルーティングテーブル検索装置は、
エントリBに対応する登録IPアドレスと入力IPアド
レスとを照合する。この場合には、登録IPアドレスと
入力IPアドレスとが一致しているため、正しく検索が
行われたのである。
Next, the routing table search device:
The registered IP address corresponding to the entry B is compared with the input IP address. In this case, since the registered IP address matches the input IP address, the search was correctly performed.

【0019】一方、別の例として、ルーティングテーブ
ルの中の登録IPアドレスABが検索対象である場合
に、検索対象のエントリとして、上述したエントリBよ
りも先に、エントリAが選択されたものとする。
On the other hand, as another example, when the registered IP address AB in the routing table is a search target, it is assumed that the entry A is selected as the search target entry before the entry B described above. I do.

【0020】これにより、ルーティングテーブル検索装
置は、まず、IPパケットから得られるIPアドレス
と、エントリAに対応するサブネットマスクSA(20
ビット)とをビット毎にAND演算する。これにより、
上記IPアドレスから、都合20ビットからなるネット
ワークアドレスおよびサブネットアドレス(入力IPア
ドレス)が抽出される。
As a result, the routing table search device firstly obtains the IP address obtained from the IP packet and the subnet mask SA (20) corresponding to the entry A.
Bit) and AND operation for each bit. This allows
From the IP address, a network address and a subnet address (input IP address) each consisting of 20 bits are extracted.

【0021】次に、ルーティングテーブル検索装置は、
エントリAに対応する登録IPアドレスと入力IPアド
レスとを照合する。ここで、検索対象がエントリBに対
応する登録IPアドレスであるにもかかわらず、上述し
たように、見かけ上、エントリAに対応する登録IPア
ドレスと入力IPアドレスとが一致している。このこと
から、ルーティングテーブル検索装置は、照合結果を一
致としてしまい、この検索においては、検索結果が本来
エントリBであるににかかわらず、検索結果をエントリ
Aとしてしまうという、検索誤りが発生している。この
ような検索誤りは、第1に、サブネットマスクが可変長
であること、第2に、エントリBより先にエントリAが
選択されたことにより発生する。
Next, the routing table search device:
The registered IP address corresponding to the entry A is compared with the input IP address. Here, although the search target is the registered IP address corresponding to the entry B, the registered IP address corresponding to the entry A and the input IP address apparently match as described above. For this reason, the routing table search apparatus determines that the matching result is a match, and in this search, a search error occurs that the search result is regarded as entry A regardless of whether the search result is originally entry B. I have. Such a search error occurs firstly because the subnet mask has a variable length, and secondly, when the entry A is selected before the entry B.

【0022】本発明は、このような背景の下になされた
もので、ルーティングテーブル検索処理を高速で行うこ
とができ、かつ大量に高速で入力するIPパケットを受
信して瞬時に宛先につながる方路へIPパケットを出力
することができ、しかもサブネットマスクが可変長であ
ることに起因する検索誤りを防止することができるルー
ティングテーブル検索装置を提供することを目的とす
る。
The present invention has been made under such a background, and is capable of performing a routing table search process at a high speed, receiving a large amount of input IP packets at a high speed, and immediately connecting to a destination. It is an object of the present invention to provide a routing table search device capable of outputting an IP packet to a path and preventing a search error caused by a variable length subnet mask.

【0023】[0023]

【課題を解決するための手段】請求項1に記載の発明
は、登録すべき複数の登録IPアドレスの各ホストアド
レス部分の全てのビットを”0”とし、かつ前記登録I
Pアドレスに対応した各サブネットマスク部分のビット
を”1”とした後、一つの前記登録IPアドレスと前記
サブネットマスクと送信先情報とをひとまとめにして1
エントリのデータとした後、さらに、前記登録IPアド
レスを数値と見なしてソートして複数のエントリからな
るルーティングテーブルを生成するルーティングテーブ
ル生成手段を有し、受信したIPパケットから読み出し
た検索IPアドレスと前記エントリの登録IPアドレス
との大小比較により、ルーティングテーブルにおける検
索範囲を半分に狭めて検索を行うルーティングテーブル
検索装置において、前記検索IPアドレスにサブネット
マスクをかけることなく、前記検索IPアドレスと前記
登録IPアドレスとの前記大小比較を行い、前記検索I
Pアドレスを直接挟みこむ、前記ルーティングテーブル
における2つのエントリを検索する比較手段と、前記2
つのエントリにおける、一方の前記登録IPアドレスと
可変長の前記サブネットマスクとをビット毎にAND演
算した結果と、他方の前記登録IPアドレスと可変長の
前記サブネットマスクとをビット毎にAND演算した結
果との比較結果に基づいて、前記ルーティングテーブル
の中から前記検索IPアドレスと一致する登録IPアド
レスを検索する検索手段とを具備することを特徴とす
る。また、請求項2に記載の発明は、請求項1に記載の
ルーティングテーブル検索装置において、前記ルーティ
ングテーブル生成手段は、前記ルーティングテーブルに
おける各登録IPアドレスのホストアドレス部分の全て
のビットを、前記”0”に代えて”1”とし、前記検索
手段は、前記2つのエントリにおける、一方の前記登録
IPアドレスと可変長の前記サブネットマスクの反転ビ
ット(”0”と”1”とを入れ替えたもの)とをビット
毎にOR演算した結果と、他方の前記登録IPアドレス
と可変長の前記サブネットマスクの反転ビット(”0”
と”1”とを入れ替えたもの)とをビット毎にOR演算
した結果との比較結果に基づいて、前記ルーティングテ
ーブルの中から前記検索IPアドレスと一致する登録I
Pアドレスを検索することを特徴とする。また、請求項
3に記載の発明は、登録すべき複数の登録IPアドレス
の各ホストアドレス部分の全てのビットを”0”とし、
かつ前記登録IPアドレスに対応した各サブネットマス
ク部分のビットを”1”とした後、一つの前記登録IP
アドレスと前記サブネットマスクと送信先情報とをひと
まとめにして1エントリのデータとした後、さらに、前
記登録IPアドレスを数値と見なしてソートして複数の
エントリからなるルーティングテーブルを生成するルー
ティングテーブル生成手段を有し、受信したIPパケッ
トから読み出した検索IPアドレスと前記エントリの登
録IPアドレスとの大小比較により、ルーティングテー
ブルにおける検索範囲を半分に狭めて検索を行うルーテ
ィングテーブル検索装置において、前記検索IPアドレ
スにサブネットマスクをかけることなく、前記検索IP
アドレスと前記登録IPアドレスとの前記大小比較を行
い、前記検索IPアドレスを直接挟みこむ、前記ルーテ
ィングテーブルにおける2つのエントリを検索する比較
手段と、前記2つのエントリにおける、一方のエントリ
の可変長の前記サブネットマスクの”1”の長さと、他
方のエントリの可変長の前記サブネットマスクの”1”
の長さとの比較結果に基づいて、前記ルーティングテー
ブルの中から前記検索IPアドレスと一致する登録IP
アドレスを検索する検索手段とを具備することを特徴と
する。
According to the first aspect of the present invention, all bits of each host address portion of a plurality of registered IP addresses to be registered are set to "0", and the registration I
After setting the bit of each subnet mask portion corresponding to the P address to “1”, the one registered IP address, the subnet mask, and the transmission destination information are combined into one.
After making the entry data, there is further provided a routing table generating means for generating a routing table composed of a plurality of entries by sorting the registered IP addresses as numerical values, and further comprising a search IP address read from the received IP packet; In a routing table search device that performs a search by narrowing the search range in a routing table by half by comparing the size of the search IP address with the registered IP address, the search IP address and the registration are applied without applying a subnet mask to the search IP address. The comparison with the IP address is performed, and the search I
Comparing means for directly searching for two entries in the routing table, directly interposing the P address;
In one entry, the result of AND operation of one registered IP address and the variable length subnet mask for each bit, and the result of AND operation of the other registered IP address and the variable length subnet mask for each bit And searching means for searching the routing table for a registered IP address that matches the search IP address based on a result of the comparison. Further, according to a second aspect of the present invention, in the routing table search device according to the first aspect, the routing table generating means replaces all bits of a host address portion of each registered IP address in the routing table with the "". "1" instead of "0", and the search means replaces one of the registered IP address and the inverted bit of the variable length subnet mask ("0" and "1") in the two entries. ) For each bit, and the other registered IP address and an inverted bit (“0”) of the variable-length subnet mask
Based on the result of comparison between the result of the OR operation for each bit and the result obtained by replacing “1” with “1”, the registration I that matches the search IP address in the routing table is determined.
It is characterized by searching for a P address. According to a third aspect of the present invention, all bits of each host address portion of a plurality of registered IP addresses to be registered are set to “0”,
After setting the bit of each subnet mask portion corresponding to the registered IP address to “1”, one of the registered IP addresses
A routing table generating unit that collects the address, the subnet mask, and the transmission destination information into one entry data, and sorts the registered IP address as a numerical value to generate a routing table including a plurality of entries. A routing table search device for performing a search by narrowing the search range in the routing table by half by comparing the search IP address read from the received IP packet with the registered IP address of the entry, Without applying a subnet mask to the
A comparison unit that performs the magnitude comparison between the registered IP address and the registered IP address and directly interposes the search IP address to search for two entries in the routing table; and a variable length of one of the two entries in the two entries. The length of “1” of the subnet mask and the variable length “1” of the subnet mask of the other entry
Registered IP address matching the search IP address in the routing table based on the comparison result
A search unit for searching for an address.

【0024】[0024]

【発明の実施の形態】BEST MODE FOR CARRYING OUT THE INVENTION

<第1実施形態>以下、図面を参照して本発明の実施形
態について説明する。図1は本発明の第1実施形態によ
るルーティングテーブル検索装置の構成を示すブロック
図である。この図において、1は、前述したものと同様
のルーティングテーブル2を図2および図3に示すフロ
ーチャートに従って生成するルーティングテーブル生成
部である。
<First Embodiment> An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of the routing table search device according to the first embodiment of the present invention. In this figure, reference numeral 1 denotes a routing table generator for generating the same routing table 2 as described above in accordance with the flowcharts shown in FIGS.

【0025】このルーティングテーブル2は、登録すべ
きIPアドレス7とサブネットマスク8とIPパケット
の送信先情報6とをひとまとめにして1つのエントリと
した場合に、複数のエントリからなり、予め、IPアド
レス7を数値と見なして各エントリを昇順(または降
順)にソートしたものから構成されている。ここで、ル
ーティングテーブル2においては、各エントリ毎のサブ
ネットマスクの長さは、可変長である。
The routing table 2 includes a plurality of entries when the IP address 7 to be registered, the subnet mask 8 and the destination information 6 of the IP packet are grouped into one entry. Each entry is sorted in ascending order (or descending order) by regarding 7 as a numerical value. Here, in the routing table 2, the length of the subnet mask for each entry is variable.

【0026】ただし、このルーティングテーブル生成部
1により生成されるルーティングテーブル2には、IP
アドレス7に対応するエントリ(オリジナルエントリ)
の他に、ダミーエントリが含まれている。このダミーエ
ントリは、ダミーのIPアドレス、ダミーのサブネット
マスク、ダミーの送信先情報、およびダミーエントリで
あることを示すフラグたるダミー識別子17から構成さ
れている。このルーティングテーブル生成部1によるル
ーティングテーブル2の生成過程、ルーティングテーブ
ル2およびダミーエントリの詳細については後述する。
However, the routing table 2 generated by the routing table generation unit 1 includes
Entry corresponding to address 7 (original entry)
In addition, a dummy entry is included. This dummy entry is composed of a dummy IP address, a dummy subnet mask, dummy destination information, and a dummy identifier 17 which is a flag indicating a dummy entry. The process of generating the routing table 2 by the routing table generator 1 and the details of the routing table 2 and the dummy entry will be described later.

【0027】3は、ルーティングテーブル2を格納(記
憶)するルーティングテーブル格納用メモリである。1
1は、後述する制御部14より入力されるアドレス生成
命令16に対応する、ルーティングテーブル格納用メモ
リ3のメモリアドレスを生成するアドレス生成部であ
る。上記メモリアドレスは、ルーティングテーブルにお
けるエントリに対応している。
Reference numeral 3 denotes a routing table storage memory that stores (stores) the routing table 2. 1
Reference numeral 1 denotes an address generation unit that generates a memory address of the routing table storage memory 3 corresponding to an address generation instruction 16 input from the control unit 14 described below. The memory address corresponds to an entry in the routing table.

【0028】5は、入力されるIPパケットから得られ
るIPアドレス(以下、検索IPアドレスと称する)を
保持する検索IPアドレス保持部である。9は、検索I
Pアドレス保持部5より入力される検索IPアドレス
と、ルーティングテーブル格納用メモリ3より入力され
るIPアドレス7の大小関係を比較する大小比較部であ
る。10は、ルーティングテーブル2におけるエントリ
がオリジナルエントリであるかダミーエントリであるか
をチェックするダミーチェック部であり、当該エントリ
にダミー識別子17が含まれている場合、当該エントリ
をダミーエントリと判定する。
Reference numeral 5 denotes a search IP address holding unit that holds an IP address obtained from an input IP packet (hereinafter, referred to as a search IP address). 9 is search I
This is a size comparison unit that compares the magnitude relationship between the search IP address input from the P address holding unit 5 and the IP address 7 input from the routing table storage memory 3. A dummy check unit 10 checks whether an entry in the routing table 2 is an original entry or a dummy entry. If the entry includes the dummy identifier 17, the entry is determined to be a dummy entry.

【0029】12は、一致比較部であり、検索IPアド
レス保持部5より入力される検索IPアドレスとサブネ
ットマスク8とをビット毎にAND演算した結果(以
下、入力IPアドレスと称する)と、ルーティングテー
ブル格納用メモリ3より入力されるIPアドレス7とを
比較して、両者が一致しているか否かを判定する。13
は、一致比較部であり、検索IPアドレス保持部5より
入力される検索IPアドレスとルーティングテーブル格
納用メモリ3より入力されるIPアドレス7とを比較し
て、両者が一致しているか否かを判定する。
Numeral 12 denotes a match comparison unit, which is a bit-wise AND operation of the search IP address input from the search IP address holding unit 5 and the subnet mask 8 (hereinafter referred to as an input IP address), and a routing. A comparison is made with the IP address 7 input from the table storage memory 3 to determine whether or not they match. 13
Is a match comparison unit that compares the search IP address input from the search IP address holding unit 5 with the IP address 7 input from the routing table storage memory 3 and determines whether they match. judge.

【0030】すなわち、一致比較部12が、サブネット
マスクが施された検索IPアドレスを比較対象とするの
に対して、一致比較部13は、サブネットマスクが施さ
れていない検索IPアドレスを比較対象とする点におい
て、一致比較部12の機能と異なる。
That is, while the match comparison unit 12 compares the search IP address with the subnet mask, the match comparison unit 13 sets the search IP address without the subnet mask as the comparison target. This is different from the function of the match comparison unit 12 in that

【0031】制御部14は、図4に示すフローチャート
の手順および図5に示す検索結果出力テーブルに従っ
て、ルーティングテーブル2の検索結果を検索結果デー
タ15として出力する。この制御部14の動作の詳細に
ついては後述する。18は、制御部14が行う各種演算
のデータを記憶する作業用メモリである。
The control unit 14 outputs the search result of the routing table 2 as search result data 15 in accordance with the procedure of the flowchart shown in FIG. 4 and the search result output table shown in FIG. Details of the operation of the control unit 14 will be described later. Reference numeral 18 denotes a work memory that stores data of various calculations performed by the control unit 14.

【0032】次に、上述した第1実施形態によるルーテ
ィングテーブル検索装置の動作について、図2〜図5を
参照しつつ説明する。 <ルーティングテーブル生成動作>はじめに、ルーティ
ングテーブル生成部1が実行するルーティングテーブル
生成動作について、図2および図3を参照して説明す
る。図2に示すステップSA1において、ルーティング
テーブル生成部1は、複数のエントリの各IPアドレス
(ディスティネーションネットワークアドレス)を数値
と見なして、昇順(または降順)にソートした後、ステ
ップSA2へ進む。以下、昇順にソートした場合につい
て説明する。
Next, the operation of the routing table search device according to the first embodiment will be described with reference to FIGS. <Routing Table Generation Operation> First, the routing table generation operation performed by the routing table generation unit 1 will be described with reference to FIGS. In step SA1 shown in FIG. 2, the routing table generating unit 1 regards each IP address (destination network address) of a plurality of entries as a numerical value, sorts the entries in ascending order (or descending order), and then proceeds to step SA2. Hereinafter, the case of sorting in ascending order will be described.

【0033】ここで、各エントリは、IPアドレス(デ
ィスティネーションネットワークアドレス)、サブネッ
トマスクおよび送信先情報から構成されている。また、
上記IP(ディスティネーションネットワークアドレ
ス)は、ネットワークアドレス、サブネットアドレスお
よびホストアドレスから構成されており、また、ホスト
アドレスは、オール”0”とされている。さらに、サブ
ネットマスクは、ネットワークアドレスおよびサブネッ
トマスクに対応するビットがオール”1”とされてお
り、ホストアドレスに対応するビットがオール”0”と
されている。
Here, each entry is composed of an IP address (destination network address), a subnet mask, and transmission destination information. Also,
The IP (destination network address) includes a network address, a subnet address, and a host address, and the host address is all “0”. Further, in the subnet mask, bits corresponding to the network address and the subnet mask are all “1”, and bits corresponding to the host address are all “0”.

【0034】ステップSA2において、ルーティングテ
ーブル生成部1は、昇順にソートされたルーティングテ
ーブルにおいて、ディスティネーションネットワークア
ドレスが同一である複数のエントリが存在する場合、各
サブネットマスクを数値とみなして、上記複数のエント
リをさらに昇順にソートした後、ステップSA3へ進
む。
In step SA 2, if there are a plurality of entries having the same destination network address in the routing table sorted in ascending order, the routing table generating unit 1 regards each subnet mask as a numerical value, and Are further sorted in ascending order, and the process proceeds to step SA3.

【0035】ステップSA3では、ルーティングテーブ
ル生成部1は、ルーティングテーブルの先頭エントリに
おける、ディスティネーションネットワークアドレス
(IPアドレス)、サブネットマスクおよび送信先情報
を図示しないメモリd1に格納した後、ステップSA4
へ進む。以下、メモリd1に格納された、ディスティネ
ーションネットワークアドレスを「d1.IP」と、サ
ブネットマスクを「d1.subnetmask」と略
記する。
At step SA3, the routing table generator 1 stores the destination network address (IP address), subnet mask and destination information in the first entry of the routing table in the memory d1 (not shown), and then returns to step SA4.
Proceed to. Hereinafter, the destination network address and the subnet mask stored in the memory d1 are abbreviated as “d1.IP” and “d1.subnetmask”, respectively.

【0036】ステップSA4では、ルーティングテーブ
ル生成部1は、ルーティングテーブルの先頭エントリの
次のエントリ(以下、第2のエントリと称する)におけ
る、ディスティネーションネットワークアドレス(IP
アドレス)、サブネットマスクおよび送信先情報を図示
しないメモリd2に格納した後、ステップSA5へ進
む。以下、メモリd2に格納された、ディスティネーシ
ョンネットワークアドレスを「d2.IP」と、サブネ
ットマスクを「d2.subnetmask」と略記す
る。
At step SA4, the routing table generator 1 sets the destination network address (IP) in the entry next to the first entry of the routing table (hereinafter referred to as the second entry).
After storing the address), the subnet mask, and the destination information in the memory d2 (not shown), the process proceeds to step SA5. Hereinafter, the destination network address and the subnet mask stored in the memory d2 are abbreviated as “d2.IP” and “d2.subnetmask”, respectively.

【0037】ステップSA5では、ルーティングテーブ
ル生成部1は、ルーティングテーブルの複数のエントリ
において、未だメモリd1またはメモリd2に格納され
ていないエントリが無いか否かを判断する。今の場合、
メモリd1またはメモリd2に格納されていないエント
リが存在しているものとし、ルーティングテーブル生成
部1は、ステップSA5の判断結果を「NO」としてス
テップSA8へ進む。
At step SA5, the routing table generator 1 determines whether or not there is an entry not yet stored in the memory d1 or the memory d2 among a plurality of entries of the routing table. In this case,
It is assumed that there is an entry that is not stored in the memory d1 or the memory d2, and the routing table generation unit 1 determines “NO” in step SA5 and proceeds to step SA8.

【0038】ステップSA8では、ルーティングテーブ
ル生成部1は、まず、メモリd1に格納されている先頭
エントリにおけるサブネットマスク(d1.subne
tmask)と、メモリd2に格納されている第2のエ
ントリにおけるディスティネーションネットワークアド
レス(d2.IP)とをビット毎にAND演算する。次
に、ルーティングテーブル生成部1は、メモリd1に格
納されている先頭エントリにおけるディスティネーショ
ンネットワークアドレス(d1.IP)と上記AND演
算した結果(以下、d2.IP*d1.subnetm
askと略記)とを数値と見なして大小関係を比較す
る。
In step SA8, the routing table generator 1 firstly sets the subnet mask (d1.subne.sub.n) in the first entry stored in the memory d1.
tmask) and the destination network address (d2.IP) in the second entry stored in the memory d2, for each bit. Next, the routing table generation unit 1 compares the destination network address (d1.IP) in the first entry stored in the memory d1 with the result of the AND operation (hereinafter, d2.IP * d1.subnetm).
ask) is compared as a numerical value.

【0039】すなわち、ディスティネーションネットワ
ークアドレス(d1.IP)>AND演算した結果(d
2.IP*d1.subnetmask)なる関係が成
立した場合、ルーティングテーブル生成部1は、ステッ
プSA9へ進み、ステップSA1およびステップSA2
における複数のエントリのソートが正しく行われなかっ
たものと判定し、ステップSA1へ戻り、初めからソー
トを実行する。上記関係は、ソートが正しく行われた場
合には、成立しない。
That is, the destination network address (d1.IP)> the result of the AND operation (d
2. IP * d1. If the relationship (subnetmask) is established, the routing table generation unit 1 proceeds to step SA9, and proceeds to step SA1 and step SA2.
It is determined that sorting of a plurality of entries in was not performed correctly, and the process returns to step SA1 to execute sorting from the beginning. The above relationship does not hold when sorting is performed correctly.

【0040】一方、ステップSA8において、ディステ
ィネーションネットワークアドレス(d1.IP)<A
ND演算した結果(d2.IP*d1.subnetm
ask)なる関係が成立した場合、ルーティングテーブ
ル生成部1は、メモリd2に格納されている第2のエン
トリの内容(ディスティネーションネットワークアドレ
ス(d1.IP)、サブネットマスク(d1.subn
etmask)および送信先情報)をメモリd1にコピ
ー(格納)した後、ステップSA4へ戻る。
On the other hand, in step SA8, the destination network address (d1.IP) <A
Result of ND operation (d2.IP * d1.subnetm)
When the relationship “ask” is established, the routing table generator 1 sets the contents of the second entry (destination network address (d1.IP), subnet mask (d1.subn) stored in the memory d2.
etmask) and destination information) are copied (stored) in the memory d1, and the process returns to step SA4.

【0041】ステップSA4では、ルーティングテーブ
ル生成部1は、第2のエントリの次のエントリの内容を
メモリd2に格納した後、ステップSA5へ進み、上述
した過程を繰り返す。
In step SA4, the routing table generator 1 stores the contents of the entry next to the second entry in the memory d2, and then proceeds to step SA5 to repeat the above-described process.

【0042】他方、ステップSA8において、ディステ
ィネーションネットワークアドレス(d1.IP)=A
ND演算した結果(d2.IP*d1.subnetm
ask)なる関係が成立した場合、メモリd1およびd
2に各々格納されている内容を引数d1およびd2とし
て、図3に示すステップSB1へ進み、関数f( ・)
を呼び出す。
On the other hand, in step SA8, the destination network address (d1.IP) = A
Result of ND operation (d2.IP * d1.subnetm)
ask), the memories d1 and d
2 as arguments d1 and d2, respectively, and proceed to step SB1 shown in FIG.
Call.

【0043】ステップSB2では、ルーティングテーブ
ル生成部1は、メモリd1に格納されている内容を図示
しないメモリDにコピー(格納)した後、メモリd2に
格納されている内容をメモリd1にコピー(格納)した
後、ステップSB3へ進む。ここで、メモリDに格納さ
れたディスティネーションネットワークアドレスを
「D.IP」と、サブネットマスクを「D.subne
tmask」と各々略記する。
In step SB2, the routing table generator 1 copies (stores) the contents stored in the memory d1 to the memory D (not shown), and then copies (stores) the contents stored in the memory d2 to the memory d1. ), The process proceeds to Step SB3. Here, the destination network address stored in the memory D is “D.IP”, and the subnet mask is “D.subne.
tmask ".

【0044】ステップSB3では、ルーティングテーブ
ル生成部1は、第2のエントリの次のエントリ(以下、
第3のエントリと称する)のディスティネーションネッ
トワークアドレス、サブネットマスクおよび送信先情報
をメモリd2に格納した後、ステップSB4へ進む。す
なわち、今の場合、メモリd1、メモリd2およびメモ
リDには、次のデータが各々格納されている。 ・メモリd1→第2のエントリの内容 ・メモリd2→第3のエントリの内容 ・ メモリD→先頭エントリの内容
In step SB3, the routing table generator 1 sets the entry next to the second entry (hereinafter referred to as the second entry).
After storing the destination network address, subnet mask, and destination information of the third entry (called the third entry) in the memory d2, the process proceeds to step SB4. That is, in this case, the following data are stored in the memory d1, the memory d2, and the memory D, respectively.・ Memory d1 → contents of second entry ・ Memory d2 → contents of third entry ・ Memory D → contents of first entry

【0045】ステップSB4では、ルーティングテーブ
ル生成部1は、ルーティングテーブルの複数のエントリ
が空であるか否かを判断する。今の場合、ルーティング
テーブルのエントリが空でないものとすると、ルーティ
ングテーブル生成部1は、ステップSB4の判断結果を
「NO」として、ステップSB5へ進む。一方、ルーテ
ィングテーブルのエントリが空である場合、ルーティン
グテーブル生成部1は、ステップSB4の判断結果を
「YES」としてステップSB8へ進む。
In step SB4, the routing table generator 1 determines whether a plurality of entries in the routing table are empty. In this case, assuming that the entry of the routing table is not empty, the routing table generator 1 sets the determination result of step SB4 to "NO" and proceeds to step SB5. On the other hand, when the entry of the routing table is empty, the routing table generation unit 1 sets the determination result of step SB4 to “YES” and proceeds to step SB8.

【0046】ステップSB5では、ルーティングテーブ
ル生成部1は、まず、メモリDに格納されている先頭エ
ントリにおけるサブネットマスク(D.subnetm
ask)と、メモリd2に格納されている第3のエント
リにおけるディスティネーションネットワークアドレス
(d2.IP)とをビット毎にAND演算する。次に、
ルーティングテーブル生成部1は、メモリDに格納され
ている先頭エントリにおけるディスティネーションネッ
トワークアドレス(D.IP)と上記AND演算した結
果(以下、d2.IP*D.subnetmaskと略
記)とを数値と見なして大小関係を比較する。
In step SB5, the routing table generator 1 firstly sets the subnet mask (D.subnetm) in the first entry stored in the memory D.
ask) and the destination network address (d2.IP) in the third entry stored in the memory d2 is ANDed for each bit. next,
The routing table generation unit 1 regards the destination network address (D.IP) in the first entry stored in the memory D and the result of the AND operation (hereinafter abbreviated as d2.IP * D.subnetmask) as a numerical value. And compare the size.

【0047】すなわち、ステップSB5において、ディ
スティネーションネットワークアドレス(D.IP)>
AND演算した結果(d2.IP*D.subnetm
ask)なる関係が成立した場合、ルーティングテーブ
ル生成部1は、ステップSB11へ進み、ステップSA
1およびステップSA2における複数のエントリのソー
トが正しく行われなかったものと判定し、ステップSA
1へ戻り、初めからソートを実行する。上記関係は、ソ
ートが正しく行われた場合、成立しない。
That is, in step SB5, the destination network address (D.IP)>
AND operation result (d2.IP * D.subnetm)
If the relationship (ask) is established, the routing table generation unit 1 proceeds to step SB11 and proceeds to step SA11.
It is determined that sorting of the plurality of entries in step 1 and step SA2 was not correctly performed, and
Return to 1 and execute sorting from the beginning. The above relationship does not hold when sorting is performed correctly.

【0048】一方、ステップSB5において、ディステ
ィネーションネットワークアドレス(D.IP)<AN
D演算した結果(d2.IP*D.subnetmas
k)なる関係が成立した場合、ルーティングテーブル生
成部1は、ステップSB8へ進む。
On the other hand, in step SB5, the destination network address (D.IP) <AN
D operation result (d2.IP * D.subnetmas)
If the relationship k) is established, the routing table generator 1 proceeds to step SB8.

【0049】ステップSB8では、まず、ルーティング
テーブル生成部1は、メモリd1に格納されている、第
2のエントリのサブネットマスク(d1.subnet
mask)を左に1ビットシフトした結果と、メモリd
1に格納されている第2のエントリのサブネットマスク
(d1.subnetmask)とのビット毎に排他的
論理和を取る。次いで、ルーティングテーブル生成部1
は、上記排他的論理和を取った結果と、メモリd1に格
納されている第2のエントリのディスティネーションネ
ットワークアドレスとの和を演算する。以下、この和演
算した結果を「d1.IP’」と略記する。次に、ルー
ティングテーブル生成部1は、上記和演算した結果(d
1.IP’)と、メモリDに格納されているサブネット
マスク(D.subnetmask)とをビット毎にA
ND演算する。以下、このAND演算した結果を、「d
1.IP’*D.subnetmask」と略記する。
In step SB8, first, the routing table generator 1 stores the subnet mask (d1.subnet) of the second entry stored in the memory d1.
mask) by one bit to the left and the memory d
The exclusive-OR is calculated for each bit with the subnet mask (d1.subnetmask) of the second entry stored in 1. Next, the routing table generator 1
Calculates the sum of the result of the exclusive OR operation and the destination network address of the second entry stored in the memory d1. Hereinafter, the result of the sum operation is abbreviated as “d1.IP ′”. Next, the routing table generator 1 calculates the result of the sum operation (d
1. IP ′) and the subnet mask (D.subnetmask) stored in the memory D for each bit A
Perform ND operation. Hereinafter, the result of the AND operation is referred to as “d
1. IP ' * D. abbreviated as “subnetmask”.

【0050】そして、ルーティングテーブル生成部1
は、和演算した結果(d1.IP’)≠メモリd2に格
納されている第3のエントリにおけるディスティネーシ
ョンネットワークアドレス(d2.IP)なる関係(以
下第1の関係と称する)が成立するか否かを判断する。
次に、ルーティングテーブル生成部1は、AND演算し
た結果(d1.IP’ *D.subnetmask)<
メモリDに格納されている先頭エントリにおけるディス
ティネーションネットワークアドレス(D.IP)なる
関係(以下、第2の関係と称する)が成立するか否かを
判断する。
Then, the routing table generator 1
Is the result of the sum operation (d1.IP ') ≠ the case in the memory d2.
Destiny in the third entry contained
Connection network address (d2.IP)
(Hereinafter referred to as a first relationship) is determined.
Next, the routing table generator 1 performs an AND operation.
Result (d1.IP ' *D. submask) <
The disk at the first entry stored in the memory D
Is the network address (D.IP)
Whether a relationship (hereinafter, referred to as a second relationship) is established
to decide.

【0051】そして、ステップSB8において、ルーテ
ィングテーブル生成部1は、上述した第1または第2の
関係が成立するか否かを判断し、同判断結果が「YE
S」の場合、ステップSB10へ進む。ステップSB1
0では、ルーティングテーブル生成部1は、メモリd2
に記憶されている内容を関数f( ・d2)の戻値とし
た後、図2に示すステップSA10へ戻った後、ステッ
プSA11へ進む。
Then, in step SB8, the routing table generator 1 determines whether or not the above-described first or second relationship is established.
If "S", the process proceeds to Step SB10. Step SB1
0, the routing table generator 1 stores the memory d2
Is used as the return value of the function f (· d2), the process returns to step SA10 shown in FIG. 2, and then proceeds to step SA11.

【0052】一方、上述した第1の関係と第2の関係と
が共に成立する場合、ルーティングテーブル生成部1
は、図3に示すステップSB8の判断結果を「NO」と
した後、ステップSB9へ進む。ステップSB9では、
ルーティングテーブル生成部1は、ルーティングテーブ
ルにおいて、メモリd1に格納されている第2のエント
リと、メモリd2に格納されている第3のエントリの間
に、ダミーエントリを挿入した後、ステップSB10へ
進む。
On the other hand, if both the first and second relationships described above are established, the routing table generator 1
Proceeds to step SB9 after making the determination result of step SB8 shown in FIG. 3 "NO". In step SB9,
The routing table generation unit 1 inserts a dummy entry between the second entry stored in the memory d1 and the third entry stored in the memory d2 in the routing table, and then proceeds to step SB10. .

【0053】ここで、上記ダミーエントリは、ディステ
ィネーションネットワークアドレスとしての、上述した
和演算した結果(d1.IP’)、サブネットマスクと
しての、メモリDに格納されている先頭エントリのサブ
ネットマスク(D.subnetmask)、送信先情
報(以下、D.next_hop)およびダミー識別子
17(図1参照)から構成されている。
Here, the dummy entry is a result of the above-described sum operation (d1.IP ') as a destination network address, and a subnet mask (D1) of the first entry stored in the memory D as a subnet mask. .Subnetmask), destination information (hereinafter, D.next_hop), and a dummy identifier 17 (see FIG. 1).

【0054】一方、ステップSB5において、ディステ
ィネーションネットワークアドレス(D.IP)=AN
D演算した結果(d2.IP*D.subnetmas
k)なる関係が成立した場合、ルーティングテーブル生
成部1は、ステップSB6へ進む。
On the other hand, in step SB5, the destination network address (D.IP) = AN
D operation result (d2.IP * D.subnetmas)
If the relationship k) is established, the routing table generation unit 1 proceeds to step SB6.

【0055】ステップSB6では、ルーティングテーブ
ル生成部1は、まず、メモリd1に格納されている第2
のエントリにおけるサブネットマスク(d1.subn
etmask)と、メモリd2に格納されている第3の
エントリにおけるディスティネーションネットワークア
ドレス(d2.IP)とをビット毎にAND演算する。
次に、ルーティングテーブル生成部1は、メモリd1に
格納されている第1のエントリにおけるディスティネー
ションネットワークアドレス(d1.IP)と、上記A
ND演算した結果(以下、d2.IP*d1.subn
etmaskと略記)とを数値と見なして大小関係を比
較する。
At step SB6, the routing table generator 1 firstly stores the second data stored in the memory d1.
Subnet mask (d1.subn) in the entry of
etmask) and the destination network address (d2.IP) in the third entry stored in the memory d2 are bit-wise ANDed.
Next, the routing table generation unit 1 determines the destination network address (d1.IP) in the first entry stored in the memory d1 and the A
The result of the ND operation (hereinafter, d2.IP * d1.subn)
and the magnitude relation is compared with each other as a numerical value.

【0056】すなわち、ステップSB6において、ディ
スティネーションネットワークアドレス(d1.IP)
>AND演算した結果(d2.IP*d1.subne
tmask)なる関係が成立した場合、ルーティングテ
ーブル生成部1は、ステップSB7へ進み、ステップS
A1およびステップSA2における複数のエントリのソ
ートが正しく行われなかったものと判定し、ステップS
A1へ戻り、初めからソートを実行する。上記関係は、
ソートが正しく行われた場合、成立しない。
That is, in step SB6, the destination network address (d1.IP)
> AND operation result (d2.IP * d1.subne)
When the relationship of (tmask) is established, the routing table generation unit 1 proceeds to step SB7 and proceeds to step SB7.
It is determined that sorting of the plurality of entries in A1 and step SA2 was not correctly performed, and
Returning to A1, sorting is executed from the beginning. The above relationship is
If sorting is performed correctly, it will not hold.

【0057】一方、ステップSB6において、ディステ
ィネーションネットワークアドレス(d1.IP)<A
ND演算した結果(d2.IP*d1.subnetm
ask)なる関係が成立した場合、ルーティングテーブ
ル生成部1は、ステップSB13へ進む。
On the other hand, in step SB6, the destination network address (d1.IP) <A
Result of ND operation (d2.IP * d1.subnetm)
If the relationship (a) is established, the routing table generator 1 proceeds to step SB13.

【0058】ステップSB13では、まず、ルーティン
グテーブル生成部1は、ステップSB8において説明し
た手順により、上述した和演算した結果(d1.I
P’)を得る。次いで、ルーティングテーブル生成部1
は、和演算した結果(d1.IP’)≠メモリd2に格
納されている第3のエントリにおけるディスティネーシ
ョンネットワークアドレス(d2.IP)なる、上述し
た第1の関係が成立するか否かを判断する。
In step SB13, first, the routing table generator 1 performs the above-described sum operation (d1.I) according to the procedure described in step SB8.
P ′). Next, the routing table generator 1
Is determined as to whether or not the above-described first relationship holds, that is, the result of the sum operation (d1.IP ′) ≠ the destination network address (d2.IP) in the third entry stored in the memory d2. I do.

【0059】次に、ルーティングテーブル生成部1は、
AND演算した結果(d1.IP’ *D.subnet
mask)<メモリDに格納されている先頭エントリに
おけるディスティネーションネットワークアドレス
(D.IP)なる、上述した第2の関係が成立するか否
かを判断する。
Next, the routing table generation unit 1
The result of the AND operation (d1.IP ' *D. subnet
mask) <to the first entry stored in the memory D
Destination network address
(D.IP) whether or not the above-mentioned second relationship holds
Judge.

【0060】そして、ルーティングテーブル生成部1
は、上述した第1または第2の関係が成立するか否かを
判断し、同判断結果が「YES」の場合、ステップSB
15へ進み、メモリd2に格納されている内容をメモリ
d1にコピー(格納)した後、ステップSB3へ戻る。
Then, the routing table generator 1
Determines whether the above-described first or second relationship is established, and if the determination result is “YES”, the process proceeds to step SB.
Proceeding to 15, the content stored in the memory d2 is copied (stored) in the memory d1, and the process returns to step SB3.

【0061】一方、上述した第1の関係と第2の関係と
が共に成立する場合、ルーティングテーブル生成部1
は、ステップSB13の判断結果を「NO」とした後、
ステップSB14へ進む。ステップSB14では、ルー
ティングテーブル生成部1は、ルーティングテーブルに
おいて、メモリd1に格納されている第2のエントリ
と、メモリd2に格納されている第3のエントリの間
に、ダミーエントリを挿入した後、ステップSB15へ
進む。
On the other hand, if both the first and second relationships described above are established, the routing table generator 1
Is “NO” in step SB13,
Proceed to step SB14. In step SB14, the routing table generation unit 1 inserts a dummy entry between the second entry stored in the memory d1 and the third entry stored in the memory d2 in the routing table, Proceed to step SB15.

【0062】ここで、上記ダミーエントリは、上述した
ように、ディスティネーションネットワークアドレスと
しての、上述した和演算した結果(d1.IP’)、サ
ブネットマスクとしての、メモリDに格納されている先
頭エントリのサブネットマスク(D.subnetma
sk)、送信先情報(以下、D.next_hop)お
よびダミー識別子17(図1参照)から構成されてい
る。
Here, as described above, the dummy entry is a result of the above-described sum operation (d1.IP ′) as a destination network address, and a leading entry stored in the memory D as a subnet mask. Subnet mask (D.subnetma)
sk), destination information (hereinafter, D.next_hop), and a dummy identifier 17 (see FIG. 1).

【0063】また、ステップSB6において、ディステ
ィネーションネットワークアドレス(d1.IP)=A
ND演算した結果(d2.IP*d1.subnetm
ask)なる関係が成立した場合、ルーティングテーブ
ル生成部1は、ステップSB12へ進む。ステップSB
12では、ルーティングテーブル生成部1は、関数f
( ・ )を再帰的に読み出した後、ステップSB5へ
戻る。
In step SB6, the destination network address (d1.IP) = A
Result of ND operation (d2.IP * d1.subnetm)
If the relationship (ask) is established, the routing table generator 1 proceeds to step SB12. Step SB
In 12, the routing table generator 1 sets the function f
After (.) Is recursively read, the process returns to step SB5.

【0064】そして、今、図2に示すステップSA5に
おいて、エントリが無くなったとすると、ルーティング
テーブル生成部1は、判断結果を「YES」として、ス
テップSA6へ進む。ステップSA6では、ルーティン
グテーブル生成部1は、ルーティングテーブルにおい
て、同じネットワークアドレスを有する複数のエントリ
が存在する場合、上記複数のエントリのうち、最長のサ
ブネットマスクを有するエントリを除くものを削除した
後、ステップSA7へ進む。
Now, assuming that there are no more entries in step SA5 shown in FIG. 2, the routing table generator 1 sets the determination result to "YES" and proceeds to step SA6. In step SA6, when there are a plurality of entries having the same network address in the routing table, the routing table generation unit 1 deletes the entries other than the entry having the longest subnet mask from the plurality of entries. Proceed to step SA7.

【0065】ステップSA7では、ルーティングテーブ
ル生成部1は、上述した処理により生成された、ダミー
エントリを有するルーティングテーブルを図1に示すル
ーティングテーブル2として、ルーティングテーブル格
納用メモリ3に格納した後、一連の処理を終了する。
In step SA7, the routing table generation unit 1 stores the routing table having the dummy entries generated by the above-described processing as the routing table 2 shown in FIG. Is completed.

【0066】<ルーティングテーブル検索動作>次に、
上述した第1実施形態によるルーティングテーブル検索
装置におけるルーティングテーブル検索動作について、
図4および図5を参照しつつ説明する。図4は、第1実
施形態によるルーティングテーブル検索装置におけるル
ーティングテーブル検索動作を説明するフローチャート
であり、図5は、図1に示す制御部14において検索結
果データ15を出力するときに用いられる検索結果出力
テーブルである。
<Routing table search operation>
Regarding the routing table search operation in the routing table search device according to the first embodiment described above,
This will be described with reference to FIGS. FIG. 4 is a flowchart illustrating a routing table search operation in the routing table search device according to the first embodiment. FIG. 5 is a flowchart illustrating search results used when the control unit 14 illustrated in FIG. 1 outputs search result data 15. It is an output table.

【0067】図1において、IPパケットが検索IPア
ドレス保持部5に入力されると、検索IPアドレス保持
部5は、上記IPパケットから検索IPアドレスを取り
だした後、これを保持する。次に、検索IPアドレス保
持部5は、ルーティングテーブル2の検索を指示する信
号を制御部14へ出力する。これにより、制御部14
は、図4に示すステップSC1へ進む。
In FIG. 1, when an IP packet is input to the search IP address holding unit 5, the search IP address holding unit 5 extracts a search IP address from the IP packet and holds it. Next, the search IP address holding unit 5 outputs a signal instructing the search of the routing table 2 to the control unit 14. Thereby, the control unit 14
Proceeds to step SC1 shown in FIG.

【0068】ステップSC1では、制御部14は、ルー
ティングテーブル格納用メモリ3に格納されているルー
ティングテーブル2における総エントリ数(テーブルサ
イズ)Xを「2」で除算した結果を演算結果Aとする。
この演算結果Aは、ルーティングテーブル2において、
先頭エントリと末尾エントリとの中央に位置するエント
リ、および該エントリが格納されているアドレスに対応
している。
At step SC 1, the control unit 14 sets a result obtained by dividing the total number of entries (table size) X in the routing table 2 stored in the routing table storage memory 3 by “2” as an operation result A.
This calculation result A is
It corresponds to the entry located at the center between the first entry and the last entry, and the address where the entry is stored.

【0069】そして、制御部14は、検索回数を示す内
部変数iに「1」を代入する。次に、制御部14は、演
算結果Aに対応する上記アドレスの生成を命令するアド
レス生成命令16をアドレス生成部11へ出力する。こ
れにより、アドレス生成部11は、演算結果Aに対応す
るメモリアドレス4を生成した後、これをルーティング
テーブル格納用メモリ3へ出力する。この結果、ルーテ
ィングテーブル格納用メモリ3からは、演算結果Aに対
応するアドレスに格納されている、A番目のエントリの
ディスティネーションネットワークアドレスIP(以
下、IPAと称する)が大小比較部9、一致比較部13
および一致比較部12へ出力される。
Then, the control unit 14 substitutes "1" for an internal variable i indicating the number of searches. Next, the control unit 14 outputs an address generation instruction 16 for instructing generation of the address corresponding to the operation result A to the address generation unit 11. As a result, the address generation unit 11 generates the memory address 4 corresponding to the operation result A, and outputs this to the routing table storage memory 3. As a result, from the routing table storage memory 3, the destination network address IP (hereinafter, referred to as IPA) of the A-th entry stored at the address corresponding to the operation result A is compared with the magnitude comparison unit 9, Part 13
And output to the coincidence comparison unit 12.

【0070】これにより、ステップSC2では、一致比
較部13は、サブネットマスクが施されていないディス
ティネーションネットワークアドレスIPAと、検索I
Pアドレス保持部5に保持されている検索IPアドレス
とが一致しているか否かを判断する。ここで、ディステ
ィネーションネットワークアドレスIPAと、検索IP
アドレスとが一致している場合、一致比較部13は、両
者が一致している旨の信号、および上記ディスティネー
ションネットワークアドレスIPAを制御部14へ各々
出力する。これにより、制御部14は、ステップSC3
へ進み、A番目のエントリのディスティネーションネッ
トワークアドレスIPAおよび送信先情報6を検索結果
データ15として出力する。
As a result, in step SC2, the match comparison unit 13 sets the destination network address IPA to which no subnet mask has been applied and the search I
It is determined whether or not the search IP address held in the P address holding unit 5 matches. Here, the destination network address IPA and the search IP
If the addresses match, the match comparison unit 13 outputs a signal indicating that both match, and the destination network address IPA to the control unit 14. Accordingly, the control unit 14 determines in step SC3
Then, the destination network address IPA of the A-th entry and the destination information 6 are output as search result data 15.

【0071】一方、ステップSC2において、ディステ
ィネーションネットワークアドレスIPA≠検索IPア
ドレスなる関係を有しているとき、一致比較部13は、
両者が一致していない旨の信号を制御部14へ出力す
る。これにより、制御部14は、ステップSC4へ進
み、X/2i<1なる関係を有しているか否かを判断す
る。言い換えれば、制御部14は、ルーティングテーブ
ルの検索において、ディスティネーションネットワーク
アドレスIP1<検索IPアドレス<ディスティネーシ
ョンネットワークアドレスIP2なる関係を有する、デ
ィスティネーションネットワークアドレスIP1および
IP2が絞り込まれたか否かを判断する。
On the other hand, in step SC2, when there is a relationship of destination network address IPA ≠ search IP address, the match comparison unit 13
A signal indicating that the two do not match is output to the control unit 14. Accordingly, the control unit 14 proceeds to step SC4, and determines whether or not the relation X / 2 i <1 is satisfied. In other words, the control unit 14 determines whether or not the destination network addresses IP1 and IP2 having the relationship of destination network address IP1 <search IP address <destination network address IP2 have been narrowed down in the search of the routing table. .

【0072】今の場合、X/2i<1なる関係が成立し
ていないものとすると、制御部14は、判断結果を「N
O」としてステップSC5へ進む。ステップSC5で
は、制御部14は、内部変数iを1インクリメントした
後、ステップSC6へ進む。ステップSC6では、大小
比較部9は、A番目のエントリにおけるディスティネー
ションネットワークアドレスIPAが検索IPアドレス
より小であるか否かを判断する。ここで、ディスティネ
ーションネットワークアドレスIPAが検索IPアドレ
スより小である場合、大小比較部9は、ステップSC1
6の判断結果を「YES」として、上記判断結果を制御
部14へ出力する。
In this case, assuming that the relationship of X / 2 i <1 is not established, the control unit 14 sets the determination result to “N
"O" and the process proceeds to Step SC5. In step SC5, the control unit 14 increments the internal variable i by 1, and then proceeds to step SC6. In step SC6, the magnitude comparing unit 9 determines whether the destination network address IPA in the A-th entry is smaller than the search IP address. Here, if the destination network address IPA is smaller than the search IP address, the magnitude comparison unit 9 proceeds to step SC1.
The judgment result of No. 6 is set to "YES", and the judgment result is outputted to the control unit 14.

【0073】これにより、ステップSC7では、制御部
14は、A=A+(X/2i)なる演算を行って、同式
の左辺の演算結果A(以下、A1と称する)に対応する
アドレス生成命令16をアドレス生成部11へ出力す
る。これにより、アドレス生成部11は、該演算結果A
1に対応するメモリアドレス4を生成した後、ルーティ
ングテーブル格納用メモリ3へ出力する。これにより、
ルーティングテーブル格納用メモリ3からは、演算結果
A1に対応するA1番目のエントリのディスティネーショ
ンネットワークアドレスIPA1が出力される。
As a result, in step SC7, the control unit 14 performs an operation of A = A + (X / 2 i ), and generates an address corresponding to the operation result A (hereinafter, referred to as A1) on the left side of the equation. The instruction 16 is output to the address generator 11. Thereby, the address generation unit 11 determines that the operation result A
After the memory address 4 corresponding to 1 is generated, it is output to the routing table storage memory 3. This allows
The routing table storage memory 3 outputs the destination network address IPA1 of the A1 entry corresponding to the operation result A1.

【0074】そして、ステップSC2では、一致比較部
13は、再びディスティネーションネットワークアドレ
スIPA1と検索IPアドレスとが一致しているか否かを
判断する。
Then, in step SC2, the match comparison unit 13 determines again whether the destination network address IPA1 matches the search IP address.

【0075】一方、ステップSC6において、A番目の
エントリにおけるディスティネーションネットワークア
ドレスIPAが検索IPアドレスより小でない場合、大
小比較部9は、判断結果を「NO」とした後、上記判断
結果を制御部14へ出力する。 これにより、ステップ
SC8では、制御部14は、A=A−(X/2i)なる
演算を行って、同式の左辺の演算結果A(以下、A2と
称する)に対応するアドレス生成命令16をアドレス生
成部11へ出力する。これにより、アドレス生成部11
は、該演算結果A2に対応するメモリアドレス4を生成
した後、ルーティングテーブル格納用メモリ3へ出力す
る。これにより、ルーティングテーブル格納用メモリ3
からは、演算結果A2に対応するA2番目のエントリのデ
ィスティネーションネットワークアドレスIPA2が出力
される。
On the other hand, in step SC6, if the destination network address IPA in the A-th entry is not smaller than the search IP address, the magnitude comparison unit 9 sets the determination result to “NO”, and then determines the above determination result to the control unit. 14 is output. Accordingly, in step SC8, the control unit 14 performs an operation of A = A− (X / 2 i ), and generates an address generation instruction 16 corresponding to the operation result A (hereinafter, referred to as A2) on the left side of the same expression. Is output to the address generation unit 11. Thereby, the address generation unit 11
Generates a memory address 4 corresponding to the operation result A2, and outputs it to the routing table storage memory 3. Thereby, the routing table storage memory 3
Output the destination network address IPA2 of the A2 entry corresponding to the operation result A2.

【0076】一方、ステップSC4において、X/2i
<1なる関係が成立している場合、制御部14は、判断
結果を「YES」とする。これにより、ステップSC9
では、一致比較部12は、検索IPアドレス保持部5に
保持されているA番目のエントリのサブネットマスク8
(maskAと略記する)をルーティングテーブル格納
用メモリ3から読み出す。
On the other hand, in step SC4, X / 2 i
When the relation of <1 is established, the control unit 14 sets the determination result to “YES”. Thereby, step SC9
Then, the match comparison unit 12 sets the subnet mask 8 of the A-th entry held in the search IP address holding unit 5.
(Abbreviated as maskA) is read from the routing table storage memory 3.

【0077】次いで、一致比較部12は、検索IPアド
レス保持部5に保持されている検索IPアドレス(IP
と略記)と、上記サブネットマスク8(maskA)と
をビット毎にAND演算する。以下、上記AND演算し
た結果を「IP*maskA」と略記する。
Next, the match comparison unit 12 searches the search IP address (IP address) held in the search IP address storage unit 5.
) And the above subnet mask 8 (maskA) for each bit. Hereinafter, the result of the AND operation is abbreviated as “IP * maskA”.

【0078】さらに、一致比較部12は、A番目のエン
トリのIPアドレス7(IPAと略記する)と、上述し
たサブネットマスク8(maskA)とをビット毎にA
ND演算する。以下、上記AND演算した結果を「IP
A*maskA」と略記する。
Further, the match comparison unit 12 stores the IP address 7 (abbreviated as IPA) of the A-th entry and the above-described subnet mask 8 (maskA) in A bits
Perform ND operation. Hereinafter, the result of the AND operation is referred to as “IP
A * maskA ".

【0079】次に、一致比較部12は、上述したAND
演算した結果(IP*maskA)と、AND演算した結
果(IPA*maskA)とが一致しているか否かを判断
する。ここで、「IP*maskA」と「IPA*mask
A」とが一致している場合、一致比較部12は、ステッ
プSC9の判断結果を「YES」とする。
Next, the coincidence comparing section 12 performs the above-described AND operation.
It is determined whether or not the calculated result (IP * maskA) matches the ANDed result (IPA * maskA). Here, “IP * maskA” and “IPA * maskA”
If “A” matches, the match comparison unit 12 sets the determination result of step SC9 to “YES”.

【0080】これにより、ステップSC10では、ダミ
ーチェック部10は、ルーティングテーブル2における
A番目のエントリがダミーチェックであるかをチェック
する。具体的には、ダミーチェック部10は、上記A番
目のエントリにダミー識別子17が含まれている場合、
第1のダミーエントリフラグに「1」を立てる一方、ダ
ミー識別子17が含まれていない場合、第1のダミーエ
ントリフラグに「0」を立てる。すなわち、上記第1の
ダミーエントリフラグが「1」である場合には、A番目
のエントリがダミーエントリであることを表し、一方、
第1のダミーエントリフラグが「0」である場合には、
A番目のエントリがオリジナルエントリであることを表
す。次に、ステップSC11では、制御部14は、A番
目のエントリの内容を作業用メモリ18に検索結果デー
タOUTtmpとして記憶する。ここで、A番目のエント
リが末尾エントリより後である場合、該A番目のエント
リのディスティネーションネットワークアドレスIP
(以下、IPtmpと略記)は、「null」文字とされ
る。
Thus, in step SC10, the dummy check unit 10 checks whether the A-th entry in the routing table 2 is a dummy check. Specifically, when the dummy identifier 17 is included in the A-th entry, the dummy check unit 10
While the first dummy entry flag is set to “1”, if the dummy identifier 17 is not included, the first dummy entry flag is set to “0”. That is, when the first dummy entry flag is “1”, it indicates that the A-th entry is a dummy entry.
When the first dummy entry flag is “0”,
This indicates that the A-th entry is the original entry. Next, in step SC11, the control unit 14 stores the contents of the A-th entry in the working memory 18 as search result data OUTtmp. Here, if the A-th entry is later than the last entry, the destination network address IP of the A-th entry
(Hereinafter abbreviated as IPtmp) is a “null” character.

【0081】一方、ステップSC9において、上述した
AND演算した結果(IP*maskA)と、AND演算
した結果(IPA*maskA)とが一致していない場
合、一致比較部12は、判断結果を「NO」とする。こ
れにより、ステップSC12では、大小比較部9は、A
番目のエントリのIPアドレス7(IPA)が検索アド
レスIPより小であるか否かを判断し、上記IPアドレ
ス7(IPA)が検索アドレスIPより小である場合、
判断結果を「YES」とする。
On the other hand, in step SC9, if the result of the AND operation (IP * maskA) does not match the result of the AND operation (IPA * maskA), the match comparison unit 12 determines that the result of the determination is “NO”. ". As a result, in step SC12, the magnitude comparison unit 9 determines that A
It is determined whether the IP address 7 (IPA) of the second entry is smaller than the search address IP, and if the IP address 7 (IPA) is smaller than the search address IP,
The judgment result is “YES”.

【0082】これにより、ステップSC13において、
制御部14は、A=A+1なる演算を行い、同式の左辺
のA番目のエントリに対応するルーティングテーブル格
納用メモリ3のアドレスを生成するアドレス生成命令1
6をアドレス生成部11へ出力する。また、制御部14
は、ステップSC12の比較結果として、大小比較結果
フラグjに「1」を立てる。この結果、アドレス生成部
11からは、A(=A+1)番目のエントリに対応する
メモリアドレス4がルーティングテーブル格納用メモリ
3へ出力される。
As a result, in step SC13,
The control unit 14 performs an operation of A = A + 1, and generates an address generation instruction 1 for generating an address of the routing table storage memory 3 corresponding to the A-th entry on the left side of the same expression.
6 is output to the address generation unit 11. The control unit 14
Sets “1” in the magnitude comparison result flag j as the comparison result in step SC12. As a result, the address generation unit 11 outputs the memory address 4 corresponding to the A (= A + 1) -th entry to the routing table storage memory 3.

【0083】一方、ステップSC12において、上記I
Pアドレス7(IPA)が検索アドレスIPより小でな
い場合、大小比較部9は、判断結果を「NO」とする。
これにより、ステップSC14において、アドレス生成
部11は、A=A−1なる演算を行い、同式の左辺のA
番目のエントリに対応するルーティングテーブル格納用
メモリ3のアドレスを生成するアドレス生成命令16を
アドレス生成部11へ出力する。また、制御部14は、
ステップSC12の比較結果として、大小比較結果フラ
グjに「0」を立てる。この結果、アドレス生成部11
からは、A(=A−1)番目のエントリに対応するメモ
リアドレス4がルーティングテーブル格納用メモリ3へ
出力される。
On the other hand, in step SC12, the I
If the P address 7 (IPA) is not smaller than the search address IP, the magnitude comparison unit 9 sets the determination result to “NO”.
As a result, in step SC14, the address generation unit 11 performs an operation of A = A−1, and the A
An address generation instruction 16 for generating an address of the routing table storage memory 3 corresponding to the third entry is output to the address generation unit 11. In addition, the control unit 14
As a result of the comparison in step SC12, the magnitude comparison result flag j is set to “0”. As a result, the address generation unit 11
, The memory address 4 corresponding to the A (= A−1) th entry is output to the routing table storage memory 3.

【0084】ステップSC15では、一致比較部12
は、ステップSC13またはステップSC14において
生成されたメモリアドレス4に格納されている、A番目
のエントリに基づいて、次の比較を行う。すなわち、一
致比較部12は、まず、検索IPアドレス保持部5に保
持されている検索IPアドレス(IP)と、上記A番目
のエントリのサブネットマスク8(maskA)とをビ
ット毎にAND演算する。以下、上記AND演算した結
果を「IP*maskA」と略記する。
In step SC15, the match comparison unit 12
Performs the next comparison based on the A-th entry stored in the memory address 4 generated in step SC13 or step SC14. That is, the match comparison unit 12 first ANDs the search IP address (IP) held in the search IP address holding unit 5 and the subnet mask 8 (maskA) of the A-th entry for each bit. Hereinafter, the result of the AND operation is abbreviated as “IP * maskA”.

【0085】さらに、一致比較部12は、A番目のエン
トリのIPアドレス7(IPAと略記する)と、上述し
たサブネットマスク8(maskA)とをビット毎にA
ND演算する。以下、上記AND演算した結果を「IP
A*maskA」と略記する。
Further, the match comparison unit 12 sets the IP address 7 (abbreviated as IPA) of the A-th entry and the above-described subnet mask 8 (maskA) on a bit-by-bit basis.
Perform ND operation. Hereinafter, the result of the AND operation is referred to as “IP
A * maskA ".

【0086】次に、一致比較部12は、上述したAND
演算した結果(IP*maskA)と、AND演算した結
果(IPA*maskA)とが一致しているか否かを判断
する。ここで、「IP*maskA」と「IPA*mask
A」とが一致しない場合、一致比較部12は、ステップ
SC15の判断結果を「NO」とする。これにより、ス
テップSC18では、制御部14は、ステップSC11
において作業用メモリ18に記憶されたA番目のエント
リのディスティネーションネットワークアドレスIPtm
pが「null」であるか否かを判断する。ここで、デ
ィスティネーションネットワークアドレスIPが「nu
ll」であるものとすると、制御部14は、ステップS
C18の判断結果を「YES」として、ステップSC1
9へ進み、検索結果たるミスヒットを表す検索結果デー
タ15を出力する。
Next, the coincidence comparing section 12 performs the above-described AND operation.
It is determined whether or not the calculated result (IP * maskA) matches the ANDed result (IPA * maskA). Here, “IP * maskA” and “IPA * maskA”
If “A” does not match, the match comparison unit 12 sets the determination result of step SC15 to “NO”. As a result, in step SC18, the control unit 14 executes step SC11.
At the destination network address IPtm of the A-th entry stored in the working memory 18
It is determined whether or not p is “null”. Here, the destination network address IP is "nu
ll ”, the control unit 14 determines in step S
The result of the determination at C18 is set to "YES", and step SC1
Then, the process proceeds to step S9, where search result data 15 representing a mishit as a search result is output.

【0087】一方、ステップSC18において、ディス
ティネーションネットワークアドレスIPtmpが「nu
ll」でない場合、制御部14は、ステップSC20へ
進む。ステップSC20では、制御部14は、ステップ
SC11において作業用メモリ18に記憶された検索結
果データOUTtmpを検索結果データ15として出力す
る。
On the other hand, in step SC18, the destination network address IPtmp is changed to “nu”.
If not “11”, the control unit 14 proceeds to step SC20. In step SC20, the control unit 14 outputs the search result data OUTtmp stored in the working memory 18 in step SC11 as the search result data 15.

【0088】一方、ステップSC15において、上述し
たAND演算した結果(IP*maskA)と、AND演
算した結果(IPA*maskA)とが一致している場
合、一致比較部12は、判断結果を「YES」とする。
これにより、ステップSC16において、ダミーチェッ
ク部10は、ルーティングテーブル2におけるA番目の
エントリがダミーチェックであるかをチェックする。こ
こで、上記A番目とは、ステップSC13またはステッ
プSC14において算出された(A+1)番目または
(A−1)番目をいう。
On the other hand, in step SC15, when the result of the AND operation (IP * maskA) and the result of the AND operation (IPA * maskA) match, the match comparison unit 12 sets the determination result to “YES”. ".
Thus, in step SC16, the dummy check unit 10 checks whether the A-th entry in the routing table 2 is a dummy check. Here, the A-th means the (A + 1) -th or (A-1) -th calculated in step SC13 or SC14.

【0089】具体的には、ダミーチェック部10は、上
記A番目のエントリにダミー識別子17が含まれている
場合、第2のダミーエントリフラグに「1」を立てる一
方、ダミー識別子17が含まれていない場合、第2のダ
ミーエントリフラグに「0」を立てる。すなわち、上記
第2のダミーエントリフラグが「1」である場合には、
A番目((A+1)番目または(A−1)番目)のエン
トリがダミーエントリであることを表し、一方、第2の
ダミーエントリフラグが「0」である場合には、A番目
((A+1)番目または(A−1)番目)のエントリが
オリジナルエントリであることを表す。
Specifically, when the dummy identifier 17 is included in the A-th entry, the dummy check unit 10 sets the second dummy entry flag to “1”, while the dummy identifier 17 is included. If not, the second dummy entry flag is set to "0". That is, when the second dummy entry flag is “1”,
The Ath ((A + 1) th or (A-1) th) entry is a dummy entry. On the other hand, if the second dummy entry flag is “0”, the Ath ((A + 1)) Or (A-1) -th entry) is the original entry.

【0090】そして、ステップSC17では、検索結果
データ15は、ステップSC10におけるダミーチェッ
ク1の結果、ステップSC16におけるダミーチェック
2の結果および大小比較結果フラグjの組み合わせ、な
らびに図5に示す検索出力結果テーブルに基づいて、検
索結果データ15として出力する検索結果を求める。具
体的には、図5に示すように、ダミーチェック1および
2の結果が共にダミーエントリであって、かつ大小比較
結果フラグjが「0」である場合、A番目のエントリの
内容である検索結果OUTAが、検索結果データ15と
して出力される。
Then, in step SC17, the search result data 15 contains the combination of the result of the dummy check 1 in step SC10, the result of the dummy check 2 in step SC16 and the magnitude comparison result flag j, and the search output result table shown in FIG. , A search result to be output as search result data 15 is obtained. Specifically, as shown in FIG. 5, when the results of the dummy checks 1 and 2 are both dummy entries and the magnitude comparison result flag j is “0”, the search that is the content of the A-th entry is performed. The result OUTA is output as the search result data 15.

【0091】また、ダミーチェック1および2が共にダ
ミーエントリであって、かつ大小比較結果フラグjが
「1」である場合には、ステップSC11において作業
用メモリ18に記憶されているA番目のエントリの内容
である検索結果OUTtmpが、検索結果データ15とし
て出力される。また、ダミーチェック1および2が共に
オリジナルエントリであって、かつ大小比較結果フラグ
jが「0」である場合には、上述した検索結果OUTtm
pが、検索結果データ15として出力される。
If both the dummy checks 1 and 2 are dummy entries and the magnitude comparison result flag j is "1", the A-th entry stored in the working memory 18 in step SC11. Is output as search result data 15. If both the dummy checks 1 and 2 are original entries and the magnitude comparison result flag j is “0”, the above-described search result OUTtm
p is output as the search result data 15.

【0092】また、ダミーチェック1および2が共にオ
リジナルエントリであって、かつ大小比較結果フラグj
が「1」である場合には、上述した検索結果OUTA
が、検索結果データ15として出力される。さらに、ダ
ミーチェック1がオリジナルエントリ、およびダミーチ
ェック2がダミーエントリである場合には、上述した検
索結果OUTtmpが、検索結果データ15として出力さ
れる。なお、この場合には、大小比較結果フラグjは考
慮されない。加えて、ダミーチェック1がダミーエント
リ、およびダミーチェック2がオリジナルエントリであ
る場合には、上述した検索結果OUTAが、検索結果デ
ータ15として出力される。なお、この場合には、大小
比較結果フラグjは考慮されない。
Further, both dummy checks 1 and 2 are original entries, and the magnitude comparison result flag j
Is “1”, the above-described search result OUTA
Is output as the search result data 15. Further, when the dummy check 1 is an original entry and the dummy check 2 is a dummy entry, the above-described search result OUTtmp is output as the search result data 15. In this case, the magnitude comparison result flag j is not considered. In addition, when the dummy check 1 is a dummy entry and the dummy check 2 is an original entry, the above-described search result OUTA is output as search result data 15. In this case, the magnitude comparison result flag j is not considered.

【0093】<第2実施形態>図6は、本発明の第2実
施形態によるルーティングテーブル検索装置の構成を示
すブロック図である。この図において、図1の各部に対
応する部分には同一の符号を付けその説明を省略する。
図6においては、図1に示すダミーチェック部10に代
えてサブネット長比較部30が設けられている。
<Second Embodiment> FIG. 6 is a block diagram showing a configuration of a routing table search device according to a second embodiment of the present invention. In this figure, parts corresponding to the respective parts in FIG. 1 are denoted by the same reference numerals, and description thereof is omitted.
6, a subnet length comparison unit 30 is provided instead of the dummy check unit 10 shown in FIG.

【0094】また、第2実施形態によるルーティングテ
ーブル検索装置は、図9に示すフローチャートの手順に
従って、ルーティングテーブルの検索動作を行う。この
図9において、図4の各部に対応する部分には同一の符
号を付けその説明を省略する。図9においては、図4に
示すステップSC10が削除されており、かつ図4に示
すステップSC16および17に代えて、ステップSD
1、SD2およびSD3が採用されている。
The routing table search device according to the second embodiment performs a routing table search operation according to the procedure of the flowchart shown in FIG. In FIG. 9, portions corresponding to the respective portions in FIG. 4 are denoted by the same reference numerals, and description thereof will be omitted. In FIG. 9, step SC10 shown in FIG. 4 is deleted, and step SD16 and step SC16 shown in FIG.
1, SD2 and SD3 are employed.

【0095】図6に示すサブネット長比較部30は、図
9に示すステップSC15の判断結果が「YES」であ
る場合、サブネットマスクmaskAの”1”の長さ
と、サブネットマスクmasktmpの”1”の長さとを
比較する。ここで、上記サブネットマスクmaskA
は、ステップSC13またはステップSC14において
演算されたA番目((A+1)番目または(A−1)番
目)のエントリのサブネットマスクである。一方、サブ
ネットマスクmasktmpは、ステップSC11におい
て作業用メモリ18に記憶されたA番目のエントリのサ
ブネットマスクである。
When the determination result of step SC15 shown in FIG. 9 is “YES”, the subnet length comparing unit 30 shown in FIG. 6 determines the length of “1” of the subnet mask maskA and “1” of the subnet mask masktmp. Compare with length. Here, the subnet mask maskA
Is the subnet mask of the Ath ((A + 1) th or (A-1) th) entry calculated in step SC13 or step SC14. On the other hand, the subnet mask masktmp is the subnet mask of the A-th entry stored in the working memory 18 in step SC11.

【0096】また、ステップSD1においては、サブネ
ット長比較部30は、サブネットマスクmaskAの”
1”の長さが、サブネットマスクmasktmpの”1”
の長さより短いか否かを判断する。そして、ステップS
D1の判断結果が「YES」の場合、制御部14は、ス
テップSD2へ進み、ステップSC11において作業用
メモリ18に記憶されたA番目のエントリの内容を、検
索結果たる検索結果データ15として出力する。一方、
ステップSD1の判断結果が「NO」の場合、制御部1
4は、ステップSD3へ進み、ステップSC3またはス
テップSC14において演算されたA番目のエントリの
内容を、検索結果たる検索結果データ15として出力す
る。
In step SD1, the subnet length comparing unit 30 determines whether the subnet mask "maskA"
The length of “1” is “1” of the subnet mask masktmp.
Judge whether it is shorter than the length. And step S
When the determination result of D1 is “YES”, the control unit 14 proceeds to step SD2, and outputs the contents of the A-th entry stored in the working memory 18 in step SC11 as search result data 15 as a search result. . on the other hand,
If the decision result in the step SD1 is "NO", the control unit 1
4 proceeds to step SD3, and outputs the contents of the A-th entry calculated in step SC3 or SC14 as search result data 15 as a search result.

【0097】図7は、図6に示す一致比較部12、制御
部14およびサブネット長比較部30の機能を表す機能
ブロック図である。この図において、比較部401およ
び比較部402の各機能は、図6に示す一致比較部12
の機能に対応しており、比較部403の機能は、図6に
示すサブネット長比較部30の機能に対応している。ま
た、判定回路41の機能は、図6に示す制御部14の機
能に対応している。
FIG. 7 is a functional block diagram showing functions of the coincidence comparison unit 12, the control unit 14, and the subnet length comparison unit 30 shown in FIG. In this figure, the functions of the comparison unit 401 and the comparison unit 402 are the same as those of the coincidence comparison unit 12 shown in FIG.
The function of the comparison unit 403 corresponds to the function of the subnet length comparison unit 30 shown in FIG. Further, the function of the determination circuit 41 corresponds to the function of the control unit 14 shown in FIG.

【0098】従って、以下の説明においては、図6に示
す一致比較部12、サブネット長比較部30および制御
部14については、図7に示す比較部401、402、4
03および判定回路41を参照して説明する。ここで、
図7を参照して説明するにあたって、図6に示すルーテ
ィングテーブル検索装置と整合性を図るべく、次の事項
を定義し直す。図7に示す”第k項”は、ステップSC
13(図9参照)の処理が行われた場合、図6に示すル
ーティングテーブル2におけるエントリの番号を表す、
ステップSC11における”A番目”をいう。また、図
7に示す”第(k+1)項”は、ステップSC13の処
理が行われた場合、図6に示すルーティングテーブル2
におけるエントリの番号を表す、ステップSC13にお
ける”A(=A+1)番目”をいう。
Therefore, in the following description, the comparison unit 12, the subnet length comparison unit 30, and the control unit 14 shown in FIG.
A description will be given with reference to FIG. here,
In the description with reference to FIG. 7, the following items are redefined in order to achieve consistency with the routing table search device shown in FIG. The “k-th term” shown in FIG.
13 (see FIG. 9) indicates the entry number in the routing table 2 shown in FIG.
This means the “A-th” in step SC11. The “(k + 1) -th item” shown in FIG. 7 indicates that the routing table 2 shown in FIG.
, The "A (= A + 1) -th" in step SC13.

【0099】一方、図7に示す”第k項”は、ステップ
SC14(図9参照)の処理が行われた場合、図6に示
すルーティングテーブル2におけるエントリの番号を表
す、ステップSC14における”A(=A−1)番目”
をいう。また、図7に示す”第(k+1)項”は、ステ
ップSC14の処理が行われた場合、図6に示すルーテ
ィングテーブル2におけるエントリの番号を表す、ステ
ップSC11における”A番目”をいう。
On the other hand, the “k-th item” shown in FIG. 7 indicates the number of the entry in the routing table 2 shown in FIG. 6 when the process of step SC14 (see FIG. 9) is performed. (= A-1) th "
Say. The “(k + 1) -th item” shown in FIG. 7 indicates the “A-th” in step SC11, which indicates the number of the entry in the routing table 2 shown in FIG. 6, when the processing in step SC14 is performed.

【0100】上述した定義において、図7に示す比較部
401(一致比較部12)は、検索IPアドレス保持部
5に保持されている検索IPアドレスにルーティングテ
ーブル2における第k項のエントリのサブネットマスク
をかけたビット列と、上記第k項のエントリのIPアド
レスに上記k項のサブネットマスクをかけたビット列と
を比較する。すなわち、比較部401は、上記両ビット
列が一致しているか否かを判断する。ここで、上記”サ
ブネットマスクをかける”とは、上述したように検索I
Pアドレスとサブネットマスクとをビット毎にAND演
算することをいう。
In the above definition, the comparison unit 401 (coincidence comparison unit 12) shown in FIG. 7 adds the subnet mask of the k-th entry in the routing table 2 to the search IP address held in the search IP address holding unit 5. Is compared with a bit string obtained by multiplying the IP address of the k-th entry by the subnet mask of the k-th term. That is, the comparing unit 401 determines whether or not the two bit strings match. Here, the “apply a subnet mask” refers to the search I as described above.
This refers to performing an AND operation on the P address and the subnet mask for each bit.

【0101】比較部402(一致比較部12)は、検索
IPアドレス保持部5に保持されている検索IPアドレ
スにルーティングテーブル2における第(k+1)項の
エントリのサブネットマスクをかけたビット列と、第
(k+1)項のIPアドレスに第(k+1)項のエント
リのサブネットマスクをかけたビット列とを比較する。
すなわち、比較部402は、上記両ビット列が一致して
いるか否かを判断する。
The comparing unit 402 (matching comparing unit 12) calculates a bit string obtained by multiplying the search IP address held in the search IP address holding unit 5 by the subnet mask of the (k + 1) -th entry in the routing table 2. A comparison is made with a bit string obtained by multiplying the (k + 1) term IP address by the subnet mask of the (k + 1) term entry.
That is, the comparing section 402 determines whether or not the two bit strings match.

【0102】比較部403(サブネット長比較部30)
は、ルーティングテーブル2における第k項のエントリ
のサブネットマスクの”1”の長さと、第(k+1)項
のサブネットマスクの”1”の長さとを比較する。すな
わち、比較部403は、両者が一致しているか、または
一致していない場合、両者の大小関係を判断する。
Comparison section 403 (subnet length comparison section 30)
Compares the length of “1” of the subnet mask of the k-th entry in the routing table 2 with the length of “1” of the subnet mask of the (k + 1) -th item. That is, when the two match or the two do not match, the comparing unit 403 determines the magnitude relationship between the two.

【0103】判定回路41は、比較部401、402およ
び403の各比較結果と図8に示す比較結果出力テーブ
ルとに基づいて、ルーティングテーブル2の検索結果
を、図6に示す検索結果データ31として出力する。こ
こで、図8に示す比較結果出力テーブルにおいて、上欄
第1項は、比較部403の比較結果に対応しており、上
欄第2項は、比較部401の比較結果に対応しており、
上欄第3項は、比較部402の比較結果に対応してい
る。この判定回路41の動作の詳細については後述す
る。
The determination circuit 41 converts the search result of the routing table 2 into the search result data 31 shown in FIG. 6 based on the comparison results of the comparison units 401, 402 and 403 and the comparison result output table shown in FIG. Output. Here, in the comparison result output table shown in FIG. 8, the first term in the upper column corresponds to the comparison result of the comparison unit 403, and the second term in the upper column corresponds to the comparison result of the comparison unit 401. ,
The third term in the upper column corresponds to the comparison result of the comparison unit 402. Details of the operation of the determination circuit 41 will be described later.

【0104】次に、上述した第2実施形態によるルーテ
ィングテーブル検索装置の動作について、図9を参照し
つつ説明する。なお、以下の説明においては、図4を参
照して説明した動作と重複する箇所についてはその説明
を省略する。また、以下の説明は、図9に示すステップ
SD1〜3に対応する部分の説明である。図7におい
て、今、比較部403の比較結果が図8に示す「第k項
>第(k+1)項」であり、かつ比較部401の比較結
果が「=」(一致)であるものとする。このとき、比較
部402の比較結果が「=」(一致)または「≠」(不
一致)である場合には、判定回路41は、検索IPアド
レスがルーティングテーブル2における第k項のエント
リのIPアドレスと一致しているものと判断して、上記
第k項のエントリの内容を検索結果データ31として出
力する。
Next, the operation of the routing table search device according to the second embodiment will be described with reference to FIG. In the following description, the description of the same parts as those described with reference to FIG. 4 will be omitted. Further, the following description is a description of a portion corresponding to steps SD1 to SD3 shown in FIG. In FIG. 7, it is assumed that the comparison result of the comparison unit 403 is “k-th item> (k + 1) -th” shown in FIG. 8 and the comparison result of the comparison unit 401 is “=” (coincidence). . At this time, if the comparison result of the comparison unit 402 is “=” (match) or “≠” (mismatch), the determination circuit 41 determines that the search IP address is the IP address of the entry of the k-th term in the routing table 2. Is determined, and the content of the k-th entry is output as search result data 31.

【0105】一方、今、比較部403の比較結果が図8
に示す「第k項>第(k+1)項」であり、かつ比較部
401の比較結果が「≠」(不一致)であるものとす
る。このとき、比較部402の比較結果が「=」(一
致)である場合には、判定回路41は、検索IPアドレ
スがルーティングテーブル2における第(k+1)項の
エントリのIPアドレスと一致しているものと判断し
て、上記第(k+1)項のエントリの内容を検索結果デ
ータ31として出力する。また、比較部402の比較結
果が「≠」(不一致)である場合には、判定回路41
は、ルーティングテーブル2において検索IPアドレス
に該当するエントリが存在しない、という検索結果を出
す。
On the other hand, the comparison result of the comparison unit 403 is now shown in FIG.
It is assumed that “the k-th item> the (k + 1) -th item” shown in FIG. At this time, when the comparison result of the comparing unit 402 is “=” (match), the determination circuit 41 determines that the search IP address matches the IP address of the (k + 1) -th entry in the routing table 2. Then, the content of the entry of the (k + 1) -th item is output as the search result data 31. If the comparison result of the comparing unit 402 is “≠” (mismatch), the judgment circuit 41
Produces a search result indicating that there is no entry corresponding to the search IP address in the routing table 2.

【0106】一方、今、比較部403の比較結果が図8
に示す「第k項=第(k+1)項」であり、かつ比較部
401の比較結果が「=」(一致)であるものとする。
このとき、比較部402の比較結果が「=」(一致)で
ある場合には、判定回路41は、ルーティングテーブル
2において検索IPアドレスに該当するエントリが存在
しない、という検索結果を出す。また、比較部402の
比較結果が「≠」(不一致)である場合には、判定回路
41は、検索IPアドレスがルーティングテーブル2に
おける第k項のエントリのIPアドレスと一致している
ものと判断して、上記第k項のエントリの内容を検索結
果データ31として出力する。
On the other hand, the comparison result of the comparison unit 403 is now shown in FIG.
, And the comparison result of the comparing unit 401 is “=” (match).
At this time, if the comparison result of the comparison unit 402 is “=” (match), the determination circuit 41 issues a search result indicating that there is no entry corresponding to the search IP address in the routing table 2. If the comparison result of the comparing unit 402 is “比較” (mismatch), the determination circuit 41 determines that the search IP address matches the IP address of the k-th entry in the routing table 2. Then, the content of the entry of the k-th item is output as the search result data 31.

【0107】一方、今、比較部403の比較結果が図8
に示す「第k項=第(k+1)項」であり、かつ比較部
401の比較結果が「≠」(不一致)であるものとす
る。このとき、比較部402の比較結果が「=」(一
致)である場合には、判定回路41は、検索IPアドレ
スがルーティングテーブル2における第(k+1)項の
エントリのIPアドレスと一致しているものと判断し
て、上記第(k+1)項のエントリの内容を検索結果デ
ータ31として出力する。また、比較部402の比較結
果が「≠」(不一致)である場合には、判定回路41
は、ルーティングテーブル2において検索IPアドレス
に該当するエントリが存在しない、という検索結果を出
す。
On the other hand, the comparison result of the comparison unit 403 is now shown in FIG.
It is assumed that the “k-th term = (k + 1) -th term” shown in (1) and the comparison result of the comparing unit 401 is “≠” (mismatch). At this time, when the comparison result of the comparing unit 402 is “=” (match), the determination circuit 41 determines that the search IP address matches the IP address of the (k + 1) -th entry in the routing table 2. Then, the content of the entry of the (k + 1) -th item is output as the search result data 31. If the comparison result of the comparing unit 402 is “≠” (mismatch), the judgment circuit 41
Produces a search result indicating that there is no entry corresponding to the search IP address in the routing table 2.

【0108】一方、今、比較部403の比較結果が図8
に示す「第k項<第(k+1)項」であり、かつ比較部
401の比較結果が「=」(一致)であるものとする。
このとき、比較部402の比較結果が「=」(一致)で
ある場合には、判定回路41は、検索IPアドレスがル
ーティングテーブル2における第(k+1)項のエント
リのIPアドレスと一致しているものと判断して、上記
第(k+1)項のエントリの内容を検索結果データ31
として出力する。また、比較部402の比較結果が
「≠」(不一致)である場合には、判定回路41は、検
索IPアドレスがルーティングテーブル2における第k
項のエントリのIPアドレスと一致しているものと判断
して、上記第k項のエントリの内容を検索結果データ3
1として出力する。
On the other hand, the comparison result of the comparison unit 403 is now shown in FIG.
It is assumed that “the k-th item <the (k + 1) -th item” and the comparison result of the comparing unit 401 is “=” (match).
At this time, when the comparison result of the comparing unit 402 is “=” (match), the determination circuit 41 determines that the search IP address matches the IP address of the (k + 1) -th entry in the routing table 2. And the contents of the entry of the (k + 1) -th item are searched for in the search result data 31.
Output as When the comparison result of the comparing unit 402 is “≠” (mismatch), the determination circuit 41 determines that the search IP address is the k-th IP address in the routing table 2.
It is determined that the entry matches the IP address of the entry of the item, and the content of the entry of the k-th item is searched for in the search result data 3
Output as 1.

【0109】一方、今、比較部403の比較結果が図8
に示す「第k項<第(k+1)項」であり、かつ比較部
401の比較結果が「≠」(不一致)であるものとす
る。このとき、比較部402の比較結果が「=」(一
致)である場合には、判定回路41は、検索IPアドレ
スがルーティングテーブル2における第(k+1)項の
エントリのIPアドレスと一致しているものと判断し
て、上記第(k+1)項のエントリの内容を検索結果デ
ータ31として出力する。また、比較部402の比較結
果が「≠」(不一致)である場合には、判定回路41
は、ルーティングテーブル2において検索IPアドレス
に該当するエントリが存在しない、という検索結果を出
す。
On the other hand, the comparison result of the comparison unit 403 is now shown in FIG.
It is assumed that “the k-th item <the (k + 1) -th item” and the comparison result of the comparing unit 401 is “≠” (mismatch). At this time, when the comparison result of the comparing unit 402 is “=” (match), the determination circuit 41 determines that the search IP address matches the IP address of the (k + 1) -th entry in the routing table 2. Then, the content of the entry of the (k + 1) -th item is output as the search result data 31. If the comparison result of the comparing unit 402 is “≠” (mismatch), the judgment circuit 41
Produces a search result indicating that there is no entry corresponding to the search IP address in the routing table 2.

【0110】以上、本発明の実施形態を図面を参照して
詳述してきたが、具体的な構成はこの実施形態に限られ
るものではなく、本発明の要旨を逸脱しない範囲の設計
変更等があっても本発明に含まれる。例えば、上述した
第1および第2実施形態によるルーティングテーブル検
索装置においては、ルーティングテーブル2におけるI
Pアドレスのホストアドレス部分の全てのビットを”
0”とし、一致比較部12においてAND演算をする例
について説明したがこれに限定されることはない。すな
わち、上述した第1および第2実施形態によるルーティ
ングテーブル検索装置においては、ルーティングテーブ
ル2におけるIPアドレスのホストアドレス部分の全て
を、上述した”0”に代えて”1”とした後、選択され
たエントリにおけるサブネットマスクの反転ビット(”
0”と”1”とを入れ換えたもの)と検索IPアドレス
とを、上述したAND演算に代えてOR演算をするよう
にしてもよい。
Although the embodiment of the present invention has been described in detail with reference to the drawings, the specific configuration is not limited to this embodiment, and a design change or the like may be made without departing from the gist of the present invention. Even if present, it is included in the present invention. For example, in the routing table search devices according to the first and second embodiments described above, the I
Change all bits of the host address part of the P address to "
The example in which the AND operation is performed in the match comparison unit 12 by setting the value to "0" has been described. However, the present invention is not limited to this. That is, in the routing table search apparatuses according to the first and second embodiments described above, After setting all of the host address portion of the IP address to “1” instead of “0”, the inversion bit (“”) of the subnet mask in the selected entry.
The OR operation may be performed on the search IP address and the search IP address instead of the AND operation described above.

【0111】[0111]

【発明の効果】本発明によれば、検索IPアドレスにサ
ブネットマスクをかけることなく、検索IPアドレスと
登録IPアドレスとの前記大小比較を行っているので、
サブネットマスクが可変長である場合であっても、ルー
ティングテーブル検索処理を高速で行うことができ、か
つ大量に高速で入力するIPパケットを受信して瞬時に
宛先につながる方路へIPパケットを出力することがで
き、しかもサブネットマスクが可変長であることに起因
する検索誤りを防止することができるという効果が得ら
れる。
According to the present invention, the search IP address is compared with the registered IP address without applying a subnet mask to the search IP address.
Even if the subnet mask has a variable length, the routing table search process can be performed at a high speed, and a large amount of high-speed input IP packets are received and the IP packets are output to a route that immediately leads to the destination. And the search error caused by the variable length of the subnet mask can be prevented.

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

【図1】 本発明の第1実施形態によるルーティングテ
ーブル検索装置の構成を示すブロック図である。
FIG. 1 is a block diagram illustrating a configuration of a routing table search device according to a first embodiment of the present invention.

【図2】 図1に示すルーティングテーブル生成部1に
よるルーティングテーブルの生成手順を示すフローチャ
ートである。
FIG. 2 is a flowchart showing a procedure for generating a routing table by a routing table generating unit 1 shown in FIG. 1;

【図3】 図1に示すルーティングテーブル生成部1に
よるルーティングテーブルの生成手順を示すフローチャ
ートである。
FIG. 3 is a flowchart showing a procedure for generating a routing table by a routing table generator 1 shown in FIG. 1;

【図4】 本発明の第1実施形態によるルーティングテ
ーブル検索装置の動作を説明するフローチャートであ
る。
FIG. 4 is a flowchart illustrating an operation of the routing table search device according to the first embodiment of the present invention.

【図5】 同第1実施形態によるルーティングテーブル
検索装置において用いられる検索結果出力テーブルを示
す図である。
FIG. 5 is a diagram showing a search result output table used in the routing table search device according to the first embodiment.

【図6】 同第2実施形態によるルーティングテーブル
検索装置の構成を示すブロック図である。
FIG. 6 is a block diagram illustrating a configuration of a routing table search device according to the second embodiment.

【図7】 同第2実施形態によるルーティングテーブル
検索装置の構成を示すブロック図である。
FIG. 7 is a block diagram showing a configuration of a routing table search device according to the second embodiment.

【図8】 同第2実施形態によるルーティングテーブル
検索装置において用いられる検索結果出力テーブルを示
す図である。
FIG. 8 is a diagram showing a search result output table used in the routing table search device according to the second embodiment.

【図9】 同第2実施形態によるルーティングテーブル
検索装置の動作を説明するフローチャートである。
FIG. 9 is a flowchart illustrating an operation of the routing table search device according to the second embodiment.

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

1 ルーティングテーブル生成部 2 ルーティングテーブル 3 ルーティングテーブル格納用メモリ 4 メモリアドレス 5 検索IPアドレス保持部 6 送信先情報 7 IPアドレス 8 サブネットマスク 9 大小比較部 10 ダミーチェック部 11 アドレス生成部 12 一致比較部 13 一致比較部 14 制御部 15 検索結果データ 16 アドレス生成命令 17 ダミー識別子 18 作業用メモリ 401、402、403 比較部 41 判定回路 DESCRIPTION OF SYMBOLS 1 Routing table generation part 2 Routing table 3 Routing table storage memory 4 Memory address 5 Search IP address holding part 6 Destination information 7 IP address 8 Subnet mask 9 Size comparison part 10 Dummy check part 11 Address generation part 12 Match comparison part 13 Match comparison unit 14 Control unit 15 Search result data 16 Address generation instruction 17 Dummy identifier 18 Working memory 401, 402, 403 Comparison unit 41 Judgment circuit

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 登録すべき複数の登録IPアドレスの各
ホストアドレス部分の全てのビットを”0”とし、かつ
前記登録IPアドレスに対応した各サブネットマスク部
分のビットを”1”とした後、一つの前記登録IPアド
レスと前記サブネットマスクと送信先情報とをひとまと
めにして1エントリのデータとした後、さらに、前記登
録IPアドレスを数値と見なしてソートして複数のエン
トリからなるルーティングテーブルを生成するルーティ
ングテーブル生成手段を有し、受信したIPパケットか
ら読み出した検索IPアドレスと前記エントリの登録I
Pアドレスとの大小比較により、ルーティングテーブル
における検索範囲を半分に狭めて検索を行うルーティン
グテーブル検索装置において、 前記検索IPアドレスにサブネットマスクをかけること
なく、前記検索IPアドレスと前記登録IPアドレスと
の前記大小比較を行い、前記検索IPアドレスを直接挟
みこむ、前記ルーティングテーブルにおける2つのエン
トリを検索する比較手段と、 前記2つのエントリにおける、一方の前記登録IPアド
レスと可変長の前記サブネットマスクとをビット毎にA
ND演算した結果と、他方の前記登録IPアドレスと可
変長の前記サブネットマスクとをビット毎にAND演算
した結果との比較結果に基づいて、前記ルーティングテ
ーブルの中から前記検索IPアドレスと一致する登録I
Pアドレスを検索する検索手段と、 を具備することを特徴とするルーティングテーブル検索
装置。
1. After all bits of each host address portion of a plurality of registered IP addresses to be registered are set to "0" and bits of each subnet mask portion corresponding to the registered IP address are set to "1", After the one registered IP address, the subnet mask, and the destination information are grouped into one entry data, the registered IP address is sorted as a numerical value to generate a routing table including a plurality of entries. The search IP address read from the received IP packet and the registration I of the entry.
In a routing table search device for performing a search by narrowing a search range in a routing table by half by comparing the size with a P address, the search IP address and the registered IP address can be set without applying a subnet mask to the search IP address. A comparing unit that performs the magnitude comparison and searches for two entries in the routing table that directly sandwiches the search IP address; and compares one of the registered IP address and the variable-length subnet mask in the two entries. A for each bit
A registration that matches the search IP address from the routing table based on a comparison result between the result of the ND operation and the result of the AND operation of the other registered IP address and the variable-length subnet mask for each bit. I
A routing table searching device, comprising: searching means for searching for a P address.
【請求項2】 前記ルーティングテーブル生成手段は、
前記ルーティングテーブルにおける各登録IPアドレス
のホストアドレス部分の全てのビットを、前記”0”に
代えて”1”とし、 前記検索手段は、前記2つのエントリにおける、一方の
前記登録IPアドレスと可変長の前記サブネットマスク
の反転ビット(”0”と”1”とを入れ替えたもの)と
をビット毎にOR演算した結果と、他方の前記登録IP
アドレスと可変長の前記サブネットマスクの反転ビット
(”0”と”1”とを入れ替えたもの)とをビット毎に
OR演算した結果との比較結果に基づいて、前記ルーテ
ィングテーブルの中から前記検索IPアドレスと一致す
る登録IPアドレスを検索すること、 を特徴とする請求項1に記載のルーティングテーブル検
索装置。
2. The routing table generating means according to claim 1,
All bits of the host address portion of each registered IP address in the routing table are set to “1” instead of “0”, and the search unit determines that one of the registered IP addresses and the variable length in the two entries The result of ORing the inverted bits of the subnet mask (in which “0” and “1” are exchanged) for each bit and the other registered IP
The search is performed in the routing table based on a comparison result between an address and a result obtained by performing an OR operation on a bit-by-bit basis with a variable-length inverted bit (in which “0” and “1” are exchanged) of the subnet mask. The routing table search device according to claim 1, wherein a search is made for a registered IP address that matches the IP address.
【請求項3】 登録すべき複数の登録IPアドレスの各
ホストアドレス部分の全てのビットを”0”とし、かつ
前記登録IPアドレスに対応した各サブネットマスク部
分のビットを”1”とした後、一つの前記登録IPアド
レスと前記サブネットマスクと送信先情報とをひとまと
めにして1エントリのデータとした後、さらに、前記登
録IPアドレスを数値と見なしてソートして複数のエン
トリからなるルーティングテーブルを生成するルーティ
ングテーブル生成手段を有し、受信したIPパケットか
ら読み出した検索IPアドレスと前記エントリの登録I
Pアドレスとの大小比較により、ルーティングテーブル
における検索範囲を半分に狭めて検索を行うルーティン
グテーブル検索装置において、 前記検索IPアドレスにサブネットマスクをかけること
なく、前記検索IPアドレスと前記登録IPアドレスと
の前記大小比較を行い、前記検索IPアドレスを直接挟
みこむ、前記ルーティングテーブルにおける2つのエン
トリを検索する比較手段と、 前記2つのエントリにおける、一方のエントリの可変長
の前記サブネットマスクの”1”の長さと、他方のエン
トリの可変長の前記サブネットマスクの”1”の長さと
の比較結果に基づいて、前記ルーティングテーブルの中
から前記検索IPアドレスと一致する登録IPアドレス
を検索する検索手段と、 を具備することを特徴とするルーティングテーブル検索
装置。
3. After setting all bits of each host address portion of a plurality of registered IP addresses to be registered to “0” and setting bits of each subnet mask portion corresponding to the registered IP address to “1”, After the one registered IP address, the subnet mask, and the destination information are combined into one entry data, the registered IP address is sorted as a numerical value to generate a routing table including a plurality of entries. The search IP address read from the received IP packet and the registration I of the entry.
In a routing table search device for performing a search by narrowing a search range in a routing table by half by comparing the size with a P address, the search IP address and the registered IP address can be set without applying a subnet mask to the search IP address. A comparison unit that performs the magnitude comparison and directly searches for the two entries in the routing table that directly sandwiches the search IP address; and, in the two entries, one of the variable-length subnet masks “1” of one of the entries. Search means for searching the routing table for a registered IP address that matches the search IP address, based on a comparison result of the length and the length of the variable "1" of the subnet mask of the other entry; Routing characterized by comprising: Buru search device.
JP24153797A 1997-09-05 1997-09-05 Routing table retrieving device Pending JPH1188427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP24153797A JPH1188427A (en) 1997-09-05 1997-09-05 Routing table retrieving device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP24153797A JPH1188427A (en) 1997-09-05 1997-09-05 Routing table retrieving device

Publications (1)

Publication Number Publication Date
JPH1188427A true JPH1188427A (en) 1999-03-30

Family

ID=17075836

Family Applications (1)

Application Number Title Priority Date Filing Date
JP24153797A Pending JPH1188427A (en) 1997-09-05 1997-09-05 Routing table retrieving device

Country Status (1)

Country Link
JP (1) JPH1188427A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999034558A1 (en) * 1997-12-25 1999-07-08 Kabushiki Kaisha Toshiba Atm repeater and network including the same
WO2002082750A1 (en) * 2001-04-02 2002-10-17 Dcl Inc. Bit string searching device and method
US6839703B2 (en) 2000-05-15 2005-01-04 Fujitsu Limited Information apparatus, table retrieval apparatus, table retrieval method, and recording medium
WO2008072667A1 (en) 2006-12-13 2008-06-19 Nec Corporation Telecommunication network, network node device, and routing method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999034558A1 (en) * 1997-12-25 1999-07-08 Kabushiki Kaisha Toshiba Atm repeater and network including the same
US6781994B1 (en) 1997-12-25 2004-08-24 Kabushiki Kaisha Toshiba Distributing ATM cells to output ports based upon destination information using ATM switch core and IP forwarding
US6839703B2 (en) 2000-05-15 2005-01-04 Fujitsu Limited Information apparatus, table retrieval apparatus, table retrieval method, and recording medium
WO2002082750A1 (en) * 2001-04-02 2002-10-17 Dcl Inc. Bit string searching device and method
WO2008072667A1 (en) 2006-12-13 2008-06-19 Nec Corporation Telecommunication network, network node device, and routing method

Similar Documents

Publication Publication Date Title
US7167474B2 (en) Network relaying apparatus and network relaying method capable of high-speed routing and packet transfer
JP4156112B2 (en) High-speed search method and high-speed search device
EP0993144B1 (en) Packet relaying apparatus and method and circuit thereof
US5920886A (en) Accelerated hierarchical address filtering and translation using binary and ternary CAMs
US6366582B1 (en) Connection switching apparatus, connection switching network control system and connection switching network control method
EP1623557B1 (en) A bounded index extensible hash-based ipv6 address lookup method
US7984038B2 (en) Longest prefix match (LPM) algorithm implementation for a network processor
US20050281257A1 (en) Packet forwarding device
US20030050762A1 (en) Method and apparatus for measuring protocol performance in a data communication network
WO1996034479A1 (en) Packet switching engine
JP2001251351A (en) Input packet processing system for packet switch
JPH09307581A (en) Bridge
JPH06203001A (en) Electronic message communication path selection method
US6570866B1 (en) High-speed flexible longest match retrieval
JPH06261078A (en) Table retrieval method and router
WO2005002178A1 (en) System and method for modifying data transferred from a source to a destination
JPH1188427A (en) Routing table retrieving device
US5535413A (en) System including plurality of data driven processors connected to each other
US7245615B1 (en) Multi-link protocol reassembly assist in a parallel 1-D systolic array system
JP2003224581A (en) Longest match retrieval circuit, its method, its program, and recording medium
US6671277B1 (en) Network relaying apparatus and network relaying method capable of high quality transfer of packets under stable service quality control
US7444562B2 (en) Trie-type memory device with a compression mechanism
JP3464021B2 (en) Router with address translation function
US6895013B1 (en) Coherent access to and update of configuration information in multiprocessor environment
EP0520116A1 (en) Method and apparatus for performing pattern search functions