Subject: Re: ifconfig -s when interface is down?
To: Martin Husemann <martin@duskware.de>
From: =?unknown-8bit?Q?Gr=E9goire?= Sutre <sutre@labri.fr>
List: tech-userlevel
Date: 11/24/2004 23:56:48
On Wed, Nov 24, 2004 at 09:10:03PM +0100, Martin Husemann wrote:
> On Wed, Nov 24, 2004 at 08:59:47PM +0100, Gr?goire Sutre wrote:
> > Unfortunately, this does not work anymore under my NetBSD 2.0_RC4 box
> > (i386) since whenever the interface is down, `ifconfig -s ex0' returns
> > the same status (true) regardless of the presence of a network cable.
> 
> Heh, incidently I just looked at a PR today where the bce driver does not
> report network link status correctly. After a bit digging around, I found
> that the interface needs to be marked UP to properly report the linnk status.
> 
> Could you try "ifconfig ex0 up" and then "ifconfig -s ex0"?

Yes, it does work as you suggest.

After "ifconfig ex0 up", "ifconfig -s ex0" properly reports the link
status (what I called "presence of network cable" as I didn't think of
wifi ;-).


> I think this behaviour is reasonable, as for example with a wifi interface
> and a notebook the test for network presence may need more power, and you 
> don't wont to waste that sometimes. With the UP flag you have explicit
> controll over wich interfaces are potential active, and if you tell an
> interface its down - it realy is down.

Yes, this makes sense :-)

Then for my "try dhclient only when connected" trick, I guess I'll have
to first activate the interface, then check the link status, and finally
put the interface back as it was...


Thanks for your explanation !

Gregoire.

-- 
Grégoire Sutre                             Bureau 211
sutre@labri.fr                             LaBRI - CNRS UMR 5800
http://www.labri.fr/~sutre                 Domaine Universitaire
Tel: +33 5 40 00 33 36                     351, cours de la Libération
Fax: +33 5 40 00 66 69                     33405 Talence Cedex, FRANCE