mDNkit に含まれる BIND-9 用のパッチファイルを適用することにより、 BIND-9 において従来の ASCII 文字によるドメイン名に加え、 非 ASCII 文字による多言語ドメイン名を扱うことが可能になります。
The BIND-9 patch file included in the mDNkit provides the ability to support both conventional ASCII character domain names and non-ASCII character-derived multilingual domain names.
具体的には、このパッチは BIND-9 に次のような機能を追加します。
Specifically, this patch adds the following functions to BIND-9.
BIND-9 へのパッチの適用方法は、パッチファイルの先頭に記載してあります。 なおパッチファイルについては、 対応する BIND のバージョンをよく確認してから、使用してください。
Instructions for how to apply the patch file to BIND-9 is explained at the beginning of the patch file. Before using the patch file, be sure to check the version of BIND being used.
BIND-9 はそれまでの BIND-8 とはリゾルバの構成が全く異なっています。 BIND-8 まではリゾルバはアプリケーションにリンクされるライブラリとして 実装されていましたが、 BIND-9 ではリゾルバの機能の大部分が lwresd (lightweight resolver daemon) というサーバに移され、 アプリケーションにリンクされるのはlightweight resolver と呼ばれる lwresd との通信を行うためのライブラリとなっています。
BIND-9 has a different resolver structure than BIND-8. Up to BIND-8, the resolver was implemented as a library linked by the application. However, with BIND-9, most of the functions of the resolver have been moved to the server called lwresd (lightweight resolver daemon) and only the library called lightweight resolver that is used to communicate with lwresd is linked by the application.
本パッチはこのアーキテクチャに合わせ、多言語ドメイン名の各処理を それぞれのコンポーネントに分散させました。以下に各コンポーネントで 実装される機能とコンポーネント間のインタフェースで用いるエンコーディングを 表した図を示します。
Matched to this architecture, the patch distributes multilingual domain name processing to the respective components. The following diagram shows the function implemented in each component and the encoding used by the interface between the components.
named における修正は次の一点のみです。
The following fixes were made in named:
BIND-9 の named ではドメイン名の処理はほとんど8ビットスルーになっており、 UTF-8 等の MSB のセットされたバイトもそのまま透過します。 しかし named 内で処理に使用されているドメイン名の内部表現 (dns_name_t) からテキスト表現への変換部分は8ビットスルーになっておらず、ASCII 文字以外 はバックスラッシュでクォートされ、\DDD という形式の表現に 変換されてしまいます。 DNS プロトコル上で用いられるエンコーディングが RACE などの ASCII 互換 エンコーディングであれば ASCII 以外の文字がドメイン名に現れることはないので 問題ないのですが、UTF-8 を使用する場合には問題となります。
With BIND-9 named, most domain name processing is based on 8-bit through and UTF-8 bytes in which MSB is set are also passed as is. However, the conversion of domain names from an internal expression (dns_name_t) to the text expression used for processing in named is not 8-bit through and other than ASCII text is quoted with a backslash and converted to a \DDD format expression. If ASCII-compatible encoding such as RACE is used for the DNS protocol, there is no problem because only ASCII characters appear in domain names; there are, however, problems when UTF-8 is used.
BIND-9 パッチは、この処理を修正し、変換しようとする文字がUTF-8 文字の 場合にはバックスラッシュによるクォートをしないようにします。 この動作は named の設定ファイル (named.conf) で切り替え可能であり、 設定ファイルの options セクションの allow-utf8 パラメータで 指定します。DNS プロトコル上で用いるエンコーディングとして UTF-8 を 使用する際には次のように記述してください。
The BIND-9 patch corrects processing so that the backslash quote is not used when converting UTF-8 characters. This operation can be switched using the allow-utf8 parameter of the options section in the named configuration file (named.conf). When UTF-8 is used for encoding the DNS protocol, write as follows.
options { ... allow-utf8 yes; ... };
lwresd に対しては次のような修正を加えてあります。
The following fixes were made to lwresd.
これは named に対する修正と同じで、ドメイン名を内部表現から テキスト表現に変換する際のバックスラッシュによるクォーティングを 行わないようにするものです。
This is the same fix made in named wherein backslash quoting is not used for conversion of domain names from an internal expression to a text expression.
named の場合、これは設定ファイル named.conf のオプションで 切り替えられるようになっていますが、lwresd の場合には自動切り替えに なっています。lwresd が読み込む クライアント設定ファイルの サーバエンコーディングエントリに設定されているコードセット名を参照し、 それが ASCII 互換エンコーディングでない場合にはバックスラッシュによる クォートをしないようにします。
With named, this setting can be changed using the option setting in the named.conf configuration file; however, it is automatically changed with Iwresd. The code set name set in the server encoding entry of the client configuration file to be loaded by lwresd is referenced and if it is not ASCII-compatible encoding, the backslash quote is not used.
lwresd は多言語ドメイン名のエンコーディングとして、クライアント つまり lightweight resolver ライブラリとの間の通信には UTF-8 を、 また named との通信には DNS プロトコル上のエンコーディングをそれぞれ 使用します。したがって両者の間のエンコーディング変換を行います。
For encoding of multilingual domain names, lwresd uses UFT-8 for communication with the client, i.e. the lightweight resolver library, and also uses the encoding used for the DNS protocol for communication with named, respectively. Therefore, encoding conversion is performed between both components.
エンコーディング変換には MDN ライブラリの res モジュール を使用しています。 DNS プロトコル上のエンコーディングの指定は クライアント設定ファイルで行います。
The res module of the MDN library is used for encoding conversion. The client configuration file is used to specify the encoding used by the DNS protocol.
クライアント側のライブラリは、
The client side library was corrected as follows:
The res module of the MDN library is used for this processing. The client configuration file is used to set settings.
名前解決用の API 関数はローカルエンコーディングで表された 多言語ドメイン名が扱えるように修正されています。 また内部実装は、将来 UTF-8 エンコーディングのドメイン名を扱える API の追加が容易にできるように設計されています。これらについて この後説明します。
The API function for name resolution was corrected to that it can handle multilingual domain names expressed in local encoding. Also, internal implementation is designed so that it will be simpler to add APIs that can handle domain names in UTF-8 encoding in the future. An explanation of those issues will follow at a later date.
パッチによって多言語化される API 関数の一覧です。
The list of API functions that are made multilingual by the patch is shown below.
多言語化された API 関数は、従来の ASCII ドメイン名に加え、 非 ASCII ドメイン名を扱うことができます。非 ASCII ドメイン名として、 クライアント設定ファイルの内容に応じて、 新たに以下のようなドメイン名を取り扱うことができるようになります。
In addition to the conventional ASCII domain names, API functions that are made multilingual can handle non-ASCII domain names. With regard to non-ASCII domain names, the following domain names can be handled, depending on which settings are set in the client configuration file.
引数の型や返り値の型に変更はありません。 パッチを当てる前と同様の呼び出し方法で、従来の ASCII ドメイン名と、 非 ASCII ドメイン名の両方を扱うことができます。 非 ASCII ドメイン名については、 ローカルエンコーディングのドメイン名を引数として受け取ることができます。
The type of arguments and return values are not changed. Using the same calling method that was used prior to applying the patch allows the system to handle both conventional ASCII domain names and non-ASCII domain names. Regarding non-ASCII domain names, domain names of local encoding can be received as arguments.
これまで上記の API 関数で行なわれていた処理は、 以降で説明するそれぞれの内部関数に移行し、API 関数は、ドメイン名のエンコーディング情報をこの内部関数に渡す役割をしています。
Processing performed by the above API functions are moved to respective internal functions explained later and API functions pass the encoding information of domain names to these internal functions.
多言語化された API 関数に関連して、以下の内部関数が追加されました。
In association with the API functions that were made multilingual, the following internal functions are added.
追加された内部関数についての仕様は、以下の通りです。
The specifications of the added internal functions are as follows.
int lwres_getaddrinfo_enc(const char *, const char *, const struct addrinfo *, struct addrinfo **, int)
lwres ライブラリの関数 lwres_getaddrinfo() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_getaddrinfo() との違いは、static 関数である set_order() 関数にエンコードタイプの判定フラグを渡している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getaddrinfo() function. The only difference between this function and the lwres_getaddrinfo() function is that the encode type judgment flag is passed to the set_order() function, which is a static function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_getaddrinfo() 関数から lwres_getaddrinfo_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getaddrinfo_enc() function from the lwres_getaddrinfo() function.
返される値は EAI_NONAME、EAI_BADFLAGS、EAI_SYSTEM、 EAI_FAMILY、EAI_SOCKTYPE、EAI_SERVICE、 EAI_MEMORY、0 のいずれかです。
One of the following values is returned. EAI_NONAME, EAI_BADFLAGS, EAI_SYSTEM, EAI_FAMILY, EAI_SOCKTYPE, EAI_SERVICE, EAI_MEMORY, 0
int lwres_getnameinfo_enc(const struct sockaddr *, size_t, char *, size_t, char *, size_t, int, int)
lwres ライブラリの関数 lwres_getnameinfo() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_getnameinfo() との違いは、lwres_getnamebyaddr() 関数の呼び出し部を lwres_getnamebyaddr_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getnameinfo() function. The only difference between this function and the lwres_getnameinfo() function is that the call portion of the lwres_getnamebyaddr() function is changed to the lwres_getnamebyaddr_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_getnameinfo() 関数から lwres_getnameinfo_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getnameinfo_enc() function from the lwres_getnameinfo() function.
返される値は ENI_NOSOCKET、ENI_SALEN、ENI_FAMILY、 ENI_MEMORY、ENI_SYSTEM、ENI_NOHOSTNAME、 SUCCESS のいずれかです。
One of the following values is returned. ENI_NOSOCKET, ENI_SALEN, ENI_FAMILY, ENI_MEMORY, ENI_SYSTEM, ENI_NOHOSTNAME, SUCCESS
struct hostent * lwres_gethostbyname_enc(const char *, int)
lwres ライブラリの関数 lwres_gethostbyname() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_gethostbyname() との違いは、lwres_getipnodebyname() 関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname() function. The only difference between this function and the lwres_gethostbyname() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_gethostbyname() 関数から lwres_gethostbyname_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_gethostbyname_enc() function from the lwres_gethostbyname() function.
lwres_getipnodebyname_enc() から返って来た hostent 構造体へのポインタを返します。
A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc().
struct hostent * lwres_gethostbyname2_enc(const char *, int, int)
lwres ライブラリの関数 lwres_gethostbyname2() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_gethostbyname2() との違いは、lwres_getipnodebyname() 関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname2() function.The only difference between this function and the lwres_gethostbyname2() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_gethostbyname2() 関数から lwres_gethostbyname2_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_gethostbyname2_enc() function from the lwres_gethostbyname2() function.
lwres_getipnodebyname_enc() から返って来た hostent 構造体へのポインタを返します。
A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc().
struct hostent * lwres_gethostbyname_r_enc(const char *, struct hostent *, char *, int, int *, int)
lwres ライブラリの関数 lwres_gethostbyname_r() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_gethostbyname_r() との違いは、lwres_getipnodebyname() 関数の呼び出し部を lwres_getipnodebyname_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyname_r() function. The only difference between this function and the lwres_gethostbyname_r() function is that the call portion of the lwres_getipnodebyname() function is changed to the lwres_getipnodebyname_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_gethostbyname_r() 関数から lwres_gethostbyname_r_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specifed for the encode type judgment flag in order to call the lwres_gethostbyname_r_enc() function from lwres_gethostbyname_r() function.
エラーのときは NULL、正常のときは値が格納された hostent 構造体へのポインタを返します。
NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal.
struct hostent * lwres_gethostbyaddr_enc(const char *, int, int, int)
lwres ライブラリの関数 lwres_gethostbyaddr() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_gethostbyaddr() との違いは、lwres_getipnodebyaddr() 関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyaddr() function. The only difference between this function and the lwres_gethostbyaddr() function is that the call portion of the lwres_getipnodebyaddr() function is changed to the lwres_getipnodebyaddr_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_gethostbyaddr() 関数から lwres_gethostbyaddr_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specifed for the encode type judgment flag in order to call the lwres_gethostbyaddr_enc() function from tge lwres_gethostbyaddr() function.
lwres_getipnodebyaddr_enc() から返って来た hostent 構造体へのポインタを返します。
The pointer is returned that points to the hostent structure returned from lwres_getipnodebyaddr_enc().
struct hostent * lwres_gethostbyaddr_r_enc(const char *, int, int, struct hostent *, char *, int, int *, int)
lwres ライブラリの関数 lwres_gethostbyaddr_r() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_gethostbyaddr_r() との違いは、lwres_getipnodebyaddr() 関数の呼び出し部を lwres_getipnodebyaddr_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_gethostbyaddr_r() function. The only difference between this function and the lwres_gethostbyaddr_r() funciton is that the call portion of the lwres_getipnodebyaddr() function is changed to the lwres_getipnodebyaddr_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_gethostbyaddr_r() 関数から lwres_gethostbyaddr_r_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified to the encode type judgment flag in order to call the lwres_gethostbyaddr_r_enc() function from the lwres_gethostbyaddr_r() function.
エラーのときは NULL、正常のときは値が格納された hostent 構造体へのポインタを返します。
NULL is returned when there is an error and pointer to hostent structure that contains the value is returned when the result of processing is normal.
struct hostent * lwres_getipnodebyname_enc(const char *, int, int, int *, int)
lwres ライブラリの関数 lwres_getipnodebyname() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_getipnodebyname() との違いは、lwres_getaddrsbyname() 関数の呼び出し部を lwres_getaddrsbyname_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getipnodebyname() function. The only difference between this function and the lwres_getipnodebyname() function is that the call portion of the lwres_getaddrsbyname() function is changed to the lwres_getaddrsbyname_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_getipnodebyname() 関数から lwres_getipnodebyname_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encoding. LWRES_ENCODING_LOCAL is specified for the encode type judgment flag in order to call the lwres_getipnodebyname_enc() function from the lwres_getipnodebyname() function.
エラーのときは NULL、正常のときは値が格納された hostent 構造体へのポインタを返します。
NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal.
struct hostent * lwres_getipnodebyaddr_enc(const void *, size_t, int, int *, int)
lwres ライブラリの関数 lwres_getipnodebyaddr() に、 ローカルエンコーディングか否かの判定フラグのエントリを追加したものです。 lwres_getipnodebyaddr() との違いは、lwres_getnamebyaddr() 関数の呼び出し部を lwres_getnamebyaddr_enc() 関数に変更している点のみです。
With this function, the entry of a flag used to determine whether or not the encode type is local is added to the lwres library lwres_getipnodebyaddr() function. The only difference between this function and the lwres_getipnodebyaddr() function is that the call portion of the lwres_getnamebyaddr() function is changed to the lwres_getnamebyaddr_enc() function.
関数の最後の引数がエンコードタイプの判定フラグで、 ローカルエンコーディングのときにはLWRES_ENCODING_LOCAL、 UTF-8 エンコーディングのときにはLWRES_ENCODING_UCSが指定可能です。 lwres_getipnodebyaddr() 関数から lwres_getipnodebyaddr_enc() 関数を呼び出すときは、 エンコードタイプの判定フラグにLWRES_ENCODING_LOCALを指定しています。
The last argument of the function is the encode type judgment flag. LWRES_ENCODING_LOCAL can be specified for local encoding and LWRES_ENCODING_UCS can be specified for UTF-8 encodong. LWRES_ENCODING_LOCAL is specified for the encode judgment flag in order to call the lwres_getipnodebyaddr_enc() function from the lwres_getipnodebyaddr() function.
エラーのときは NULL、正常のときは値が格納された hostent 構造体へのポインタを返します。
NULL is returned when there is an error and a pointer to the hostent structure that contains the value is returned when the result of processing is normal.
BIND-9 には DNS の問い合わせツールとして dig、host、nslookup という コマンドが付属します。mDNkit の BIND-9 パッチにより、これらはいずれも 多言語ドメイン名が扱えるようになります。具体的には以下の機能が 付加されます。
The DNS inquiry commands called dig, host, and nslookup are attached to BIND-9. Because of the BIND-9 patch in mDNkit, these commands can handle multilingual domain names. Specifically, the following functions are added.
また DNS の返答に含まれる多言語ドメイン名をローカルエンコーディングに 変換し、表示します。
Also converts multilingual domain names included in the DNS response to local encoding and displays the result.
The res module of the MDN library is used for that processing. The client configuration file is used to make the setting.