Subject: "ifconfig -s" not working properly
To: NetBSD/macppc list <port-macppc@netbsd.org>
From: John Valdes <valdes@uchicago.edu>
List: port-macppc
Date: 06/06/2001 12:43:06
All,

"ifconfig -s" on my PowerBook (G3, Lombard) doesn't seem to be working
properly.  From ifconfig(8):

SYNOPSIS
...
     ifconfig -s interface

DESCRIPTION
...
     If the -s flag is passed before an interface name, ifconfig will attempt
     to query the interface for its media status.  If the interface supports
     reporting media status, and it reports that it does not appear to be con-
     nected to a network, ifconfig will exit with status of 1 (false); other-
     wise, it will exit with a zero (true) exit status.  Not all interface
     drivers support media status reporting.

Specifically, "ifconfig -s" doesn't seem to work if the interface
hasn't already been configured w/ an IP address.  I want to use
"ifconfig -s" at boot to see if my PowerBook is plugged into a
network.  If it isn't, I want it to skip interface configuration (in
my case, running dhclient).  However, "ifconfig -s" always returns
true (exit status 0) at boot, regardless of whether a live cable is
plugged into the ethernet interface or not.  In contrast, if the
interface is already configured, then "ifconfig -s" works as
advertised.  I can unplug the cable, and it will report false; if I
plug the cable back in, it will then report true.

The interface in question is "bm0":

  bm0 at obio0 offset 0x11000 irq 42,33: address 00:50:e4:d0:12:5b
  nsphyter0 at bm0 phy 0: DP83843 10/100 media interface, rev. 0
  nsphyter0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

Is this the expected behavior (ie, one must configure an interface
before "ifconfig -s" will work), or a bug?  This is with NetBSD 1.5.

Thanks,

John