On Fri, 2005-06-17 at 14:31 -0400, mclellan, dave wrote:
> Hi list folks:  I am searching out how to set the sin6_scope_id member field
> of the sockaddr_in6 structure when it contains a link-local address.

How did you get the link-local address in the first place?  The entity
that provided that information should also provide sin6_scope_id.

>  
> 
> I know that if_nametoindex() is supposed to return the scope of the
> interface, given a name, e.g. 

No, that function returns the interface index for a given interface.
It may just so happen that the two are the same on multiple
implementations.  That doesn't mean that you should assume that its
true for all implementations.

>       struct sockaddr_in6 sa; 
>               sa.sin6_scope_id = if_nametoindex("eth0"); 

This is really playing with fire...  interface index does have to
equal scope_id.

> 
> My main question is:  how do I deteminre the name to pass to
> if_nametoindex()?  I am supporting Solaris, AIX, HP, Tru64, Linux kernels,
> and Win2K and WIN IA.  

This should really be provided to you by the entity that provided the
link-local address.  So, if the user type it in, he should have provided
a scope-id.  If you got it from a system call, the system should have
provided the scope_id.

-vlad


---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]

Reply via email to