diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-10-02 22:06:04 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-10-10 09:05:02 -0300 | 
| commit | ff880b78ef2d480b381d29487812279d57c0bbac (patch) | |
| tree | 6c3996876d32ec10973145aba99aecf514a017ba /nhrpd | |
| parent | 8928a08f657948c5d04807de399b89051ae54d88 (diff) | |
*: 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 <renato@opensourcerouting.org>
Diffstat (limited to 'nhrpd')
| -rw-r--r-- | nhrpd/nhrp_interface.c | 2 | 
1 files changed, 1 insertions, 1 deletions
diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index a46962c91a..67e3f41b3d 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -299,7 +299,7 @@ int nhrp_interface_delete(int cmd, struct zclient *client,  		return 0;  	debugf(NHRP_DEBUG_IF, "if-delete: %s", ifp->name); -	ifp->ifindex = IFINDEX_INTERNAL; +	if_set_index(ifp, ifp->ifindex);  	nhrp_interface_update(ifp);  	/* if_delete(ifp); */  	return 0;  | 
