summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ChangeLog6
-rw-r--r--ospfd/ospf_snmp.c40
2 files changed, 45 insertions, 1 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 855ea29d..1c6c136e 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,5 +1,11 @@
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.
+
+2007-03-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
* ospf_zebra.c: (ospf_zebra_add, ospf_zebra_delete) Fix bug
where inet_ntoa was used twice in the same debug message,
which doesn't work because there's a single shared buffer
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index bc594b3a..6e972605 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);