tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
ifconfig(8) - a tale of two states
Hi List!
Consider this ifconfig(8) output:
urtwn0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ssid ""
powersave off
chan 6
address: 80:1f:02:82:35:c3
media: IEEE802.11 OFDM54 monitor (OFDM54 mode 11g monitor)
status: active
inet 192.168.0.1/24 broadcast 192.168.0.255 flags 0x4<DETACHED>
Is this output too confusing?
We claim that the media is active but the address is detached and there is no SSID!
WTF BBQ!
Traditionally, ifconfig reports the status of the media.
If the interface has no media, no status was reported .... until recently.
Now, if the interface has no media, it prints the status of the link state.
ALL interfaces, even bridge(4), has a link state. According to CVS, this has
always been the case. The link state can be UNKNOWN, DOWN or UP.
When an interface first registers it gains the state UNKNOWN - no claim is made
if it's down or up. It's only when the interfaces realises it's state the change
is made to UP or DOWN.
We've put a lot of work into changing our link state, it's there for a very good
reason.
But, traditionally, NetBSD applications such as ifconfig, ifwatchd and even the
portable dhcpcd have adhered to a common BSD facility - the media is the be all
and end all of if the interface has a carrier or not. The problem here is that
not all interfaces have media. A few years ago, I added media to PPP just to
make it active, but didn't register any actual media values. This was totes the
wrong thing to do! And has been recently reverted.
In a nutshell, the interface link state is the single source of truth regarding
the link state. So to the make matter right, I added a small change to our
net80211 stack to put the wireless interfce into a decent link state - HOSTAP,
IBSS and AHDEMO remain unknown, but BSS and MONITOR are clearly down.
BSS will go up when we join a node, but MONITOR is just read only. It cannot send.
As such any addresses on the interface are useless.
Which brings us back to the beginning with more clarity. We have an active media
state, but the interface link itself is down. Should we change the output of
ifconfig somehow to include the link state or is this too much of a corner case
to consider?
Comments welcome.
Roy
Home |
Main Index |
Thread Index |
Old Index