From ff880b78ef2d480b381d29487812279d57c0bbac Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 2 Oct 2017 22:06:04 -0300 Subject: *: introduce new rb-tree to optimize interface lookup by ifindex Performance tests showed that, when running on a system with a large number of interfaces, some daemons would spend a considerable amount of time in the if_lookup_by_index() function. Introduce a new rb-tree to solve this problem. With this change, we need to use the if_set_index() function whenever we want to change the ifindex of an interface. This is necessary to ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The return value of all insert/remove operations in the interface rb-trees is checked to ensure that an error is logged if a corruption is detected. Signed-off-by: Renato Westphal --- babeld/babel_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'babeld/babel_interface.c') diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 49c848d49..5bc48e8a2 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -138,7 +138,7 @@ babel_interface_delete (int cmd, struct zclient *client, zebra_size_t length, vr /* To support pseudo interface do not free interface structure. */ /* if_delete(ifp); */ - ifp->ifindex = IFINDEX_INTERNAL; + if_set_index(ifp, IFINDEX_INTERNAL); return 0; } -- cgit v1.2.3