From nobody@FreeBSD.ORG  Mon Oct  2 02:38:28 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id B26F137B502; Mon,  2 Oct 2000 02:38:28 -0700 (PDT)
Message-Id: <20001002093828.B26F137B502@hub.freebsd.org>
Date: Mon,  2 Oct 2000 02:38:28 -0700 (PDT)
From: pekkas@netcore.fi
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
X-Send-Pr-Version: www-1.0

>Number:         21695
>Category:       conf
>Synopsis:       ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 02 02:40:01 PDT 2000
>Closed-Date:    Sun Feb 02 04:36:15 PST 2003
>Last-Modified:  Sun Feb 02 04:36:15 PST 2003
>Originator:     Pekka Savola
>Release:        FreeBSD-4.1-STABLE
>Organization:
Netcore
>Environment:
>Description:
ifconfig_fxp0_aliasX definitions in /etc/rc.conf must be in 
sequential order.  Also, if one (here 'X-1') is missing, all aliases
from X onwards will be ignored.

This could be viewed as a configuration issue (which it is, strictly 
speaking), but as some poeple have a lot of aliases, this kind of
mechanism could be optimized.

>How-To-Repeat:
Put the following in rc.conf:

ifconfig_fxp0="inet x.y.129.194 netmask 255.255.255.240"
ifconfig_fxp0_alias0="inet x.y.129.195 netmask 255.255.255.255"
#ifconfig_fxp0_alias1="inet x.y.129.196 netmask 255.255.255.255"
ifconfig_fxp0_alias2="inet x.y.129.198 netmask 255.255.255.255"

alias2 will not be configured.
>Fix:


>Release-Note:
>Audit-Trail:

From: "Chris D. Faulhaber" <jedgar@fxp.org>
To: pekkas@netcore.fi
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential
 order
Date: Mon, 2 Oct 2000 06:10:02 -0400 (EDT)

 On Mon, 2 Oct 2000 pekkas@netcore.fi wrote:
 
 > >Synopsis:       ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
 > 
 > >How-To-Repeat:
 > Put the following in rc.conf:
 > 
 > ifconfig_fxp0="inet x.y.129.194 netmask 255.255.255.240"
 > ifconfig_fxp0_alias0="inet x.y.129.195 netmask 255.255.255.255"
 > #ifconfig_fxp0_alias1="inet x.y.129.196 netmask 255.255.255.255"
 > ifconfig_fxp0_alias2="inet x.y.129.198 netmask 255.255.255.255"
 > 
 > alias2 will not be configured.
 > 
 
 Is this a problem or just something you noticed?  This behaviour is 
 documented in rc.conf(5).
 
 -----
 Chris D. Faulhaber - jedgar@fxp.org - jedgar@FreeBSD.org
 --------------------------------------------------------
 FreeBSD: The Power To Serve   -   http://www.FreeBSD.org
 
 

From: Pekka Savola <pekkas@netcore.fi>
To: "Chris D. Faulhaber" <jedgar@fxp.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential
 order
Date: Mon, 2 Oct 2000 13:18:29 +0300 (EEST)

 On Mon, 2 Oct 2000, Chris D. Faulhaber wrote:
 
 > On Mon, 2 Oct 2000 pekkas@netcore.fi wrote:
 > 
 > > >Synopsis:       ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
 > > 
 > > >How-To-Repeat:
 > > Put the following in rc.conf:
 > > 
 > > ifconfig_fxp0="inet x.y.129.194 netmask 255.255.255.240"
 > > ifconfig_fxp0_alias0="inet x.y.129.195 netmask 255.255.255.255"
 > > #ifconfig_fxp0_alias1="inet x.y.129.196 netmask 255.255.255.255"
 > > ifconfig_fxp0_alias2="inet x.y.129.198 netmask 255.255.255.255"
 > > 
 > > alias2 will not be configured.
 > > 
 > 
 > Is this a problem or just something you noticed?  This behaviour is 
 > documented in rc.conf(5).
 
 Well, both. :-)
 
 Actually I hadn't noticed there was a man page about rc.conf earlier, so I
 just noticed it now.
 
 Nevertheless, even though it's documented, this would seem to be like a
 thing that should just plain work :-)
  
 -- 
 Pekka Savola                 "Tell me of difficulties surmounted, 
 Pekka.Savola@netcore.fi      not those you stumble over and fall"
 
 

