[Olsr-dev] [PATCH v2 6/7] gateway: split olsr_delete_gateway_entry

Ferry Huberts (spam-protected)
Thu Oct 18 11:50:42 CEST 2012


From: Ferry Huberts <(spam-protected)>

The olsr_delete_gateway_entry function now is a wrapper around
the olsr_delete_gateway_tree_entry function. The latter function
will be used by the cleanup function later on, to prevent needless
iterations on the gateway tree.

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/gateway.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/gateway.c b/src/gateway.c
index be55ef7..993122a 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -50,6 +50,12 @@ static struct gateway_entry *current_ipv6_gw;
 static struct olsr_iptunnel_entry *v6gw_tunnel;
 
 /*
+ * Forward Declarations
+ */
+
+static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t prefixlen, bool immediate);
+
+/*
  * Helper Functions
  */
 
@@ -390,7 +396,18 @@ void olsr_update_gateway_entry(union olsr_ip_addr *originator, union olsr_ip_add
  * gateway tree immediately, else it is removed on a delayed schedule.
  */
 void olsr_delete_gateway_entry(union olsr_ip_addr *originator, uint8_t prefixlen, bool immediate) {
-  struct gateway_entry *gw = node2gateway(avl_find(&gateway_tree, originator));
+  olsr_delete_gateway_tree_entry(node2gateway(avl_find(&gateway_tree, originator)), prefixlen, immediate);
+}
+
+/**
+ * Delete a gateway entry .
+ *
+ * @param gw a gateway entry from the gateway tree
+ * @param prefixlen
+ * @param immediate when set to true then the gateway is removed from the
+ * gateway tree immediately, else it is removed on a delayed schedule.
+ */
+static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t prefixlen, bool immediate) {
   bool change = false;
 
   if (!gw) {
-- 
1.7.11.7





More information about the Olsr-dev mailing list