>>>>> On Wed, 6 Apr 2005 10:09:22 -0400, 
>>>>> "Steve Cipolli" <[EMAIL PROTECTED]> said:

> Can someone explain the rational for why RFC 4007 mandates the scope
> zone index before the prefix in the textual representation?  

(snip)

> Section 11.7 says its important to put the scope zone index first for
> parsing by name-to-address functions and references a document that I
> was unable to find.  I understand the "name-to-address functions" to
> mean getaddrinfo.  However I'm not clear why getaddrinfo should care
> that scope zone index appeared first assuming the substring "ip6 ['/'
> prefix]" were handled by a function similar in6_addr_pton above.

The intended function is getaddrinfo, yes.  And the expected usage in
this case is as follows:

(assume variable "prefix" points to a string like "fe80::%5/64")

        char *addr, *p;
        int plen;

        p = strchr(prefix, '/');
        *p++ = '\0';
        getaddrinfo(p, NULL, hints, res);
        plen = atoi(p);

(Note: error handling or proper handling of constant variables are
ignored for simplicity)

Then
  ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr = fe80::
  ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope-id = 5
  plen = 64

If we represented the scoped prefix as, e.g., "fe80::/64%5", the above
code couldn't be that straightforward.

                                        JINMEI, Tatuya
                                        Communication Platform Lab.
                                        Corporate R&D Center, Toshiba Corp.
                                        [EMAIL PROTECTED]

--------------------------------------------------------------------
IETF IPv6 working group mailing list
[email protected]
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------

Reply via email to