From 2c9fd7e07283b8904ef20030c9dadb032e999b12 Mon Sep 17 00:00:00 2001 From: Michael Lambert Date: Sat, 24 Jul 2010 12:44:07 -0400 Subject: bgpd: "Intern" communities in route maps * bgp_community.[ch]: (community_lookup) New helper function to look up a community list in the hash table. * bgp_routemap.c: A new community structure was being allocated for every BGP update which matched a route map which set a community. This behavior led to rapid growth in the memory consumed by bgpd. Adding the communities to the hash table addresses the memory growth, but may introduce a problem in modifying or deleting the 'set community' statement in the route map. --- bgpd/bgp_community.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bgpd/bgp_community.c') diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index ae1d7a15..68383adf 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -292,6 +292,13 @@ community_com2str (struct community *com) return str; } +/* Find an 'intern'ed community structure */ +struct community * +community_lookup (struct community *com) +{ + return (struct community *) hash_lookup (comhash, com); +} + /* Intern communities attribute. */ struct community * community_intern (struct community *com) -- cgit v1.2.1