JP2007135035A - Communication device and packet processing method - Google Patents

Communication device and packet processing method Download PDF

Info

Publication number
JP2007135035A
JP2007135035A JP2005327072A JP2005327072A JP2007135035A JP 2007135035 A JP2007135035 A JP 2007135035A JP 2005327072 A JP2005327072 A JP 2005327072A JP 2005327072 A JP2005327072 A JP 2005327072A JP 2007135035 A JP2007135035 A JP 2007135035A
Authority
JP
Japan
Prior art keywords
packet
ipv6
ipsec
header
extension header
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
JP2005327072A
Other languages
Japanese (ja)
Inventor
Kenji Kawai
健治 川合
Kouho Nishida
享邦 西田
Keiichi Koike
恵一 小池
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 JP2005327072A priority Critical patent/JP2007135035A/en
Publication of JP2007135035A publication Critical patent/JP2007135035A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To transmit and receive IPsec packets speedily, and also IPsec packets to which an extension header is added. <P>SOLUTION: When the IPsec packet having an extension header is transmitted, a CPU 650 generates an IPv6 encapsulated packet where an internal IP packet is encapsulated and the extension header is added. An IPsec circuit 620 adds an ESP header to the packet, rewrites the information of payload length in an IP header, and generates an IPv6 IPsec packet having the extension header. When the IPv6 IPsec packet having the extension header is received, the IPsec circuit 620 acquires the internal IP packet by decoding processing, and rewrites the next header in the extension header and the payload length in the IP header of the IPsec packet. The IPv6 encapsulated packet having the extension header and the rewritten IP header and the extension with the internal encapsulated IP packet is output to the CPU 650. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、IPsecパケットを送受信する通信装置及びパケット処理方法に関する。   The present invention relates to a communication apparatus and a packet processing method for transmitting / receiving an IPsec packet.

近年、IP(Internet Protocol)通信を安全に行うために、IPパケットの認証・暗号化を行うIPsec(Security Architecture for Internet Protocol)が使用されている。   In recent years, IPsec (Security Architecture for Internet Protocol), which authenticates and encrypts IP packets, has been used to perform IP (Internet Protocol) communication safely.

図9は、IPsecパケットの構成を説明するための図である。IPsecには、トンネルモードとトランスポートモードがあるが、ここでは、トンネルモードについてのみ説明する。
なお、本明細書においては、OSI(Open Systems Interconnection)参照モデルの第2層にあたるデータリンク層において送受信されるデータをフレームと記載し、第3層において送受信されるデータ、すなわちフレームからMAC(Media Access Control)ヘッダやVLAN(Virtual Local Area Network)ヘッダを除いたものをパケットと記載する。例えば、IPパケットは、IPヘッダ及びIPデータからなる。
FIG. 9 is a diagram for explaining the configuration of an IPsec packet. IPsec has a tunnel mode and a transport mode. Here, only the tunnel mode will be described.
In this specification, data transmitted / received in the data link layer corresponding to the second layer of the OSI (Open Systems Interconnection) reference model is described as a frame, and data transmitted / received in the third layer, that is, from the frame to the MAC (Media A packet excluding an Access Control) header and a VLAN (Virtual Local Area Network) header is described as a packet. For example, an IP packet consists of an IP header and IP data.

IPsecは、IPにESP(Encapsulating Security Payload)などのプロトコルを追加して構成される。送受信データを暗号化する場合、トンネルモードのIPsecでは、IPパケット710を暗号化して暗号化パケット720を生成し、トレーラ730を付加する。さらに、新たなIPヘッダ740及びIPsecヘッダ750を付加して、暗号化パケット720及びトレーラ730がカプセル化されたIPsecパケットを生成する。ここでは、IPsecパケットに設定される新たなIPヘッダ740を外側IPヘッダとよび、外側IPヘッダがIPv6を用いている場合は、外側IPv6ヘッダと記載する。ESPを用いる場合、IPsecヘッダ750にはESPヘッダが用いられる。ESPヘッダは、SPI(セキュリティパラメータインデックス)と、シーケンス番号からなる。SPIは、IPsecにおける論理的なコネクションであるSA(セキュリティアソシエーション)を管理するSAD(セキュリティアソシエーションデータベース)の検索に用いられる値を示す。また、シーケンス番号は、パケットの順番を示す。   IPsec is configured by adding a protocol such as ESP (Encapsulating Security Payload) to IP. When the transmission / reception data is encrypted, in IPsec in the tunnel mode, the IP packet 710 is encrypted to generate an encrypted packet 720, and a trailer 730 is added. Further, a new IP header 740 and an IPsec header 750 are added to generate an IPsec packet in which the encrypted packet 720 and the trailer 730 are encapsulated. Here, the new IP header 740 set in the IPsec packet is called an outer IP header, and when the outer IP header uses IPv6, it is described as an outer IPv6 header. When ESP is used, an ESP header is used as the IPsec header 750. The ESP header includes an SPI (security parameter index) and a sequence number. The SPI indicates a value used for searching a SAD (Security Association Database) that manages SA (Security Association) that is a logical connection in IPsec. The sequence number indicates the order of packets.

暗号化に用いられるアルゴリズムには、NULL暗号アルゴリズム(暗号化機能を使用しない)、CBC−AES(Cipher Block Chaining - Advanced Encryption Standard)などがある。CBC−AESを使用する場合、次の暗号化に用いるための情報であるIV(初期ベクトル)760がIPsecヘッダ(ESPヘッダ)750と暗号化パケット720との間に設定される。また、暗号化パケット720を生成する際は、IPパケット710にパディングを行って暗号化する。IPパケット710へパディングする長さは、生成された暗号化パケット720とトレーラ730を合わせた長さが、所定のバイト数の整数倍となるように決められる。トレーラ730は、パディング長と、次ヘッダの情報とを含むデータであり、NULL暗号アルゴリズム以外では暗号化される。パディング長とは、暗号化パケット720を生成する際にIPパケット710に行ったパディングの長さを示す。また、次ヘッダとは、パケット内でIPsecヘッダ(ESPヘッダ)750の次に来るヘッダのプロトコルを示し、同図においては、トンネルモードであるのでIPを示す値が設定される。認証を行う場合は、認証データであるICV(Integrity Check Value)770がトレーラ730の後ろに付加される。   Examples of algorithms used for encryption include a NULL encryption algorithm (which does not use an encryption function), CBC-AES (Cipher Block Chaining-Advanced Encryption Standard), and the like. When using CBC-AES, an IV (initial vector) 760 that is information used for the next encryption is set between the IPsec header (ESP header) 750 and the encrypted packet 720. When generating the encrypted packet 720, the IP packet 710 is padded and encrypted. The length of padding to the IP packet 710 is determined such that the total length of the generated encrypted packet 720 and trailer 730 is an integral multiple of a predetermined number of bytes. The trailer 730 is data including the padding length and the next header information, and is encrypted except for the NULL encryption algorithm. The padding length indicates the length of padding performed on the IP packet 710 when the encrypted packet 720 is generated. Further, the next header indicates the protocol of the header that comes after the IPsec header (ESP header) 750 in the packet, and in this figure, since it is a tunnel mode, a value indicating IP is set. When performing authentication, an ICV (Integrity Check Value) 770 that is authentication data is added after the trailer 730.

IPsecを搭載する従来の装置の構成には、ルックアサイド型とインライン型の2つがある(例えば、非特許文献1参照)。
図10は、ルックアサイド型のIPsec回路を搭載したパケット転送装置の構成を示すブロック図である。同図においては、CPU(Central Processing Unit)、IPsecのパケットを含むフレームを送受信する第1LAN(Local Area Network)ポート、IPパケットを含むフレームを送受信する第2LANポート、及び、IPsec回路がバスを介して接続されている。この構成において、CPUが第1LANポートからIPsecパケットを受信してデカプセル化を含むパケットヘッダ処理を行い(ステップS1001)、暗号化データをIPsec回路に転送する(ステップS1002)。IPsec回路は、復号したデータをCPUに転送し(ステップS1003)、CPUから第2LANポートへ復号されたIPパケットが転送されて送信処理が行われる(ステップS1004)。
There are two types of configurations of a conventional apparatus equipped with IPsec: a look-aside type and an inline type (see Non-Patent Document 1, for example).
FIG. 10 is a block diagram showing a configuration of a packet transfer apparatus equipped with a look-aside type IPsec circuit. In the figure, a CPU (Central Processing Unit), a first LAN (Local Area Network) port that transmits and receives frames including IPsec packets, a second LAN port that transmits and receives frames including IP packets, and an IPsec circuit are connected via a bus. Connected. In this configuration, the CPU receives an IPsec packet from the first LAN port, performs packet header processing including decapsulation (step S1001), and transfers the encrypted data to the IPsec circuit (step S1002). The IPsec circuit transfers the decrypted data to the CPU (step S1003), and the decrypted IP packet is transferred from the CPU to the second LAN port for transmission processing (step S1004).

このように、同図に示すパケット転送装置では、CPUがIPsecパケットを送受信し、暗号・復号・認証の各定型処理のみをワイヤードロジックにより構成されるIPsec回路により処理させている。CPU上で実行されたソフトウェアによってカプセル化やデカプセル化などを含むパケットヘッダ処理が行われるため、多様なパケット形式に対して対応できるという柔軟性がある。しかし、受信したパケットデータは、バスを介して、CPU/メモリ/IPsec回路間を複数回転送される。このため、バス性能がパケット処理能力を制限するとともに、パケットヘッダ処理のためのCPU負荷が大きくなる。   As described above, in the packet transfer apparatus shown in the figure, the CPU transmits / receives an IPsec packet, and only the fixed processing of encryption / decryption / authentication is processed by the IPsec circuit configured by wired logic. Since packet header processing including encapsulation and decapsulation is performed by software executed on the CPU, there is flexibility in that it can cope with various packet formats. However, the received packet data is transferred multiple times between the CPU / memory / IPsec circuit via the bus. For this reason, the bus performance limits the packet processing capability, and the CPU load for packet header processing increases.

図11は、インライン型IPsec回路を搭載したパケット転送装置の構成を示すブロック図である。同図においては、IPsecのパケットを含むフレームを送受信する第1LANポートと、IPsec回路とが直接接続されており、IPsec回路、CPU、及び、IPパケットを含むフレームを送受信する第2LANポートがバスを介して接続されている。この構成において、IPsec回路が第1LANポートからIPsecのパケットを受信してデカプセル化を含むパケットヘッダ処理と、復号・認証処理を行い(ステップS1011)、デカプセル化したパケットをCPUに転送する(ステップS1012)。そして、CPUからLANポートにIPパケットが転送されて送信処理が行われる(ステップS1013)。   FIG. 11 is a block diagram showing a configuration of a packet transfer apparatus equipped with an inline IPsec circuit. In the figure, a first LAN port for transmitting and receiving a frame including an IPsec packet is directly connected to an IPsec circuit, and a second LAN port for transmitting and receiving a frame including an IPsec packet is connected to the bus. Connected through. In this configuration, the IPsec circuit receives an IPsec packet from the first LAN port, performs packet header processing including decapsulation, and decryption / authentication processing (step S1011), and transfers the decapsulated packet to the CPU (step S1012). ). Then, the IP packet is transferred from the CPU to the LAN port, and transmission processing is performed (step S1013).

このように、同図に示すパケット転送装置では、IPsec回路が、暗号、復号、認証の各定型処理のみならず、パケットの送受信と前記パケットに対するパケットヘッダ処理を行うため、CPUの割り込みがなく、負荷が軽減されるとともに、パケットデータがバス962を介して転送される回数が軽減する。
東京エレクトロンデバイス株式会社、“東京エレクトロンデバイスニュース”、[online]、[平成17年8月3日]、インターネット<URL: http://www.teldevice.co.jp/tednews/Vol-78/engineer.html>
As described above, in the packet transfer apparatus shown in the figure, since the IPsec circuit performs not only encryption, decryption, and authentication routine processing but also packet transmission / reception and packet header processing for the packet, there is no CPU interruption, The load is reduced and the number of times packet data is transferred via the bus 962 is reduced.
Tokyo Electron Device Co., Ltd., “Tokyo Electron Device News”, [online], [August 3, 2005], Internet <URL: http://www.teldevice.co.jp/tednews/Vol-78/engineer .html>

上述したインライン型のIPsec回路は、高速処理が可能となる。しかし、IPsec回路はハードウェア処理で実現されているため、パケットヘッダ処理が定型処理となり、例外的なパケット構造には対応できないという問題があった。特に、IPv6ルータ装置のIPsec回路はトンネルモードのIPsecパケットを処理するが、カプセル化やデカプセル化の処理をIPsec回路が行うため、カプセル化後の外側IPv6ヘッダに拡張ヘッダを追加して送信することや、拡張ヘッダが追加されたパケットを受信したとき、その拡張ヘッダ内容に応じた拡張ヘッダ処理を行うことができないという問題がっあた。   The above-described inline type IPsec circuit can perform high-speed processing. However, since the IPsec circuit is realized by hardware processing, the packet header processing becomes a standard processing, and there is a problem that an exceptional packet structure cannot be handled. In particular, the IPsec circuit of the IPv6 router device processes the tunnel mode IPsec packet. However, since the IPsec circuit performs the encapsulation and decapsulation processing, an extension header is added to the encapsulated outer IPv6 header and transmitted. In addition, when a packet with an extension header added is received, the extension header processing corresponding to the contents of the extension header cannot be performed.

また、受信したIPパケットに対して、外側IPヘッダ等を付加するIPsecカプセル化を行うため、IPsecカプセル化前のフレーム長よりもIPsecカプセル化後のフレーム長が大きくなるが、IPsecカプセル化前後の両フレームとも、データリンク層の最大フレーム長を超えることができない。このため、IPsecカプセル化前のフレーム長がデータリンク層の最大フレーム長に近い場合、IPsecカプセル化後のフレーム長は前記最大フレーム長を超えてしまう。このままでは送信できないため、通常は、受信したIPパケットを分割した後、IPsecカプセル化して送信し、前記IPsecパケットを受信したときにIPsecデカプセル化して、分割されたIPパケットを取得し、これらを再構成して分割前のIPパケットに戻している(第1の方法)。あるいは、受信したIPパケットをIPsecカプセル化した後分割して送信し、前記分割されたIPsecパケットを受信したとき、これらを再構成して分割前のIPsecパケットに戻した後、IPsecデカプセル化してIPパケットを取得している(第2の方法)。ここで、前記分割処理や再構成処理は複雑であるため、回路規模が増大するハードウェア処理よりも、ソフトウェア処理が望ましい。また、計算量が多いIPsecカプセル化やデカプセル化の処理はハードウェア処理が望ましい。しかし、第1の方法は、分割禁止ビットが立っていないIPv4パケットに限られるという問題があった。また、第2の方法は、IPsec処理の後に分割処理を行って送信し、また、受信パケットの再構成処理の後にIPsec処理を行う必要があるため、ハードウェアによる送受信とIPsec処理の間に、ソフトウェアによる分割処理や再構成処理が入り、インライン型のIPsec処理が困難になるという問題があった。
なお、IPv6パケットの拡張ヘッダには、ホップバイホップ・オプション、デスティネーション・オプション、ルーティング、フラグメント、認証(Authentication)、ESPなどがあるが、詳細は、IETF(Internet Engineering Task Force) RFC(Request For Comments) 2460を参照のこと。
In addition, since the IPsec encapsulation that adds the outer IP header or the like is performed on the received IP packet, the frame length after the IPsec encapsulation becomes larger than the frame length before the IPsec encapsulation, but before and after the IPsec encapsulation. Both frames cannot exceed the maximum frame length of the data link layer. For this reason, when the frame length before IPsec encapsulation is close to the maximum frame length of the data link layer, the frame length after IPsec encapsulation exceeds the maximum frame length. Since it cannot be transmitted as it is, normally, the received IP packet is divided and then encapsulated and transmitted. When the IPsec packet is received, it is decapsulated to obtain the divided IP packets, and these are re-sent. It is configured and returned to the IP packet before division (first method). Alternatively, the received IP packet is encapsulated and transmitted after being divided, and when the divided IPsec packet is received, these are reconstructed and returned to the pre-divided IPsec packet, and then decapsulated into the IP A packet is acquired (second method). Here, since the division processing and the reconfiguration processing are complicated, software processing is preferable to hardware processing in which the circuit scale increases. Also, hardware processing is desirable for IPsec encapsulation and decapsulation processing with a large calculation amount. However, the first method has a problem that it is limited to IPv4 packets in which no division prohibition bit is set. In addition, the second method performs transmission after dividing processing after IPsec processing, and also needs to perform IPsec processing after reconfiguration processing of the received packet. Therefore, between hardware transmission / reception and IPsec processing, There is a problem that inline IPsec processing becomes difficult due to software division processing and reconfiguration processing.
The extension header of the IPv6 packet includes a hop-by-hop option, a destination option, routing, fragment, authentication (Authentication), ESP, and the like. For details, refer to IETF (Internet Engineering Task Force) RFC (Request For Comments) See 2460.

本発明は、上記問題を解決するためになされたもので、その目的は、高速なIPsecパケットの送受信処理を行うとともに、拡張ヘッダが付加されたIPSecパケットや、フラグメントを伴うIPsecパケットについても送受信処理を行うことができる通信装置及びパケット処理方法を提供することにある。   The present invention has been made in order to solve the above-described problems. The object of the present invention is to perform high-speed IPsec packet transmission / reception processing, as well as transmission / reception processing for IPSec packets with an extension header added and IPsec packets with fragments. It is an object of the present invention to provide a communication apparatus and a packet processing method capable of performing the above.

上記問題を解決するために、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを送信する通信装置において、前記内側IPパケットをIPv6カプセル化したIPv6カプセル化パケットに対して前記拡張ヘッダを付加した拡張ヘッダ付IPv6カプセル化パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力するソフトウェア処理部と、前記ソフトウェア処理部により出力されたIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記IPv6パケットの内側IPパケットに対してESP暗号処理を行い、拡張ヘッダ付IPv6 IPsecパケットとして出力するIPsec処理部と、前記IPsec処理部により出力された拡張ヘッダ付IPv6 IPsecパケットを送信するインタフェース部と、を備えることを特徴とする通信装置である。   In order to solve the above problem, the present invention transmits an IPv6 IPsec packet with an extension header in which an IP packet is an inner IP packet and IPv6 IPsec encapsulation in ESP tunnel mode is performed and an extension header is added to the outer IPv6 packet. The IPv6 encapsulated packet with the extension header added to the IPv6 encapsulated packet obtained by adding the extension header to the IPv6 encapsulated packet obtained by encapsulating the inner IP packet into the IPv6 encapsulated packet. When the IPv6 encapsulated IPsec transmission information is added to the IPv6 packet output by the software processing unit and the IPv6 packet output by the software processing unit. An IPsec processing unit that performs ESP encryption processing on an inner IP packet of the IPv6 packet and outputs the packet as an IPv6 IPsec packet with an extension header; and an interface unit that transmits the IPv6 IPsec packet with an extension header output by the IPsec processing unit; A communication apparatus comprising:

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを送信する通信装置において、前記IPv6 IPsecパケットの長さがMTUを越える場合に、内側IPパケットをIPv6カプセル化し、前記IPv6カプセル化パケットを各々フラグメント拡張ヘッダが付加された複数のフラグメントIPv6パケットに分割し、前記各フラグメントIPv6パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力するソフトウェア処理部と、前記ソフトウェア処理部により出力されたフラグメントIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記フラグメントIPv6パケットのフラグメント拡張ヘッダ以後のデータに対してESP暗号処理を行い、IPv6 IPsecパケットとして出力するIPsec処理部と、前記IPsec処理部により出力されたIPv6 IPsecパケットを送信するインタフェース部と、を備えることを特徴とする通信装置である。   Also, the present invention provides a communication apparatus that transmits an IPv6 IPsec packet that has been encapsulated with an IPv6 IPsec in ESP tunnel mode using the IP packet as an inner IP packet, and when the length of the IPv6 IPsec packet exceeds the MTU, The packet is IPv6 encapsulated, the IPv6 encapsulated packet is divided into a plurality of fragment IPv6 packets each having a fragment extension header added thereto, and each fragment IPv6 packet is an IPv6 encapsulated packet for IPsec transmission processing. A software processing unit that adds and outputs the IPv6 encapsulated IPsec transmission information indicating, and the fragment IPv6 packet output by the software processing unit to the IPv6 encapsulated I When the sec transmission information is added, the ESP encryption processing is performed on the data after the fragment extension header of the fragment IPv6 packet, and output as an IPv6 IPsec packet, and output by the IPsec processing unit And an interface unit that transmits an IPv6 IPsec packet.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを受信する通信装置において、IPv6 IPsecパケットを受信し出力するインタフェース部と、前記インタフェース部により出力されたIPv6 IPsecパケットが、拡張ヘッダが付加されたIPsec受信処理対象のパケットであることを検出し、前記検出されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードのIPパケットを内側IPパケットとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもち、前記拡張ヘッダが付加された、拡張ヘッダ付IPv6カプセル化パケットを出力するIPsec処理部と、前記IPsec処理部から出力された拡張ヘッダ付IPv6カプセル化パケットの拡張ヘッダに基づく所定の拡張ヘッダ処理を行い、前記拡張ヘッダ付IPv6カプセル化パケットをデカプセル化して内側IPパケットを取得するソフトウェア処理部と、を備えることを特徴とする通信装置である。   The present invention also relates to a communication apparatus that receives an IPv6 IPsec packet with an extension header in which an IPv6 IPsec encapsulation in an ESP tunnel mode is performed using an IP packet as an inner IP packet, and an extension header is added to the outer IPv6 packet. An interface unit that receives and outputs an IPsec packet, and detects that the IPv6 IPsec packet output by the interface unit is an IPsec reception processing target packet to which an extension header is added, and includes the detected IPv6 IPsec packet. ESP decryption processing is performed, the IP packet of the ESP payload is set as the inner IP packet, the IPv6 header of the IPv6 IPsec packet has the outer IPv6 header, and the extension header is added. An IPv6 encapsulation packet with a header, an IPv6 encapsulation packet with an extension header, and a predetermined extension header process based on the extension header of the IPv6 encapsulation packet with an extension header output from the IPsec processing unit. And a software processing unit that decapsulates the packet to obtain an inner IP packet.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを受信する通信装置において、IPv6 IPsecパケットを受信し出力するインタフェース部と、
前記インタフェース部により出力されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードの先頭にフラグメント拡張ヘッダが付加されていることを検出し、前記検出されたデータをペイロードとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもつ、フラグメントIPv6パケットを出力するIPsec処理部と、1個のIPv6パケットから分割された複数の前記フラグメントIPv6パケットを収集し、再構成を行って分割前のIPv6パケットを取得し、前記IPv6パケットがIPパケットをIPv6カプセル化されたIPv6カプセル化パケットであることを検出して、前記検出されたIPv6カプセル化パケットをデカプセル化して内側IPパケットを取得するソフトウェア処理部と、を備えることを特徴とする通信装置である。
Further, the present invention provides an interface unit that receives and outputs an IPv6 IPsec packet in a communication device that receives an IPv6 IPsec packet that has undergone IPv6 IPsec encapsulation in an ESP tunnel mode using the IP packet as an inner IP packet;
ESP decoding processing is performed on the IPv6 IPsec packet output by the interface unit, and it is detected that a fragment extension header is added to the head of the ESP payload. The detected data is used as the payload, and the IPv6 IPsec packet is detected. An IPv6 header in the outer IPv6 header and outputting a fragment IPv6 packet, and collecting a plurality of the fragmented IPv6 packets divided from one IPv6 packet, reconfiguring the IPv6 packet before the division And detecting that the IPv6 packet is an IPv6 encapsulated packet obtained by encapsulating an IPv6 packet into an IPv6 packet, and decapsulating the detected IPv6 encapsulated packet to obtain an inner IP packet. And Towea processor, a communication device, characterized in that it comprises a.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを送信する通信装置に用いられるパケット処理方法であって、ソフトウェア処理部が、前記内側IPパケットをIPv6カプセル化したIPv6カプセル化パケットに対して前記拡張ヘッダを付加した拡張ヘッダ付IPv6カプセル化パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力し、IPsec処理部が、前記ソフトウェア処理部により出力されたIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記IPv6パケットの内側IPパケットに対してESP暗号処理を行い、拡張ヘッダ付IPv6 IPsecパケットとして出力し、インタフェース部が、前記IPsec処理部により出力された拡張ヘッダ付IPv6 IPsecパケットを送信する、ことを特徴とするパケット処理方法である。   Further, the present invention is used for a communication apparatus that performs IPv6 IPsec encapsulation in ESP tunnel mode using an IP packet as an inner IP packet, and transmits an IPv6 IPsec packet with an extension header in which an extension header is added to the outer IPv6 packet. A packet processing method, wherein a software processing unit transmits an IPv6-encapsulated IPsec packet to an IPv6 encapsulated packet with an extension header obtained by adding the extension header to an IPv6 encapsulated packet obtained by encapsulating the inner IP packet with IPv6 IPv6 encapsulated IPsec transmission information indicating that the packet is a processing target is added and output, and the IPsec processing unit transmits the IPv6 encapsulated IPsec transmission to the IPv6 packet output by the software processing unit. When information is added, ESP encryption processing is performed on the inner IP packet of the IPv6 packet, and output as an IPv6 IPsec packet with an extension header. The interface unit has an extension header output by the IPsec processing unit. A packet processing method characterized by transmitting an IPv6 IPsec packet.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを送信する通信装置用いられるパケット処理方法であって、ソフトウェア処理部が、前記IPv6 IPsecパケットの長さがMTUを越える場合に、内側IPパケットをIPv6カプセル化し、前記IPv6カプセル化パケットを各々フラグメント拡張ヘッダが付加された複数のフラグメントIPv6パケットに分割し、前記各フラグメントIPv6パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力し、IPsec処理部が、前記ソフトウェア処理部により出力されたフラグメントIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記フラグメントIPv6パケットのフラグメント拡張ヘッダ以後のデータに対してESP暗号処理を行い、IPv6 IPsecパケットとして出力し、インタフェース部が、前記IPsec処理部により出力されたIPv6 IPsecパケットを送信する、ことを特徴とするパケット処理方法である。   The present invention also relates to a packet processing method used in a communication apparatus for transmitting an IPv6 IPsec packet obtained by encapsulating an IPv6 IPsec in ESP tunnel mode using an IP packet as an inner IP packet, wherein a software processing unit includes the IPv6 IPsec packet. When the length of the packet exceeds the MTU, the inner IP packet is IPv6 encapsulated, the IPv6 encapsulated packet is divided into a plurality of fragment IPv6 packets each having a fragment extension header added thereto, and each of the fragment IPv6 packets has an IPv6 capsule. IPv6 encapsulated IPsec transmission information indicating that the packet is a target packet for IPsec transmission processing is added and output, and the IPsec processing unit outputs the fragment sent by the software processing unit. When IPv6 encapsulated IPsec transmission information is added to the IPv6 packet, ESP encryption processing is performed on the data after the fragment extension header of the fragment IPv6 packet, and output as an IPv6 IPsec packet. An IPv6 IPsec packet output by the IPsec processing unit is transmitted.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを受信する通信装置に用いられるパケット処理方法であって、インタフェース部が、IPv6 IPsecパケットを受信して出力し、IPsec処理部が、前記インタフェース部により出力されたIPv6 IPsecパケットが、拡張ヘッダが付加されたIPsec受信処理対象のパケットであることを検出して、前記検出されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードのIPパケットを内側IPパケットとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもち、前記拡張ヘッダが付加された、拡張ヘッダ付IPv6カプセル化パケットを出力し、前記ソフトウェア処理部が、前記IPsec処理部から出力された拡張ヘッダ付IPv6カプセル化パケットの拡張ヘッダに基づく所定の拡張ヘッダ処理を行い、前記拡張ヘッダ付IPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する、ことを特徴とするパケット処理方法である。   Further, the present invention is used in a communication apparatus that receives an IPv6 IPsec packet with an extension header in which an IPv6 IPsec encapsulation in an ESP tunnel mode is performed using an IP packet as an inner IP packet, and an extension header is added to the outer IPv6 packet. A packet processing method in which an interface unit receives and outputs an IPv6 IPsec packet, and an IPsec processing unit outputs an IPv6 IPsec packet output by the interface unit as a packet subjected to IPsec reception processing to which an extension header is added. , The ESP decoding process is performed on the detected IPv6 IPsec packet, the IP packet of the ESP payload is set as the inner IP packet, and the IPv6 header of the IPv6 IPsec packet is set as the outer I packet. An IPv6 encapsulated packet with an extension header having the extension header added to the v6 header is output, and the software processing unit is based on the extension header of the IPv6 encapsulated packet with an extension header output from the IPsec processing unit. A packet processing method characterized by performing predetermined extension header processing and decapsulating the IPv6 encapsulated packet with extension header to obtain an inner IP packet.

