netdev
[Top] [All Lists]

Re: sin6_scope_id

To: netdev@xxxxxxxxxxx
Subject: Re: sin6_scope_id
From: David Jeffery <lordbeatnik@xxxxxxxxxxxxxx>
Date: Thu, 13 Jan 2000 17:14:14 -0800
Sender: owner-netdev@xxxxxxxxxxx
Hideaki YOSHIFUJI (=?iso-2022-jp?B?GyRCNUhGIzFRTEAbKEI=?=)
    <yoshfuji@xxxxxxxxxxxxxxxxx> wrote:
>Alexey, 
>
>In article <200001130359.WAA0000007676@xxxxxxxxxxxxxxxxxx> (at Wed, 12 Jan 
>2000 22:59:34 -0500), Jim Bound <bound@xxxxxxxxxxx> says:
>
>> .. I suggest to you that Linux
>> does not want to be the only platform that does not support scopes.
>
>We, Sekiya, I and other Linux IPv6 Users JP members, discussed on this 
>issue, and now we think Linux must not go wrong. 
>
>Delays are dangerous.  Let's make a room for sin6_scope_id as soon as 
>possible.  (I know you are busy,  but the best to do is to add into 
>2.3.x kernels.)  After that, support code for sin6_scope_id should be 
>added.

Alexey can't just add the sin6_scope_id field. It would break userspace.
for example, the following line from inet6_bind

        if (addr_len < sizeof(struct sockaddr_in6))
                return -EINVAL;

would reject current userspace programs without sin6_scope_id.
Also, you'd have to make sure copy_from/to_user would copy the proper size.
and not copy garbage or overwrite userspace.

from my limited experiance with the ip6 stack, it would seem possible to play 
games like:

        if (addr_len < SOCKADDR_IN6_MIN))
                return -EINVAL;

and
        if(userlen >= sizeof(struct sockaddr_in6))
                copy_from_user(..., sizeof(struct sockaddr_in6);
        else if(userlen >= SOCKADDR_IN6_MIN))
                copy_from_user(..., SOCKADDR_IN6_MIN);

where SOCKADDR_IN6_MIN is the size of sockaddr_in6 without sin6_scope_id.
You'd also have to make sure sin6_scope_id inits to 0 when dealing with 
scope_id-less userspace

Those are just the issues I've seen with a quick scan of the relivant code.  
Most of my code reading has been with other sections of the stack, so can 
others more familiar with it speak of any other issues that make it a pain or 
would break userspace?

David "LordBeatnik" Jeffery
----------------------
Do you do Linux? :)
Get your FREE @linuxstart.com email address at: http://www.linuxstart.com       
                                                            

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