summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry_src.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-02-13 09:12:36 +0000
committerDamjan Marion <dmarion@me.com>2020-02-13 11:56:02 +0000
commit6ede570259a91cd0c34b9faf9fec7e4ec8275200 (patch)
treefc7d01ec2fb827db81fae936025ec4f389a8cc57 /src/vnet/fib/fib_entry_src.c
parent685001f0abe26bafbc1f27da303019fcbc2cd4b2 (diff)
fib: Fix some more realloc errors
Type: fix Change-Id: I6011f5d6eae79019d3c16a260a9bedf0a76d2151 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_entry_src.c')
-rw-r--r--src/vnet/fib/fib_entry_src.c72
1 files changed, 23 insertions, 49 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index d534135d330..ad8b23e4af1 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -91,7 +91,7 @@ fib_entry_src_action_init (fib_entry_t *fib_entry,
.fes_entry_flags = flags,
};
- FIB_ENTRY_SRC_VFT_INVOKE(&esrc, fesv_init, (&esrc));
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, &esrc, fesv_init, (&esrc));
vec_add1(fib_entry->fe_srcs, esrc);
vec_sort_with_function(fib_entry->fe_srcs,
@@ -213,7 +213,7 @@ fib_entry_src_action_deinit (fib_entry_t *fib_entry,
ASSERT(NULL != esrc);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deinit, (esrc));
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_deinit, (esrc));
fib_path_ext_list_flush(&esrc->fes_path_exts);
vec_del1(fib_entry->fe_srcs, index);
@@ -776,7 +776,7 @@ fib_entry_src_action_copy (fib_entry_t *fib_entry,
orig_src->fes_src,
orig_src->fes_entry_flags);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_copy,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_copy,
(orig_src, fib_entry, esrc));
fib_path_list_unlock(esrc->fes_pl);
@@ -1095,7 +1095,7 @@ fib_entry_src_action_deactivate (fib_entry_t *fib_entry,
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ACTIVE);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deactivate,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_deactivate,
(esrc, fib_entry));
esrc->fes_flags &= ~(FIB_ENTRY_SRC_FLAG_ACTIVE |
@@ -1134,7 +1134,7 @@ fib_entry_src_action_fwd_update (const fib_entry_t *fib_entry,
vec_foreach(esrc, fib_entry->fe_srcs)
{
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_fwd_update,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_fwd_update,
(esrc, fib_entry, source));
}
}
@@ -1223,18 +1223,20 @@ fib_entry_src_action_reactivate (fib_entry_t *fib_entry,
fib_entry_src_action_fwd_update(fib_entry, source);
}
-void
-fib_entry_src_action_installed (const fib_entry_t *fib_entry,
+fib_entry_t *
+fib_entry_src_action_installed (fib_entry_t *fib_entry,
fib_source_t source)
{
fib_entry_src_t *esrc;
esrc = fib_entry_src_find(fib_entry, source);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_installed,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_installed,
(esrc, fib_entry));
fib_entry_src_action_fwd_update(fib_entry, source);
+
+ return (fib_entry);
}
/*
@@ -1251,7 +1253,6 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
fib_entry_flag_t flags,
const dpo_id_t *dpo)
{
- fib_node_index_t fib_entry_index;
fib_entry_src_t *esrc;
esrc = fib_entry_src_find_or_create(fib_entry, source, flags);
@@ -1261,7 +1262,7 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
if (flags != esrc->fes_entry_flags)
{
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_flags_change,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_flags_change,
(esrc, fib_entry, flags));
}
esrc->fes_entry_flags = flags;
@@ -1274,20 +1275,13 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
return (fib_entry);
}
- /*
- * save variable so we can recover from a fib_entry realloc.
- */
- fib_entry_index = fib_entry_get_index(fib_entry);
-
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_add,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_add,
(esrc,
fib_entry,
flags,
fib_entry_get_dpo_proto(fib_entry),
dpo));
- fib_entry = fib_entry_get(fib_entry_index);
-
esrc->fes_flags |= FIB_ENTRY_SRC_FLAG_ADDED;
fib_path_list_lock(esrc->fes_pl);
@@ -1314,7 +1308,7 @@ fib_entry_src_action_update (fib_entry_t *fib_entry,
fib_entry_flag_t flags,
const dpo_id_t *dpo)
{
- fib_node_index_t fib_entry_index, old_path_list_index;
+ fib_node_index_t old_path_list_index;
fib_entry_src_t *esrc;
esrc = fib_entry_src_find_or_create(fib_entry, source, flags);
@@ -1327,20 +1321,13 @@ fib_entry_src_action_update (fib_entry_t *fib_entry,
old_path_list_index = esrc->fes_pl;
esrc->fes_entry_flags = flags;
- /*
- * save variable so we can recover from a fib_entry realloc.
- */
- fib_entry_index = fib_entry_get_index(fib_entry);
-
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_add,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_add,
(esrc,
fib_entry,
flags,
fib_entry_get_dpo_proto(fib_entry),
dpo));
- fib_entry = fib_entry_get(fib_entry_index);
-
esrc->fes_flags |= FIB_ENTRY_SRC_FLAG_ADDED;
fib_path_list_lock(esrc->fes_pl);
@@ -1435,14 +1422,14 @@ fib_entry_src_action_remove (fib_entry_t *fib_entry,
}
else if (esrc->fes_flags & FIB_ENTRY_SRC_FLAG_CONTRIBUTING)
{
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deactivate,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_deactivate,
(esrc, fib_entry));
esrc->fes_flags &= ~FIB_ENTRY_SRC_FLAG_CONTRIBUTING;
}
old_path_list = esrc->fes_pl;
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_remove, (esrc));
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_remove, (esrc));
fib_path_list_unlock(old_path_list);
fib_entry_unlock(fib_entry_get_index(fib_entry));
@@ -1584,15 +1571,10 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
fib_entry_flag_t flags,
const fib_route_path_t *rpaths)
{
- fib_node_index_t old_path_list, fib_entry_index;
+ fib_node_index_t old_path_list;
fib_path_list_flags_t pl_flags;
fib_entry_src_t *esrc;
- /*
- * save variable so we can recover from a fib_entry realloc.
- */
- fib_entry_index = fib_entry_get_index(fib_entry);
-
esrc = fib_entry_src_find(fib_entry, source);
if (NULL == esrc)
{
@@ -1625,9 +1607,8 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
pl_flags = fib_entry_src_flags_2_path_list_flags(fib_entry_get_flags_i(fib_entry));
fib_entry_flags_update(fib_entry, rpaths, &pl_flags, esrc);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_add,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_path_add,
(esrc, fib_entry, pl_flags, rpaths));
- fib_entry = fib_entry_get(fib_entry_index);
fib_path_list_lock(esrc->fes_pl);
fib_path_list_unlock(old_path_list);
@@ -1650,17 +1631,12 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
fib_entry_flag_t flags,
const fib_route_path_t *rpaths)
{
- fib_node_index_t old_path_list, fib_entry_index;
+ fib_node_index_t old_path_list;
fib_path_list_flags_t pl_flags;
fib_entry_src_t *esrc;
esrc = fib_entry_src_find(fib_entry, source);
- /*
- * save variable so we can recover from a fib_entry realloc.
- */
- fib_entry_index = fib_entry_get_index(fib_entry);
-
if (NULL == esrc)
{
const dpo_id_t *dpo;
@@ -1681,7 +1657,7 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
{
if (flags != esrc->fes_entry_flags)
{
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_flags_change,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_flags_change,
(esrc, fib_entry, flags));
}
esrc->fes_entry_flags = flags;
@@ -1700,12 +1676,10 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
fib_entry_flags_update(fib_entry, rpaths, &pl_flags, esrc);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_swap,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_path_swap,
(esrc, fib_entry,
pl_flags, rpaths));
- fib_entry = fib_entry_get(fib_entry_index);
-
fib_path_list_lock(esrc->fes_pl);
fib_path_list_unlock(old_path_list);
@@ -1739,7 +1713,7 @@ fib_entry_src_action_path_remove (fib_entry_t *fib_entry,
pl_flags = fib_entry_src_flags_2_path_list_flags(fib_entry_get_flags_i(fib_entry));
fib_entry_flags_update(fib_entry, rpaths, &pl_flags, esrc);
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_remove,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_path_remove,
(esrc, pl_flags, rpaths));
/*
@@ -1901,7 +1875,7 @@ fib_entry_set_source_data (fib_node_index_t fib_entry_index,
if (NULL != esrc)
{
- FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_set_data,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, esrc, fesv_set_data,
(esrc, fib_entry, data));
}
}