また、本発明は、IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを受信する通信装置に用いられるパケット処理方法であって、インタフェース部が、IPv6 IPsecパケットを受信して出力し、IPsec処理部が、前記インタフェース部により出力されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードの先頭にフラグメント拡張ヘッダが付加されていることを検出して、前記検出されたデータをペイロードとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもつ、フラグメントIPv6パケットを出力し、ソフトウェア処理部が、1個のIPv6パケットから分割された複数の前記フラグメントIPv6パケットを収集し、再構成を行って分割前のIPv6パケットを取得し、前記IPv6パケットがIPパケットをIPv6カプセル化されたIPv6カプセル化パケットであることを検出して、前記検出されたIPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する、ことを特徴とするパケット処理方法である。   The present invention also relates to a packet processing method used in a communication apparatus for receiving an IPv6 IPsec packet obtained by performing IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet, wherein the interface unit converts the IPv6 IPsec packet to The IPsec processing unit performs ESP decoding processing on the IPv6 IPsec packet output by the interface unit, detects that a fragment extension header is added to the head of the ESP payload, A fragment IPv6 packet having the detected data as a payload and having an IPv6 header of the IPv6 IPsec packet in an outer IPv6 header is output, and a software processing unit is divided into a plurality of pieces divided from one IPv6 packet. The fragmented IPv6 packet is collected, reassembled to obtain an undivided IPv6 packet, and detected that the IPv6 packet is an IPv6 encapsulated packet obtained by encapsulating an IPv6 packet into an IPv6 packet. A packet processing method characterized in that an IPv6 encapsulated packet is decapsulated to obtain an inner IP packet.

この発明によれば、通信装置は、拡張ヘッダが付加されたIPSecパケットに対して、ハードウェア処理と、ソフトウェアの処理とを組み合わせて、送受信処理を実現することができる。また、本発明では、IPv6カプセル化したパケットを分割するため、内側IPパケットが制約されない。すなわち、受信パケットについてはIPsec処理の後に再構成処理を行い、また、分割処理の後にIPsec処理を行って送信するため、ハードウェアによる送受信とIPsec処理が連続して実施され、インライン型のIPsec処理が可能となる。加えて、IPsecパケットの生成により、送受信可能な信号長を超えてしまう場合には、転送対象のIPパケットを分割して送受信することができる。   According to the present invention, the communication apparatus can realize transmission / reception processing by combining hardware processing and software processing for an IPSec packet to which an extension header is added. In the present invention, since the IPv6 encapsulated packet is divided, the inner IP packet is not restricted. That is, for the received packet, reconfiguration processing is performed after IPsec processing, and transmission is performed by performing IPsec processing after splitting processing. Therefore, hardware transmission / reception and IPsec processing are continuously performed, and inline-type IPsec processing is performed. Is possible. In addition, when the IPsec packet generation exceeds the signal length that can be transmitted / received, the transfer target IP packet can be divided and transmitted / received.

以下、本発明の実施形態を図面を参照して説明する。
本実施の形態においては、OSI(Open Systems Interconnection)参照モデルの第2層にあたるデータリンク層において送受信されるデータをフレームと記載し、第3層において送受信されるデータ、すなわちフレームからMAC(Media Access Control)ヘッダやVLAN(Virtual Local Area Network)ヘッダを除いたものをパケットと記載する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
In the present embodiment, data transmitted and received in the data link layer corresponding to the second layer of the OSI (Open Systems Interconnection) reference model is described as a frame, and data transmitted and received in the third layer, that is, MAC (Media Access) from the frame. A packet excluding a (Control) header and a VLAN (Virtual Local Area Network) header is described as a packet.

図1は、一実施の形態による通信装置の構成を示す図である。
本実施の形態で送受信するIPsecは、IPv6により送受信され、トンネルモードのESP(Encapsulating Security Payload)を使用する。
同図において、IPsec(IP Security Architecture for Internet Protocol)のパケットを含むフレームを送受信する第1LAN(Local Area Network)ポート610(インタフェース部)と、ワイヤードロジックにより構成され、IPsecの処理を行うIPsec回路620(IPsec処理部)とが接続されている。また、IPパケットを含むフレームを送受信する第2LANポート640(インタフェース部)と、IPsec回路620と、CPU(Central Processing Unit)650(ソフトウェア処理部)とが、パケットを転送する転送回路630(転送部)に接続されている。
FIG. 1 is a diagram illustrating a configuration of a communication apparatus according to an embodiment.
IPsec transmitted / received in the present embodiment is transmitted / received by IPv6 and uses ESP (Encapsulating Security Payload) in tunnel mode.
In the figure, an IPsec circuit 620 configured by a wired LAN and a first LAN (Local Area Network) port 610 (interface unit) that transmits and receives a frame including an IPsec (IP Security Architecture for Internet Protocol) packet and performs IPsec processing. (IPsec processing unit) is connected. Further, a second LAN port 640 (interface unit) that transmits and receives a frame including an IP packet, an IPsec circuit 620, and a CPU (Central Processing Unit) 650 (software processing unit) transfer a packet 630 (transfer unit). )It is connected to the.

この構成において、IPsec回路620は、第1LANポート610から受信したIPv6トンネルモードのIPsecパケットに拡張ヘッダが付加されていない場合、デカプセル化を行い(ステップS1)、転送回路630は、デカプセル化されたIPパケットを第2LANポート640へ転送する(ステップS2)。
一方、ステップS1において受信したIPv6トンネルモードのIPsecパケットの外側IPv6ヘッダに拡張ヘッダが付加されている場合、IPsec回路620は、暗号化されている本来のIPパケットを復号し、外側IPv6ヘッダと、拡張ヘッダと、復号したIPパケットがカプセル化されたIPデータとからなる形式のIPv6パケットに変換する。以下、このようにIPパケットがIPv6パケットにカプセル化された形式を、「IP in V6形式」と記載する。IPsec回路620は、IP in IPv6形式のパケットを転送回路630によりCPU650に転送する(ステップS2’)。
In this configuration, the IPsec circuit 620 performs decapsulation when an extension header is not added to the IPsec packet in the IPv6 tunnel mode received from the first LAN port 610 (step S1), and the transfer circuit 630 is decapsulated. The IP packet is transferred to the second LAN port 640 (step S2).
On the other hand, when the extension header is added to the outer IPv6 header of the IPsec packet in the IPv6 tunnel mode received in step S1, the IPsec circuit 620 decrypts the encrypted original IP packet, The packet is converted into an IPv6 packet having a format including an extension header and IP data obtained by encapsulating the decrypted IP packet. Hereinafter, a format in which an IP packet is encapsulated in an IPv6 packet in this way is referred to as an “IP in V6 format”. The IPsec circuit 620 transfers the IP in IPv6 format packet to the CPU 650 by the transfer circuit 630 (step S2 ′).

上記のように、高速のパケット転送を行うため、通信装置100がCPU650ではなく、ハードウェア(転送回路630)によるパケット転送を行う場合、転送回路630は、例外的な拡張ヘッダ処理を行うことができないため、IP in IPv6形式に変換したパケットについてはCPU650に転送し、通常のデカプセル化されたパケットについては、CPU650を介さずに、ハードウェアによるLANポート640へパケットの転送を行う。   As described above, when the communication apparatus 100 performs packet transfer by hardware (transfer circuit 630) instead of the CPU 650 in order to perform high-speed packet transfer, the transfer circuit 630 may perform exceptional extension header processing. Since the packet cannot be converted to the IP in IPv6 format, the packet is transferred to the CPU 650, and the normal decapsulated packet is transferred to the LAN port 640 by hardware without going through the CPU 650.

図2は、LAN(Local Area Network)及びWAN(Wide Area Network)に接続される通信装置100の詳細な構成を示すブロック図である。
通信装置100は、GMII(Gigabit Medium Independent Interface)やMII(Medium Independent Interface)の規格のインタフェースを介してWANに接続する物理I/F(Interface)500及びLANに接続する物理I/F501と接続し、LAN側から送信されるパケットをWAN側へ転送し、また、WAN側から送信されるパケットをLAN側へ転送する。本実施形態の通信装置100では、OSIの第3層にあたるネットワーク層では、IPv4あるいはIPv6のパケットの送受信を行い、OSIの第2層にあたるデータリンク層では、イーサネット(登録商標)のフレームの送受信を行う。
FIG. 2 is a block diagram illustrating a detailed configuration of the communication apparatus 100 connected to a LAN (Local Area Network) and a WAN (Wide Area Network).
The communication apparatus 100 is connected to a physical I / F (Interface) 500 connected to a WAN and a physical I / F 501 connected to a LAN via an interface of GMII (Gigabit Medium Independent Interface) or MII (Medium Independent Interface) standards. The packet transmitted from the LAN side is transferred to the WAN side, and the packet transmitted from the WAN side is transferred to the LAN side. In the communication apparatus 100 of the present embodiment, IPv4 or IPv6 packets are transmitted and received in the network layer corresponding to the third layer of OSI, and Ethernet (registered trademark) frames are transmitted and received in the data link layer corresponding to the second layer of OSI. Do.

通信装置100は、転送処理の高速化を図るため半導体素子で構成される通信処理回路200と、CPU400と、DDR−SDRAM(Double Data Rate-Synchronous Dynamic Random Access Memory)300とを備えている。   The communication device 100 includes a communication processing circuit 200 composed of semiconductor elements, a CPU 400, and a DDR-SDRAM (Double Data Rate-Synchronous Dynamic Random Access Memory) 300 in order to speed up transfer processing.

DDR−SDRAM300は、半導体記憶素子であり、一定容量値、例えば2キロバイトごとに領域分割され、フレーム長が長いフレームであっても、短いフレームであっても分割した1つの領域を割り当てて記憶する。なお、分割されたそれぞれの領域は、後述するハンドル管理部255が付与するハンドル番号に対応付けられる。   The DDR-SDRAM 300 is a semiconductor memory element, and is divided into areas each having a constant capacity value, for example, 2 kilobytes, and allocates and stores one divided area regardless of whether the frame length is long or short. . Each divided area is associated with a handle number assigned by a handle management unit 255 described later.

CPU400は、主に通信処理回路200で転送処理を行うことができないフレームを通信処理回路200から受信し、受信したフレームに対する転送先を検出する等の処理を予め内部で動作するソフトウェアに基づいて行う。CPU400が備えるドライバ400aは、通信処理回路200がCPU400に入力するパケットのCPU400の内部のメモリへの書き込み及び読み出しを行い、また、通信処理回路200の各機能部の動作を制御する情報の設定を各機能部に対して行う。   The CPU 400 mainly receives a frame that cannot be transferred by the communication processing circuit 200 from the communication processing circuit 200 and performs processing such as detecting a transfer destination for the received frame based on software that operates in advance. . The driver 400a included in the CPU 400 writes and reads packets input to the CPU 400 by the communication processing circuit 200 to / from the internal memory of the CPU 400, and sets information for controlling the operation of each function unit of the communication processing circuit 200. Perform for each functional unit.

通信処理回路200において、WAN用MAC(Media Access Control) I/F205は、WANに接続される物理I/F500へ接続する接続インタフェースである。LAN用MAC I/F275は、LANに接続される物理I/F501へ接続する接続インタフェースである。WAN用MAC I/F205及び、LAN用MAC I/F275は、上記したGII及びMIIに準拠した規格を有し、送受信するイーサネット(登録商標)のフレーム(以下、フレームと記載)に対してIEEE802.3準拠のMAC処理を行い、また、物理I/F500あるいは501との間で送受信されるフレームに対してCRC(Cyclic Redundancy Check)処理などを行う。   In the communication processing circuit 200, a WAN MAC (Media Access Control) I / F 205 is a connection interface connected to a physical I / F 500 connected to the WAN. The LAN MAC I / F 275 is a connection interface connected to the physical I / F 501 connected to the LAN. The WAN MAC I / F 205 and the LAN MAC I / F 275 have standards conforming to the above-described GII and MII, and are used for an Ethernet (registered trademark) frame (hereinafter referred to as a frame) to be transmitted and received. 3 compliant MAC processing is performed, and CRC (Cyclic Redundancy Check) processing is performed on a frame transmitted / received to / from the physical I / F 500 or 501.

IPsec部210は、WAN用MAC I/F205、書き込みスケジューラ部215、及び、フレーム生成部260に接続される。IPsec部210は、RFC(Request for Comments)2406準拠のIPsec処理に基づき、WANに送信するパケットに対して暗号処理を行い、また、WANから受信するパケットに対して復号処理を行う。ここで、RFC2406準拠のIPsec処理とは、RFC2403/2404準拠のHMAC−MD5(Keyed Hashing for Message Authentication Code-Message Digest 5)やHMAC−SHA−1(HMAC-Secure Hash Algorithm-1)の認証機能や、RFC2410/2451のNULL,CBC−AES(Cipher Block Chaining - Advanced Encryption Standard)の暗号機能などによるIPv4及びIPv6パケットに対する暗号及び復号処理である。   The IPsec unit 210 is connected to the WAN MAC I / F 205, the write scheduler unit 215, and the frame generation unit 260. The IPsec unit 210 performs encryption processing on a packet transmitted to the WAN and decryption processing on a packet received from the WAN, based on an RFC processing conforming to RFC (Request for Comments) 2406. Here, RFC2406-compliant IPsec processing refers to RFC2403 / 2404-compliant HMAC-MD5 (Keyed Hashing for Message Authentication Code-Message Digest 5) and HMAC-SHA-1 (HMAC-Secure Hash Algorithm-1) authentication functions, This is encryption and decryption processing for IPv4 and IPv6 packets by using the encryption function of RFC 2410/2451 NULL, CBC-AES (Cipher Block Chaining-Advanced Encryption Standard).

書き込みスケジューラ部215は、IPsec部210と、LAN用MAC I/F275と、CPU400に接続するCPU I/F265とに接続され、ラウンドロビン方式により、IPsec部210と、LAN用MAC I/F275と、CPU I/F265の順に、これら3つの機能部によって情報が付加されたフレーム(以下、前記3つの機能部によって情報が付加されたフレームをフレーム情報と記載)を出力する。   The write scheduler unit 215 is connected to the IPsec unit 210, the LAN MAC I / F 275, and the CPU I / F 265 connected to the CPU 400, and in a round robin manner, the IPsec unit 210, the LAN MAC I / F 275, In the order of the CPU I / F 265, a frame to which information is added by these three function units (hereinafter, a frame to which information is added by the three function units will be described as frame information) is output.

CPU I/F265は、通信処理回路200の各機能部と、書き込みスケジューラ部215と、メモリコントローラ部220とCPU400とに接続され、CPU400から出力されるフレームを書き込みスケジューラ部215に入力する。CPU400が通信処理回路200の各機能部に対して設定を行う際、CPU I/F265は、設定情報を該当する機能部に入力する。また、メモリコントローラ部220から出力されるフレーム情報をCPU400に入力する。   The CPU I / F 265 is connected to each functional unit of the communication processing circuit 200, the write scheduler unit 215, the memory controller unit 220, and the CPU 400, and inputs a frame output from the CPU 400 to the write scheduler unit 215. When the CPU 400 performs setting for each function unit of the communication processing circuit 200, the CPU I / F 265 inputs setting information to the corresponding function unit. Further, frame information output from the memory controller unit 220 is input to the CPU 400.

DDR−SDRAM I/F225は、メモリコントローラ部220とDDR−SDRAM300に接続され、メモリコントローラ部220とDDR−SDRAM300の間でフレームの入出力を行う。   The DDR-SDRAM I / F 225 is connected to the memory controller unit 220 and the DDR-SDRAM 300, and performs frame input / output between the memory controller unit 220 and the DDR-SDRAM 300.

メモリコントローラ部220は、書き込みスケジューラ部215と、フレーム生成部260と、DDR−SDRAM I/F225と、パーサ部230と、ハンドル管理部255と、QoS部250とに接続されている。メモリコントローラ部220は、書き込みスケジューラ部215から入力されるフレーム情報に対し、ハンドル管理部255から付与された空きハンドルのハンドル番号に対応するDDR−SDRAM300の分割された領域に、DDR−SDRAM I/F225を介してDDR−SDRAM300に書き込む。また、メモリコントローラ部220は、書き込みスケジューラ部215から入力されるフレーム情報に対し、ハンドル管理部255から付与されたハンドル番号を付加してパーサ部230に出力する。また、メモリコントローラ部220は、後述するQoS部250から出力されるジョブ情報に含まれるハンドル番号に対応するDDR−SDRAM300の領域からDDR−SDRAM I/F225を介してフレーム情報を読み出し、読み出したフレーム情報に対してジョブ情報に基づく情報を付加し、フレーム生成部260に出力、あるいはCPU I/F265を介してCPU400に出力する。   The memory controller unit 220 is connected to the write scheduler unit 215, the frame generation unit 260, the DDR-SDRAM I / F 225, the parser unit 230, the handle management unit 255, and the QoS unit 250. For the frame information input from the write scheduler unit 215, the memory controller unit 220 stores the DDR-SDRAM I / O in the divided area of the DDR-SDRAM 300 corresponding to the handle number of the empty handle given from the handle management unit 255. Write to the DDR-SDRAM 300 via F225. Further, the memory controller unit 220 adds the handle number given from the handle management unit 255 to the frame information input from the write scheduler unit 215 and outputs the frame information to the parser unit 230. In addition, the memory controller unit 220 reads frame information from the DDR-SDRAM 300 area corresponding to the handle number included in the job information output from the QoS unit 250 described later via the DDR-SDRAM I / F 225, and reads the read frame information. Information based on job information is added to the information and output to the frame generation unit 260 or output to the CPU 400 via the CPU I / F 265.

パーサ部230は、メモリコントローラ部220によりハンドル番号が付加されたフレーム情報に対して解析を行い、フレーム情報から転送処理に係る情報であるヘッダ情報などを抽出し、解析結果情報としてメモリコントローラ部220が付加したハンドル番号等の情報とともに出力する。   The parser unit 230 analyzes the frame information to which the handle number is added by the memory controller unit 220, extracts header information that is information related to transfer processing from the frame information, and the memory controller unit 220 as analysis result information. Is output together with information such as the handle number added.

