Improved seed for zcip

Denys Vlasenko vda.linux at googlemail.com
Fri Oct 31 01:15:34 UTC 2008


On Wednesday 29 October 2008 23:29, Joachim Nilsson wrote:
> When I run udhcpc, with zcip as fallback, simultaneously on many
> VLAN interfaces I get exactly the same link-local address assigned
> for all of them.  It  turns out the random seed basically just uses
> the MAC address, which for VLAN interfaces is shared with the base
> interface.  To fix this I added the ifindex of the requested iface
> to the seed and everything works much better.

So the addresses now *most of the time, but not always*
are different. Not so good. You still need to have a mechanism
to prevent collisions, but now you have an excuse to
not do it - it doesn not happen all the time ;)

But more to it, I do not really understand how it works
at all when you have more than one zcip-controlled inteface.
All ifaces get 169.254.x.x addresses. Let's imagine
I want to talk to the remote host 169.254.22.33,
from which iface should I (or kernel) send the packet?

How does it work in practice?

> -		memcpy(&t, (char*)&eth_addr + 2, 4);
> +		memcpy(&t, (char*)&eth_addr + 2 + if_nametoindex(intf), 4);

Oops... you added if_nametoindex() to the _address_!
You had to add it to t here:

>  		srand(t);
>  	}

--
vda



More information about the busybox mailing list