From: Ruslan Ermilov <ru@sunbay.com>
To: Pekka Savola <pekkas@netcore.fi>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
Date: Mon, 2 Oct 2000 14:16:57 +0300

 On Mon, Oct 02, 2000 at 03:20:05AM -0700, Pekka Savola wrote:
 > The following reply was made to PR conf/21695; it has been noted by GNATS.
 > 
 > From: Pekka Savola <pekkas@netcore.fi>
 > To: "Chris D. Faulhaber" <jedgar@fxp.org>
 > Cc: freebsd-gnats-submit@FreeBSD.org
 > Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential
 >  order
 > Date: Mon, 2 Oct 2000 13:18:29 +0300 (EEST)
 > 
 >  On Mon, 2 Oct 2000, Chris D. Faulhaber wrote:
 >  
 >  > On Mon, 2 Oct 2000 pekkas@netcore.fi wrote:
 >  > 
 >  > > >Synopsis:       ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
 >  > > 
 >  > > >How-To-Repeat:
 >  > > Put the following in rc.conf:
 >  > > 
 >  > > ifconfig_fxp0="inet x.y.129.194 netmask 255.255.255.240"
 >  > > ifconfig_fxp0_alias0="inet x.y.129.195 netmask 255.255.255.255"
 >  > > #ifconfig_fxp0_alias1="inet x.y.129.196 netmask 255.255.255.255"
 >  > > ifconfig_fxp0_alias2="inet x.y.129.198 netmask 255.255.255.255"
 >  > > 
 >  > > alias2 will not be configured.
 >  > > 
 >  > 
 >  > Is this a problem or just something you noticed?  This behaviour is 
 >  > documented in rc.conf(5).
 >  
 >  Well, both. :-)
 >  
 >  Actually I hadn't noticed there was a man page about rc.conf earlier, so I
 >  just noticed it now.
 >  
 >  Nevertheless, even though it's documented, this would seem to be like a
 >  thing that should just plain work :-)
 >   
 Hmm, how would you expect it to work?  rc.network scanning all possible
 ifconfig_<iface>_alias<n>, where n is from 0 to infinity?  I doubt this
 would be practical.
 
 
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 

From: Pekka Savola <pekkas@netcore.fi>
To: Ruslan Ermilov <ru@sunbay.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential
 order
Date: Mon, 2 Oct 2000 14:23:09 +0300 (EEST)

 On Mon, 2 Oct 2000, Ruslan Ermilov wrote:
 
 > On Mon, Oct 02, 2000 at 03:20:05AM -0700, Pekka Savola wrote:
 > > The following reply was made to PR conf/21695; it has been noted by GNATS.
 > > 
 > > From: Pekka Savola <pekkas@netcore.fi>
 > > To: "Chris D. Faulhaber" <jedgar@fxp.org>
 > > Cc: freebsd-gnats-submit@FreeBSD.org
 > > Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential
 > >  order
 > > Date: Mon, 2 Oct 2000 13:18:29 +0300 (EEST)
 > > 
 > >  On Mon, 2 Oct 2000, Chris D. Faulhaber wrote:
 > >  
 > >  > On Mon, 2 Oct 2000 pekkas@netcore.fi wrote:
 > >  > 
 > >  > > >Synopsis:       ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
 > >  > > 
 > >  > > >How-To-Repeat:
 > >  > > Put the following in rc.conf:
 > >  > > 
 > >  > > ifconfig_fxp0="inet x.y.129.194 netmask 255.255.255.240"
 > >  > > ifconfig_fxp0_alias0="inet x.y.129.195 netmask 255.255.255.255"
 > >  > > #ifconfig_fxp0_alias1="inet x.y.129.196 netmask 255.255.255.255"
 > >  > > ifconfig_fxp0_alias2="inet x.y.129.198 netmask 255.255.255.255"
 > >  > > 
 > >  > > alias2 will not be configured.
 > >  > > 
 > >  > 
 > >  > Is this a problem or just something you noticed?  This behaviour is 
 > >  > documented in rc.conf(5).
 > >  
 > >  Well, both. :-)
 > >  
 > >  Actually I hadn't noticed there was a man page about rc.conf earlier, so I
 > >  just noticed it now.
 > >  
 > >  Nevertheless, even though it's documented, this would seem to be like a
 > >  thing that should just plain work :-)
 > >   
 > Hmm, how would you expect it to work?  rc.network scanning all possible
 > ifconfig_<iface>_alias<n>, where n is from 0 to infinity?  I doubt this
 > would be practical.
 
 Well, this is a bit hackish approach, but an equivalent of:
 
 grep ^ifconfig_.*_alias /etc/rc.conf
 
 would probably be good.
 
 -- 
 Pekka Savola                 "Tell me of difficulties surmounted, 
 Pekka.Savola@netcore.fi      not those you stumble over and fall"
 
 

