メインコンテンツへジャンプする

JPNICはインターネットの円滑な運営を支えるための組織です

ロゴ:JPNIC

WHOIS 検索 サイト内検索 WHOISとは? JPNIC WHOIS Gateway
WHOIS検索 サイト内検索

BIND-9 Patch


Overview

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.

Specifically, this patch adds the following functions to BIND-9.

  • Uses a lightweight resolver API (lwres_gethostbyname, etc.) to search the IP address from the host name, as expressed in local encoding.
  • For the result of name resolution, returns the host name expressed in the local encoding as well.
  • Uses dig, host, and nslookup commands to accept domain names in the local encoding and displays domain names included in the inquiry result using local encoding.

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.


Architecture

BIND-9 has a different resolver structure than BIND-8. Up to BIND-8, the resolver was implemented as a library linked to 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 to 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.

bind9 resolver architecture

Fixes in named

The following fixes were made in named:

UTF-8 Character Transparency

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.

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;
    ...
};

Fixes in lwresd

The following fixes were made to lwresd.

UTF-8 Character Transparency

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.

With named, this setting can be changed using the option setting in the named.conf configuration file; however, it is automatically changed with lwresd. 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.

Encoding Conversion

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.

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.


Fixes in Client Library

The client side library was corrected to perform the following operations:

  • Encoding Conversion
  • Normalization

The res module of the MDN library is used for this processing. The client configuration file is used to set settings.

The API functions 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.

Multilingual API Functions

The list of API functions that are made multilingual by the patch is shown below.

  • lwres_getaddrinfo()
  • lwres_getnameinfo()
  • lwres_gethostbyname()
  • lwres_gethostbyname2()
  • lwres_gethostbyname_r()
  • lwres_gethostbyaddr()
  • lwres_gethostbyaddr_r()
  • lwres_getipnodebyname()
  • lwres_getipnodebyaddr()

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.

  • host-in-Japanese.company-in-Japanese.jp
  • www.other-company-in-Japanese.com

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.

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.

Added internal functions

In association with the API functions that were made multilingual, the following internal functions are added.

lwres_getaddrinfo_enc()
lwres_getaddrinfo() internal function
lwres_getnameinfo_enc()
lwres_getnameinfo() internal function
lwres_gethostbyname_enc()
lwres_gethostbyname() internal function
lwres_gethostbyname2_enc()
lwres_gethostbyname2() internal function
lwres_gethostbyname_r_enc()
lwres_gethostbyname_r() internal function
lwres_gethostbyaddr_enc()
lwres_gethostbyaddr() internal function
lwres_gethostbyaddr_r_enc()
lwres_gethostbyaddr_r() internal function
lwres_getipnodebyname_enc()
lwres_getipnodebyname() internal function
lwres_getipnodebyaddr_enc()
lwres_getipnodebyaddr() internal function

The specifications of the added internal functions are as follows.

lwres_getaddrinfo_enc
int
lwres_getaddrinfo_enc(const char *, const char *, const struct addrinfo *,
		      struct addrinfo **, int)

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.

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.

One of the following values is returned. EAI_NONAME, EAI_BADFLAGS, EAI_SYSTEM, EAI_FAMILY, EAI_SOCKTYPE, EAI_SERVICE, EAI_MEMORY, 0

lwres_getnameinfo_enc
int
lwres_getnameinfo_enc(const struct sockaddr *, size_t, char *, size_t, char *,
		      size_t, int, int)

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.

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.

One of the following values is returned. ENI_NOSOCKET, ENI_SALEN, ENI_FAMILY, ENI_MEMORY, ENI_SYSTEM, ENI_NOHOSTNAME, SUCCESS

lwres_gethostbyname_enc
struct hostent *
lwres_gethostbyname_enc(const char *, int)

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.

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.

A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc().

lwres_gethostbyname2_enc
struct hostent *
lwres_gethostbyname2_enc(const char *, int, int)

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.

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.

A pointer is returned that points to the hostent structure returned from lwres_getipnodebyname_enc().

lwres_gethostbyname_r_enc
struct hostent *
lwres_gethostbyname_r_enc(const char *, struct hostent *, char *,
			  int, int *, int)

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.

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 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.

lwres_gethostbyaddr_enc
struct hostent *
lwres_gethostbyaddr_enc(const char *, int, int, int)

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.

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.

The pointer is returned that points to the hostent structure returned from lwres_getipnodebyaddr_enc().

lwres_gethostbyaddr_r_enc
struct hostent *
lwres_gethostbyaddr_r_enc(const char *, int, int, struct hostent *,
			  char *, int, int *, int)

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.

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 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.

lwres_getipnodebyname_enc
struct hostent *
lwres_getipnodebyname_enc(const char *, int, int, int *, int)

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.

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 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.

lwres_getipnodebyaddr_enc
struct hostent *
lwres_getipnodebyaddr_enc(const void *, size_t, int, int *, int)

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.

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 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.


Fixes in dig/host/nslookup

The DNS inquiry commands called dig, host, and nslookup are included in BIND-9. Because of the BIND-9 patch in mDNkit, these commands can handle multilingual domain names. Specifically, the following functions are added.

  • Encoding conversion
    Converts domain names expressed in local encoding entered using command arguments or through standard input to the encoding used by the DNS protocol and issues a DNS inquiry.

    Also converts multilingual domain names included in the DNS response to local encoding and displays the result.

  • Normalization
    When converting domain names expressed in local encoding to the encoding used in DNS protocol as a result of a DNS inquiry, the domain names are normalized.

The res module of the MDN library is used for that processing. The client configuration file is used to make the setting.

このページを評価してください

このWebページは役に立ちましたか?
よろしければ回答の理由をご記入ください

それ以外にも、ページの改良点等がございましたら自由にご記入ください。

回答が必要な場合は、お問い合わせ先をご利用ください。

ロゴ:JPNIC

Copyright© 1996-2024 Japan Network Information Center. All Rights Reserved.