ospf6d: complete SNMP implementation of ospfv3AreaTable

This commit is contained in:
Vincent Bernat 2012-06-04 10:29:49 +02:00
parent 2c5f148065
commit ea86e4042b
3 changed files with 31 additions and 2 deletions

View file

@ -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;

View file

@ -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:

View file

@ -473,6 +473,8 @@ ospf6_spf_calculation (u_int32_t router_id,
}
pqueue_delete (candidate_list);
oa->spf_calculation++;
}
static void