[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=p84Y3o+AgUX-59nvGzqZacm8nR0-GvstR6KmO@mail.gmail.com>
Date: Thu, 18 Nov 2010 16:43:30 +0100
From: Daniel Turull <daniel.turull@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org, "Voravit T." <voravit@....se>,
Robert Olsson <robert@...julf.net>
Subject: Re: [PATH] dev: reusing unregistered ifindex values in net_device
Ok,
thanks you for you quick response.
//Daniel
On Thu, Nov 18, 2010 at 16:37, Eric Dumazet <eric.dumazet@...il.com> wrote:
> Le jeudi 18 novembre 2010 à 16:25 +0100, Daniel Turull a écrit :
>> When a new index is going to be assigned in register_netdevice,
>> the dev_new_index starts to search possible values from the last index
>> given to a device although there might be some free ifindex that has been
>> previously unregistered. This behaviour may create gap(s) in the ifindex list.
>>
>> This patch checks for unused values from 1 and gives to the new device the
>> first available value. This limits the maximum ifindex to a smaller value.
>>
>> The ifindex will still be unique since the old value is no longer in use.
>>
>> Reported-by: Voravit Tanyingyong <voravit@....se>
>> Signed-off-by: Daniel Turull <daniel.turull@...il.com>
>>
>> ---
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 381b8e2..a7babab 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -4871,7 +4871,7 @@ int dev_ioctl(struct net *net, unsigned int cmd,
>> void __user *arg)
>> */
>> static int dev_new_index(struct net *net)
>> {
>> - static int ifindex;
>> + int ifindex;
>> for (;;) {
>> if (++ifindex <= 0)
>> ifindex = 1;
>> --
>
> NACK
>
> Two bugs
>
> 1) ifindex is not initialized : you'll be suprised of random values
>
> 2) ifindex should not be reused. You'll be surprised so applications can
> break. SNMP comes to mind.
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists