| Summary: | ifconfig_XXX_aliasY in rc.conf; Y must be in sequential order | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Pekka Savola <pekkas> |
| Component: | conf | Assignee: | Doug Barton <dougb> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.1-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Pekka Savola
2000-10-02 10:40:01 UTC
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 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" 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 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" 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 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
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 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 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 Over to /etc guru. Doug, let me know if you want some help with some of the etc PRs. State Changed
From-To: open->closed
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.
|