At 7:44 PM +0900 2002/07/23, JINMEI Tatuya / 
=?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= wrote:

>  What exactly do you mean by BIND 9.2.1?
>
>  1. the resolver library under lib/bind
>  2. the resolver routine in lwresd
>  3. both 1 and 2

        Well, lwresd is just BIND by another name, so it should be the 
same library call.  Starting in the bind-9.2.1 directory and 
searching for relevant strings, we find:

% find . -name \*.c -print | xargs egrep -i 'ip6\.(arpa|int)'
./bin/named/query.c: * Convert the ip6.int name 'name' into the 
corresponding IPv6 address
./bin/named/query.c:    /* Try IP6.ARPA first. */
./bin/named/query.c:            /* Try IP6.INT next. */
./bin/named/query.c:             * of NXDOMAIN and NXRRSET results 
from the IP6.INT
./bin/named/query.c:             * and IP6.ARPA lookups, it could 
still be wrong with
./bin/tests/lwres_test.c:       test_gabn("foo.ip6.int.");
./lib/bind/resolv/res_init.c: 
strcpy(statp->_u._ext.ext->nsuffix, "ip6.int");
./lib/bind/resolv/res_init.c: 
strcpy(statp->_u._ext.ext->bsuffix, "ip6.arpa");
./lib/bind/resolv/res_init.c:   return ("ip6.int");
./lib/bind/resolv/res_init.c:   return ("ip6.arpa");
./lib/dns/byaddr.c:                     strcpy(cp, "ip6.int.");
./lib/dns/byaddr.c:                     strcpy(cp, "].ip6.arpa.");


        Specifically, looking in bind-9.2.1/bin/named/query.c, starting 
on line 3770, we see:

         /* Try IP6.ARPA first. */
         result = dns_byaddr_create(client->mctx,
                                    &client->query.synth.na,
                                    client->view,
                                    0, client->task,
                                    synth_rev_byaddrdone_arpa,
                                    client, &byaddr_dummy);
         if (result == ISC_R_SUCCESS)
                 return; /* Wait for completion event. */

        Then, starting on line 3796, we see:

                 /* Try IP6.INT next. */
                 result = dns_byaddr_create(client->mctx,
                                            &client->query.synth.na,
                                            client->view,
                                            DNS_BYADDROPT_IPV6NIBBLE,
                                            client->task,
                                            synth_rev_byaddrdone_int,
                                            client, &byaddr_dummy);
                 if (result != ISC_R_SUCCESS)
                         synth_finish(client, result);

        Then starting on line 3821, we see:

         } else if (bevent->result == DNS_R_NCACHENXDOMAIN ||
                    bevent->result == DNS_R_NCACHENXRRSET ||
                    bevent->result == DNS_R_NXDOMAIN ||
                    bevent->result == DNS_R_NXRRSET) {
                 /*
                  * We could give a NOERROR/NODATA response instead
                  * in some cases, but since there may be any combination
                  * of NXDOMAIN and NXRRSET results from the IP6.INT
                  * and IP6.ARPA lookups, it could still be wrong with
                  * respect to one or the other.
                  */
                 synth_finish(client, DNS_R_NXDOMAIN);

        Looking at bind-9.2.1/lib/bind/resolv/res_init.c, starting on 
line 194, we see:

         if (statp->_u._ext.ext != NULL) {
                 memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext));
                 statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
                 strcpy(statp->_u._ext.ext->nsuffix, "ip6.int");
                 strcpy(statp->_u._ext.ext->bsuffix, "ip6.arpa");
         }

        Then starting on line 608, we see:

const char *
res_get_nibblesuffix(res_state statp) {
         if (statp->_u._ext.ext)
                 return (statp->_u._ext.ext->nsuffix);
         return ("ip6.int");
}

const char *
res_get_bitstringsuffix(res_state statp) {
         if (statp->_u._ext.ext)
                 return (statp->_u._ext.ext->bsuffix);
         return ("ip6.arpa");
}

        Moving on to bind-9.2.1/lib/dns/byaddr.c starting on line 93, we see:

         } else if (address->family == AF_INET6) {
                 if (nibble) {
                         cp = textname;
                         for (i = 15; i >= 0; i--) {
                                 *cp++ = hex_digits[bytes[i] & 0x0f];
                                 *cp++ = '.';
                                 *cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
                                 *cp++ = '.';
                         }
                         strcpy(cp, "ip6.int.");
                 } else {
                         cp = textname;
                         *cp++ = '\\';
                         *cp++ = '[';
                         *cp++ = 'x';
                         for (i = 0; i < 16; i += 2) {
                                 *cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
                                 *cp++ = hex_digits[bytes[i] & 0x0f];
                                 *cp++ = hex_digits[(bytes[i+1] >> 4) & 0x0f];
                                 *cp++ = hex_digits[bytes[i+1] & 0x0f];
                         }
                         strcpy(cp, "].ip6.arpa.");
                 }
         } else

>  In my understanding (I've quickly checked the code again, too), both 1
>  and 2 only tries ip6.arpa with bitstring labels.

        I'm not sure why nibble and bitstring forms are handled 
differently within the libraries, but clearly within the nameserver 
itself, it does check both domains.

-- 
Brad Knowles, <[EMAIL PROTECTED]>

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
     -Benjamin Franklin, Historical Review of Pennsylvania.

--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to