summaryrefslogtreecommitdiffstats
path: root/lib/plist_int.h
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-05-01 15:34:03 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-06-05 19:36:53 +0200
commita7b2821884074b0e16a4de4588a8b27b6ae086be (patch)
treef172a3e91ff30f070464afbf7115718305e24ae2 /lib/plist_int.h
parentlib: fix access list mac removal command (diff)
downloadfrr-a7b2821884074b0e16a4de4588a8b27b6ae086be.tar.xz
frr-a7b2821884074b0e16a4de4588a8b27b6ae086be.zip
lib: fix prefix list installation
Based on the function `prefix_list_entry_add` and `prefix_list_entry_delete` it was created two functions to replicate its functionality without the assumption we are always alocating a new prefix list entry. Since the prefix list entry is stored in the YANG private data structures, we want to avoid the allocation/free of memory that is hold by the schema. Every time a prefix list entry values change we must call `prefix_list_entry_update_start` to uninstall the entry from prefix list internal structures and then call `prefix_list_entry_update_finish` to put them back. The variable `installed` in the prefix list entry tracks the installation status of the internal structure. It is possible that a user unconfigures or forgets to add a `prefix` value and so we can't install the entry until then. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/plist_int.h')
-rw-r--r--lib/plist_int.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/plist_int.h b/lib/plist_int.h
index b180d1808..cef78a3ef 100644
--- a/lib/plist_int.h
+++ b/lib/plist_int.h
@@ -72,8 +72,15 @@ struct prefix_list_entry {
/* up the chain for best match search */
struct prefix_list_entry *next_best;
+
+ /* Flag to track trie/list installation status. */
+ bool installed;
};
+extern void prefix_list_entry_free(struct prefix_list_entry *pentry);
+extern void prefix_list_entry_update_start(struct prefix_list_entry *ple);
+extern void prefix_list_entry_update_finish(struct prefix_list_entry *ple);
+
#ifdef __cplusplus
}
#endif