summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-02-24 06:16:01 -0800
committerNeale Ranns <nranns@cisco.com>2017-02-24 16:37:23 +0000
commit08a70f177d340a40c2f3653124f0807fe1e69ebd (patch)
tree2f21345ac9b020abf046e40c8f82942b121b04ad /src/vnet/fib/fib_entry.c
parent26cd8c129567b48ed0e3610293251ca78fa67103 (diff)
FIB: 1) fix pool realloc during prefix export. 2) don't walk off the end of the path-extension vector
Change-Id: I8bd8f6917ace089edb1f65bd017b478ee198c03f Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_entry.c')
-rw-r--r--src/vnet/fib/fib_entry.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 8ef4ea898f4..25005e119ca 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -551,11 +551,18 @@ fib_entry_alloc (u32 fib_index,
return (fib_entry);
}
-static void
+static fib_entry_t*
fib_entry_post_flag_update_actions (fib_entry_t *fib_entry,
fib_source_t source,
fib_entry_flag_t old_flags)
{
+ fib_node_index_t fei;
+
+ /*
+ * save the index so we can recover from pool reallocs
+ */
+ fei = fib_entry_get_index(fib_entry);
+
/*
* handle changes to attached export for import entries
*/
@@ -592,6 +599,11 @@ fib_entry_post_flag_update_actions (fib_entry_t *fib_entry,
*/
/*
+ * reload the entry address post possible pool realloc
+ */
+ fib_entry = fib_entry_get(fei);
+
+ /*
* handle changes to attached export for export entries
*/
int is_attached = (FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags_i(fib_entry));
@@ -605,6 +617,8 @@ fib_entry_post_flag_update_actions (fib_entry_t *fib_entry,
// FIXME
}
// else FIXME
+
+ return (fib_entry);
}
static void
@@ -612,7 +626,9 @@ fib_entry_post_install_actions (fib_entry_t *fib_entry,
fib_source_t source,
fib_entry_flag_t old_flags)
{
- fib_entry_post_flag_update_actions(fib_entry, source, old_flags);
+ fib_entry = fib_entry_post_flag_update_actions(fib_entry,
+ source,
+ old_flags);
fib_entry_src_action_installed(fib_entry, source);
}
@@ -909,7 +925,9 @@ fib_entry_path_remove (fib_node_index_t fib_entry_index,
* no more sources left. this entry is toast.
*/
fib_entry_src_action_uninstall(fib_entry);
- fib_entry_post_flag_update_actions(fib_entry, source, bflags);
+ fib_entry = fib_entry_post_flag_update_actions(fib_entry,
+ source,
+ bflags);
return (FIB_ENTRY_SRC_FLAG_NONE);
}
@@ -997,7 +1015,9 @@ fib_entry_special_remove (fib_node_index_t fib_entry_index,
* no more sources left. this entry is toast.
*/
fib_entry_src_action_uninstall(fib_entry);
- fib_entry_post_flag_update_actions(fib_entry, source, bflags);
+ fib_entry = fib_entry_post_flag_update_actions(fib_entry,
+ source,
+ bflags);
return (FIB_ENTRY_SRC_FLAG_NONE);
}