summaryrefslogtreecommitdiff
path: root/ospf6d
diff options
context:
space:
mode:
authorVincent Bernat <bernat@luffy.cx>2012-06-04 10:29:49 +0200
committerVincent Bernat <bernat@luffy.cx>2012-06-25 19:05:17 +0200
commitea86e4042b7459fbf5d96835c509cb743bf013c0 (patch)
tree7cf527b8084fd7ede72503d6aad273eaf73261e6 /ospf6d
parent2c5f148065c074d51ff10808a2b6ac2b3296a828 (diff)
ospf6d: complete SNMP implementation of ospfv3AreaTable
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_area.h1
-rw-r--r--ospf6d/ospf6_snmp.c30
-rw-r--r--ospf6d/ospf6_spf.c2
3 files changed, 31 insertions, 2 deletions
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index c7c5ee35..e8a4fbd8 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
@@ -57,6 +57,7 @@ struct ospf6_area
struct thread *thread_spf_calculation;
struct thread *thread_route_calculation;
+ u_int32_t spf_calculation; /* SPF calculation count */
struct thread *thread_router_lsa;
struct thread *thread_intra_prefix_lsa;
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 9f333a81..293d66a1 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -449,10 +449,14 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
struct ospf6_area *oa, *area = NULL;
+ struct ospf6_lsa *lsa = NULL;
u_int32_t area_id = 0;
+ u_int32_t count;
+ u_int16_t sum;
struct listnode *node;
unsigned int len;
char a[16];
+ struct ospf6_route *ro;
if (ospf6 == NULL)
return NULL;
@@ -498,15 +502,37 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
switch (v->magic)
{
case OSPFv3IMPORTASEXTERN:
- return SNMP_INTEGER (ospf6->external_table->count);
- break;
+ /* No NSSA support */
+ return SNMP_INTEGER (IS_AREA_STUB(area)?2:1);
case OSPFv3AREASPFRUNS:
+ return SNMP_INTEGER (area->spf_calculation);
case OSPFv3AREABDRRTRCOUNT:
case OSPFv3AREAASBDRRTRCOUNT:
+ count = 0;
+ for (ro = ospf6_route_head (ospf6->brouter_table); ro;
+ ro = ospf6_route_next (ro))
+ {
+ if (ntohl (ro->path.area_id) != ntohl (area->area_id)) continue;
+ if (v->magic == OSPFv3AREABDRRTRCOUNT &&
+ CHECK_FLAG (ro->path.router_bits, OSPF6_ROUTER_BIT_B))
+ count++;
+ if (v->magic == OSPFv3AREAASBDRRTRCOUNT &&
+ CHECK_FLAG (ro->path.router_bits, OSPF6_ROUTER_BIT_E))
+ count++;
+ }
+ return SNMP_INTEGER (count);
case OSPFv3AREASCOPELSACOUNT:
+ return SNMP_INTEGER (area->lsdb->count);
case OSPFv3AREASCOPELSACKSUMSUM:
+ for (sum = 0, lsa = ospf6_lsdb_head (area->lsdb);
+ lsa;
+ lsa = ospf6_lsdb_next (lsa))
+ sum += ntohs (lsa->header->checksum);
+ return SNMP_INTEGER (sum);
case OSPFv3AREASUMMARY:
+ return SNMP_INTEGER (2); /* sendAreaSummary */
case OSPFv3AREAROWSTATUS:
+ return SNMP_INTEGER (1); /* Active */
case OSPFv3AREASTUBMETRIC:
case OSPFv3AREANSSATRANSLATORROLE:
case OSPFv3AREANSSATRANSLATORSTATE:
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index a4a5b721..da0ee131 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -473,6 +473,8 @@ ospf6_spf_calculation (u_int32_t router_id,
}
pqueue_delete (candidate_list);
+
+ oa->spf_calculation++;
}
static void