検索部235は、パーサ部230から入力される解析結果情報に基づいて、予めCPU400により検索部235の内部に設定される転送条件情報を参照し、転送条件情報に基づいて、当該フレームを破棄するか、通過させるか、CPU400へ転送、すなわちCPU400へ入力するかを示すフィルタ検索結果情報、及び品質クラスなどの情報を示す分類検索結果などを検出し、検出したフィルタ検索結果情報及び分類検索結果と、パーサ部230から入力される解析結果情報の一部の情報、例えば、フレーム長等とをCPU転送判定部240に出力する。ここで、転送条件情報に含まれる条件としては、MACアドレス、IPアドレス、ポート番号などがあり、解析結果情報に含まれるフレームのヘッダ情報がこれらの転送条件情報に一致するか否かの検索が行われる。   The search unit 235 refers to the transfer condition information set in the search unit 235 in advance by the CPU 400 based on the analysis result information input from the parser unit 230 and discards the frame based on the transfer condition information. Filter search result information indicating whether to pass, pass to CPU 400, that is, input to CPU 400, classification search result indicating information such as quality class, and the like, and the detected filter search result information and classification search result Then, a part of the analysis result information input from the parser unit 230, for example, the frame length or the like is output to the CPU transfer determination unit 240. Here, the conditions included in the transfer condition information include a MAC address, an IP address, a port number, and the like, and a search for whether or not the frame header information included in the analysis result information matches these transfer condition information. Done.

検索部235は、パーサ部230にエラーを検出したフレームと、CPU I/F265を介してCPU400から入力されたフレームに対しては、検索を行わない。検索は、受信論理I/F検索、NAT(Network Address Translation)/NAPT(Network Address Port Translation)検索、経路検索、フィルタ検索、分類検索である。各検索では、解析結果情報に含まれる各種情報の全てまたは一部(検索によって対象となる情報が異なる)と、CPU400から設定された判定条件及び前記判定条件毎の判定マスク(判定条件の無効や一部ビットの無効などの指定であり、マスクがない判定条件もある)により構成される規則(検索毎に複数個の規則を設定できる)と、適合判定を行う。前述の適合判定では、前記判定マスクによって無効とならなかった各判定条件について、入力されたフレームからパーサ部230が得た解析結果情報との一致・不一致を得る比較演算を実施し、前記判定条件の全てについて一致を得た場合にのみ、前記規則に適合すると判定される。その後、各検索は、適合した規則(複数個の適合した規則がみつかった場合は、規則毎に設定された優先度を比較し、より優先度の高い規則)に付加された検索結果を出力する。   The search unit 235 does not search for a frame in which an error is detected by the parser unit 230 and a frame input from the CPU 400 via the CPU I / F 265. The search includes reception logic I / F search, NAT (Network Address Translation) / NAPT (Network Address Port Translation) search, route search, filter search, and classification search. In each search, all or a part of various types of information included in the analysis result information (target information is different depending on the search), a determination condition set by the CPU 400, and a determination mask for each determination condition (invalidity of the determination condition or It is determined whether or not the rule is configured (a plurality of rules can be set for each search) composed of rules (designation such as invalidity of some bits, and determination conditions without a mask). In the above-described conformity determination, for each determination condition that is not invalidated by the determination mask, a comparison operation is performed to obtain a match / mismatch with the analysis result information obtained by the parser unit 230 from the input frame, and the determination condition Only when a match is obtained for all of the above, it is determined that the rule is satisfied. After that, each search outputs the search result added to the matched rule (when multiple matched rules are found, the priority set for each rule is compared and the rule with higher priority). .

受信論理I/F検索の規則を構成する判定条件は、受信物理I/F、送信元MACアドレス、VLAN有無、VLAN有のときのVLAN ID、PPPoE有無、PPPoE有のときのPPPoEセッションID、受信IPsec有無、受信IPsec有のときの受信SA番号であり、検索結果は、受信論理I/F番号、CPU転送の有無、NAT/NAPTの有無である。ここで、受信論理I/F番号とは、パケットを受信した論理I/Fを識別する番号であり、VLANやIPsec VPNによって1個の物理I/Fに複数個の論理I/Fを設定できる。また、前記でNAT/NAPT有の結果を得たパケットのみが、後述のNAT/NAPT検索(グローバル→ローカル)の対象となる。   The determination conditions constituting the rule of the reception logical I / F search are: reception physical I / F, transmission source MAC address, VLAN presence / absence, VLAN ID when VLAN is present, PPPoE presence / absence, PPPoE session ID when PPPoE is present, reception The reception SA number when there is IPsec and reception IPsec is present, and the search results are the reception logical I / F number, the presence / absence of CPU transfer, and the presence / absence of NAT / NAPT. Here, the reception logical I / F number is a number for identifying the logical I / F that has received the packet, and a plurality of logical I / Fs can be set for one physical I / F by VLAN or IPsec VPN. . Further, only the packets obtained as a result of having NAT / NAPT as described above are subjected to NAT / NAPT search (global → local) described later.

NAT/NAPT検索(グローバル→ローカル)の規則を構成する検索条件は、宛先IPアドレスと宛先TCP/UDPポート番号(NAPTのみ)であり、検索結果は、付け替え後のIPアドレスと宛先TCP/UDPポート番号(NAPTのみ)である。ここで、NAT/NAPT検索(グローバル→ローカル)の対象となったパケットに対する、経路検索、フィルタ検索、分類検索の各々は、解析結果情報に含まれる宛先IPアドレスと宛先TCP/UDPポートではなく、NAT/NAPT検索結果である付け替え後の宛先IPアドレスと宛先TCP/UDPポートを検索対象として、前述の検索の規則との適合判定を行う(グローバル→ローカルNAT/NAPTを行うパケットについては、ローカルアドレスやポート番号に基づく検索が行われる)。また、NAT/NAPT検索(グローバル→ローカル)の対象となったパケットで、適合する規則が見つからなかった場合は、CPU転送要因にNAT/NAPT(グローバル→ローカル)検索ミスヒットの情報が付加される。   The search conditions constituting the NAT / NAPT search (global → local) rule are the destination IP address and the destination TCP / UDP port number (NAPT only), and the search result is the IP address after replacement and the destination TCP / UDP port. Number (only NAPT). Here, each of route search, filter search, and classification search for a packet subjected to NAT / NAPT search (global → local) is not a destination IP address and a destination TCP / UDP port included in the analysis result information. The destination IP address after replacement, which is the NAT / NAPT search result, and the destination TCP / UDP port are searched for, and a conformance determination with the above-described search rule is made (for a packet for global → local NAT / NAPT, the local address Or a search based on port number). Also, if no matching rule is found in the NAT / NAPT search (global → local) target packet, NAT / NAPT (global → local) search miss hit information is added to the CPU transfer factor. .

経路検索の規則を構成する判定条件は、受信論理I/F番号、送信元IPアドレス、宛先IPアドレスであり、検索結果は、送信論理I/F番号、宛先MACアドレス、MTU(Maximum Transmission Unit)長、NAT/NAPT有無、MACアドレス未解決有無、自宛有無である。ここで、送信論理I/F番号とは、パケットを送信する論理I/Fを識別する番号(受信論理I/Fと送信論理I/Fが同一である場合は番号も共通)である。また、前記でNAT/NAPT有の結果を得たパケットのみが。後述のNAT/NAPT検索(ローカル→グローバル)の対象となる。また、前記MTU長とパケット長が比較され、パケット長のほうが長い場合に、CPU転送要因にMTU長超過の情報が付加される。また、MACアドレス未解決有のパケットには、CPU転送要因にMACアドレス未解決の情報が付加される。また、自宛有のパケットには、CPU転送要因に自宛パケットの情報が付加される。   The determination conditions constituting the route search rule are the reception logical I / F number, the transmission source IP address, and the destination IP address, and the search results are the transmission logical I / F number, the destination MAC address, and the MTU (Maximum Transmission Unit). Length, NAT / NAPT presence / absence, MAC address unresolved presence / absence, self presence / absence. Here, the transmission logical I / F number is a number for identifying a logical I / F that transmits a packet (if the reception logical I / F and the transmission logical I / F are the same, the number is also common). Also, only the packets that obtained the result with NAT / NAPT in the above. It becomes a target of the NAT / NAPT search (local → global) described later. Also, the MTU length is compared with the packet length, and if the packet length is longer, information indicating that the MTU length has been exceeded is added to the CPU transfer factor. In addition, the MAC address unresolved information is added to the CPU transfer factor in the packet with the MAC address unresolved. In addition, information about the self-addressed packet is added to the CPU transfer factor for the self-addressed packet.

NAT/NAPT検索(ローカル→グローバル)の規則を構成する検索条件は、送信元IPアドレスと送信元TCP/UDPポート番号(NAPTのみ)であり、検索結果は、付け替え後の送信元IPアドレスと送信元TCP/UDPポート番号(NAPTのみ)である。ここで、NAT/NAPT検索(ローカル→グローバル)の対象となったパケットで、適合する規則が見つからなかった場合は、CPU転送要因にNAT/NAPT(ローカル→グローバル)検索ミスヒットの情報が付加される。   The search conditions constituting the NAT / NAPT search (local → global) rule are the transmission source IP address and the transmission source TCP / UDP port number (only NAPT), and the search result is the transmission source IP address after transmission and the transmission. This is the original TCP / UDP port number (only NAPT). If no matching rule is found in the NAT / NAPT search (local → global) target packet, NAT / NAPT (local → global) search miss hit information is added to the CPU transfer factor. The

フィルタ検索及び分類検索の規則を構成する判定条件は、受信論理I/F番号、送信論理I/F番号、VLAN優先度、IPv4/IPv6、送信元IPアドレス、宛先IPアドレス、TOS/トラフィック・クラス(IPv4の場合はTOSを、IPv6の場合はトラフィック・クラスを使用する)、オプション・拡張ヘッダ有無、フラグメント状態(フラグメント無、先頭/最後尾/中間)、TOS/トラフィック・クラス、上位プロトコル、送信元ポート番号、宛先ポート番号、TCPフラグ、ICMPタイプ・コードを条件として検索する。フィルタ検索結果は、破棄/通過/CPU転送の指定であり、分類検索結果は、品質クラスに関する各種情報(送信時のVLAN優先度、リマークの有無、リマーク時のTOS/トラフィック・クラス、キューの指定など)である。   The judgment conditions constituting the rules of filter search and classification search are: reception logical I / F number, transmission logical I / F number, VLAN priority, IPv4 / IPv6, transmission source IP address, destination IP address, TOS / traffic class (Uses TOS for IPv4, uses traffic class for IPv6), option / extension header presence / absence, fragment status (no fragment, head / end / intermediate), TOS / traffic class, upper layer protocol, transmission The search is performed using the original port number, the destination port number, the TCP flag, and the ICMP type code as conditions. The filter search result specifies discard / pass / CPU transfer, and the classification search result includes various information related to the quality class (VLAN priority at transmission, presence / absence of remark, TOS / traffic class at remark, specification of queue) Etc.).

CPU転送判定部240は、検索部235においてCPU400へ転送する要因があるとして検出されたフレームに対して、CPU転送要因を示す情報、すなわち後述するCPU転送要因フラグを付与し、CPU400へ転送するか、あるいは破棄するかを判定し、判定した判定結果情報を、検索部235から出力される情報とともに出力する。   Whether the CPU transfer determination unit 240 assigns information indicating a CPU transfer factor, that is, a CPU transfer factor flag, which will be described later, to the frame detected by the search unit 235 as having a factor to be transferred to the CPU 400 and transfers the frame to the CPU 400. Or the decision result information is output together with the information output from the search unit 235.

キュー選択部245は、CPU転送判定部240から入力される情報に含まれる品質クラス情報や送信先の論理I/Fの情報に基づいてQoS部250がキューを選択する際に参照するキュー番号を検出し、CPU転送判定部240から出力される情報と、検出したキュー番号とを出力する。   The queue selection unit 245 selects a queue number to be referred to when the QoS unit 250 selects a queue based on the quality class information included in the information input from the CPU transfer determination unit 240 or the logical I / F information of the transmission destination. Information detected and output from the CPU transfer determination unit 240 and the detected queue number are output.

QoS部250は、キュー選択部245から出力される情報に基づいてジョブ情報を生成し、同じくキュー選択部245から出力されるキュー番号に基づいて、生成したジョブ情報を該当するキューに記録する。また、QoS部250は、キューに記録されているジョブ情報を予め定められているキューごとの優先度に基づいて読み出し、メモリコントローラ部220へ出力する。また、メモリコントローラ部220へ出力する際に、ハンドル番号を返却するためハンドル管理255へ出力する。ここで、ジョブ情報とは、WAN用MAC I/F205やLAN用MAC I/F275から送信されるフレームに対しては、受信フレーム長、送信フレーム長、送信論理I/F、宛先MACアドレス、NAT/NAPT指定、DSCPやVLAN priority等の情報に対応する品質クラス、ハンドル番号等の情報から構成されている。また、CPU400に転送されるフレームに対しては、ジョブ情報は、受信フレーム長、送信フレーム長、受信論理I/F、CPU転送理由、品質クラス、ハンドル番号等の情報から構成される。   The QoS unit 250 generates job information based on the information output from the queue selection unit 245, and similarly records the generated job information in the corresponding queue based on the queue number output from the queue selection unit 245. Further, the QoS unit 250 reads job information recorded in the queue based on a predetermined priority for each queue, and outputs the job information to the memory controller unit 220. Further, when outputting to the memory controller unit 220, it outputs it to the handle management 255 in order to return the handle number. Here, the job information refers to the received frame length, transmission frame length, transmission logical I / F, destination MAC address, NAT for frames transmitted from the WAN MAC I / F 205 or LAN MAC I / F 275. It consists of information such as / NAPT designation, quality class corresponding to information such as DSCP and VLAN priority, and handle number. For frames transferred to the CPU 400, job information includes information such as a reception frame length, a transmission frame length, a reception logic I / F, a CPU transfer reason, a quality class, and a handle number.

ハンドル管理部255は、QoS(Quality of Service)部250と、メモリコントローラ部220とに接続され、DDR−SDRAM300の分割された領域のそれぞれに対応するハンドル番号に基づいてDDR−SDRAM300の分割された領域の空塞管理を行う。ここで、空塞管理とは、メモリコントローラ部220へは空きハンドル番号を出力して使用中のハンドル番号として管理し、QoS部250から入力されるフレーム破棄により返却対象となるハンドル番号や、送信により返却対象となるハンドル番号については領域が空きとなるため、空きのハンドル番号として管理する。また、ハンドル管理部255は、マルチキャストフレームの場合には、マルチキャストの回数分送信が終了するまで、フレームを削除できないため、QoS部250が、メモリコントローラ部220にジョブ情報を出力した情報をQoS部250からメモリコントローラ部220へ直接接続する接続線から分岐する線により参照して、送信開始時に定められるマルチキャストの回数を管理する。   The handle management unit 255 is connected to the QoS (Quality of Service) unit 250 and the memory controller unit 220, and the DDR-SDRAM 300 is divided based on the handle numbers corresponding to the divided regions of the DDR-SDRAM 300. Perform airspace management of the area. In this case, the empty / busy management means that an empty handle number is output to the memory controller unit 220 and managed as a handle number in use, and the handle number to be returned by discarding the frame input from the QoS unit 250 or transmission The handle number to be returned is managed as an empty handle number because the area becomes empty. In addition, in the case of a multicast frame, the handle management unit 255 cannot delete the frame until transmission for the number of times of multicasting is completed, so that the QoS unit 250 outputs information on job information output to the memory controller unit 220 as a QoS unit. The number of multicasts determined at the start of transmission is managed by referring to a line branched from a connection line directly connected from 250 to the memory controller unit 220.

フレーム生成部260は、予めCPU400のドライバ400aから設定される情報に基づいて、メモリコントローラ部220から出力されるフレームに対して送信先の論理インタフェースに応じたVLAN(Virtual LAN)タグやPPPoE(Point to Point Protocol over Ethernet:Ethernetは登録商標)ヘッダの挿入を行い、当該挿入を行ったフレームを出力する。また、フレーム生成部260は、宛先MACアドレスの付け替え、NAT(Network Address Translation)/NAPT(Network Address Port Translation)のためのIPアドレス及びポート番号の付け替えを行う。また、フレーム生成部260は、IPsec部210に出力するフレーム対してIPsec SA(Security Association)の情報の付加を行う。また、フレーム生成部260は、DSCP(DiffServ Code Point)のIPパケットのヘッダへの付加、VLAN priorityのフレームのヘッダへの付加を行う。DSCPやVLAN priorityは、優先制御の際に参照される品質クラス情報となる。ここで、品質クラス情報とは、転送されるフレームに含まれる情報の種別を分類する分類情報であり、分類情報によって示される情報の種別が例えば音声の場合には、当該分類種別を有するフレームには遅延が少ない高い品質の通信処理が適用されることになる。   Based on information set in advance from the driver 400a of the CPU 400, the frame generation unit 260 applies a VLAN (Virtual LAN) tag or PPPoE (Point) corresponding to the logical interface of the transmission destination for the frame output from the memory controller unit 220. to Point Protocol over Ethernet: Ethernet is a registered trademark) header and inserts the inserted frame. The frame generator 260 also changes the destination MAC address and the IP address and port number for NAT (Network Address Translation) / NAPT (Network Address Port Translation). Also, the frame generation unit 260 adds IPsec SA (Security Association) information to the frame output to the IPsec unit 210. In addition, the frame generation unit 260 adds a DSCP (DiffServ Code Point) IP packet to the header and a VLAN priority frame header. DSCP and VLAN priority are quality class information that is referred to during priority control. Here, the quality class information is classification information for classifying the type of information included in the transferred frame. When the type of information indicated by the classification information is, for example, voice, the quality class information is a frame having the classification type. Therefore, high-quality communication processing with a small delay is applied.

なお、CPU転送判定部240において破棄すると判定されたフレームついてはCPU転送判定部240あるいはQoS部250のいずれかにより破棄されることとなる。   Note that the frame determined to be discarded by the CPU transfer determination unit 240 is discarded by either the CPU transfer determination unit 240 or the QoS unit 250.

なお、インタフェース部としてのWAN用MAC I/F205、LAN用MAC I/F275は、それぞれ、図1における第1LANポート610、第2LANポート640に対応する。また、IPsec処理部としてのIPsec部210は、図1におけるIPsec回路620に対応する。また、ソフトウェア処理部としてのCPU400は、図1におけるCPU650に対応する。また、書き込みスケジューラ部215、メモリコントローラ部220、DDR−SDRAM I/F225、パーサ部230、検索部235、CPU転送判定部240、キュー選択部245、QoS部250、ハンドル管理部255、フレーム生成部260、CPU I/F265、及び、DDR−SDRM300は、図1における転送回路630に対応する。   Note that the WAN MAC I / F 205 and the LAN MAC I / F 275 as interface units correspond to the first LAN port 610 and the second LAN port 640 in FIG. 1, respectively. The IPsec unit 210 as the IPsec processing unit corresponds to the IPsec circuit 620 in FIG. Further, the CPU 400 as the software processing unit corresponds to the CPU 650 in FIG. In addition, the write scheduler unit 215, the memory controller unit 220, the DDR-SDRAM I / F 225, the parser unit 230, the search unit 235, the CPU transfer determination unit 240, the queue selection unit 245, the QoS unit 250, the handle management unit 255, the frame generation unit 260, CPU I / F 265, and DDR-SDRM 300 correspond to the transfer circuit 630 in FIG. 1.

<第1の実施の形態>
第1の実施の形態では、通信処理回路200におけるIPsec処理手順について説明する。
まず、図1に示す構成におけるIPsecパケットの基本的な送受信処理について説明する。
CPU650は、IPsecトンネルモードで送信するIPパケットについては、IPsec処理対象であることと、トンネルを指定して(トンネル毎に設定した番号を付加して)、パケットデータをIPsec回路620に転送する。ただし、IPsecトンネルに送信するパケットのうち、各種の拡張ヘッダを付加する場合は、パケットデータをIPsec回路620に転送する前に、IP in IPv6形式によって前記パケットをカプセル化し、さらに外側IPv6ヘッダに所定の拡張ヘッダを付加したパケットデータを転送し、IPsec処理対象であることと、トンネルを指定するとともに、IP in IPv6形式であることを示すフラグを付加する。
<First Embodiment>
In the first embodiment, an IPsec processing procedure in the communication processing circuit 200 will be described.
First, basic transmission / reception processing of an IPsec packet in the configuration shown in FIG. 1 will be described.
The CPU 650 transfers the packet data to the IPsec circuit 620 by specifying that the IP packet to be transmitted in the IPsec tunnel mode is an IPsec processing target, specifying a tunnel (adding a number set for each tunnel). However, when various extension headers are added to a packet to be transmitted to the IPsec tunnel, the packet is encapsulated in the IP in IPv6 format before the packet data is transferred to the IPsec circuit 620, and further specified in the outer IPv6 header. The packet data to which the extension header is added is transferred, and a flag indicating that the packet is a target of IPsec processing, a tunnel, and the IP in IPv6 format is added.

また、CPU650は、各ポートから受信したパケットのIPヘッダを読み取り、転送処理によって送信するポートやIPsecトンネルを決め、パケットデータを所定のインタフェース(IPsec回路620を含む)に転送する。ただし、受信したパケットに、IP in IPv6形式であることを示すフラグが立っている場合、外側IPv6ヘッダに付加された拡張ヘッダに従って拡張ヘッダ処理を行い、デカプセル化した後、内側IPヘッダ等を読み取って、転送処理によって送信するポートやIPsecトンネルを決め、パケットデータを所定のインタフェース(IPsec処理回路620を含む)に転送する。
このように、IPsec処理対象の受信パケットがIPsce回路620(受信側)で処理された後、転送回路630でCPU転送と判断されてCPU650に転送される場合、CPU650は、転送されたパケットデータに付加されたIP in IPv6形式であることを示すフラグを用いて、デカプセル化の有無を判断することが可能である。しかし、IPsec回路620(受信側)がフラグを生成せず、CPU650に転送されたパケットデータにIP in IPv6形式であることを示すフラグを付加しない方法も可能である。この場合、CPU650は、転送されたパケットデータを解析してIP in IPv6形式であることを検出する。
Further, the CPU 650 reads the IP header of the packet received from each port, determines a port and an IPsec tunnel to be transmitted by a transfer process, and transfers the packet data to a predetermined interface (including the IPsec circuit 620). However, if the received packet has a flag indicating that it is in the IP in IPv6 format, the extension header processing is performed according to the extension header added to the outer IPv6 header, and after decapsulation, the inner IP header or the like is read. Then, the port and IPsec tunnel to be transmitted are determined by the transfer process, and the packet data is transferred to a predetermined interface (including the IPsec processing circuit 620).
As described above, when a received packet to be processed by IPsec is processed by the IPsce circuit 620 (receiving side) and then transferred to the CPU 650 by the transfer circuit 630, the CPU 650 converts the received packet data into the transferred packet data. It is possible to determine the presence / absence of decapsulation by using the added flag indicating IP in IPv6 format. However, a method is also possible in which the IPsec circuit 620 (reception side) does not generate a flag and does not add a flag indicating that the packet is transferred to the CPU 650 in the IP in IPv6 format. In this case, the CPU 650 analyzes the transferred packet data and detects that it is in the IP in IPv6 format.

