Subject: Re: Why is ifconfig.ae0 better than hostname.ae0?
To: Andrew Brown <email@example.com>
From: Luke Mewburn <firstname.lastname@example.org>
Date: 04/16/1997 23:25:33
Andrew Brown writes:
> >> >Parsing begins to become a serious pain.
> >> are inet addresses no longer going to be assigned this way? isn't
> >> netstart supposed to be able to read the ifconfig.### files anyway?
> >> doens't it "implicitly" know how to parse the file?
> >ifconfig.foo works by having netstart do "ifconfig foo `cat ifconfig.foo`"
> >That isn't parsing by any normal use of the term.
> wow. i guess it's been too long since i looked at netstart. yes,
> you are correct. it doesn't even pretend to know what's in them
> anymore. hmm...
Parsing the format of either /etc/ifconfig.xxN or $ifconfig_xxN is
to get the interface address is too much work.
A proposed solution is as follows:
a) add an option to ifconfig(8) which returns the inet source
address for a given interface.
b) modify /etc/netstart to take advantage of this
a) I've done this. It was rather simple, in the end. I just added a
'-q' (``quiet'') option. Currently, it's only effective if you do
ifconfig -q ed0
and it will return a string like "192.168.42.42" if things are OK, or
an null string if no address is bound to the interface. If there's a
problem, the message goes to STDERR and a non-zero exit status is
b) Replace the code in /etc/netstart that looks like (well, similar
to; i'm just getting the gist across here):
for i in `list of interfaces` ; do
if [$ifconfig_$$tmp != ""]; then # (you get the idea)
ifconfig $i $ifconfig_$$tmp
elif [-f /etc/ifconfig.$i]; then
ifconfig `cat /etc/ifconfig.$i`
echo "can't configure $i"
# <-------------------------- point `A'
# <---------------------------------- point `B'
route add `hostname` localhost # <---------- point `C'
Point `A': Add a "continue"
Point `B': Add something like:
$addr=`ifconfig -q $i`
if [$addr != ""]; then
route add $addr localhost
Point `C': remove the line
I'll test this latter code, but I'm pretty sure that this is a sane
solution. The "ifconfig -q ..." bit may be a bit hacky for some,