Subject: Re: [PATCH net-next] ip6_tunnel: ensure to always have a link local address

From: Nicolas Dichtel <[email-masked]>
Date: Wed, 21 Aug 2013 12:25:19 +0200

Le 21/08/2013 11:02, Bjørn Mork a écrit :
> Nicolas Dichtel <[email-masked]> writes:
>> Le 21/08/2013 08:48, David Miller a écrit :
>>
>>> Applied, but this brings up an issue I keep noticing.
>>>
>>> We talk about eth_random_addr() and "uniqueness" together all the
>>> time, but the former never implies the latter.
>>>
>>> And we're going to run into situations where any conflicts generated
>>> by this random address generater will cause reall failures.
>>>
>>> Therefore we'll have to create a system to prevent them.  Probably
>>> using some simple table that keeps track of the addresses we've
>>> generated.
>>>
>> Ok, I will look at this.
>
> Are eth_random_addr() collisions really any different than interfaces
> having the same address for other reasons?
I would tend to say yes, it's different.
It's easy for an administrator to fix a configuration for a physical interface, 
because it's statically configured and there is a limited number of interfaces.

For virtual interfaces, they can be dynamically created and destroyed by daemons 
and we can have a lot of interfaces. Hence it could be hard to fix them. Trying 
to avoid these errors at kernel level could be useful.

I've start to write a patch, and to test it I've just run a simple test which 
generate 1 000 000 of random addresses. I've run it several times (maybe not 
enough ;-)) and I never get a duplicated address...