Subject: Re: "rotating" IPv4 addresses - bug or feature?
To: None <tech-net@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 07/10/2007 19:31:25
On Wed, Jul 11, 2007 at 02:12:23AM +0200, Jukka Salmi wrote:
> Hmm, it's not a problem AFAICT, I just wonder if this is expected
> behaviour...

It is expected behavior.  The kernel keeps a linked list of addresses
on each interface.  Adding/deleting addresses can change the order of
that list.  When userland asks the kernel for the addresses, it writes
them out in the order that they appear on the list.

Only the address that is first on the list is "special" in any way;
after the kernel chooses an outgoing IP interface, it uses the first
address on the interface for the source, if the socket did not bind(2)
to some other address.  (I recommend to users who desire the kernel to
make a less arbitrary choice of source address, recompile your kernel with
'options IPSELSRC' and set a policy that suits you.)

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933 ext 24