Subject: Re: How to detect net cable plug-in
To: Brian Grayson (home) <email@example.com>
From: Robert Elz <kre@munnari.OZ.AU>
Date: 10/15/2003 03:47:01
Date: Tue, 14 Oct 2003 00:42:00 -0500
From: "Brian Grayson \(home\)" <firstname.lastname@example.org>
| Or, the more fundamental question is, can one detect the actual
| status of the wire (carrier or no) independently from whether the
| interface is up or down? For tlp0, the answer seems to be yes, while
| for ex0, the answer seems to be no (with the kernel as written today).
The problem is that link status is not really one of the exported
attributes of net interfaces (though one would really assume that it should
be) - so there's no spec on just what drivers should do. Consequently, they
do almost anything.
Another consequence of this is that SNMP on NetBSD (perhaps other *BSD)
uses the IFF_RUNNING flag for "administratively up" and IFF_UP for
"operationally up", which is total nonsense. IFF_UP is what should be
admin up, operationally up is the link status - but there's no standard
way to get that one. IFF_RUNNING has absolutely nothing to do with any
of this (and, for example, on lo0, never gets set, so snmp can show the
interface as "administratively down, operationally up" which should be
a transitory state at best).
The net interface API needs a whole bunch of work.