IPsec回路620(受信側)は、受信処理後、CPU650から転送回路630に入力されたパケットデータを除き、IPsec処理対象であるか否かに関わらず、全ての受信パケットデータを転送回路630へ出力する。転送回路630は、パケットデータをCPUへ転送するか否かの判断を行い、CPUへ転送すると判断したパケットデータのみをCPU650へ転送する。CPUへ転送しないと判断したパケットは、転送回路630が決定した送信インタフェース(IPsce回路620を介して送信する場合はトンネル)から送信される。
なお、転送回路630は、パケットデータに付加されたIP in IPv6形式であることを示すフラグを用いて、CPU転送を判断することが可能である。しかし、フラグが付加されない場合であっても、転送回路630は、IP in IPv6形式のパケットデータを解析し、外側IPv6ヘッダの宛先IPアドレスに基づいて、CPU転送を判断することも可能である。
After receiving processing, the IPsec circuit 620 (receiving side) outputs all received packet data to the transfer circuit 630 regardless of whether or not the packet is input from the CPU 650 to the transfer circuit 630, regardless of whether or not it is an IPsec processing target. To do. The transfer circuit 630 determines whether or not to transfer packet data to the CPU, and transfers only the packet data determined to be transferred to the CPU to the CPU 650. A packet that is determined not to be transferred to the CPU is transmitted from a transmission interface determined by the transfer circuit 630 (or a tunnel in the case of transmission via the IPsce circuit 620).
Note that the transfer circuit 630 can determine the CPU transfer using a flag indicating that the packet is in IP in IPv6 format added to the packet data. However, even if the flag is not added, the transfer circuit 630 can analyze the packet data in the IP in IPv6 format and determine the CPU transfer based on the destination IP address of the outer IPv6 header.

IPsec回路620におけるパケットの受信動作を、図2に示す構成を用いて説明する。
IPsec部210(IPsec回路620)は、SA(受信)に対応させて、外側IPv6ヘッダの宛先IPv6アドレスと、ESPヘッダ内のSPIを、SA判定条件として記憶している。IPsec部210は、WAN用MAC I/F205より受信したIPsecパケットから抽出した外側IPv6ヘッダの宛先IPアドレスと、ESPヘッダに含まれるSPIが前述したSA判定条件と一致するSA(受信)を取得する。IPsecパケットを含まないフレームや、IPsecパケットを含むが一致するSA(受信)が見つからなかったフレームについては、IPsec部210は、前記フレームに、受信IPsec無を示す情報を付加して、書き込みスケジューラ部215へ出力する。ここで、外側IPv6ヘッダの後のESPヘッダ以外の拡張ヘッダ有無を検出しておく。
The packet reception operation in the IPsec circuit 620 will be described using the configuration shown in FIG.
The IPsec unit 210 (IPsec circuit 620) stores the destination IPv6 address of the outer IPv6 header and the SPI in the ESP header as SA determination conditions in association with SA (reception). The IPsec unit 210 acquires the SA (reception) in which the destination IP address of the outer IPv6 header extracted from the IPsec packet received from the WAN MAC I / F 205 and the SPI included in the ESP header match the above-described SA determination condition. . For a frame that does not include an IPsec packet or a frame that includes an IPsec packet but does not find a matching SA (reception), the IPsec unit 210 adds information indicating no received IPsec to the frame, and writes a scheduler. To 215. Here, the presence or absence of an extension header other than the ESP header after the outer IPv6 header is detected.

以下に、SA(受信)が見つかったIPsecパケットに対するIPsec部210の動作を説明する。
IPsec部210は、SA(受信)に対応させて、暗号アルゴリズム、暗号鍵(NULL暗号以外の場合)、認証アルゴリズム、認証鍵(認証ありの場合)、アンチリプレイの有無を、SA処理条件(受信)として記憶している。IPsec部210は、受信したIPsecパケットのSA(受信)に基づいて、SA処理条件(受信)を取得する。
The operation of the IPsec unit 210 for an IPsec packet in which SA (reception) is found will be described below.
In correspondence with SA (reception), the IPsec unit 210 determines the SA processing condition (reception) based on the encryption algorithm, the encryption key (in the case of other than NULL encryption), the authentication algorithm, the authentication key (in the case of authentication), and the presence / absence of anti-replay. ). The IPsec unit 210 acquires SA processing conditions (reception) based on the SA (reception) of the received IPsec packet.

IPsec部210は、この取得したSA処理条件(受信)を使用して、認証と復号とデカプセル化の各処理を行い、復号された内側IPパケットを取得する。さらに、復号された内側IPパケットを含むフレームに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号を付加して、書き込みスケジューラ部215に出力する。なお、SA処理条件(受信)のアンチリプレイが有りの場合は、アンチリプレイの処理が行われる。以下に、認証、復号、デカプセル、アンチリプレイの各処理の動作を説明する。   The IPsec unit 210 performs authentication, decryption, and decapsulation processes using the acquired SA processing condition (reception), and acquires the decrypted inner IP packet. Further, information indicating the presence of received IPsec and a received SA number for identifying SA (reception) are added to the frame including the decrypted inner IP packet, and output to the write scheduler unit 215. Note that when there is anti-replay of the SA processing condition (reception), anti-replay processing is performed. Hereinafter, operations of authentication, decryption, decapsulation, and anti-replay processes will be described.

<認証処理>
受信したIPsecパケットに対する認証処理では、前記IPsecパケットのESPヘッダ先頭から暗号化されたトレーラ終了までの復号前のデータに対して、所定の認証アルゴリズムと認証鍵を使用してICVを計算し、前記IPsecパケット内のICVとの一致を判定する。この判定で一致を得た場合は認証成功であり、不一致の場合は認証失敗となる。なお、認証アルゴリズムとして認証なしが指定されている場合は、前述の認証処理を行わず、認証成功とみなす。前述の認証処理において失敗と判定されたパケットや、受信したIPsecパケットからICVを得られなかった場合(パケット長が短すぎる場合など)は、IPsec部210内で破棄される。
<Authentication process>
In the authentication process for the received IPsec packet, the ICV is calculated using a predetermined authentication algorithm and authentication key for the data before decryption from the beginning of the ESP header of the IPsec packet to the end of the trailer encrypted, A match with the ICV in the IPsec packet is determined. If a match is obtained in this determination, authentication is successful, and if they do not match, authentication fails. If no authentication is specified as the authentication algorithm, the above-described authentication process is not performed and the authentication is considered successful. A packet that is determined to have failed in the authentication process described above, or when an ICV cannot be obtained from the received IPsec packet (such as when the packet length is too short) is discarded in the IPsec unit 210.

<復号処理>
受信したIPsecパケットに対する復号処理では、前記IPsecパケット内の暗号化されたIV直後(NULL暗号やEBCモードでの暗号アルゴリズムなどIV無しの場合はESPヘッダ直後)から暗号化されたトレーラ終了までの復号前のデータを、所定の暗号アルゴリズム、暗号鍵を使用して復号する。なおCBCモードでの復号演算の初期値として、前記IPsecパケット内のIVを使用する。暗号アルゴリズムとしてNULL暗号(暗号なし)が指定されている場合は、前述の復号処理を行わない。なお、復号対象のデータ長が、暗号アルゴリズムによって予め決められたブロック長の整数倍となっていない場合は、IPsec部210内で破棄される。
<Decryption process>
In the decryption process for the received IPsec packet, decryption from the encrypted IV immediately after the encrypted IV (immediately after the ESP header if there is no IV such as a NULL encryption or an encryption algorithm in the EBC mode) to the end of the encrypted trailer. The previous data is decrypted using a predetermined encryption algorithm and encryption key. Note that the IV in the IPsec packet is used as the initial value of the decoding operation in the CBC mode. When NULL encryption (no encryption) is designated as the encryption algorithm, the above-described decryption process is not performed. If the data length to be decrypted is not an integral multiple of the block length predetermined by the encryption algorithm, it is discarded in the IPsec unit 210.

<デカプセル処理;ESPを除く拡張ヘッダ無>
外側IPv6ヘッダの後にESP以外の拡張ヘッダ無の場合、受信したIPsecパケットに対するデカプセル処理では、前記IPsecパケットから外側IPヘッダ、ESPヘッダ、IV、トレーラ、ICVを削除し、復号された内側IPパケットを取得する。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、内側IPパケットのプロトコルに基づいて、フレームのレイヤ3プロトコルとして、IPv4あるいはIPv6を指定する。すなわち、イーサネット(登録商標)フレームのTypeフィールドを、内側IPパケットのプロトコルに相当する値に書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化無しを示す情報を付加してもよい。
<Decapsulation processing; no extension header except ESP>
When there is no extension header other than ESP after the outer IPv6 header, in the decapsulation processing for the received IPsec packet, the outer IP header, ESP header, IV, trailer, and ICV are deleted from the IPsec packet, and the decoded inner IP packet is get. At this time, the pad is deleted based on the decoded pad length of the trailer, and IPv4 or IPv6 is designated as the layer 3 protocol of the frame based on the protocol of the inner IP packet. That is, the Type field of the Ethernet (registered trademark) frame is rewritten to a value corresponding to the protocol of the inner IP packet. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating no IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<デカプセル処理;ESPを除く拡張ヘッダ有>
外側IPv6ヘッダの後にESP以外の拡張ヘッダ有の場合、受信したIPsecパケットに対するデカプセル処理では、前記IPsecパケットからESPヘッダ、IV、トレーラ、ICVを削除し、外側IPv6ヘッダと前記外側IPv6ヘッダの後のESP以外の拡張ヘッダを残し、復号された内側IPパケットを内側IPパケットとしたIPv6カプセル化パケットに書き換える。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、内側IPパケットのプロトコルに基づいて、前記内側IPパケットの直前の拡張ヘッダ内の次ヘッダフィールドに、IPv4あるいはIPv6を指定する。すなわち、拡張ヘッダの次ヘッダフィールドを、内側IPパケットのプロトコルに相当する値に書き換える。さらに、外側IPv6ヘッダ直後から内側IPパケット終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化有りを示す情報を付加してもよい。
<Decapsulation processing; with extension header excluding ESP>
When there is an extension header other than ESP after the outer IPv6 header, in the decapsulation processing for the received IPsec packet, the ESP header, IV, trailer, and ICV are deleted from the IPsec packet, and after the outer IPv6 header and the outer IPv6 header. The extension header other than ESP is left, and the decrypted inner IP packet is rewritten to an IPv6 encapsulated packet which is an inner IP packet. At this time, the pad is deleted based on the decoded pad length of the trailer, and IPv4 or IPv6 is designated in the next header field in the extension header immediately before the inner IP packet based on the protocol of the inner IP packet. . That is, the next header field of the extension header is rewritten to a value corresponding to the protocol of the inner IP packet. Furthermore, the payload length of the outer IPv6 header is rewritten based on the length from immediately after the outer IPv6 header to the end of the inner IP packet. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating the presence of IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<アンチリプレイ処理>
受信したIPsecパケットに対するアンチリプレイ処理では、認証に成功したIPsecパケットのESPヘッダ内のシーケンス番号と、IPsec部210がSA(受信)別に管理しているシーケンス番号の状態情報により、アンチリプレイの成功・失敗を判定し、前記シーケンス番号の状態情報の更新(アンチリプレイ処理の成功時のみ)を行う。このアンチリプレイ処理では、シーケンス番号の状態情報としてスライディング受信ウィンドウを使用する。前記ウィンドウの右端は、このSAで受信され、認証に成功したパケットについてシーケンス番号の最大値を表す。ウィンドウの左端より小さいシーケンス番号を含むパケットは拒否される。ウィンドウ内に収まるパケットは、ウィンドウ内で受信したパケットのリストに対して既受信としてチェックされる。受信されたパケットがウィンドウに収まり、かつ新しい(既受信としてチェックされていない)場合、あるいは受信されたパケットがウィンドウの右端にある場合、アンチリプレイに成功したと判定する。前記において失敗と判定されたパケットは、IPsec部210内で破棄される。
<Anti-replay process>
In the anti-replay processing for the received IPsec packet, the success of anti-replay is determined based on the sequence number in the ESP header of the IPsec packet that has been successfully authenticated and the sequence number status information managed by the IPsec unit 210 for each SA (reception). The failure is determined, and the state information of the sequence number is updated (only when the anti-replay process is successful). In this anti-replay process, a sliding reception window is used as the sequence number state information. The right end of the window represents the maximum value of the sequence number for a packet received at this SA and successfully authenticated. Packets containing a sequence number smaller than the left edge of the window are rejected. Packets that fall within the window are checked as received against the list of packets received within the window. If the received packet fits in the window and is new (not checked as already received), or if the received packet is at the right edge of the window, it is determined that anti-replay was successful. The packet determined to have failed in the above is discarded in the IPsec unit 210.

IPsec部210が、書き込みスケジューラ部215へデータを出力した以降の動作は、上述した図2における各部の説明に従う。ただし、外側IPv6ヘッダの後のESP以外の拡張ヘッダ有の場合にIPsec部210が出力するIPv6カプセル化パケットは、外側IPv6ヘッダ内のあて先IPv6アドレスに基づいて自宛と判断して、CPU400に転送される。IPv6カプセル化有りを示す情報が前記IPv6カプセル化パケットに付加されている場合は、前記情報に基づきCPU400に転送してもよい。   The operation after the IPsec unit 210 outputs data to the write scheduler unit 215 follows the description of each unit in FIG. However, the IPv6 encapsulated packet output from the IPsec unit 210 when the extension header other than the ESP after the outer IPv6 header is present is determined to be addressed to itself based on the destination IPv6 address in the outer IPv6 header and transferred to the CPU 400. Is done. When information indicating the presence of IPv6 encapsulation is added to the IPv6 encapsulated packet, it may be transferred to the CPU 400 based on the information.

CPU400は、拡張ヘッダ付IPv6カプセル化パケットを、転送回路から入力し、前記拡張ヘッダに基づく所定の拡張ヘッダ処理を行うとともに、前記拡張ヘッダ付IPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する。前記内側IPパケットに対する処理は、通常のIPパケットに対する処理と同じである。   The CPU 400 receives the IPv6 encapsulated packet with the extension header from the transfer circuit, performs predetermined extension header processing based on the extension header, and decapsulates the IPv6 encapsulated packet with the extension header to obtain the inner IP packet. . The process for the inner IP packet is the same as the process for a normal IP packet.

続いて、IPsec回路620におけるパケットの送信動作を、図2に示す構成を用いて説明する。
IPsec部210(IPsec回路620)は、フレーム生成部260より、送信IPsecの有無を示す情報と、SA(送信)を識別する送信SA番号とが付加された、WAN用MAC I/F205から送信すべきフレームの入力を受ける。IPsec部210は、送信IPsec無を示す情報が付加されている場合、当該フレームをそのままWAN用MAC I/F205へ出力する。また、CPU I/F265を介してCPU400から入力されたフレームに対しては、前述の送信IPsec有無を示す情報とSA(送信)を識別する送信SA番号に加えて、IPv6カプセル化の有無を示す情報が、CPU400によって付加される。ここで、前記がIPv6カプセル化有を示す場合は、これらの情報をまとめて、IPv6カプセル化済みIPsec送信情報と定義する。
Next, the packet transmission operation in the IPsec circuit 620 will be described using the configuration shown in FIG.
The IPsec unit 210 (IPsec circuit 620) transmits the information from the frame generation unit 260 from the WAN MAC I / F 205 to which information indicating the presence / absence of transmission IPsec and a transmission SA number for identifying SA (transmission) are added. The input of the power frame is received. When information indicating no transmission IPsec is added, the IPsec unit 210 outputs the frame to the WAN MAC I / F 205 as it is. For frames input from the CPU 400 via the CPU I / F 265, the presence / absence of IPv6 encapsulation is indicated in addition to the information indicating the presence / absence of transmission IPsec and the transmission SA number for identifying SA (transmission). Information is added by the CPU 400. Here, when the above indicates that IPv6 encapsulation is present, these pieces of information are collectively defined as IPv6 encapsulated IPsec transmission information.

CPU400は、所定の拡張ヘッダを付加するとともにIPsecカプセル化を行って送信するIPパケットについて、前記IPパケットを内側IPパケットとしてIPv6カプセル化し、このIPv6カプセル化パケットに前記拡張ヘッダを付加した拡張ヘッダ付IPv6カプセル化パケットにL2ヘッダ(宛先・送信元MACアドレスとイーサネット(登録商標)フレームのTypeなど)を付与して、IPv6カプセル化済みIPsec送信情報を付加し、CPU I/F265を介して転送回路に入力する。なお、拡張ヘッダを付加せずに、IPsecカプセル化を行って送信するIPパケットについても、前記IPパケットを内側IPパケットとしてIPv6カプセル化し、L2ヘッダ(宛先・送信元MACアドレスとイーサネット(登録商標)フレームのTypeなど)を付与して、IPv6カプセル化済みIPsec送信情報を付加し、CPU I/F265を介して転送回路に入力してもよい。   The CPU 400 adds a predetermined extension header and performs IP6 encapsulation on the IP packet to be transmitted, encapsulates the IP packet as an inner IP packet, and encapsulates the IPv6 encapsulated packet with the extension header. An IPv6 encapsulated packet is provided with an L2 header (destination / source MAC address and Ethernet (registered trademark) frame type, etc.), IPv6 encapsulated IPsec transmission information is added, and a transfer circuit via the CPU I / F 265 To enter. It should be noted that an IP packet transmitted by performing IPsec encapsulation without adding an extension header is also encapsulated in IPv6 as an inner IP packet, and an L2 header (destination / source MAC address and Ethernet (registered trademark)) Frame type) and the like, and IPv6 encapsulated IPsec transmission information may be added and input to the transfer circuit via the CPU I / F 265.

WAN/LANの物理I/F500,501で受信したフレームが転送回路内で転送されてIPsec部210に入力されたフレームに対するIPsec部210の処理は、IPv6カプセル化無を示す情報が付加された場合の処理に一致し、本実施の形態では、前記フレームを、IPv6カプセル化無を示す情報が付加されたフレームとして説明する。   When the frame received by the WAN / LAN physical I / F 500, 501 is transferred in the transfer circuit and input to the IPsec unit 210, the processing of the IPsec unit 210 includes information indicating that there is no IPv6 encapsulation. In this embodiment, the frame is described as a frame to which information indicating that IPv6 encapsulation is not added is added.

以下に、送信IPsec有の場合の送信フレームに対するIPsec部210の動作を説明する。
IPsec部210は、SA(送信)に対応させて、暗号アルゴリズム、暗号鍵(NULL暗号以外の場合)、認証アルゴリズム、認証鍵(認証ありの場合)を、SA処理条件(送信)として記憶する。IPsec部210は、SA(送信)に基づいて、SA処理条件(送信)を取得する。
The operation of the IPsec unit 210 for a transmission frame when there is transmission IPsec will be described below.
The IPsec unit 210 stores an encryption algorithm, an encryption key (in the case of other than NULL encryption), an authentication algorithm, and an authentication key (in the case of authentication) as SA processing conditions (transmission) in association with SA (transmission). The IPsec unit 210 acquires SA processing conditions (transmission) based on SA (transmission).

また、IPsec部210は、SA(送信)に対応させて、外側IPヘッダの宛先IPドレス、送信元IPv6アドレス、ホップ・リミット、及び、トラフィック・クラス(内側IPパケットのトラフィック・クラスを外側IPヘッダに複製することも可能)と、ESPヘッダのSPIとをカプセル化条件として記憶している。IPsec部210は、SA(送信)に基づいて、カプセル化条件を取得する。   In addition, the IPsec unit 210 associates SA (transmission) with the destination IP address of the outer IP header, the source IPv6 address, the hop limit, and the traffic class (the traffic class of the inner IP packet is changed to the outer IP header). And the SPI of the ESP header are stored as encapsulation conditions. The IPsec unit 210 acquires an encapsulation condition based on SA (transmission).

さらに、IPsec部210は、SA(送信)に対応させて、送信するIPv6パケットのESPヘッダ内のシーケンス番号を管理する。すなわち、SA(送信)別に送信したIPパケットの個数を計測し、シーケンス番号とする。IPsec部210は、SA(送信)に基づいて、シーケンス番号を取得する。   Furthermore, the IPsec unit 210 manages the sequence number in the ESP header of the IPv6 packet to be transmitted in association with SA (transmission). That is, the number of IP packets transmitted for each SA (transmission) is measured and used as a sequence number. The IPsec unit 210 acquires a sequence number based on SA (transmission).

IPsec部210は、フレーム生成部260より入力されたフレームに含まれるIPパケットに対して、上記の取得したSA処理条件(送信)、カプセル化条件、シーケンス番号を使用して、暗号とICV生成とカプセルの各処理を行う。
以下に、暗号、ICV生成、カプセルの各処理の動作を説明する。
The IPsec unit 210 performs encryption and ICV generation on the IP packet included in the frame input from the frame generation unit 260 using the acquired SA processing condition (transmission), encapsulation condition, and sequence number. Perform each processing of the capsule.
The operations of encryption, ICV generation, and capsule processing will be described below.

<暗号処理;IPv6カプセル化無>
IPv6カプセル化無を示す情報が付加されている場合、IPsec部210は、フレーム生成部260より入力されたフレームに含まれるIPパケットを、IPsecパケットの内側IPパケットとするため、所定のトレーラを当該IPパケットの直後に付加する。前記トレーラは、パッド、当該パッドのパッド長、内側IPパケットのプロトコルから構成されるが、前記パッドを付加するパディング処理において、当該IPパケットとトレーラを合計した長さが、これらを暗号化するときの暗号アルゴリズムによって予め決められたブロック長の整数倍となるよう、パッド長を取得する。
次に、IPsec部210は、前記内側IPパケット及び前記トレーラを、所定の暗号アルゴリズムと暗号鍵を使用して暗号化する。CBCモードの暗号アルゴリズムを使用する場合は、暗号演算の初期値としてIVが必要となるが、前回暗号化した結果をIVとして利用することが可能である。さらに、前記IVを、前記内側IPパケットの直前に挿入する(CBCモードの暗号アルゴリズムの場合のみ)。なお、暗号アルゴリズムとしてNULL暗号(暗号なし)が指定された場合は、この暗号処理を行わない。
<Encryption processing; no IPv6 encapsulation>
When information indicating that there is no IPv6 encapsulation is added, the IPsec unit 210 uses an IP packet included in the frame input from the frame generation unit 260 as an inner IP packet of the IPsec packet. It is added immediately after the IP packet. The trailer is composed of a pad, a pad length of the pad, and an inner IP packet protocol. In the padding process for adding the pad, the total length of the IP packet and the trailer encrypts them. The pad length is acquired so as to be an integral multiple of the block length predetermined by the encryption algorithm.
Next, the IPsec unit 210 encrypts the inner IP packet and the trailer using a predetermined encryption algorithm and encryption key. When the CBC mode cryptographic algorithm is used, IV is required as an initial value of the cryptographic operation, but the previous encrypted result can be used as IV. Further, the IV is inserted immediately before the inner IP packet (only in the case of the CBC mode encryption algorithm). Note that this encryption process is not performed when a NULL encryption (no encryption) is designated as the encryption algorithm.