From: Ruslan Ermilov <ru@sunbay.com>
To: Pekka Savola <pekkas@netcore.fi>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
Date: Mon, 2 Oct 2000 16:01:12 +0300

 On Mon, Oct 02, 2000 at 04:30:03AM -0700, Pekka Savola wrote:
 [...]
 >  > Hmm, how would you expect it to work?  rc.network scanning all possible
 >  > ifconfig_<iface>_alias<n>, where n is from 0 to infinity?  I doubt this
 >  > would be practical.
 >  
 >  Well, this is a bit hackish approach, but an equivalent of:
 >  
 >  grep ^ifconfig_.*_alias /etc/rc.conf
 >  
 >  would probably be good.
 >  
 Not if /usr/bin/grep is called when /usr is not yet mounted.
 
 If you really need to have the ability to selectively turn on/off
 aliases on your interface, the below might work.  Besides that it
 would allow you to selectively turn your aliases, it also has a
 plus in that you may choose whatever name you wish for your alias
 (much like the same as we do for ${static_routes}).
 
 #!/bin/sh
 
 network_interfaces="ed0"
 ifconfig_ed0_aliases="foo bar"
 ifconfig_ed0_alias_foo="alias_foo"
 ifconfig_ed0_alias_bar="alias_bar"
 
 for ifn in ${network_interfaces}; do
 	eval ifconfig_aliases=\$ifconfig_${ifn}_aliases
 	if [ -n "${ifconfig_aliases}" ]; then
 		for i in ${ifconfig_aliases}; do
 			eval ifconfig_args=\$ifconfig_${ifn}_alias_${i}
 			if [ -n "${ifconfig_args}" ]; then
 				echo ifconfig ${ifn} ${ifconfig_args} alias
 				eval showstat_$ifn=1
 			fi
 		done
 	fi
 done
 
 
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 

From: Ian Dowse <iedowse@maths.tcd.ie>
To: pekkas@netcore.fi
Cc: freebsd-gnats-submit@freebsd.org, ru@freebsd.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
Date: Sat, 17 Nov 2001 15:19:09 +0000

 Another approach that could be used here would be to filter the
 output of "set" using while/read/case, e.g something like
 
 set | (while read alias; do
 	alias=${alias%%=*}
 	case "$alias" in
 	ifconfig_${ifn}_alias*)
 		eval ifconfig_args=\$$alias
 		ifconfig ${ifn} ${ifconfig_args} alias
 		eval showstat_$ifn=1
 		;;
 	esac
 done)
 
 
 Ian

From: Dag-Erling Smorgrav <des@ofug.org>
To: Ian Dowse <iedowse@maths.tcd.ie>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
Date: 17 Nov 2001 21:07:03 +0100

 Ian Dowse <iedowse@maths.tcd.ie> writes:
 >  Another approach that could be used here would be to filter the
 >  output of "set" using while/read/case, e.g something like
 >  
 >  set | (while read alias; do
 >  [...]
 >  done)
 
 Unless set(1) is guaranteed to sort its output, you might want to pipe
 it through sort(1) first.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: Ian Dowse <iedowse@maths.tcd.ie>
To: Dag-Erling Smorgrav <des@ofug.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order 
Date: Sat, 17 Nov 2001 21:02:53 +0000

 In message <xzpy9l5kvq0.fsf@flood.ping.uio.no>, Dag-Erling Smorgrav writes:
 >Unless set(1) is guaranteed to sort its output, you might want to pipe
 >it through sort(1) first.
 
 For aliases the order shouldn't be important - the problem with
 sort(1) is that it is in /usr/bin, which may not be available at
 the time the aliases are configured.
 
 Ian

From: Dag-Erling Smorgrav <des@ofug.org>
To: Ian Dowse <iedowse@maths.tcd.ie>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/21695: ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order
Date: 17 Nov 2001 23:35:23 +0100

 Ian Dowse <iedowse@maths.tcd.ie> writes:
 > For aliases the order shouldn't be important - the problem with
 > sort(1) is that it is in /usr/bin, which may not be available at
 > the time the aliases are configured.
 
 Sorry, I misunderstood the bug report - I thought the issue here was
 ordering, but it's consecutivity.  Please ignore me :)
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: johan 
Responsible-Changed-When: Thu Aug 22 12:30:30 PDT 2002 
Responsible-Changed-Why:  
Over to /etc guru. 

Doug, let me know if you want some help with 
some of the etc PRs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21695 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Sun Feb 2 04:24:32 PST 2003 
State-Changed-Why:  

There is a better way for you to deal with your problem. First, 
make sure that your network_interfaces variable in rc.conf 
is set to 'auto' (it's that way in /etc/defaults/rc.conf). 
Then, create individual files called start_if.<interface>, 
such as start_if.fxp0 with the commands you want executed 
for that interface. For example: 

ifconfig ${ifn} 192.168.0.127 netmask 0xffffff00 
ifconfig ${ifn} media 100basetx mediaopt full-duplex 
route add default 192.168.0.1 

You only need to add the default route once. 

This way, you can easily control which interfaces are set up, and 
you don't have to worry about the sequential ordering problems. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21695 
>Unformatted:
