From ecad9e9289162faec7b678be54178d22876b5d90 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 12 Mar 2002 14:20:44 +0000 Subject: [PATCH] Remove silly cache thingy. --- src/subnet.c | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/src/subnet.c b/src/subnet.c index 525c14e9..5e096252 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: subnet.c,v 1.1.2.32 2002/03/11 11:23:04 guus Exp $ + $Id: subnet.c,v 1.1.2.33 2002/03/12 14:20:44 guus Exp $ */ #include "config.h" @@ -42,10 +42,6 @@ #include "system.h" -int cache_mac_valid = 0; -int cache_ipv4_valid = 0; -int cache_ipv6_valid = 0; - /* lists type of subnet */ avl_tree_t *subnet_tree; @@ -154,20 +150,11 @@ cp /* Adding and removing subnets */ -void cache_invalidate(void) -{ - cache_mac_valid = 0; - cache_ipv4_valid = 0; - cache_ipv6_valid = 0; -} - void subnet_add(node_t *n, subnet_t *subnet) { cp subnet->owner = n; - cache_invalidate(); - avl_insert(subnet_tree, subnet); cp avl_insert(n->subnet_tree, subnet); @@ -177,8 +164,6 @@ cp void subnet_del(node_t *n, subnet_t *subnet) { cp - cache_invalidate(); - avl_delete(n->subnet_tree, subnet); cp avl_delete(subnet_tree, subnet); @@ -304,27 +289,20 @@ cp subnet_t *lookup_subnet_mac(mac_t *address) { - static subnet_t subnet, *p; + subnet_t subnet, *p; cp - if(cache_mac_valid && !memcmp(&subnet.net.mac.address, address, sizeof(mac_t))) - return p; - subnet.type = SUBNET_MAC; memcpy(&subnet.net.mac.address, address, sizeof(mac_t)); p = (subnet_t *)avl_search(subnet_tree, &subnet); - cache_mac_valid = 1; cp return p; } subnet_t *lookup_subnet_ipv4(ipv4_t *address) { - static subnet_t subnet, *p; + subnet_t subnet, *p; cp - if(cache_ipv4_valid && !memcmp(&subnet.net.ipv4.address, address, sizeof(ipv4_t))) - return p; - subnet.type = SUBNET_IPV4; memcpy(&subnet.net.ipv4.address, address, sizeof(ipv4_t)); subnet.net.ipv4.masklength = 32; @@ -356,20 +334,14 @@ cp } } } while (p); - - memcpy(&subnet.net.ipv4.address, address, sizeof(ipv4_t)); - cache_ipv4_valid = 1; cp return p; } subnet_t *lookup_subnet_ipv6(ipv6_t *address) { - static subnet_t subnet, *p; + subnet_t subnet, *p; cp - if(cache_ipv6_valid && !memcmp(&subnet.net.ipv6.address, address, sizeof(ipv6_t))) - return p; - subnet.type = SUBNET_IPV6; memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t)); subnet.net.ipv6.masklength = 128; @@ -399,9 +371,6 @@ cp } } } while (p); - - memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t)); - cache_ipv6_valid = 1; cp return p; } -- 2.39.5