<暗号処理;IPv6カプセル化有>
IPv6カプセル化有を示す情報が付加されている場合、IPsec部210は、フレーム生成部260より入力されたフレームに含まれるIPv6パケットがカプセル化している内側IPパケットを、IPsecパケットの内側IPパケットとするため、所定のトレーラを、前記内側IPパケットの直後に付加する。前記トレーラは、パッド、前記パッドのパッド長、内側IPパケットのプロトコルから構成されるが、前記パッドを付加するパディング処理において、前記内側IPパケットとトレーラの合計した長さが、これらを暗号化するときの暗号アルゴリズムによって予め決められたブロック長の整数倍となるよう、パッド長を取得する。以後の暗号化の処理については、IPv6カプセル化無を示す情報が付加されている場合の処理と同じである。
<Encryption processing with IPv6 encapsulation>
When information indicating that IPv6 encapsulation is present is added, the IPsec unit 210 converts the inner IP packet encapsulated in the IPv6 packet included in the frame input from the frame generation unit 260 as the inner IP packet of the IPsec packet. Therefore, a predetermined trailer is added immediately after the inner IP packet. The trailer includes a pad, a pad length of the pad, and an inner IP packet protocol. In the padding process for adding the pad, the total length of the inner IP packet and the trailer encrypts them. The pad length is acquired so as to be an integral multiple of the block length predetermined by the encryption algorithm. The subsequent encryption processing is the same as the processing in the case where information indicating that IPv6 encapsulation is not added is added.

<ICV生成処理>
ICV生成処理では、IPsec部210は、取得したカプセル化条件のSPIとシーケンス番号に基づいてESPヘッダを生成し、挿入する。この挿入位置は、IV(IVがない場合は内側IPパケット)の直前である。さらに、ESPヘッダ先頭から暗号化されたトレーラ終了までの復号前のデータに対して、所定の認証アルゴリズムと認証鍵を使用してICVを計算し、トレーラの直後に計算したICVを付加する。
<ICV generation processing>
In the ICV generation process, the IPsec unit 210 generates and inserts an ESP header based on the acquired encapsulation condition SPI and sequence number. This insertion position is immediately before IV (inner IP packet when there is no IV). Further, ICV is calculated using a predetermined authentication algorithm and authentication key for the data before decryption from the beginning of the ESP header to the end of the trailer, and the calculated ICV is added immediately after the trailer.

<カプセル処理;IPv6カプセル化無>
IPv6カプセル化無を示す情報が付加されている場合、IPsec部210は、取得したカプセル化条件のうち外側IPv6ヘッダに関する条件(宛先IPv6アドレス、送信元IPv6アドレス、ホップ・リミット、トラフィック・クラス)と、ESPヘッダ先頭から暗号化されたトレーラ終了までの長さに基づいて、外側IPv6ヘッダを生成し、ESPヘッダ直前に挿入する。さらにフレームのレイヤ3プロトコルとして、外側IPv6ヘッダのプロトコルを指定する。すなわち、イーサネット(登録商標)フレームのTypeフィールドを、IPv6に相当する値に書き換える。
<Capsule processing; no IPv6 encapsulation>
When information indicating that IPv6 encapsulation is not present is added, the IPsec unit 210 includes the conditions related to the outer IPv6 header (destination IPv6 address, source IPv6 address, hop limit, traffic class) among the obtained encapsulation conditions. Based on the length from the beginning of the ESP header to the end of the encrypted trailer, an outer IPv6 header is generated and inserted immediately before the ESP header. Further, the protocol of the outer IPv6 header is specified as the layer 3 protocol of the frame. That is, the Type field of the Ethernet (registered trademark) frame is rewritten to a value corresponding to IPv6.

<カプセル処理;IPv6カプセル化有>
IPv6カプセル化有を示す情報が付加されている場合、IPsec部210は、外側IPv6ヘッダ直後から暗号化されたトレーラ終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。また、ESPヘッダ直前の外側IPv6ヘッダもしくは拡張ヘッダに含まれる次ヘッダフィールドをESPを示す値に書き換える。
<Capsule processing; with IPv6 encapsulation>
When information indicating that IPv6 encapsulation is present is added, the IPsec unit 210 rewrites the payload length of the outer IPv6 header based on the length from immediately after the outer IPv6 header to the end of the encrypted trailer. Further, the next header field included in the outer IPv6 header or extension header immediately before the ESP header is rewritten to a value indicating ESP.

次に、図2の構成によるIPsecパケットの基本的な送受信処理の詳細について説明する。
図3は、拡張ヘッダがなく、フラグメントの必要がないIPsecパケットを送信する場合の処理を示す図である。
CPU400においてIPsecを用いてIPパケット10を転送すべきと判断した場合、CPU400は、CPU I/F265を介して、IPパケット10のパケットデータと、送信インタフェースの情報を書き込みスケジューラ部215へ出力する。送信インタフェースの情報には、送信するLANポートを指定する番号、IPsecカプセル化の有無(IPsec処理対象であるか否か)、IPsecカプセル化有りの場合のIPsecトンネルを指定する番号(IPsecトンネル番号)、IP in IPv6であるか否かを示すフラグなどの情報が含まれる。IPパケット10は、IPv4またはIPv6のパケット(以下、「IPv4/IPv6パケット」と記載)である。また、IPsecトンネルを指定する番号は、SAを示す。IPパケット10のパケットデータは、送信インタフェース情報とともに、CPU I/F部265及び書き込みスケジューラ部215を介してメモリコントローラ部220へ入力される。
Next, details of basic transmission / reception processing of an IPsec packet with the configuration of FIG. 2 will be described.
FIG. 3 is a diagram illustrating processing when an IPsec packet that does not have an extension header and does not require fragmentation is transmitted.
When the CPU 400 determines that the IP packet 10 should be transferred using IPsec, the CPU 400 outputs the packet data of the IP packet 10 and the transmission interface information to the write scheduler unit 215 via the CPU I / F 265. The transmission interface information includes a number for specifying a LAN port to be transmitted, presence / absence of IPsec encapsulation (whether it is an IPsec processing target), a number for specifying an IPsec tunnel when IPsec encapsulation is present (IPsec tunnel number) , Information such as a flag indicating whether or not IP in IPv6 is included. The IP packet 10 is an IPv4 or IPv6 packet (hereinafter referred to as “IPv4 / IPv6 packet”). The number designating the IPsec tunnel indicates SA. The packet data of the IP packet 10 is input to the memory controller unit 220 via the CPU I / F unit 265 and the write scheduler unit 215 together with the transmission interface information.

メモリコントローラ部220は、DDR−SDRAM I/F225を介してDDR−SDRAM300へIPパケット10のパケットデータを書き込む。検索部235は、IPsecを用いたIPパケットの送信のジョブを選択し、CPU転送判定部240は、CPU400への転送が不要であると判断する。キュー選択部245は、送信インタフェースの情報に基づいてキューを選択し、この選択されたQoS部250内のキューに、IPパケット10のパケットデータの記録位置を示すハンドル番号と送信インタフェースの情報とがジョブとして記録される。なお、CPU400から転送されたパケットデータに対するパーサ部230、検索部235、CPU転送判定部240の動作は、前記ジョブの生成に必要となるハンドル番号、送信インタフェースの情報などの各種情報を次段に転送するのみである。Qos部250から出力されたジョブは、メモリコントローラ部220に出力され、このジョブに基づいてDDR−SDRAM300からパケットデータが読み出されて、フレーム生成部260へ出力される。フレーム生成部260は、入力されたジョブに基づき、IPsecカプセル化を除く送信フレームを生成する。フレーム生成部260は、前記ジョブにIPsecカプセル化有を示す情報が含まれている場合、生成した送信フレームに、IPsecトンネル番号、IP in IPv6形式であるか否かを示すフラグを併せてIPsec部210(送信側)に出力する。   The memory controller unit 220 writes the packet data of the IP packet 10 to the DDR-SDRAM 300 via the DDR-SDRAM I / F 225. The search unit 235 selects an IP packet transmission job using IPsec, and the CPU transfer determination unit 240 determines that transfer to the CPU 400 is unnecessary. The queue selection unit 245 selects a queue based on the transmission interface information, and the handle number indicating the recording position of the packet data of the IP packet 10 and the transmission interface information are stored in the queue in the selected QoS unit 250. Recorded as a job. The operations of the parser unit 230, the search unit 235, and the CPU transfer determination unit 240 for the packet data transferred from the CPU 400 include various information such as a handle number and transmission interface information necessary for generating the job in the next stage. Just forward. The job output from the QoS unit 250 is output to the memory controller unit 220. Based on this job, packet data is read from the DDR-SDRAM 300 and output to the frame generation unit 260. The frame generation unit 260 generates a transmission frame excluding IPsec encapsulation based on the input job. When the job includes information indicating that IPsec encapsulation is present, the frame generation unit 260 adds an IPsec tunnel number and a flag indicating whether the packet is in IP in IPv6 format to the generated transmission frame. Output to 210 (transmission side).

一方、WANまたはLANから受信したパケットを、IPsecにより送信する場合は、以下のように動作する。
WAN用MAC I/F205はパケットを受信すると、受信したパケットにMAC処理、CRC処理などを行う。書き込みスケジューラ部215は、IPsec部210を介して、WAN用MAC I/F205によりフレーム情報が付加された受信パケットのパケットデータを受信する。あるいは、LAN用MAC I/F275がパケットを受信すると、受信したパケットにMAC処理、CRC処理などを行う。書き込みスケジューラ部215は、LAN用MAC I/F275によりフレーム情報が付加された受信パケットのパケットデータを受信する。受信パケットのパケットデータは、フレーム情報とともに、書き込みスケジューラ部215を介してメモリコントローラ部220へ入力される。
On the other hand, when a packet received from WAN or LAN is transmitted by IPsec, it operates as follows.
When the WAN MAC I / F 205 receives a packet, it performs MAC processing, CRC processing, and the like on the received packet. The write scheduler unit 215 receives the packet data of the received packet to which the frame information is added by the WAN MAC I / F 205 via the IPsec unit 210. Alternatively, when the LAN MAC I / F 275 receives a packet, it performs MAC processing, CRC processing, and the like on the received packet. The write scheduler unit 215 receives the packet data of the received packet to which the frame information is added by the LAN MAC I / F 275. The packet data of the received packet is input to the memory controller unit 220 through the write scheduler unit 215 together with the frame information.

メモリコントローラ部220は、DDR−SDRAM I/F225を介してDDR−SDRAM300へ受信パケットのパケットデータを書き込む。検索部235は、IPsecトンネルへの送信を指定し、CPU転送判定部240は、CPU400への転送が不要であるか否かを判断する。キュー選択部245は、フレーム情報に基づいてキューを選択し、この選択されたQoS部250内のキューに、受信パケットのパケットデータの記録位置を示すハンドル番号と送信インタフェースの情報とがジョブとして記録される。Qos部250から出力されたジョブは、メモリコントローラ部220に出力され、このジョブに基づいてDDR−SDRAM300からパケットデータが読み出されて、フレーム生成部260へ出力される。フレーム生成部260は、入力されたジョブに基づき、IPsecカプセル化を除く送信フレームを生成し、生成した送信フレームに、IPsecトンネル番号を併せてIPsec部210へ出力する。   The memory controller unit 220 writes the packet data of the received packet to the DDR-SDRAM 300 via the DDR-SDRAM I / F 225. The search unit 235 designates transmission to the IPsec tunnel, and the CPU transfer determination unit 240 determines whether transfer to the CPU 400 is unnecessary. The queue selection unit 245 selects a queue based on the frame information, and the handle number indicating the recording position of the packet data of the received packet and the transmission interface information are recorded as a job in the queue in the selected QoS unit 250. Is done. The job output from the QoS unit 250 is output to the memory controller unit 220. Based on this job, packet data is read from the DDR-SDRAM 300 and output to the frame generation unit 260. The frame generation unit 260 generates a transmission frame excluding IPsec encapsulation based on the input job, and outputs the generated transmission frame together with the IPsec tunnel number to the IPsec unit 210.

IPsec部210は、IPsecトンネル番号をキーに暗号化アルゴリズムと、認証キーとを読み出す。IPsec部210は、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従って、IPパケット10から暗号化パケット11を生成する。さらに、IPsec部210は、トレーラ12を生成して付加し、暗号アルゴリズムがnull暗号以外であれば、暗号化パケット11の前にIV15を付加する。また、認証ありの場合、ICV16をトレーラ12の後ろに付加する。IPsec部210は、IPsecトンネル番号に対応したIPドレスから外側IPv6ヘッダ13を、IPsecトンネル番号に対応したSPIからESPヘッダ14を生成して付加する。これにより、外側IPv6ヘッダ13、ESPヘッダ14、IV15、暗号化パケット11、トレーラ12、及び、ICV16からなるIPv6 IPsecパケットを生成する。
IPsec部210は、生成したIPv6 IPsecパケットを含み、IPsecトンネル番号に対応したMACアドレスから生成したL2ヘッダを付加したフレームをWAN用MAC I/F205に出力する。WAN用MAC I/F205は受信したフレームを物理I/F500を介してWANに送出する。
The IPsec unit 210 reads out an encryption algorithm and an authentication key using the IPsec tunnel number as a key. If the encryption algorithm is other than the null cipher, the IPsec unit 210 generates the encrypted packet 11 from the IP packet 10 according to the encryption algorithm. Further, the IPsec unit 210 generates and adds the trailer 12, and adds IV 15 before the encrypted packet 11 if the encryption algorithm is other than the null encryption. In the case of authentication, the ICV 16 is added behind the trailer 12. The IPsec unit 210 generates and adds the outer IPv6 header 13 from the IP address corresponding to the IPsec tunnel number and the ESP header 14 from the SPI corresponding to the IPsec tunnel number. As a result, an IPv6 IPsec packet including the outer IPv6 header 13, the ESP header 14, IV15, the encrypted packet 11, the trailer 12, and the ICV 16 is generated.
The IPsec unit 210 outputs, to the WAN MAC I / F 205, a frame that includes the generated IPv6 IPsec packet and includes the L2 header generated from the MAC address corresponding to the IPsec tunnel number. The WAN MAC I / F 205 sends the received frame to the WAN via the physical I / F 500.

図4は、フラグメントされていないIPsecパケットを受信した場合の処理を示す図である。
IPsec部210は、WAN用MAC I/F205からIPv6 IPsecパケットを含むフレームを受信する。IPv6 IPsecパケットは、外側IPv6ヘッダ20、ESPヘッダ21、IV22、暗号化パケット23、トレーラ24、及び、ICV25からなる。IPsec部210は、パケットのヘッダからIPsec処理対象であり、拡張ヘッダがないことを認識すると、ESPヘッダ21に含まれるSPIからSA、暗号化アルゴリズム、認証鍵を取得する。認証ありの場合、IPsec部210は、読み出した認証鍵により、ICV25の認証を行った後、ICV25を削除する。IPsec部210は、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従い、IV22を用いて暗号化パケット23及びトレーラ24を復号する。そして、復号したトレーラ24で示されるパディング長に従い、復号した暗号化パケット23からパディングを削除してIPv4/IPv6パケットであるIPパケット26を取得する。IPsec部210は、外側IPv6ヘッダ20、ESPヘッダ21を削除し、null暗号以外の場合、さらに、IV22を削除する。
FIG. 4 is a diagram illustrating processing when an unfragmented IPsec packet is received.
The IPsec unit 210 receives a frame including an IPv6 IPsec packet from the WAN MAC I / F 205. The IPv6 IPsec packet includes an outer IPv6 header 20, an ESP header 21, IV22, an encrypted packet 23, a trailer 24, and an ICV 25. When recognizing that there is no extension header from the packet header, the IPsec unit 210 acquires the SA, the encryption algorithm, and the authentication key from the SPI included in the ESP header 21. In the case of authentication, the IPsec unit 210 deletes the ICV 25 after authenticating the ICV 25 with the read authentication key. If the encryption algorithm is other than the null encryption, the IPsec unit 210 decrypts the encrypted packet 23 and the trailer 24 using the IV 22 according to the encryption algorithm. Then, according to the padding length indicated by the decrypted trailer 24, the padding is deleted from the decrypted encrypted packet 23 to obtain an IP packet 26 that is an IPv4 / IPv6 packet. The IPsec unit 210 deletes the outer IPv6 header 20 and the ESP header 21, and further deletes the IV 22 in cases other than the null cipher.

IPsec部210は、復号したIPパケット26を含むフレームと、SAを示すIPsecトンネル番号とを書き込みスケジューラ部215に出力する。出力されたフレームは、DDR−SDRAM300に書き込まれ、パーサ部230は、この書き込まれたフレーム内のアドレス等に基づき処理を行う。そして、検索部235においてジョブが発生し、QoS部250に書き込まれる。メモリコントローラ部220は、DDR−SDRAM300から読み出したIPパケット26と、IPsecトンネル番号とをCPU I/F265を介してCPU400に出力する。あるいは、フレーム生成部260からLAN用MAC I/F275に出力され、LANに送出される。   The IPsec unit 210 outputs the frame including the decrypted IP packet 26 and the IPsec tunnel number indicating SA to the write scheduler unit 215. The output frame is written in the DDR-SDRAM 300, and the parser unit 230 performs processing based on the address in the written frame. Then, a job is generated in the search unit 235 and written in the QoS unit 250. The memory controller unit 220 outputs the IP packet 26 read from the DDR-SDRAM 300 and the IPsec tunnel number to the CPU 400 via the CPU I / F 265. Alternatively, the data is output from the frame generation unit 260 to the LAN MAC I / F 275 and transmitted to the LAN.

図5は、拡張ヘッダがあり、フラグメントの必要がないIPsecパケットを送信する場合の処理を示す図である。
CPU400においてIPsecを用いてIPv4/IPv6パケットであるIPパケット30を転送すべきと判断した場合、CPU400は、CPU I/F265を介して、IPv6ヘッダ31、拡張ヘッダ32、及び、カプセル化されたIPパケット30からなるIP in IPv6形式の拡張ヘッダ付IPv6カプセル化パケットと、SAを示すIPsecトンネル番号と、IP in IPv6形式であることを示すフラグとを書き込みスケジューラ部215へ出力する。IPv6ヘッダ31に設定するIPアドレスは、IPsecカプセル化で付加される外側IPv6ヘッダのIPアドレスと一致させる。また、拡張ヘッダ数は1以上あればよい。IPパケット30の直前の拡張ヘッダ32内にある次ヘッダの情報には、IPパケット30のプロトコルであるIPv4/IPv6のプロトコルを示す情報を設定する。
FIG. 5 is a diagram illustrating processing when an IPsec packet having an extension header and not requiring fragmentation is transmitted.
When the CPU 400 determines that the IP packet 30 that is an IPv4 / IPv6 packet should be transferred using IPsec, the CPU 400 transmits the IPv6 header 31, the extension header 32, and the encapsulated IP via the CPU I / F 265. An IPv6 encapsulated packet with an extension header in the IP in IPv6 format composed of the packet 30, an IPsec tunnel number indicating SA, and a flag indicating the IP in IPv6 format are output to the write scheduler unit 215. The IP address set in the IPv6 header 31 is matched with the IP address of the outer IPv6 header added by IPsec encapsulation. Further, the number of extension headers may be one or more. Information indicating the IPv4 / IPv6 protocol that is the protocol of the IP packet 30 is set in the information of the next header in the extension header 32 immediately before the IP packet 30.

メモリコントローラ部220は、DDR−SDRAM I/F225を介してDDR−SDRAM300へ拡張ヘッダ付IPv6カプセル化パケットを書き込み、パーサ部230は、IPsecトンネル番号及びフラグを検索部235に出力する。検索部235は、IPsecを用いたパケットの送信のジョブを選択し、CPU転送判定部240は、CPU400への転送が不要であると判断する。QoS部250は、ジョブ情報を生成してキューに記録する。フレーム生成部260は、IPsecトンネル番号及びフラグと、メモリコントローラ部220がDDR−SDRAM300から読み出した拡張ヘッダ付IPv6カプセル化パケットとをIPsec部210に出力する。   The memory controller unit 220 writes the IPv6 encapsulated packet with an extension header to the DDR-SDRAM 300 via the DDR-SDRAM I / F 225, and the parser unit 230 outputs the IPsec tunnel number and the flag to the search unit 235. The search unit 235 selects a packet transmission job using IPsec, and the CPU transfer determination unit 240 determines that transfer to the CPU 400 is unnecessary. The QoS unit 250 generates job information and records it in a queue. The frame generation unit 260 outputs the IPsec tunnel number and flag, and the IPv6 encapsulated packet with extension header read out from the DDR-SDRAM 300 by the memory controller unit 220 to the IPsec unit 210.

IPsec部210は、パケットがIPsec処理対象であり、かつ、拡張ヘッダがあることを認識し、さらに、フラグによりパケットがIP in IPv6形式であることを認識する。IPsec部210は、IPsecトンネル番号(SA)をキーに暗号化アルゴリズムと、認証鍵を読み出す。IPsec部210は、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従ってIPパケット30から暗号化パケット33を生成し、さらに、トレーラ34を生成して暗号化パケット33の後ろに付加するとともに、暗号化パケット33の前にIV38を付加する。また、認証ありの場合、ICV39をトレーラ34の後ろに付加する。   The IPsec unit 210 recognizes that the packet is an IPsec processing target and has an extension header, and further recognizes that the packet is in the IP in IPv6 format by the flag. The IPsec unit 210 reads out an encryption algorithm and an authentication key using the IPsec tunnel number (SA) as a key. If the encryption algorithm is other than the null encryption, the IPsec unit 210 generates an encrypted packet 33 from the IP packet 30 according to the encryption algorithm, generates a trailer 34, and adds it to the end of the encrypted packet 33. , IV 38 is added before the encrypted packet 33. In the case of authentication, the ICV 39 is added behind the trailer 34.

IPsec部210は、ESPヘッダ37を生成し、IV38の直前に付加する。そして、IPv6ヘッダ31内のペイロード長を、生成したIPsecパケットの長さとなるよう更正して外側IPv6ヘッダ35とする。さらに、拡張ヘッダ32のうちESPヘッダ直前の拡張ヘッダ内の次ヘッダを、ESPを示す情報に更正して拡張ヘッダ36とする。このようにして、IPsec部210は、外側IPv6ヘッダ35、拡張ヘッダ36、ESPヘッダ37、IV38、暗号化パケット33、トレーラ34、及び、ICV39からなる拡張ヘッダ付IPv6 IPsecパケットを生成する。IPsec部210は、生成した拡張ヘッダ付IPv6 IPsecパケットを含み、IPsecトンネル番号に対応したMACアドレスから生成したL2ヘッダを付加したフレームをWAN用MAC I/F205に出力し、WAN用MAC I/F205は受信したフレームを物理I/F500を介してWANに送出する。   The IPsec unit 210 generates the ESP header 37 and adds it immediately before IV38. Then, the payload length in the IPv6 header 31 is corrected to be the length of the generated IPsec packet to be the outer IPv6 header 35. Further, the next header in the extension header immediately before the ESP header in the extension header 32 is corrected to the information indicating ESP to be the extension header 36. In this way, the IPsec unit 210 generates an IPv6 IPsec packet with an extension header including the outer IPv6 header 35, the extension header 36, the ESP headers 37 and IV38, the encrypted packet 33, the trailer 34, and the ICV 39. The IPsec unit 210 includes the generated IPv6 IPsec packet with an extension header, outputs a frame to which the L2 header generated from the MAC address corresponding to the IPsec tunnel number is added to the WAN MAC I / F 205, and the WAN MAC I / F 205 Sends the received frame to the WAN via the physical I / F 500.

