lib: add cleanup hook to route table

This commit is contained in:
Christian Franke 2017-01-18 23:46:43 +01:00
parent 785025eea0
commit a27428eb71
2 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,8 @@ route_node_set (struct route_table *table, const struct prefix *prefix)
static void static void
route_node_free (struct route_table *table, struct route_node *node) route_node_free (struct route_table *table, struct route_node *node)
{ {
if (table->cleanup)
table->cleanup(table, node);
table->delegate->destroy_node (table->delegate, table, node); table->delegate->destroy_node (table->delegate, table, node);
} }

View File

@ -62,6 +62,7 @@ struct route_table
* Delegate that performs certain functions for this table. * Delegate that performs certain functions for this table.
*/ */
route_table_delegate_t *delegate; route_table_delegate_t *delegate;
void (*cleanup)(struct route_table *, struct route_node *);
unsigned long count; unsigned long count;