From f8fc0f60ac41673f913a69c84cf8a3b41c6e473e Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 10 Jan 2017 18:13:41 +0100 Subject: Account for pool realloc when importing FIB entries during VRF export Change-Id: I8ec6d53fa9c0790f85802663f70a6b3630239f8d Signed-off-by: Neale Ranns --- src/vnet/fib/fib_attached_export.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c index c389ea43..fd597e3e 100644 --- a/src/vnet/fib/fib_attached_export.c +++ b/src/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); -- cgit 1.2.3-korg