図6は、拡張ヘッダがあり、フラグメントされていないIPsecパケットを受信した場合の処理を示す図である。
IPsec部210は、WAN用MAC I/F205から拡張ヘッダ付IPv6 IPsecパケットを含むフレームを受信する。拡張ヘッダ付IPv6 IPsecパケットは、外側IPv6ヘッダ40、拡張ヘッダ41、ESPヘッダ42、IV43、暗号化パケット44、トレーラ45、及び、ICV46からなる。IPsec部210は、パケットのヘッダからIPsec処理対象であり、拡張ヘッダがあることを認識すると、ESPヘッダ42に含まれるSPIからSA、暗号化アルゴリズム、認証鍵を取得する。認証ありの場合、IPsec部210は、読み出した認証鍵により、ICV46の認証を行った後、ICV46を削除する。さらに、IPsec部210は、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従い、IV43を用いて暗号化パケット44及びトレーラ45を復号する。そして、復号したトレーラ45で示されるパディング長に従い、復号した暗号化パケット44からパディングを削除してIPv4/IPv6パケットであるIPパケット49を取得し、IV43を削除する。
FIG. 6 is a diagram illustrating processing when an IPsec packet having an extension header and not fragmented is received.
The IPsec unit 210 receives a frame including an IPv6 IPsec packet with an extension header from the WAN MAC I / F 205. The IPv6 IPsec packet with an extension header includes an outer IPv6 header 40, an extension header 41, an ESP header 42, IV43, an encrypted packet 44, a trailer 45, and an ICV 46. When the IPsec unit 210 recognizes that there is an extension header from the header of the packet and that there is an extension header, the IPsec unit 210 acquires the SA, the encryption algorithm, and the authentication key from the SPI included in the ESP header 42. When authentication is performed, the IPsec unit 210 deletes the ICV 46 after authenticating the ICV 46 using the read authentication key. Furthermore, if the encryption algorithm is other than the null encryption, the IPsec unit 210 uses the IV 43 to decrypt the encrypted packet 44 and the trailer 45 according to the encryption algorithm. Then, according to the padding length indicated by the decrypted trailer 45, the padding is deleted from the decrypted encrypted packet 44 to obtain the IP packet 49 which is an IPv4 / IPv6 packet, and the IV 43 is deleted.

IPsec部210は、ESPヘッダ42を削除し、拡張ヘッダ41のうちESPヘッダ42直前の拡張ヘッダ内の次ヘッダを、IPv4/IPv6パケットのプロトコルを示す情報に更正して拡張ヘッダ48とする。また、IPsec部210は、外側IPv6ヘッダ40内のペイロード長を更正し、IPv6ヘッダ47とする。これにより、IPv6ヘッダ47、拡張ヘッダ48、及び、カプセル化されたIPパケット49からなるIP in IPv6形式の拡張ヘッダ付きIPv6カプセル化パケットが生成される。IPsec部210は、生成した拡張ヘッダ付きIPv6カプセル化パケットを含むフレームと、IP in IPv6形式であることを示すフラグと、SAを示すIPsecトンネル番号とを書き込みスケジューラ部215に出力する。   The IPsec unit 210 deletes the ESP header 42 and modifies the next header in the extension header immediately before the ESP header 42 in the extension header 41 to information indicating the protocol of the IPv4 / IPv6 packet as the extension header 48. Further, the IPsec unit 210 corrects the payload length in the outer IPv6 header 40 to obtain an IPv6 header 47. As a result, an IPv6 encapsulated packet with an extension header of the IP in IPv6 format including the IPv6 header 47, the extension header 48, and the encapsulated IP packet 49 is generated. The IPsec unit 210 outputs the generated frame including the IPv6 encapsulated packet with the extension header, the flag indicating the IP in IPv6 format, and the IPsec tunnel number indicating the SA to the write scheduler unit 215.

IPsec部210から出力されたフレームは、DDR−SDRAM300に書き込まれ、パーサ部230は、この書き込まれたフレーム内のアドレス等により処理を行う。そして、検索部235においてジョブが発生し、QoS部250に書き込まれる。メモリコントローラ部220は、DDR−SDRAM300から読み出した拡張ヘッダ付きIPv6カプセル化パケットと、IPsecトンネル番号と、フラグとをCPU I/F265を介してCPU400に出力する。CPU400は、拡張ヘッダ48に従った拡張ヘッダ処理を実行した後、拡張ヘッダ48を削除し、IPパケット49を用いた処理が行われる。   The frame output from the IPsec unit 210 is written in the DDR-SDRAM 300, and the parser unit 230 performs processing based on the address in the written frame. Then, a job is generated in the search unit 235 and written in the QoS unit 250. The memory controller unit 220 outputs the IPv6 encapsulated packet with extension header, the IPsec tunnel number, and the flag read from the DDR-SDRAM 300 to the CPU 400 via the CPU I / F 265. After executing the extension header processing according to the extension header 48, the CPU 400 deletes the extension header 48 and performs processing using the IP packet 49.

<第2の実施形態>
第2の実施の形態では、フラグメントを伴うIPsec処理について説明する。
IPsecのカプセル化を行うと、パケット長が増加するため、1回の転送で送信できるデータの最大値であるMTU(Maximum Transmission Unit)を超えてしまう場合がある。そこで、MTUを超えないよう複数のIPsecパケットに分割することで、送信可能な長さとする。以下では、IPsecのカプセル化時のパケット分割と、IPsecのデカプセル化時のパケット再構築の方法を説明する。
<Second Embodiment>
In the second embodiment, an IPsec process involving a fragment will be described.
When IPsec encapsulation is performed, the packet length increases, so there are cases where the maximum value of data that can be transmitted in one transfer exceeds the maximum transmission unit (MTU). Therefore, the transmission length is set by dividing the packet into a plurality of IPsec packets so as not to exceed the MTU. In the following, a method of packet division at the time of encapsulation of IPsec and a method of packet reconstruction at the time of decapsulation of IPsec will be described.

IPパケットを暗号化した後にカプセル化して分割する場合は、IPsec回路が送信するパケットをさらに分割する処理と、IPsec回路が受信する前に分割されたパケットを再構築する処理が必要となる。これらの処理は、ハードウェア化が困難であるため、CPUでのソフトウェア処理が望ましいが、パケット転送回数が増加するため、インライン型の特徴である高速性は損なわれることになる。
そこで、本実施の形態では、CPU650において転送パケットをカプセル化して分割し、その後、IPsec回路620が分割された各パケットを暗号化する。つまり、フラグメントヘッダを含めた暗号化(ESPヘッダをフラグメントヘッダの前に挿入)によって、形式的な暗号・復号処理をIPsec回路620にて行うことができる。
When an IP packet is encrypted and then encapsulated and divided, a process for further dividing a packet transmitted by the IPsec circuit and a process for reconstructing the divided packet before the IPsec circuit receives the packet are required. Since these processes are difficult to implement in hardware, software processing by the CPU is desirable. However, since the number of packet transfers increases, the high-speed characteristic that is an inline type feature is impaired.
Therefore, in this embodiment, the CPU 650 encapsulates and divides the transfer packet, and then the IPsec circuit 620 encrypts each divided packet. That is, formal encryption / decryption processing can be performed by the IPsec circuit 620 by encryption including the fragment header (inserting the ESP header before the fragment header).

第2の実施形態の通信装置の通信処理回路200に関して、第1の実施形態との差分について説明する。
第2の実施形態では、SA(受信)が見つかったIPsecパケットに対するIPsec部210の動作に関して、第1の実施形態の動作とは異なる点がある。以下にIPsec部210における第1の実施の形態との差分の動作を説明する。
Regarding the communication processing circuit 200 of the communication apparatus according to the second embodiment, differences from the first embodiment will be described.
In the second embodiment, the operation of the IPsec unit 210 for an IPsec packet in which SA (reception) is found differs from the operation in the first embodiment. The operation of the difference between the IPsec unit 210 and the first embodiment will be described below.

まず、IPsecパケットの受信動作について差分を説明する。
IPsec部210は、SA(受信)に対応させて、暗号アルゴリズム、暗号鍵(NULL暗号以外の場合)、認証アルゴリズム、認証鍵(認証ありの場合)、アンチリプレイの有無を、SA処理条件(受信)として記憶している。IPsec部210は、受信したIPsecパケットのSA(受信)に基づいて、SA処理条件(受信)を取得する。
First, the difference in IPsec packet reception operation will be described.
In correspondence with SA (reception), the IPsec unit 210 determines the SA processing condition (reception) based on the encryption algorithm, the encryption key (in the case of other than NULL encryption), the authentication algorithm, the authentication key (in the case of authentication), and the presence / absence of anti-replay. ). The IPsec unit 210 acquires SA processing conditions (reception) based on the SA (reception) of the received IPsec packet.

IPsec部210は、上記の取得したSA処理条件(受信)を使用して、認証と復号とデカプセルの各処理を行い、復号された内側IPパケットを取得する。さらに、前記IPパケットを含むフレームに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号を付加して、書き込みスケジューラ部215に出力する。なお、SA処理条件(受信)のアンチリプレイが有りの場合は、アンチリプレイの処理が行われる。
以下に、認証、復号、デカプセル、アンチリプレイの各処理の動作を説明する。
The IPsec unit 210 performs authentication, decryption, and decapsulation processes using the acquired SA processing conditions (reception), and acquires the decrypted inner IP packet. Further, information indicating the presence of received IPsec and a received SA number for identifying SA (reception) are added to the frame including the IP packet and output to the write scheduler unit 215. Note that when there is anti-replay of the SA processing condition (reception), anti-replay processing is performed.
Hereinafter, operations of authentication, decryption, decapsulation, and anti-replay processes will be described.

<認証処理>
第1の実施形態と同じ処理を行う。
<Authentication process>
The same processing as in the first embodiment is performed.

<復号処理>
第1の実施形態と同じ処理を行う。ただし、復号後のトレーラ内に含まれている次ヘッダ値に基づいて、ESPペイロードの先頭にフラグメント拡張ヘッダが付加されているか否かを検出する。第1の実施形態では、ESPペイロードの先頭は、内側IPパケットのIPv4ヘッダ、または、IPv6ヘッダの何れかであった。第2の実施形態では、前記IPv4ヘッダもしくはIPv6ヘッダの場合の他に、フラグメント拡張ヘッダの場合があり、前者の場合をフラグメント拡張ヘッダ無として、後者の場合をフラグメント拡張ヘッダ有として検出しておく。
<Decryption process>
The same processing as in the first embodiment is performed. However, based on the next header value included in the trailer after decoding, it is detected whether or not a fragment extension header is added to the head of the ESP payload. In the first embodiment, the head of the ESP payload is either the IPv4 header or the IPv6 header of the inner IP packet. In the second embodiment, there is a case of a fragment extension header in addition to the case of the IPv4 header or the IPv6 header. The former case is detected as no fragment extension header, and the latter case is detected as having a fragment extension header. .

<デカプセル処理;ESPを除く拡張ヘッダ無、フラグメント拡張ヘッダ無>
外側IPv6ヘッダの後にESP以外の拡張ヘッダ無の場合で、かつ、ESPペイロードの先頭がフラグメント拡張ヘッダ無の場合、受信したIPsecパケットに対するデカプセル処理では、前記パケットから外側IPヘッダ、ESPヘッダ、IV、トレーラ、ICVを削除し、復号された内側IPパケットを取得する。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、内側IPパケットのプロトコルに基づいて、フレームのレイヤ3プロトコルとして、IPv4あるいはIPv6を指定する。すなわち、イーサネット(登録商標)フレームのTypeフィールドを、内側IPパケットのプロトコルに相当する値に書き換える。さらに、外側IPv6ヘッダ直後から内側IPパケット終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化無しを示す惰報を付加してもよい。
<Decapsulation processing; no extension header excluding ESP, no fragment extension header>
When there is no extension header other than ESP after the outer IPv6 header, and when the head of the ESP payload does not have a fragment extension header, in the decapsulation processing for the received IPsec packet, the outer IP header, ESP header, IV, The trailer and ICV are deleted, and the decrypted inner IP packet is acquired. At this time, the pad is deleted based on the decoded pad length of the trailer, and IPv4 or IPv6 is designated as the layer 3 protocol of the frame based on the protocol of the inner IP packet. That is, the Type field of the Ethernet (registered trademark) frame is rewritten to a value corresponding to the protocol of the inner IP packet. Furthermore, the payload length of the outer IPv6 header is rewritten based on the length from immediately after the outer IPv6 header to the end of the inner IP packet. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating no IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<デカプセル処理;ESPを除く拡張ヘッダ無、フラグメント拡張ヘッダ有>
外側IPv6ヘッダの後にESP以外の拡張ヘッダ無の場合で、かつ、ESPペイロードの先頭がフラグメント拡張ヘッダ有の場合、受信したIPsecパケットに対するデカプセル処理では、前記パケットからESPヘッダ、IV、トレーラ、ICVを削除し、外側IPv6ヘッダと、ペイロードとして復号されたフラグメント拡張ヘッダを先頭にもつフラグメントデータから構成される、フラグメントIPv6パケットに書き換える。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、外側IPv6ヘッダ内の次ヘッダフィールドを、フラグメント拡張ヘッダを示す値に書き換える。さらに、外側IPv6ヘッダ直後からフラグメントデータ終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化有りを示す情報を付加してもよい。
<Decapsulation processing; no extension header except ESP, with fragment extension header>
When there is no extension header other than ESP after the outer IPv6 header and the beginning of the ESP payload has a fragment extension header, in the decapsulation processing for the received IPsec packet, the ESP header, IV, trailer, and ICV are extracted from the packet. Delete and rewrite a fragment IPv6 packet composed of fragment data having the outer IPv6 header and the fragment extension header decoded as the payload at the head. At this time, the pad is deleted based on the decoded trailer pad length, and the next header field in the outer IPv6 header is rewritten to a value indicating the fragment extension header. Further, the payload length of the outer IPv6 header is rewritten based on the length from immediately after the outer IPv6 header to the end of the fragment data. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating the presence of IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<デカプセル処理;ESPを除く拡張ヘッダ有、フラグメント拡張ヘッダ無>
外側IPv6ヘッダの後のESP以外の拡張ヘッダ有の場合で、かつ、ESPペイロードの先頭がフラグメント拡張ヘッダ無の場合、受信したIPsecパケットに対するデカプセルにおいて、前記パケットからESPヘッダ、IV、トレーラ、ICVを削除し、外側IPv6ヘッダと前記外側IPv6ヘッダの後のESP以外の拡張ヘッダを残し、復号された内側IPパケットを内側IPパケットとした、IPv6カプセル化パケットに書き換える。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、内側IPパケットのプロトコルに基づいて、前記内側IPパケットの直前の拡張ヘッダ内の次ヘッダフィールドに、IPv4あるいはIPv6を指定する。すなわち、拡張ヘッダの次ヘッダフィールドを、内側IPパケットのプロトコルに相当する値に書き換える。さらに、外側IPv6ヘッダ直後から内側IPパケット終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化有りを示す情報を付加してもよい。
<Decapsulation processing; with extension header excluding ESP, without fragment extension header>
If there is an extension header other than ESP after the outer IPv6 header, and the beginning of the ESP payload does not have a fragment extension header, the ESP header, IV, trailer, and ICV are extracted from the packet in the decapsulation for the received IPsec packet. It deletes and leaves the outer IPv6 header and an extension header other than the ESP after the outer IPv6 header, and rewrites the decoded inner IP packet as an IPv6 encapsulated packet. At this time, the pad is deleted based on the decoded pad length of the trailer, and IPv4 or IPv6 is designated in the next header field in the extension header immediately before the inner IP packet based on the protocol of the inner IP packet. . That is, the next header field of the extension header is rewritten to a value corresponding to the protocol of the inner IP packet. Furthermore, the payload length of the outer IPv6 header is rewritten based on the length from immediately after the outer IPv6 header to the end of the inner IP packet. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating the presence of IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<デカプセル処理;ESPを除く拡張ヘッダ有、フラグメント拡張ヘッダ有>
外側IPv6ヘッダの後にESP以外の拡張ヘッダ有の場合で、かつ、ESPペイロードの先頭がフラグメント拡張ヘッダ有の場合、受信したIPsecパケットに対するデカプセルにおいて、前記パケットからESPヘッダ、IV、トレーラ、ICVを削除し、外側IPv6ヘッダと、外側IPv6ヘッダと前記外側IPv6ヘッダの後のESP以外の拡張ヘッダと、前記拡張ヘッダに続く復号されたフラグメント拡張ヘッダを先頭にもつフラグメントデータから構成される、フラグメントIPv6パケットに書き換える。このとき、復号されたトレーラのパッド長に基づいてパッドの削除を行い、フラグメント拡張ヘッダの直前の拡張ヘッダ内の次ヘッダフィールドを、フラグメント拡張ヘッダを示す値に書き換える。さらに、外側IPv6ヘッダ直後からフラグメントデータ終了までの長さに基づいて、外側IPv6ヘッダのペイロード長を書き換える。ここで、前記IPv6カプセル化パケットに、受信IPsec有を示す情報とSA(受信)を識別する受信SA番号に加えて、IPv6カプセル化有を示す情報を付加してもよい。
<Decapsulation processing; with extension header excluding ESP, with fragment extension header>
When there is an extension header other than ESP after the outer IPv6 header and the header of the ESP payload has a fragment extension header, the ESP header, IV, trailer, and ICV are deleted from the packet in the decapsulation for the received IPsec packet. A fragment IPv6 packet comprising an outer IPv6 header, an outer IPv6 header, an extension header other than ESP after the outer IPv6 header, and fragment data having a decoded fragment extension header following the extension header at the head Rewrite to At this time, the pad is deleted based on the decoded trailer pad length, and the next header field in the extension header immediately before the fragment extension header is rewritten to a value indicating the fragment extension header. Further, the payload length of the outer IPv6 header is rewritten based on the length from immediately after the outer IPv6 header to the end of the fragment data. Here, in addition to the information indicating the presence of received IPsec and the received SA number for identifying SA (reception), information indicating the presence of IPv6 encapsulation may be added to the IPv6 encapsulated packet.

<アンチリプレイ処理>
第1の実施形態と同じ処理を行う。
<Anti-replay process>
The same processing as in the first embodiment is performed.

なお、IPsec部210が書き込みスケジューラ部215ヘデータを出力した以後の動作は、上述した図2に示す各部の説明に従う。ただし、外側IPv6ヘッダの後のESP以外の拡張ヘッダ有の場合にIPsec部210が出力するIPv6カプセル化パケットを、外側IPv6ヘッダ内のあて先IPv6アドレスに基づいて自宛と判断し、CPU400に転送される。IPv6カプセル化有りを示す情報が前記IPv6カプセル化パケットに付加されている場合は、前記情報に基づきCPU400に転送してもよい。   The operation after the IPsec unit 210 outputs data to the write scheduler unit 215 follows the description of each unit shown in FIG. However, the IPv6 encapsulated packet output by the IPsec unit 210 when there is an extension header other than ESP after the outer IPv6 header is determined to be addressed to itself based on the destination IPv6 address in the outer IPv6 header and transferred to the CPU 400. The When information indicating the presence of IPv6 encapsulation is added to the IPv6 encapsulated packet, it may be transferred to the CPU 400 based on the information.

CPU400は、1個のIPv6パケットから分割された複数の前記フラグメントIPv6パケットを、転送回路から入力し、これらを再構成を行って分割前のIPv6パケットを取得する。さらに、前記IPv6パケットが、IPパケットをIPv6カプセル化したIPv6カプセル化パケットであることを検出して、前記検出されたIPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する。前記内側IPパケットに対する処理は、通常のIPパケットに対する処理と同じである。   The CPU 400 inputs a plurality of the fragment IPv6 packets divided from one IPv6 packet from the transfer circuit, reconfigures them, and acquires the pre-division IPv6 packet. Furthermore, it detects that the IPv6 packet is an IPv6 encapsulated packet obtained by encapsulating an IP packet with IPv6, and decapsulates the detected IPv6 encapsulated packet to obtain an inner IP packet. The process for the inner IP packet is the same as the process for a normal IP packet.

続いて、IPsecパケットの送信動作について差分を説明する。
CPU400は、所定の拡張ヘッダを付加するとともにIPsecカプセル化を行って送信するIPパケットについて、前記IPパケットを内側IPパケットとしてIPv6カプセル化し、前記IPv6カプセル化パケットに前記拡張ヘッダを付加した、拡張ヘッダ付IPv6カプセル化パケットにL2ヘッダ(あて先・送信元MACアドレスとイーサネット(登録商標)フレームのTypeなど)を付与し、IPv6カプセル化済みIPsec送信情報を付加して、CPU I/F265を介して転送回路に入力する。
Subsequently, differences in the transmission operation of the IPsec packet will be described.
The CPU 400 adds a predetermined extension header and performs an IP encapsulation to send the IP packet as an inner IP packet by IPv6 encapsulation, and adds the extension header to the IPv6 encapsulated packet. L2 header (address / source MAC address and Ethernet (registered trademark) frame type, etc.) is added to the attached IPv6 encapsulated packet, and the IPv6 encapsulated IPsec transmission information is added and transferred via the CPU I / F 265. Input to the circuit.

またCPU400は、IPsecカプセル化後のパケットの長さがMTUを越える場合に、内側IPパケットに対してIPv6カプセル化し、前記IPv6カプセル化パケットを各々フラグメント拡張ヘッダが付加された複数のフラグメントIPv6パケットに分割し、前記各フラグメントIPv6パケットにL2ヘッダを付与し、IPv6カプセル化済みIPsec送信情報を付加して、CPU I/F265を介して転送回路に入力する。なお、上述の拡張ヘッダ付IPv6カプセル化パケットと、フラグメントIPv6パケットとを区別する情報を、IPv6カプセル化済みIPsec送信情報として付加してもよい。   In addition, when the length of the packet after IPsec encapsulation exceeds the MTU, the CPU 400 encapsulates the inner IP packet with IPv6, and the IPv6 encapsulated packet is converted into a plurality of fragment IPv6 packets each having a fragment extension header added thereto. The packet is divided, an L2 header is added to each of the fragment IPv6 packets, an IPsec transmission information with IPv6 encapsulation is added, and the packet is input to the transfer circuit via the CPU I / F 265. Note that information for distinguishing the above-described IPv6 encapsulated packet with an extension header from a fragmented IPv6 packet may be added as IPv6 encapsulated IPsec transmission information.

WAN/LANの物理I/F500,501で受信したフレームが転送回路内で転送されてIPsec部210に入力されたフレームに対するIPsec部210の処理は、IPv6カプセル化無を示す情報が付加された場合の処理に一致し、本実施の形態では、前記フレームを、IPv6カプセル化無を示す情報が付加されたフレームとして説明する。   When the frame received by the WAN / LAN physical I / F 500, 501 is transferred in the transfer circuit and input to the IPsec unit 210, the processing of the IPsec unit 210 includes information indicating that there is no IPv6 encapsulation. In this embodiment, the frame is described as a frame to which information indicating that IPv6 encapsulation is not added is added.

以下に、送信IPsec有の場合の送信フレームに対するIPsec部210の動作を説明する。
IPsec部210は、SA(送信)に対応させて、暗号アルゴリズム、暗号鍵(NULL暗号以外の場合)、認証アルゴリズム、認証鍵(認証ありの場合)を、SA処理条件(送信)として記憶する。IPsec部210は、SA(送信)に基づいて、SA処理条件(送信)を取得する。
The operation of the IPsec unit 210 for a transmission frame when there is transmission IPsec will be described below.
The IPsec unit 210 stores an encryption algorithm, an encryption key (in the case of other than NULL encryption), an authentication algorithm, and an authentication key (in the case of authentication) as SA processing conditions (transmission) in association with SA (transmission). The IPsec unit 210 acquires SA processing conditions (transmission) based on SA (transmission).

