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/11/2007 13:06:03
On Wed, Jul 11, 2007 at 12:53:05PM +0200, Jukka Salmi wrote:
> Alan Barrett --> tech-net (2007-07-11 11:12:12 +0200):
> > On Wed, 11 Jul 2007, Jukka Salmi wrote:
> >   [several ifconfig commands, then:]
> > > $ ifconfig vr0 inet 192.168.0.1/24
> > > $ ifconfig vr0
> > > vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> > > 	address: 00:0c:6e:74:f6:81
> > > 	media: Ethernet autoselect (100baseTX full-duplex)
> > > 	status: active
> > > 	inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
> > > 	inet alias 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
> > > 	inet alias 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
> > 
> > This looks like a bug to me.  "ifconfig vr0 inet 192.168.0.1/24" should
> > not have made 192.168.0.2 become the first address in the list; it
> > should have made 192.168.0.1 the first adress in the list.
> 
> That's what I had expected, too.
> 
> I just noticed something what really looks like a bug to me:
> 
> $ ifconfig vr0
> vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> 	[...]
> 	inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
> 	inet alias 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
> 	inet alias 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
> 
> $ ifconfig vr0 inet 192.168.0.1/24
> $ ifconfig vr0
> vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> 	[...]
> 	inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
> 	inet alias 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
> 	inet alias 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
> 
> $ ifconfig vr0 inet 192.168.0.1/24
> $ ifconfig vr0
> vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> 	[...]
> 	inet 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
> 	inet alias 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
> 
> Huh, 192.168.0.2 is gone...

You have to use the 'alias' keyword, or else the kernel will replace the
first address instead of adding an address.  IMO we should get rid of
'alias' and make ifconfig inet work as ifconfig inet6 does before 5.0:
always add an address unless the operator gives the 'delete' keyword.

Dave

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