diff options
author | Vincent Bernat <bernat@luffy.cx> | 2012-06-04 10:29:49 +0200 |
---|---|---|
committer | Vincent Bernat <bernat@luffy.cx> | 2012-06-25 19:05:17 +0200 |
commit | ea86e4042b7459fbf5d96835c509cb743bf013c0 (patch) | |
tree | 7cf527b8084fd7ede72503d6aad273eaf73261e6 /ospf6d/ospf6_snmp.c | |
parent | 2c5f148065c074d51ff10808a2b6ac2b3296a828 (diff) |
ospf6d: complete SNMP implementation of ospfv3AreaTable
Diffstat (limited to 'ospf6d/ospf6_snmp.c')
-rw-r--r-- | ospf6d/ospf6_snmp.c | 30 |
1 files changed, 28 insertions, 2 deletions
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: |