また、IPsec部210は、SA(送信)に対応させて、外側IPv6ヘッダの宛先IPv6アドレス、送信元IPv6アドレス、ホップ・リミット、トラフィック・クラス(内側IPパケットのトラフィック・クラスを外側IPヘッダに複製する指定も可能)と、ESPヘッダのSPIをカプセル化条件として記憶する。IPsec部210は、SA(送信)に基づいて、カプセル化条件を取得する。   Further, the IPsec unit 210 copies the destination IPv6 address, the source IPv6 address, the source IPv6 address, the hop limit, and the traffic class (the traffic class of the inner IP packet in the outer IP header) corresponding to SA (transmission). The SPI of the ESP header is stored as an encapsulation condition. The IPsec unit 210 acquires an encapsulation condition based on SA (transmission).

さらに、IPsec部210は、SA(送信)に対応させて、送信するIPv6パケットのESPヘッダ内のシーケンス番号を管理する。すなわち、SA(送信)別に送信したIPパケットの個数を計数し、シーケンス番号とする。IPsec部210は、SA(送信)に基づいて、シーケンス番号を取得する。   Furthermore, the IPsec unit 210 manages the sequence number in the ESP header of the IPv6 packet to be transmitted in association with SA (transmission). That is, the number of IP packets transmitted for each SA (transmission) is counted and used as a sequence number. The IPsec unit 210 acquires a sequence number based on SA (transmission).

IPsec部210は、フレーム生成部260より入力されたフレームに含まれるIPパケットに対して、上記の取得したSA処理条件(送信)、カプセル化条件、シーケンス番号を使用して、暗号とICV生成とカプセルの各処理を行う。
以下に、暗号、ICV生成、カプセルの各処理の動作を説明する。
The IPsec unit 210 performs encryption and ICV generation on the IP packet included in the frame input from the frame generation unit 260 using the acquired SA processing condition (transmission), encapsulation condition, and sequence number. Perform each processing of the capsule.
The operations of encryption, ICV generation, and capsule processing will be described below.

<暗号処理;IPv6カプセル化無>
第1の実施形態と同じ処理を行う。
<Encryption processing; no IPv6 encapsulation>
The same processing as in the first embodiment is performed.

<暗号処理;IPv6カプセル化有>
IPv6カプセル化有を示す情報が付加されている場合、外側IPv6ヘッダに続く拡張ヘッダにフラグメント拡張ヘッダが含まれているか否かを検出する。IPv6カプセル化済みIPsec送信情報にフラグメントIPv6パケットの有無を示す情報が含まれている場合は、前記情報に基づいて検出してもよい。前記検出によりフラグメント拡張ヘッダ無である場合、以後の暗号化の処理については、第1の実施形態と同じである。
前記検出によりフラグメント拡張ヘッダ有である場合、前記フラグメント拡張ヘッダ以後のIPv6パケットデータを、ESPカプセル化するため、所定のトレーラを、前記内側IPパケットの直後に付加する。前記トレーラは、パッド、前記パッドのパッド長、フラグメント拡張ヘッダを示す次ヘッダ値から構成されるが、前記パッドを付加するパディング処理において、前記内側IPパケットとトレーラの合計した長さが、これらを暗号化するときの暗号アルゴリズムによって予め決められたブロック長の整数倍となるよう、パッド長を取得する。以後の暗号化の処理については、IPv6カプセル化無を示す情報が付加されている場合の処理と同じである。
<Encryption processing with IPv6 encapsulation>
When information indicating that IPv6 encapsulation is present is added, it is detected whether or not a fragment extension header is included in the extension header following the outer IPv6 header. When the IPv6 encapsulated IPsec transmission information includes information indicating the presence or absence of a fragmented IPv6 packet, the information may be detected based on the information. When there is no fragment extension header due to the detection, the subsequent encryption processing is the same as in the first embodiment.
If the fragment extension header is present by the detection, a predetermined trailer is added immediately after the inner IP packet in order to encapsulate the IPv6 packet data after the fragment extension header. The trailer is composed of a pad, a pad length of the pad, and a next header value indicating a fragment extension header. In the padding process for adding the pad, the total length of the inner IP packet and the trailer is calculated as follows. The pad length is acquired so as to be an integral multiple of the block length predetermined by the encryption algorithm used for encryption. The subsequent encryption processing is the same as the processing in the case where information indicating that IPv6 encapsulation is not added is added.

<ICV生成処理>
第1の実施形態と同じ処理を行う。
<ICV generation processing>
The same processing as in the first embodiment is performed.

<カプセル処理;IPv6カプセル化無>
第1の実施形態と同じ処理を行う。
<Capsule processing; no IPv6 encapsulation>
The same processing as in the first embodiment is performed.

<カプセル処理;IPv6カプセル化有>
第1の実施形態と同じ処理を行う。
<Capsule processing; with IPv6 encapsulation>
The same processing as in the first embodiment is performed.

図7は、フラグメントを伴うIPsecパケットを送信する場合の処理を示す図である。
図2に示す通信装置100において、CPU400がIPsecを用いてIPv4/IPv6パケットであるIPパケット50を転送すべきと判断し、かつ、IPsec処理によりMTUを超過すると判断した場合、IPパケット50を分割し、分割IPパケット50a及び分割IPパケット50bを生成する。そして、IPv6ヘッダ51a、フラグメントヘッダである拡張ヘッダ52a、及び、カプセル化された分割IPパケット50aからなるX in IPv6形式のフラグメントIPv6パケットと、IPv6ヘッダ51b、フラグメントヘッダである拡張ヘッダ52b、及び、カプセル化された分割IPパケット50bからなるX in IPv6形式のフラグメントIPv6パケットを生成する。X in IPv6形式とは、拡張ヘッダを含み、分割されたIPパケットをパケットデータとしてカプセル化したIPv6パケットを示す。フラグメントヘッダには、フラグメントの識別番号と、分割順序の情報が含まれる。CPU400は、分割IPパケット50aをカプセル化したフラグメントIPv6パケットと、SAを示すIPsecトンネル番号と、X in IPv6形式であることを示すフラグとを書き込みスケジューラ部215へ出力する。さらに、CPU400は、分割IPパケット50bをカプセル化したフラグメントIPv6パケットと、SAを示すIPsecトンネル番号と、X in IPv6形式であることを示すフラグとを書き込みスケジューラ部215へ出力する。
なお、LANポート(WAN,LAN)で受信したパケットをIPsecにより送信する場合、検索部235においてMTC超過であると検出されたときには、当該受信パケットがCPU400へ転送される。CPU400は、転送された受信パケットがMTU超過であることを認識すると、受信パケットを分割し、分割した受信パケットをカプセル化したフラグメントIPv6パケットを生成して、上記と同様の処理を行う。
FIG. 7 is a diagram illustrating processing when an IPsec packet with a fragment is transmitted.
In the communication apparatus 100 shown in FIG. 2, when the CPU 400 determines that the IP packet 50 that is an IPv4 / IPv6 packet should be transferred using IPsec and determines that the MTU is exceeded by the IPsec processing, the IP packet 50 is divided. Then, the divided IP packet 50a and the divided IP packet 50b are generated. An IPv6 header 51a, an extended header 52a that is a fragment header, and a fragmented IPv6 packet in X in IPv6 format that consists of an encapsulated fragmented IP packet 50a, an IPv6 header 51b, an extended header 52b that is a fragment header, and A fragment IPv6 packet of the X in IPv6 format composed of the encapsulated divided IP packet 50b is generated. The X in IPv6 format indicates an IPv6 packet that includes an extension header and encapsulates the divided IP packet as packet data. The fragment header includes fragment identification numbers and division order information. The CPU 400 outputs a fragment IPv6 packet encapsulating the fragmented IP packet 50a, an IPsec tunnel number indicating SA, and a flag indicating X in IPv6 format to the write scheduler unit 215. Further, the CPU 400 outputs a fragment IPv6 packet encapsulating the fragmented IP packet 50b, an IPsec tunnel number indicating SA, and a flag indicating X in IPv6 format to the write scheduler unit 215.
When a packet received at a LAN port (WAN, LAN) is transmitted by IPsec, if the search unit 235 detects that the MTC is exceeded, the received packet is transferred to the CPU 400. When the CPU 400 recognizes that the transferred received packet exceeds the MTU, the CPU 400 divides the received packet, generates a fragment IPv6 packet that encapsulates the divided received packet, and performs the same processing as described above.

以下、分割IPパケット50aをカプセル化したフラグメントIPv6パケットについて処理を説明するが、分割IPパケット50bをカプセル化したフラグメントIPv6パケットについても同様の処理を行う。
メモリコントローラ部220は、DDR−SDRAM I/F225を介してDDR−SDRAM300へ分割IPパケット50aをカプセル化したフラグメントIPv6パケットを書き込み、パーサ部230は、IPsecトンネル番号及びフラグを検索部235に出力する。検索部235は、IPsecを用いたパケットの送信のジョブを選択し、CPU転送判定部240は、CPU400への転送が不要であると判断する。QoS部250は、ジョブ情報を生成してキューに記録する。フレーム生成部260は、IPsecトンネル番号、フラグ、メモリコントローラ部220がDDR−SDRAM300から読み出したフラグメントIPv6パケットをIPsec部210に出力する。
Hereinafter, the processing is described for the fragment IPv6 packet encapsulating the fragmented IP packet 50a, but the same processing is performed for the fragment IPv6 packet encapsulating the fragmented IP packet 50b.
The memory controller unit 220 writes the fragment IPv6 packet in which the divided IP packet 50a is encapsulated into the DDR-SDRAM 300 via the DDR-SDRAM I / F 225, and the parser unit 230 outputs the IPsec tunnel number and the flag to the search unit 235. . The search unit 235 selects a packet transmission job using IPsec, and the CPU transfer determination unit 240 determines that transfer to the CPU 400 is unnecessary. The QoS unit 250 generates job information and records it in a queue. The frame generation unit 260 outputs the IPsec tunnel number, the flag, and the fragment IPv6 packet read from the DDR-SDRAM 300 by the memory controller unit 220 to the IPsec unit 210.

IPsec部210は、パケットがIPsec処理対象であり、かつ、拡張ヘッダを含み、X in IPv6形式であることを認識する。IPsec部210は、IPsecトンネル番号(SA)をキーに暗号化アルゴリズムと、認証鍵とを読み出す。そして、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従って拡張ヘッダ52aから暗号化拡張ヘッダ53aを、分割IPパケット50aから暗号化分割IPパケット54aを生成し、さらに、トレーラ55aを生成して暗号化分割IPパケット54aの後ろに付加するとともに、暗号化拡張ヘッダ53aの前にIV56aを付加する。また、認証ありの場合、ICV57aをトレーラ55aの後ろに付加する。   The IPsec unit 210 recognizes that the packet is an IPsec processing target, includes an extension header, and is in X in IPv6 format. The IPsec unit 210 reads out an encryption algorithm and an authentication key using the IPsec tunnel number (SA) as a key. If the encryption algorithm is other than the null cipher, an encrypted extended header 53a is generated from the extended header 52a, an encrypted divided IP packet 54a is generated from the divided IP packet 50a according to the encryption algorithm, and a trailer 55a is further generated. Are added after the encrypted divided IP packet 54a, and IV 56a is added before the encrypted extension header 53a. In the case of authentication, the ICV 57a is added behind the trailer 55a.

IPsec部210は、ESPヘッダ59aを生成し、IV56aの直前に付加する。そして、IPv6ヘッダ51a内のペイロード長を、生成したIPsecパケットの長さとなるよう更正してIPv6ヘッダ58aとする。このようにして、IPsec部210は、IPv6ヘッダ58a、ESPヘッダ59a、IV56a、暗号化拡張ヘッダ53a、暗号化分割IPパケット54a、トレーラ55a、及び、ICV57aからなるIPv6 IPsecパケットを生成する。IPsec部210は、生成したIPv6 IPsecパケットを含み、IPsecトンネル番号に対応したMACアドレスから生成したL2ヘッダを付加したフレームをWAN用MAC I/F205に出力する。WAN用MAC I/F205は受信したIPsecパケットを物理I/F500を介してWANに送出する。
一方、同様の処理によりIPv6ヘッダ58b、ESPヘッダ59b、IV56b、暗号化拡張ヘッダ53b、暗号化分割IPパケット54b、トレーラ55b、及び、ICV57bからなるIPv6 IPsecパケットが生成され、WANに送出される。
The IPsec unit 210 generates the ESP header 59a and adds it immediately before the IV 56a. Then, the payload length in the IPv6 header 51a is corrected to be the length of the generated IPsec packet to be an IPv6 header 58a. In this manner, the IPsec unit 210 generates an IPv6 IPsec packet including the IPv6 header 58a, the ESP header 59a, the IV 56a, the encrypted extension header 53a, the encrypted divided IP packet 54a, the trailer 55a, and the ICV 57a. The IPsec unit 210 outputs, to the WAN MAC I / F 205, a frame that includes the generated IPv6 IPsec packet and includes the L2 header generated from the MAC address corresponding to the IPsec tunnel number. The WAN MAC I / F 205 sends the received IPsec packet to the WAN via the physical I / F 500.
On the other hand, an IPv6 IPsec packet including an IPv6 header 58b, an ESP header 59b, an IV56b, an encrypted extension header 53b, an encrypted divided IP packet 54b, a trailer 55b, and an ICV 57b is generated by the same processing and sent to the WAN.

次に、フラグメントされたパケットを含むIPsecパケットを受信した場合の処理について説明する。図1に示す構成において、IPsec回路620は、受信したIPsecパケットを復号したとき、トレーラから読み出した次ヘッダの示すプロトコルがIPv4/IPv6以外である場合、外側IPv6ヘッダの削除は行わず、ESP拡張ヘッダの削除、IVの削除(null暗号化以外の場合のみ)、トレーラからパッド長及び次ヘッダの読み出し、トレーラの削除を行う。また、ESP拡張ヘッダ直前のヘッダ内の次ヘッダをトレーラから読み出した次ヘッダが示すプロトコルに更正する。前記処理の後、IPsec処理対象であることと、トンネルを指定するとともに、X in IPv6形式であることを示すフラグを付加して、パケットデータをCPU650に転送する。なお、本実施の形態のIPsec回路620を用いたとき、CPU650がフラグメントの有無によらず、X in IPv6形式であることを示すフラグをつけてIPsec回路620にパケットを転送することで、IPsecトランスポートモードを実現することが可能となる。   Next, processing when an IPsec packet including a fragmented packet is received will be described. In the configuration shown in FIG. 1, when the IPsec circuit 620 decodes the received IPsec packet and the protocol indicated by the next header read from the trailer is other than IPv4 / IPv6, the outer IPv6 header is not deleted and the ESP extension is not performed. Deletion of header, deletion of IV (only for cases other than null encryption), reading of pad length and next header from trailer, and deletion of trailer. Further, the next header in the header immediately before the ESP extension header is corrected to the protocol indicated by the next header read from the trailer. After the above processing, the packet data is transferred to the CPU 650 by adding a flag indicating that it is an IPsec processing target, specifying a tunnel, and in X in IPv6 format. When the IPsec circuit 620 of the present embodiment is used, the CPU 650 attaches a flag indicating that it is in the X in IPv6 format regardless of the presence or absence of the fragment, and transfers the packet to the IPsec circuit 620, whereby the IPsec transformer Port mode can be realized.

図8は、フラグメントされたIPsecパケットを受信した場合の処理を示す図である。
図2の構成において、IPsec部210は、WAN用MAC I/F205からIPv6 IPsecパケットを含むフレームを受信する。IPv6 IPsecパケットは、外側IPv6ヘッダ70a、ESPヘッダ71a、IV72a、暗号化拡張ヘッダ73a、暗号化分割IPパケット74a、トレーラ75a、及び、ICV76aからなる。IPsec部210は、パケットのヘッダからIPsec処理対象であり、拡張ヘッダがないことを認識すると、ESPヘッダ71aに含まれるSPIからSA、暗号化アルゴリズム、認証鍵を取得する。認証ありの場合、IPsec部210は、読み出した認証鍵により、ICV76aの認証を行った後、ICV76aを削除する。さらに、IPsec部210は、暗号化アルゴリズムがnull暗号以外であれば、暗号化アルゴリズムに従い、IV72aを用いて暗号化拡張ヘッダ73a、暗号化分割IPパケット74a及びトレーラ75aを復号する。復号したトレーラ75aの示すプロトコルがIPv4/IPv6以外である場合、IPsec部210は、外側IPv6ヘッダ70aの削除を行わず、ESPヘッダ71aを削除する。また、復号したトレーラ75aの示すパディング長に従い、復号した暗号化分割IPパケット74aからパディングを削除して分割されたIPv4/IPv6パケットである分割IPパケット78aを取得し、IV72aを削除する。
FIG. 8 is a diagram illustrating processing when a fragmented IPsec packet is received.
In the configuration of FIG. 2, the IPsec unit 210 receives a frame including an IPv6 IPsec packet from the WAN MAC I / F 205. The IPv6 IPsec packet includes an outer IPv6 header 70a, an ESP header 71a, IV 72a, an encrypted extension header 73a, an encrypted divided IP packet 74a, a trailer 75a, and an ICV 76a. When the IPsec unit 210 recognizes that the packet is an IPsec processing target from the header of the packet and does not have an extension header, the IPsec unit 210 acquires the SA, the encryption algorithm, and the authentication key from the SPI included in the ESP header 71a. In the case of authentication, the IPsec unit 210 deletes the ICV 76a after authenticating the ICV 76a with the read authentication key. Furthermore, if the encryption algorithm is other than null encryption, the IPsec unit 210 uses the IV 72a to decrypt the encrypted extension header 73a, the encrypted divided IP packet 74a, and the trailer 75a according to the encryption algorithm. When the protocol indicated by the decrypted trailer 75a is other than IPv4 / IPv6, the IPsec unit 210 deletes the ESP header 71a without deleting the outer IPv6 header 70a. Further, in accordance with the padding length indicated by the decrypted trailer 75a, the divided IP packet 78a, which is an IPv4 / IPv6 packet divided by deleting the padding from the decrypted encrypted divided IP packet 74a, is obtained, and the IV 72a is deleted.

IPsec部210は、外側IPv6ヘッダ70a内のペイロード長を更正し、IPv6ヘッダ79aとする。これにより、IPv6ヘッダ79a、暗号化拡張ヘッダ73aを復号して得た拡張ヘッダ77a、及び、カプセル化された分割IPパケット78aからなるX in IPv6形式のフラグメントIPv6パケットが生成される。IPsec部210は、生成したフラグメントIPv6パケットを含むフレームと、X in IPv6形式であることを示すフラグと、SAを示すIPsecトンネル番号とを書き込みスケジューラ部215に出力する。   The IPsec unit 210 corrects the payload length in the outer IPv6 header 70a to be an IPv6 header 79a. As a result, a fragment IPv6 packet in the X in IPv6 format including the IPv6 header 79a, the extension header 77a obtained by decrypting the encrypted extension header 73a, and the encapsulated divided IP packet 78a is generated. The IPsec unit 210 outputs the frame including the generated fragment IPv6 packet, the flag indicating the X in IPv6 format, and the IPsec tunnel number indicating the SA to the write scheduler unit 215.

IPsec部210から出力されたフレームは、DDR−SDRAM300に書き込まれ、パーサ部230は、この書き込まれたフレーム内のアドレス等により処理を行う。そして、検索部235においてジョブが発生し、QoS部250に書き込まれる。メモリコントローラ部220は、DDR−SDRAM300から読み出したフラグメントIPv6パケットと、IPsecトンネル番号と、フラグとをCPU I/F265を介してCPU400に出力する。   The frame output from the IPsec unit 210 is written in the DDR-SDRAM 300, and the parser unit 230 performs processing based on the address in the written frame. Then, a job is generated in the search unit 235 and written in the QoS unit 250. The memory controller unit 220 outputs the fragment IPv6 packet read from the DDR-SDRAM 300, the IPsec tunnel number, and the flag to the CPU 400 via the CPU I / F 265.

続いて、IPsec部210は、WAN用MAC I/F205から、外側IPv6ヘッダ70b、ESPヘッダ71b、IV72b、暗号化拡張ヘッダ73b、暗号化分割IPパケット74b、トレーラ75b、及び、ICV76bからなるIPv6 IPsecパケットを含むフレームを受信する。そして、上記と同様の処理により、IPv6ヘッダ70bのペイロード長を更正したIPv6ヘッダ79b、暗号化拡張ヘッダ73bを復号して得た拡張ヘッダ77b、及び、暗号化分割IPパケット74bを復号して得られ、カプセル化された分割IPパケット78bからなるフラグメントIPv6パケットが生成され、CPU400に、IPsecトンネル番号及びフラグとともに出力される。   Subsequently, the IPsec unit 210 receives the IPv6 IPsec including the outer IPv6 header 70b, the ESP headers 71b and IV72b, the encrypted extended header 73b, the encrypted divided IP packet 74b, the trailer 75b, and the ICV 76b from the WAN MAC I / F 205. Receive a frame containing a packet. Then, the IPv6 header 79b obtained by correcting the payload length of the IPv6 header 70b, the extension header 77b obtained by decrypting the encrypted extension header 73b, and the encrypted divided IP packet 74b are obtained by the same processing as described above. The fragmented IPv6 packet composed of the encapsulated divided IP packet 78b is generated and output to the CPU 400 together with the IPsec tunnel number and the flag.

CPU400は、分割IPパケット78a、78bがカプセル化されたフラグメントIPv6パケットを受信すると、拡張ヘッダ77a及び77bのフラグメントの識別番号及び分割順序の情報を用いて、分割IPパケット78a及び78bからフラグメント前のIPパケット78を生成する。   When receiving the fragment IPv6 packet in which the fragmented IP packets 78a and 78b are encapsulated, the CPU 400 uses the fragment identification number and the information of the fragmentation order in the extension headers 77a and 77b, and the information before the fragment from the fragmented IP packets 78a and 78b. An IP packet 78 is generated.

上記実施の形態によれば、通信装置は、拡張ヘッダが付加されていないIPパケットについては、ワイヤードロジックによる高速な送受信処理を行う。また、拡張ヘッダが付加されたIPSecパケットに対しては、ハードウェア処理と、ソフトウェアの処理とを組み合わせて、送受信処理を実現することができる。また、上記実施の形態によれば、IPv6カプセル化したパケットを分割するため、内側IPパケットが制約されない。すなわち、受信パケットについてはIPsec処理の後に再構成処理を行い、また、分割処理の後にIPsec処理を行って送信するため、ハードウェアによる送受信とIPsec処理が連続して実施され、インライン型のIPsec処理が可能となる。加えて、IPsecパケットの生成により、送受信可能な信号長を超えてしまう場合には、転送対象のIPパケットを分割して送受信することができる。   According to the above embodiment, the communication device performs high-speed transmission / reception processing by wired logic for an IP packet to which no extension header is added. For an IPSec packet to which an extension header is added, a transmission / reception process can be realized by combining hardware processing and software processing. Further, according to the above embodiment, since the IPv6-encapsulated packet is divided, the inner IP packet is not restricted. That is, for the received packet, reconfiguration processing is performed after IPsec processing, and transmission is performed by performing IPsec processing after splitting processing. Therefore, hardware transmission / reception and IPsec processing are continuously performed, and inline-type IPsec processing is performed. Is possible. In addition, when the IPsec packet generation exceeds the signal length that can be transmitted / received, the transfer target IP packet can be divided and transmitted / received.

