summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-01-10 18:13:41 +0100
committerNeale Ranns <neale.ranns@cisco.com>2017-01-10 18:13:41 +0100
commit257d5e25bf3b22b31d8388298717220f2a88224d (patch)
tree5d290223ee7cf572a59573d34558b0cffe559db1
parentbf2fcad04abd30eb04ca00173efc886e2043a11e (diff)
Account for pool realloc when importing FIB entries during VRF export
Change-Id: I8ec6d53fa9c0790f85802663f70a6b3630239f8d Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
-rw-r--r--vnet/vnet/fib/fib_attached_export.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/vnet/vnet/fib/fib_attached_export.c b/vnet/vnet/fib/fib_attached_export.c
index c389ea43feb..fd597e3e12c 100644
--- a/vnet/vnet/fib/fib_attached_export.c
+++ b/vnet/vnet/fib/fib_attached_export.c
@@ -244,6 +244,12 @@ fib_attached_export_import (fib_entry_t *fib_entry,
{
fib_entry_delegate_t *fed;
fib_ae_import_t *import;
+ fib_node_index_t fei;
+
+ /*
+ * save index for later post-realloc retreival
+ */
+ fei = fib_entry_get_index(fib_entry);
pool_get(fib_ae_import_pool, import);
@@ -292,11 +298,13 @@ fib_attached_export_import (fib_entry_t *fib_entry,
/*
* track the entry in the export table so we can update appropriately
- * when it changes
+ * when it changes.
+ * Exporting prefixes will have allocated new fib_entry_t objects, so the pool
+ * may have realloc'd.
*/
- import->faei_export_sibling =
- fib_entry_cover_track(fib_entry_get(import->faei_export_entry),
- fib_entry_get_index(fib_entry));
+ fib_entry = fib_entry_get(fei);
+ import->faei_export_sibling =
+ fib_entry_cover_track(fib_entry_get(import->faei_export_entry), fei);
fed = fib_entry_delegate_find_or_add(fib_entry,
FIB_ENTRY_DELEGATE_ATTACHED_IMPORT);