summaryrefslogtreecommitdiffstats
path: root/contrib/bsnmp
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-11-02 14:05:49 +0000
committerharti <harti@FreeBSD.org>2005-11-02 14:05:49 +0000
commitac5d1bb3eaf4c98e3a71e21f0cee4e9e68e0fbbb (patch)
tree4fdb91410f1a9bbad47c80ff67142978a8d797b2 /contrib/bsnmp
parent1973a24241e1546ff01c2e658c24e17f7ac6b29e (diff)
downloadFreeBSD-src-ac5d1bb3eaf4c98e3a71e21f0cee4e9e68e0fbbb.zip
FreeBSD-src-ac5d1bb3eaf4c98e3a71e21f0cee4e9e68e0fbbb.tar.gz
Vendor patch: fix the reporting of ifOperStatus. We now consider an
interface up when it is running AND the link is not down (that is, it is up or unknown). If the interface is running but the link is down, we return state 'dormant', because we're waiting for an external event. Otherwise the interface is 'down'. Submitted by: csjp Reviewed by: glebius
Diffstat (limited to 'contrib/bsnmp')
-rw-r--r--contrib/bsnmp/snmp_mibII/mibII_interfaces.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/contrib/bsnmp/snmp_mibII/mibII_interfaces.c b/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
index 1c08260..d3211d0 100644
--- a/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
+++ b/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.15 2005/05/23 09:03:39 brandt_h Exp $
+ * $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.16 2005/11/02 12:07:40 brandt_h Exp $
*
* Interfaces group.
*/
@@ -280,8 +280,22 @@ op_ifentry(struct snmp_context *ctx, struct snmp_value *value,
break;
case LEAF_ifOperStatus:
- value->v.integer =
- (ifp->mib.ifmd_flags & IFF_RUNNING) ? 1 : 2;
+ /*
+ * According to RFC 2863 the state should be Up if the
+ * interface is ready to transmit packets. We takes this to
+ * mean that the interface should be running and should have
+ * a carrier. If it is running and has no carrier we interpret
+ * this as 'waiting for an external event' (plugging in the
+ * cable) and hence return 'dormant'.
+ */
+ if (ifp->mib.ifmd_flags & IFF_RUNNING) {
+ if (ifp->mib.ifmd_data.ifi_link_state ==
+ LINK_STATE_DOWN)
+ value->v.integer = 5; /* state dormant */
+ else
+ value->v.integer = 1; /* state up */
+ } else
+ value->v.integer = 2; /* state down */
break;
case LEAF_ifLastChange:
OpenPOWER on IntegriCloud