本発明の一実施の形態に係る通信装置の概要構成を示すブロック図である。It is a block diagram which shows schematic structure of the communication apparatus which concerns on one embodiment of this invention. 同実施の形態による通信装置の詳細な構成を示すブロック図である。It is a block diagram which shows the detailed structure of the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット送信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet transmission in the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット受信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet reception in the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット送信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet transmission in the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット受信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet reception in the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット送信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet transmission in the communication apparatus by the embodiment. 同実施の形態による通信装置におけるIPsecパケット受信時の処理を示す図である。It is a figure which shows the process at the time of the IPsec packet reception in the communication apparatus by the embodiment. IPsecパケットの構成を示す図である。It is a figure which shows the structure of an IPsec packet. 従来のパケット転送装置の構成を示す図である。It is a figure which shows the structure of the conventional packet transfer apparatus. 従来のパケット転送装置の構成を示す図である。It is a figure which shows the structure of the conventional packet transfer apparatus.

符号の説明Explanation of symbols

100…通信装置、 200…通信処理回路、 205…WAN用MAC I/F、 210…IPsec部、 215…書き込みスケジューラ部、 220…メモリコントローラ部、 225…DDR−SDRAM I/F、 230…パーサ部、 235…検索部、 240…CPU転送判定部、245…キュー選択部、 250…QoS部、 255…ハンドル管理部、 260…フレーム生成部、 265…CPU I/F、 275…LAN用MAC I/F、 300…DDR−SDRAM、 400…CPU、 500、501…物理I/F、 610…第1LANポート、 620…IPsec回路、 630…転送回路、 640…第2LANポート、 650…CPU

DESCRIPTION OF SYMBOLS 100 ... Communication apparatus, 200 ... Communication processing circuit, 205 ... WAN MAC I / F, 210 ... IPsec part, 215 ... Write scheduler part, 220 ... Memory controller part, 225 ... DDR-SDRAM I / F, 230 ... Parser part 235 ... Search unit, 240 ... CPU transfer determination unit, 245 ... Queue selection unit, 250 ... QoS unit, 255 ... Handle management unit, 260 ... Frame generation unit, 265 ... CPU I / F, 275 ... MAC I / F for LAN F, 300 ... DDR-SDRAM, 400 ... CPU, 500, 501 ... Physical I / F, 610 ... First LAN port, 620 ... IPsec circuit, 630 ... Transfer circuit, 640 ... Second LAN port, 650 ... CPU

Claims (8)

IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを送信する通信装置において、
前記内側IPパケットをIPv6カプセル化したIPv6カプセル化パケットに対して前記拡張ヘッダを付加した拡張ヘッダ付IPv6カプセル化パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力するソフトウェア処理部と、
前記ソフトウェア処理部により出力されたIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記IPv6パケットの内側IPパケットに対してESP暗号処理を行い、拡張ヘッダ付IPv6 IPsecパケットとして出力するIPsec処理部と、
前記IPsec処理部により出力された拡張ヘッダ付IPv6 IPsecパケットを送信するインタフェース部と、
を備えることを特徴とする通信装置。
In a communication apparatus for performing IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet and transmitting an IPv6 IPsec packet with an extension header in which an extension header is added to the outer IPv6 packet,
IPv6 encapsulation indicating that an IPv6 encapsulated packet with an extension header added to the IPv6 encapsulated packet obtained by encapsulating the inner IP packet with IPv6 is an IPv6 encapsulated packet to be subjected to IPsec transmission processing A software processing unit for adding and outputting completed IPsec transmission information;
When IPv6 encapsulated IPsec transmission information is added to the IPv6 packet output by the software processing unit, ESP encryption processing is performed on the inner IP packet of the IPv6 packet as an IPv6 IPsec packet with an extension header. An IPsec processing unit to output;
An interface unit for transmitting an IPv6 IPsec packet with an extension header output by the IPsec processing unit;
A communication apparatus comprising:
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを送信する通信装置において、
前記IPv6 IPsecパケットの長さがMTUを越える場合に、内側IPパケットをIPv6カプセル化し、前記IPv6カプセル化パケットを各々フラグメント拡張ヘッダが付加された複数のフラグメントIPv6パケットに分割し、前記各フラグメントIPv6パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力するソフトウェア処理部と、
前記ソフトウェア処理部により出力されたフラグメントIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記フラグメントIPv6パケットのフラグメント拡張ヘッダ以後のデータに対してESP暗号処理を行い、IPv6 IPsecパケットとして出力するIPsec処理部と、
前記IPsec処理部により出力されたIPv6 IPsecパケットを送信するインタフェース部と、
を備えることを特徴とする通信装置。
In a communication apparatus that transmits an IPv6 IPsec packet in which an IPv6 IPsec encapsulation in an ESP tunnel mode is performed using an IP packet as an inner IP packet,
When the length of the IPv6 IPsec packet exceeds the MTU, the inner IP packet is IPv6 encapsulated, the IPv6 encapsulated packet is divided into a plurality of fragment IPv6 packets each having a fragment extension header added thereto, and each fragment IPv6 packet is A software processing unit for adding and outputting IPv6 encapsulated IPsec transmission information indicating that the packet is an IPv6 encapsulated IPsec transmission processing target,
When the IPv6 encapsulated IPsec transmission information is added to the fragment IPv6 packet output by the software processing unit, ESP encryption processing is performed on the data after the fragment extension header of the fragment IPv6 packet, and the IPv6 IPsec An IPsec processing unit that outputs the packet;
An interface unit for transmitting an IPv6 IPsec packet output by the IPsec processing unit;
A communication apparatus comprising:
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを受信する通信装置において、
IPv6 IPsecパケットを受信し出力するインタフェース部と、
前記インタフェース部により出力されたIPv6 IPsecパケットが、拡張ヘッダが付加されたIPsec受信処理対象のパケットであることを検出し、前記検出されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードのIPパケットを内側IPパケットとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもち、前記拡張ヘッダが付加された、拡張ヘッダ付IPv6カプセル化パケットを出力するIPsec処理部と、
前記IPsec処理部から出力された拡張ヘッダ付IPv6カプセル化パケットの拡張ヘッダに基づく所定の拡張ヘッダ処理を行い、前記拡張ヘッダ付IPv6カプセル化パケットをデカプセル化して内側IPパケットを取得するソフトウェア処理部と、
を備えることを特徴とする通信装置。
In a communication apparatus that receives an IPv6 IPsec packet with an extension header, in which an IPv6 IPsec encapsulation in an ESP tunnel mode is performed using an IP packet as an inner IP packet, and an extension header is added to the outer IPv6 packet.
An interface unit for receiving and outputting an IPv6 IPsec packet;
The IPv6 IPsec packet output by the interface unit is detected to be an IPsec reception processing target packet to which an extension header is added, ESP decoding processing is performed on the detected IPv6 IPsec packet, and the ESP payload An IPsec processing unit that outputs an IPv6 encapsulated packet with an extension header, in which the IP packet is an inner IP packet, the IPv6 header of the IPv6 IPsec packet is an outer IPv6 header, and the extension header is added;
A software processing unit that performs predetermined extension header processing based on an extension header of the IPv6 encapsulated packet with extension header output from the IPsec processing unit, decapsulates the IPv6 encapsulated packet with extension header, and obtains an inner IP packet; ,
A communication apparatus comprising:
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを受信する通信装置において、
IPv6 IPsecパケットを受信し出力するインタフェース部と、
前記インタフェース部により出力されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードの先頭にフラグメント拡張ヘッダが付加されていることを検出し、前記検出されたデータをペイロードとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもつ、フラグメントIPv6パケットを出力するIPsec処理部と、
1個のIPv6パケットから分割された複数の前記フラグメントIPv6パケットを収集し、再構成を行って分割前のIPv6パケットを取得し、前記IPv6パケットがIPパケットをIPv6カプセル化されたIPv6カプセル化パケットであることを検出して、前記検出されたIPv6カプセル化パケットをデカプセル化して内側IPパケットを取得するソフトウェア処理部と、
を備えることを特徴とする通信装置。
In a communication device that receives an IPv6 IPsec packet in which an IPv6 IPsec encapsulation in an ESP tunnel mode is performed using an IP packet as an inner IP packet,
An interface unit for receiving and outputting an IPv6 IPsec packet;
ESP decoding processing is performed on the IPv6 IPsec packet output by the interface unit, and it is detected that a fragment extension header is added to the head of the ESP payload. The detected data is used as the payload, and the IPv6 IPsec packet is detected. An IPsec processing unit for outputting a fragmented IPv6 packet having an IPv6 header of
A plurality of fragmented IPv6 packets divided from one IPv6 packet are collected, reconfigured to obtain an undivided IPv6 packet, and the IPv6 packet is an IPv6 encapsulated packet obtained by encapsulating an IPv6 packet into an IPv6 packet. A software processing unit that detects the presence and decapsulates the detected IPv6 encapsulated packet to obtain an inner IP packet;
A communication apparatus comprising:
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを送信する通信装置に用いられるパケット処理方法であって、
ソフトウェア処理部が、前記内側IPパケットをIPv6カプセル化したIPv6カプセル化パケットに対して前記拡張ヘッダを付加した拡張ヘッダ付IPv6カプセル化パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力し、
IPsec処理部が、前記ソフトウェア処理部により出力されたIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記IPv6パケットの内側IPパケットに対してESP暗号処理を行い、拡張ヘッダ付IPv6 IPsecパケットとして出力し、
インタフェース部が、前記IPsec処理部により出力された拡張ヘッダ付IPv6 IPsecパケットを送信する、
ことを特徴とするパケット処理方法。
A packet processing method used for a communication apparatus that performs IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet, and transmits an IPv6 IPsec packet with an extension header to which an extension header is added to the outer IPv6 packet. ,
The software processing unit is an IPv6 encapsulated packet for IPsec transmission processing in an IPv6 encapsulated packet with an extension header obtained by adding the extension header to the IPv6 encapsulated packet obtained by encapsulating the inner IP packet with IPv6 Output with the IPv6 encapsulated IPsec transmission information indicating
The IPsec processing unit performs ESP encryption processing on the inner IP packet of the IPv6 packet when the IPv6 encapsulated IPsec transmission information is added to the IPv6 packet output by the software processing unit, and the extension header Output as an attached IPv6 IPsec packet,
The interface unit transmits the IPv6 IPsec packet with an extension header output by the IPsec processing unit.
And a packet processing method.
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを送信する通信装置用いられるパケット処理方法であって、
ソフトウェア処理部が、前記IPv6 IPsecパケットの長さがMTUを越える場合に、内側IPパケットをIPv6カプセル化し、前記IPv6カプセル化パケットを各々フラグメント拡張ヘッダが付加された複数のフラグメントIPv6パケットに分割し、前記各フラグメントIPv6パケットに、IPv6カプセル化されたIPsec送信処理対象のパケットであることを示すIPv6カプセル化済みIPsec送信情報を付加して出力し、
IPsec処理部が、前記ソフトウェア処理部により出力されたフラグメントIPv6パケットに、IPv6カプセル化済みIPsec送信情報が付加されている場合に、前記フラグメントIPv6パケットのフラグメント拡張ヘッダ以後のデータに対してESP暗号処理を行い、IPv6 IPsecパケットとして出力し、
インタフェース部が、前記IPsec処理部により出力されたIPv6 IPsecパケットを送信する、
ことを特徴とするパケット処理方法。
A packet processing method used for a communication device that transmits an IPv6 IPsec packet obtained by performing IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet,
When the length of the IPv6 IPsec packet exceeds the MTU, the software processing unit encapsulates the inner IP packet in IPv6, and divides the IPv6 encapsulated packet into a plurality of fragment IPv6 packets each having a fragment extension header added thereto, IPv6 encapsulated IPsec transmission information indicating that the packet is an IPv6 encapsulated IPsec transmission process target is added to each fragment IPv6 packet and output.
When the IPsec processing unit adds the IPv6 encapsulated IPsec transmission information to the fragment IPv6 packet output by the software processing unit, the ESP encryption processing is performed on the data after the fragment extension header of the fragment IPv6 packet. Output as an IPv6 IPsec packet,
The interface unit transmits the IPv6 IPsec packet output by the IPsec processing unit;
And a packet processing method.
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行い、かつ、外側IPv6パケットに拡張ヘッダを付加した、拡張ヘッダ付IPv6 IPsecパケットを受信する通信装置に用いられるパケット処理方法であって、
インタフェース部が、IPv6 IPsecパケットを受信して出力し、
IPsec処理部が、前記インタフェース部により出力されたIPv6 IPsecパケットが、拡張ヘッダが付加されたIPsec受信処理対象のパケットであることを検出して、前記検出されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードのIPパケットを内側IPパケットとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもち、前記拡張ヘッダが付加された、拡張ヘッダ付IPv6カプセル化パケットを出力し、
前記ソフトウェア処理部が、前記IPsec処理部から出力された拡張ヘッダ付IPv6カプセル化パケットの拡張ヘッダに基づく所定の拡張ヘッダ処理を行い、前記拡張ヘッダ付IPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する、
ことを特徴とするパケット処理方法。
A packet processing method used for a communication apparatus that receives an IPv6 IPsec packet with an extension header, which performs IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet, and adds an extension header to the outer IPv6 packet. ,
The interface unit receives and outputs an IPv6 IPsec packet,
An IPsec processing unit detects that an IPv6 IPsec packet output by the interface unit is a packet that is an IPsec reception processing target with an extension header added, and performs an ESP decoding process on the detected IPv6 IPsec packet An IP packet of the ESP payload is set as an inner IP packet, and an IPv6 encapsulated packet with an extension header having the IPv6 header of the IPv6 IPsec packet as an outer IPv6 header and the extension header added thereto is output.
The software processing unit performs predetermined extension header processing based on the extension header of the IPv6 encapsulated packet with extension header output from the IPsec processing unit, decapsulates the IPv6 encapsulated packet with extension header, and converts the inner IP packet get,
And a packet processing method.
IPパケットを内側IPパケットとしてESPトンネルモードのIPv6 IPsecカプセル化を行ったIPv6 IPsecパケットを受信する通信装置に用いられるパケット処理方法であって、
インタフェース部が、IPv6 IPsecパケットを受信して出力し、
IPsec処理部が、前記インタフェース部により出力されたIPv6 IPsecパケットに対してESP復号処理を行い、ESPペイロードの先頭にフラグメント拡張ヘッダが付加されていることを検出して、前記検出されたデータをペイロードとし、前記IPv6 IPsecパケットのIPv6ヘッダを外側IPv6ヘッダにもつ、フラグメントIPv6パケットを出力し、
ソフトウェア処理部が、1個のIPv6パケットから分割された複数の前記フラグメントIPv6パケットを収集し、再構成を行って分割前のIPv6パケットを取得し、前記IPv6パケットがIPパケットをIPv6カプセル化されたIPv6カプセル化パケットであることを検出して、前記検出されたIPv6カプセル化パケットをデカプセル化して内側IPパケットを取得する、
ことを特徴とするパケット処理方法。

A packet processing method used for a communication device that receives an IPv6 IPsec packet that has been subjected to IPv6 IPsec encapsulation in an ESP tunnel mode using an IP packet as an inner IP packet,
The interface unit receives and outputs an IPv6 IPsec packet,
An IPsec processing unit performs an ESP decoding process on the IPv6 IPsec packet output from the interface unit, detects that a fragment extension header is added to the head of the ESP payload, and transfers the detected data to the payload. A fragment IPv6 packet having an IPv6 header of the IPv6 IPsec packet as an outer IPv6 header,
The software processing unit collects the plurality of fragmented IPv6 packets divided from one IPv6 packet, performs reconfiguration to obtain an IPv6 packet before the division, and the IPv6 packet encapsulates the IP packet into IPv6 Detecting an IPv6 encapsulated packet and decapsulating the detected IPv6 encapsulated packet to obtain an inner IP packet;
And a packet processing method.

JP2005327072A 2005-11-11 2005-11-11 Communication device and packet processing method Pending JP2007135035A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005327072A JP2007135035A (en) 2005-11-11 2005-11-11 Communication device and packet processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005327072A JP2007135035A (en) 2005-11-11 2005-11-11 Communication device and packet processing method

Publications (1)

Publication Number Publication Date
JP2007135035A true JP2007135035A (en) 2007-05-31

Family

ID=38156325

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005327072A Pending JP2007135035A (en) 2005-11-11 2005-11-11 Communication device and packet processing method

Country Status (1)

Country Link
JP (1) JP2007135035A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009022422A1 (en) * 2007-08-16 2009-02-19 Panasonic Corporation Cipher communication device
JP2010206276A (en) * 2009-02-27 2010-09-16 Nec Commun Syst Ltd Communication apparatus, processing method therefor, and program thereof
JP2012034169A (en) * 2010-07-30 2012-02-16 Access Co Ltd Packet authentication system, authentication method, and program
JP2013509052A (en) * 2009-10-26 2013-03-07 ゼットティーイー コーポレーション Dynamic tunnel message transfer method and switch
US8826003B2 (en) 2012-02-21 2014-09-02 International Business Machines Corporation Network node with network-attached stateless security offload device employing out-of-band processing
JP2014526859A (en) * 2011-09-29 2014-10-06 インテル コーポレイション Packet transmission using extension header
US9071582B2 (en) 2011-09-30 2015-06-30 Lapis Semiconductor Co., Ltd. Communication apparatus, reception control method, and transmission control method
US9213666B2 (en) 2011-11-29 2015-12-15 Intel Corporation Providing a sideband message interface for system on a chip (SoC)
US9270576B2 (en) 2011-09-29 2016-02-23 Intel Corporation Aggregating completion messages in a sideband interface
US9448870B2 (en) 2011-09-29 2016-09-20 Intel Corporation Providing error handling support to legacy devices
CN105978909A (en) * 2016-07-08 2016-09-28 北京炼石网络技术有限公司 Transport layer encapsulation-based data transmission method, and data transmission apparatus and system
US9489329B2 (en) 2011-09-29 2016-11-08 Intel Corporation Supporting multiple channels of a single interface
US9658978B2 (en) 2011-09-29 2017-05-23 Intel Corporation Providing multiple decode options for a system-on-chip (SoC) fabric
US10846126B2 (en) 2016-12-28 2020-11-24 Intel Corporation Method, apparatus and system for handling non-posted memory write transactions in a fabric
US10911261B2 (en) 2016-12-19 2021-02-02 Intel Corporation Method, apparatus and system for hierarchical network on chip routing
CN115699629A (en) * 2020-09-02 2023-02-03 华为技术有限公司 Data transmission method and equipment thereof

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009022422A1 (en) * 2007-08-16 2009-02-19 Panasonic Corporation Cipher communication device
JP2010206276A (en) * 2009-02-27 2010-09-16 Nec Commun Syst Ltd Communication apparatus, processing method therefor, and program thereof
JP2013509052A (en) * 2009-10-26 2013-03-07 ゼットティーイー コーポレーション Dynamic tunnel message transfer method and switch
JP2012034169A (en) * 2010-07-30 2012-02-16 Access Co Ltd Packet authentication system, authentication method, and program
US9270576B2 (en) 2011-09-29 2016-02-23 Intel Corporation Aggregating completion messages in a sideband interface
US9489329B2 (en) 2011-09-29 2016-11-08 Intel Corporation Supporting multiple channels of a single interface
US10164880B2 (en) 2011-09-29 2018-12-25 Intel Corporation Sending packets with expanded headers
JP2015109679A (en) * 2011-09-29 2015-06-11 インテル コーポレイション Sending packets with expanded headers
JP2014526859A (en) * 2011-09-29 2014-10-06 インテル コーポレイション Packet transmission using extension header
US9753875B2 (en) 2011-09-29 2017-09-05 Intel Corporation Systems and an apparatus with a sideband interface interconnecting agents with at least one router
US9448870B2 (en) 2011-09-29 2016-09-20 Intel Corporation Providing error handling support to legacy devices
US9658978B2 (en) 2011-09-29 2017-05-23 Intel Corporation Providing multiple decode options for a system-on-chip (SoC) fabric
US9071582B2 (en) 2011-09-30 2015-06-30 Lapis Semiconductor Co., Ltd. Communication apparatus, reception control method, and transmission control method
US9213666B2 (en) 2011-11-29 2015-12-15 Intel Corporation Providing a sideband message interface for system on a chip (SoC)
US8826003B2 (en) 2012-02-21 2014-09-02 International Business Machines Corporation Network node with network-attached stateless security offload device employing out-of-band processing
US8918634B2 (en) 2012-02-21 2014-12-23 International Business Machines Corporation Network node with network-attached stateless security offload device employing out-of-band processing
CN105978909A (en) * 2016-07-08 2016-09-28 北京炼石网络技术有限公司 Transport layer encapsulation-based data transmission method, and data transmission apparatus and system
CN105978909B (en) * 2016-07-08 2019-01-22 北京炼石网络技术有限公司 Data transmission method, data transmission device and system based on transport-layer encapsulations
US10911261B2 (en) 2016-12-19 2021-02-02 Intel Corporation Method, apparatus and system for hierarchical network on chip routing
US10846126B2 (en) 2016-12-28 2020-11-24 Intel Corporation Method, apparatus and system for handling non-posted memory write transactions in a fabric
US11372674B2 (en) 2016-12-28 2022-06-28 Intel Corporation Method, apparatus and system for handling non-posted memory write transactions in a fabric
CN115699629A (en) * 2020-09-02 2023-02-03 华为技术有限公司 Data transmission method and equipment thereof

Similar Documents

Publication Publication Date Title
JP2007135035A (en) Communication device and packet processing method
US7818564B2 (en) Deciphering of fragmented enciphered data packets
US7398386B2 (en) Transparent IPSec processing inline between a framer and a network component
US7434045B1 (en) Method and apparatus for indexing an inbound security association database
US7143282B2 (en) Communication control scheme using proxy device and security protocol in combination
KR100910818B1 (en) Method and system for tunneling macsec packets through non-macsec nodes
US9369550B2 (en) Protocol for layer two multiple network links tunnelling
US20070214502A1 (en) Technique for processing data packets in a communication network
US10044841B2 (en) Methods and systems for creating protocol header for embedded layer two packets
JP2005522924A (en) Packet processing method and packet processing system
JP4340653B2 (en) Communication processing apparatus and communication processing method
KR100415554B1 (en) Method for transmitting and receiving of security provision IP packet in IP Layer
US7644187B2 (en) Internet protocol based encryptor/decryptor two stage bypass device
JP4263718B2 (en) Communication processing apparatus and communication processing method
CN112600802B (en) SRv6 encrypted message and SRv6 message encryption and decryption methods and devices
US7680115B2 (en) Internet protocol based encryptor/decryptor bypass device
JP4551112B2 (en) ENCRYPTED PACKET PROCESSING DEVICE, METHOD, PROGRAM, AND PROGRAM RECORDING MEDIUM
US7840712B2 (en) Hybrid internet protocol encryptor/decryptor bypass device
JP4647479B2 (en) IPsec circuit and IPsec processing method
KR100449809B1 (en) Improved method for securing packets providing multi-security services in ip layer
JP4350713B2 (en) Data transfer apparatus and data transfer method
KR100522090B1 (en) METHOD FOR SECURING PAEKETS IN IPv6 LAYER
KR100666948B1 (en) Apparatus and method for processing ipv6 packet
CN111835736A (en) Message transmission method and system