aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vnet/fib/fib_entry.c2
-rw-r--r--src/vnet/fib/fib_entry_src.c72
-rw-r--r--src/vnet/fib/fib_entry_src.h8
-rw-r--r--src/vnet/fib/fib_entry_src_interface.c5
-rw-r--r--src/vnet/fib/fib_entry_src_interpose.c2
5 files changed, 34 insertions, 55 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index d8c57fd1032..3bef28e3ad0 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -708,7 +708,7 @@ fib_entry_post_install_actions (fib_entry_t *fib_entry,
{
fib_entry = fib_entry_post_flag_update_actions(fib_entry,
old_flags);
- fib_entry_src_action_installed(fib_entry, source);
+ fib_entry = fib_entry_src_action_installed(fib_entry, source);
return (fib_entry);
}
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));
}
}
diff --git a/src/vnet/fib/fib_entry_src.h b/src/vnet/fib/fib_entry_src.h
index 308005777a0..edeaaf980e8 100644
--- a/src/vnet/fib/fib_entry_src.h
+++ b/src/vnet/fib/fib_entry_src.h
@@ -226,14 +226,16 @@ typedef struct fib_entry_src_vft_t_ {
} \
}
-#define FIB_ENTRY_SRC_VFT_INVOKE(esrc, func, args) \
+#define FIB_ENTRY_SRC_VFT_INVOKE(_fe, esrc, func, args) \
{ \
const fib_entry_src_vft_t *_vft; \
+ fib_node_index_t _fei = fib_entry_get_index(_fe); \
_vft = fib_entry_src_get_vft(esrc); \
if (_vft->func) { \
(esrc)->fes_flags &= ~FIB_ENTRY_SRC_FLAG_STALE; \
_vft->func args; \
} \
+ _fe = fib_entry_get(_fei); \
}
#define FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, func, args) \
@@ -313,8 +315,8 @@ extern fib_entry_src_flag_t fib_entry_src_action_path_remove(fib_entry_t *fib_en
fib_source_t source,
const fib_route_path_t *path);
-extern void fib_entry_src_action_installed(const fib_entry_t *fib_entry,
- fib_source_t source);
+extern fib_entry_t* fib_entry_src_action_installed(fib_entry_t *fib_entry,
+ fib_source_t source);
extern void fib_entry_src_inherit (const fib_entry_t *cover,
fib_entry_t *covered);
diff --git a/src/vnet/fib/fib_entry_src_interface.c b/src/vnet/fib/fib_entry_src_interface.c
index 88154ef90be..e1725773d93 100644
--- a/src/vnet/fib/fib_entry_src_interface.c
+++ b/src/vnet/fib/fib_entry_src_interface.c
@@ -56,8 +56,10 @@ fib_entry_src_interface_path_swap (fib_entry_src_t *src,
fib_path_list_flags_t pl_flags,
const fib_route_path_t *paths)
{
+ fib_node_index_t fib_entry_index;
ip_adjacency_t *adj;
+ fib_entry_index = fib_entry_get_index(entry);
src->fes_pl = fib_path_list_create(pl_flags, paths);
/*
@@ -69,7 +71,8 @@ fib_entry_src_interface_path_swap (fib_entry_src_t *src,
adj_index_t ai;
ai = fib_path_list_get_adj(src->fes_pl,
- fib_entry_get_default_chain_type(entry));
+ fib_entry_get_default_chain_type(
+ fib_entry_get(fib_entry_index)));
if (INDEX_INVALID != ai)
{
adj = adj_get(ai);
diff --git a/src/vnet/fib/fib_entry_src_interpose.c b/src/vnet/fib/fib_entry_src_interpose.c
index 02db3911dfc..af650a92597 100644
--- a/src/vnet/fib/fib_entry_src_interpose.c
+++ b/src/vnet/fib/fib_entry_src_interpose.c
@@ -207,7 +207,7 @@ fib_entry_src_interpose_deactivate (fib_entry_src_t *src,
* there is another source for this entry. activate it so it
* can provide forwarding
*/
- FIB_ENTRY_SRC_VFT_INVOKE(best_src, fesv_deactivate,
+ FIB_ENTRY_SRC_VFT_INVOKE(fib_entry, best_src, fesv_deactivate,
(best_src, fib_entry));
}
}