diff options
author | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2007-03-14 23:05:18 +0100 |
---|---|---|
committer | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2007-03-14 23:05:18 +0100 |
commit | ad81f8cc2e77275cdeef1267d1ff4173eb89e093 (patch) | |
tree | 05b192314db804a18e2c8ca329b4f7bf3475033d /ospfd/ospf_snmp.c | |
parent | [ospfd] Fix two debug messages that used inet_ntoa more than once (diff) | |
download | frr-ad81f8cc2e77275cdeef1267d1ff4173eb89e093.tar.xz frr-ad81f8cc2e77275cdeef1267d1ff4173eb89e093.zip |
[ospfd] Return SNMP standard neighbor state values, not quagga internal ones
2007-03-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_snmp.c: (ospf_snmp_neighbor_state) New function to
map internal quagga neighbor states to SNMP standard values.
(ospfNbrEntry) Call new ospf_snmp_neighbor_state function.
Diffstat (limited to 'ospfd/ospf_snmp.c')
-rw-r--r-- | ospfd/ospf_snmp.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index bc594b3a9..6e972605f 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -2216,6 +2216,44 @@ ospfNbrLookup (struct variable *v, oid *name, size_t *length, return NULL; } +/* map internal quagga neighbor states to official MIB values: + +ospfNbrState OBJECT-TYPE + SYNTAX INTEGER { + down (1), + attempt (2), + init (3), + twoWay (4), + exchangeStart (5), + exchange (6), + loading (7), + full (8) + } +*/ +static int32_t +ospf_snmp_neighbor_state(u_char nst) +{ + switch (nst) + { + case NSM_Attempt: + return 2; + case NSM_Init: + return 3; + case NSM_TwoWay: + return 4; + case NSM_ExStart: + return 5; + case NSM_Exchange: + return 6; + case NSM_Loading: + return 7; + case NSM_Full: + return 8; + default: + return 1; /* down */ + } +} + static u_char * ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) @@ -2254,7 +2292,7 @@ ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact, return SNMP_INTEGER (nbr->priority); break; case OSPFNBRSTATE: - return SNMP_INTEGER (nbr->state); + return SNMP_INTEGER (ospf_snmp_neighbor_state(nbr->state)); break; case OSPFNBREVENTS: return SNMP_INTEGER (nbr->state_change); |