On Fri, Oct 31, 2008 at 02:15:34AM +0100, Denys Vlasenko wrote: > 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 does not happen all the time ;)
This was just to correct the seeding so that local interfaces are not seeded the same way. This seed could probably be made even better, but I didn't know how, so I just used the ifindex. The link-local protocol has its own built-in back-off algorithm to prevent address collisions, which I didn't study in detail. > 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? Hmm, you have good point here. :) Incoming packets should be no problem, the headache starts when the system sends the reply. The route for 169.254.0.0/16 will become the first zcip-assigned interface, which is subject to race. I clearly hadn't thought this through fully. Maybe different routing tables can help? Something like this: http://pontus.ullgren.com/view/Multiple_interfaces_on_the_same_subnet > > - memcpy(&t, (char*)ð_addr + 2, 4); > > + memcpy(&t, (char*)ð_addr + 2 + if_nametoindex(intf), 4); > Oops... you added if_nametoindex() to the _address_! > You had to add it to t here: > > srand(t); > > } Yes, that was surely not my intention, but perhaps makes an even better seed? ;-) Regards /Jocke -- Joachim Nilsson :: <joachim AT vmlinux DOT org> +46(0)21-123348 :: <http://vmlinux.org/joachim> _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
