summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_snmp.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-10-03 03:06:01 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-10-10 14:05:02 +0200
commitf4e14fdba7de19ca660278a0b8c750140db5868b (patch)
tree58eb2d22e84b24672ddff1dd786f18e5bc555b15 /ospf6d/ospf6_snmp.c
parentlib: register 'if_var_handlers' only once (diff)
downloadfrr-f4e14fdba7de19ca660278a0b8c750140db5868b.tar.xz
frr-f4e14fdba7de19ca660278a0b8c750140db5868b.zip
*: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with a large number of interfaces (e.g. thousands of tunnels). Red-black trees scale much better than sorted linked-lists and also store the elements in an ordered way (contrary to hash tables). This is a big patch but the interesting bits are all in lib/if.[ch]. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_snmp.c')
-rw-r--r--ospf6d/ospf6_snmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 0b399bad1..fb3b146e3 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -837,6 +837,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len,
WriteMethod **write_method)
{
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct ospf6_lsa *lsa = NULL;
ifindex_t ifindex;
uint32_t area_id, id, instid, adv_router;
@@ -955,8 +956,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
if (!ifslist)
return NULL;
ifslist->cmp = (int (*)(void *, void *))if_icmp_func;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node,
- iif))
+ RB_FOREACH (iif, if_name_head, &vrf->ifaces_by_name)
listnode_add_sort(ifslist, iif);
for (ALL_LIST_ELEMENTS_RO(ifslist, node, iif)) {
@@ -1092,7 +1092,7 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
if (!ifslist)
return NULL;
ifslist->cmp = (int (*)(void *, void *))if_icmp_func;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, iif))
+ RB_FOREACH (iif, if_name_head, &vrf->ifaces_by_name)
listnode_add_sort(ifslist, iif);
for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) {
@@ -1253,7 +1253,7 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
if (!ifslist)
return NULL;
ifslist->cmp = (int (*)(void *, void *))if_icmp_func;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, iif))
+ RB_FOREACH (iif, if_name_head, &vrf->ifaces_by_name)
listnode_add_sort(ifslist, iif);
for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) {