Check interface if it's in dormant status

Hi :)
Is there a way to check if my system has interfaces in DORMANT status?
A query via SNMP on 1.3.6.1.2.1.2.2.1.8 returns the interface is DORMANT

The
Code:
ifconfig  [interface]
returns status active

Linux has the
Code:
ip link show [interface]
command that exposes this information.

Thanks for the help!
 
according to bsnmp source an interface with IFF_RUNNING and no link will be dormant so probably if ifconfig shows it as running and no carrier then its dormant
 

SirDice

Administrator
Staff member
Administrator
Moderator
It's ifOperStatus, so that's administratively up or down. DORMANT isn't correct. It should be 1 for UP, 2 for DOWN and 3 for TESTING.


Code:
% ifconfig em0
em0: flags=8822<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
This one's DOWN.

Code:
% ifconfig em1
em1: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
This one's UP.

Edit: reading that OID information, DORMANT is possible, that's 5.
Code:
dormant(5),
notPresent(6), -- some component is missing
lowerLayerDown(7) -- down due to state of
"The current operational state of the interface. The testing(3) state indicates that no operational packets can be passed. If ifAdminStatus is down(2) then ifOperStatus should be down(2). If ifAdminStatus is changed to up(1) then ifOperStatus should change to up(1) if the interface is ready to transmit and receive network traffic; it should change to dormant(5) if the interface is waiting for external actions (such as a serial line waiting for an incoming connection); it should remain in the down(2) state if and only if there is a fault that prevents it from going to the up(1) state; it should remain in the notPresent(6) state if the interface has missing (typically, hardware) components."

So based on that, I'm thinking DORMANT is when the interface is UP but 'status' is still "no carrier".
 
5 is dormant according to bsnmp source (also its referenced in kernel if_ti driver)
C:
        volatile u_int32_t ifOperStatus;                        /* 17 */
#define IF_OPER_STATUS_UP       1
#define IF_OPER_STATUS_DOWN     2
#define IF_OPER_STATUS_TESTING  3
#define IF_OPER_STATUS_UNKNOWN  4
#define IF_OPER_STATUS_DORMANT  5
 

SirDice

Administrator
Staff member
Administrator
Moderator
5 is dormant according to bsnmp source (also its referenced in kernel if_ti driver)
Yes, the original source I quoted didn't have it. But looking at the real OID information DORMANT is possible. The explanation regarding when an interface is supposed to be DORMANT isn't very clear though.
 
The example of a serial line is interesting and I can kind of make sense with it; a dial line that is configured and enabled for incoming connections I can see it as being "adminstratively UP but since it's not currently in use" DORMANT makes sense from a purely definitional POV. But other types of interface? Not sure. Can an ethernet interface be UP without an address be considered DORMANT?
 

SirDice

Administrator
Staff member
Administrator
Moderator
Sigh, it's been too long since I dabbled with SNMP, I really only use it for network equipment, not for hosts.

ifAdminStatus is the administrative status. In other words the difference between ifconfig <int> up and ifconfig <int> down. That's reflected in the flags output of ifconfig(8).

ifOperStatus is the operational status. That's the 'status' line in ifconfig(8). "no carrier" is DOWN, "active" is UP. Still not entirely sure what DORMANT is supposed to be. Maybe a wireless interface that's not associated yet with an AP is considered dormant?
 
C:
       case LEAF_ifOperStatus:
                /*
                 * 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_UP)
                                value->v.integer = 5;   /* state dormant */
                        else
                                value->v.integer = 1;   /* state up */
                } else
                        value->v.integer = 2;   /* state down */
                break;

/usr/src/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
 

SirDice

Administrator
Staff member
Administrator
Moderator
So, when looking at the ifconfig(8) output, it's when 'flags' says it's RUNNING and 'status' doesn't indicate 'active'. If flags = RUNNING and status = active it's operational status is UP.

A bit of pseudo code:
Code:
if flags = RUNNING {
  if status != active { 
    ifOperStatus = DORMANT
  } else { 
   ifOperStatus = UP
 }
} else {
  ifOperStatus = DOWN
}

Am I correct?
 
So, when looking at the ifconfig(8) output, it's when 'flags' says it's RUNNING and 'status' doesn't indicate 'active'. If flags = RUNNING and status = active it's operational status is UP.

A bit of pseudo code:
Code:
if flags = RUNNING {
  if status != active {
    ifOperStatus = DORMANT
  } else {
   ifOperStatus = UP
 }
} else {
  ifOperStatus = DOWN
}

Am I correct?
looks ok
 
Top