[quagga-dev 4612] snmp neighbor states off by 1

Andrew J. Schorr aschorr at telemetry-investments.com
Thu Mar 8 21:41:40 GMT 2007


According to the OSPF MIB:

   ospfNbrState OBJECT-TYPE
        SYNTAX   INTEGER    {
                    down (1),
                    attempt (2),
                    init (3),
                    twoWay (4),
                    exchangeStart (5),
                    exchange (6),
                    loading (7),
                    full (8)

But ospf_nsm.h got patched last year:

        * ospf_nsm.h: Add a NSM_Deleted neighbour state, to act as dummy
          state indicating the neighbour is to be deleted.

As a result, ospf_nsm.h now says:

/* OSPF Neighbor State Machine State. */
#define NSM_DependUpon          0
#define NSM_Deleted             1
#define NSM_Down                2
#define NSM_Attempt             3
#define NSM_Init                4
#define NSM_TwoWay              5
#define NSM_ExStart             6
#define NSM_Exchange            7
#define NSM_Loading             8
#define NSM_Full                9
#define OSPF_NSM_STATE_MAX     10

And ospf_snmp.c:ospfNbrEntry simply returns
the nbr->state field.  So the values being reported
by SNMP are now off by 1.  

Thoughts on the best way to fix?  We could either change
the values in ospf_nsm.h to match the MIB, or we could
translate our values inside ospf_snmp.c.  What seems
best?  I'm guessing translation?


More information about the Quagga-dev mailing list