From 10f9bf3f2021f874e574e4ebae9413bee982ed2b Mon Sep 17 00:00:00 2001 From: "Jorge Boncompte [DTI2]" Date: Mon, 7 May 2012 16:52:52 +0000 Subject: bgpd: optimize bgp_nexthop_self() This function scores 2nd, profiling a full internet table load. It's called for every prefix received. Instead of looping in the interface lists comparing addresses use a hash to mantain them. * bgpd.c: Init the own address hash. * bgp_nexthop.c: Introduce methods to maintain an own address hash. (bgp_connected_add) add addresses to the hash. (bgp_connected_delete) delete addresses from the hash. (bgp_nexthop_self) lookup addresses in the hash. Removed the unused afi_t parameter. * bgp_route.c: (bgp_update_main) Micro-optimization, rearranged condition to not lookup the hash for bogus nexthops (0.0.0.0 or a class D/E address) Signed-off-by: Jorge Boncompte [DTI2] Signed-off-by: David Lamparter --- lib/memtypes.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/memtypes.c') diff --git a/lib/memtypes.c b/lib/memtypes.c index acbd16b9..1723490f 100644 --- a/lib/memtypes.c +++ b/lib/memtypes.c @@ -150,6 +150,7 @@ struct memory_list memory_list_bgp[] = { MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" }, { MTYPE_BGP_REGEXP, "BGP regexp" }, { MTYPE_BGP_AGGREGATE, "BGP aggregate" }, + { MTYPE_BGP_ADDR, "BGP own address" }, { -1, NULL } }; -- cgit v1.2.1