>>>>> On Thu, 26 Sep 2002 21:38:51 -0700 (PDT), 
>>>>> MIP Team <[EMAIL PROTECTED]> said:

> I have confirmed that my BSD api supports the sin6_scope_id field in
> the sockaddr_in6 struct. However what should be the value that I set
> for the link local addresses. Currently I am probably setting ot to
> zero (memcpy the entire structure zero and donot assign any thing to
> it). are there any #defines that i can look up for different scope. I
> have Unix Netwrok programming by W.Richards but since its published in
> 1998 no such info is provided in it. Please tell me what value i should
> assign so that it works on link local or site local addresses!

Unfortunately, there is no clear specification on the value to be set
in the sin6_scope_id field.  You may want to check
draft-ietf-ipv6-scope-api-00.txt, which has a following section:

2.1. sin6_scope_id

   The definition of the sin6_scope_id is extended as follows:

   - The sin6_scope_id field of the sockaddr_in6 structure contains
     a zone index [SCOPE-ARCH] as appropriate for the scope of the
     address carried in the sin6_addr field.  For a link scope
     sin6_addr, sin6_scope_id would contain a link index.  For a
     site scope sin6_addr, sin6_scope_id would contain a site index.
     The value zero in the sin6_scope_id field represents a default
     zone.

However, it is still unclear what a "link index" is.  Since links are
technically larger scope than interfaces (see
draft-ietf-ipngwg-scoping-arch-04.txt), you cannot always expect that
interface identifiers work as link indices.

So, at this moment, I'd recommend

1. if the application itself does not have to fill in the
   sin6_scope_id field (i.e. only users pass link-local addresses via
   command line arguments or configuration files), just use
   getaddrinfo() and let the users to specify the link-local addresses
   with the format described in section 13 of the scoping-arch draft.

2. if the application has to fill in the field, use interface
   identifiers (that you can get by if_nametoindex()) as link indices,
   *assuming* that there is a one-to-one mapping between interfaces and
   links and that the OS uses the same link IDs as interface IDs.
   Technically, the assumption is not always true, but should be the
   case for most situations.  Particularly, this is the case for BSD
   variants.

If you're using BSD variants, you may also want to check section 1.3
of the KAME Implementation Note, which is available at (e.g.)
http://orange.kame.net/dev/cvsweb.cgi/kame/IMPLEMENTATION?rev=1.315

                                        JINMEI, Tatuya
                                        Communication Platform Lab.
                                        Corporate R&D Center, Toshiba Corp.
                                        [EMAIL PROTECTED]
---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]

Reply via email to