[Top] [All Lists]


To: kuznet@xxxxxxxxxxxxx
Subject: sin6_scope_id
From: Yuji Sekiya <sekiya@xxxxxxx>
Date: Wed, 29 Dec 1999 17:53:00 +0900
Cc: netdev@xxxxxxxxxxx, users@xxxxxxxx
Cc: Hideaki YOSHIFUJI <yoshfuji@xxxxxxxxxxxxxxxxx>
Organization: Information Sciences Institute
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Wanderlust/2.2.12 (Joyride) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) MULE XEmacs/21.2 (beta19) (Shinjuku) (i586-pc-linux)
Hello Alexey and folks,

We(Linux IPv6 Group in Japan) found the portability problem that
sin6_scope_id member is missing in Linux kernel.
When we ported some applications to IPv6 ready, we encountered this problem.

RFC2553 says in section 2.4 that follow

        2.4 Structures

           When structures are described the members shown are the ones that
           must appear in an implementation.
and defines sockaddr_in6 as the following.

        struct sockaddr_in6 {
            sa_family_t     sin6_family;    /* AF_INET6 */
            in_port_t       sin6_port;      /* transport layer port # */
            uint32_t        sin6_flowinfo;  /* IPv6 traffic class & flow info */
            struct in6_addr sin6_addr;      /* IPv6 address */
            uint32_t        sin6_scope_id;  /* set of interfaces for a scope */

But in in6.h file of Linux kernel, sockaddr_in6 is defined as follows.

        struct sockaddr_in6 {
                unsigned short int      sin6_family;    /* AF_INET6 */
                __u16                   sin6_port;      /* Transport layer port 
# */
                __u32                   sin6_flowinfo;  /* IPv6 flow 
information */
                struct in6_addr         sin6_addr;      /* IPv6 address */

In case that the destination of outgoing packets is an
IPv6 global address, kernel may select an outgoing interface as routing
table. But in case of a link-local address, how can I select the interface
for outgoing packets without sin6_scope_id ?

Of course, I know the method of using SO_BINDTODEVICE, but I think it
is the linux only method and it is hard to keep portability of applications
with other Operating Systems.

In IPv4 environment, there are few applications which have to select an
interface. It is a rare case (at least for me) that we have to specify
an outgoing interface to use applications. AFAIK, tcpdump is the only

But IPv6, we can select one of addresses from three address types, global,
site-local and link-local. So it is not rare case for us to specify
an outgoing interface.

>From our experiences, we encountered the case which we wanna
use sin6_scope_id for portability of source code many times.
IMHO, I think it is better for us to support both of SO_BINDTODEVICE and

Do you have any plan to add sin6_scope_id in in6.h ?

BTW, if we add sin6_scope_id into **ONLY LINUX KERNEL**
or **ONLY LIBC HEADER FILE**, we encounter the problem of
inconsistency between kernel and libc structure. Many applications
which use sockaddr_in6 don't work correctly.

As a solution, we would suggest the following alternatives.

        1) Implementing the mechanism for backward compatibility
            in Linux kernel. ( Switch kernel syscall dynamically
            according to the size of sockaddr_in6 structure. )

        2) Providing kernel option in which we can select sockaddr_in6

Are these reasonable solutions for you ?
If you aren't interested in the sockaddr_in6 problem,
we would like take any solution to the problem.


SEKIYA Yuji     USC/ISI  Computer Networks Division 7
<sekiya@xxxxxxx / sekiya@xxxxxxxxxxxxxx / sekiya@xxxxxxxxxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>