summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hicn-plugin/src/hicn_api.c4
-rw-r--r--hicn-plugin/src/mapme_ack_node.c7
-rw-r--r--hicn-plugin/src/mapme_ctrl_node.c7
-rw-r--r--hicn-plugin/src/mapme_eventmgr.c3
-rw-r--r--hicn-plugin/src/route.c2
-rw-r--r--hicn-plugin/src/strategies/dpo_mw.c142
-rw-r--r--hicn-plugin/src/strategies/dpo_rr.c141
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c3
8 files changed, 144 insertions, 165 deletions
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index df3365999..806de2b4e 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -702,7 +702,7 @@ static void vl_api_hicn_api_route_get_t_handler
{
hicn_dpo_vft = hicn_dpo_get_vft(hicn_dpo_id->dpoi_type);
hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx(hicn_dpo_id->dpoi_index);
- for (int i = 0; i < hicn_dpo_ctx->entry_count; i++)
+ for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++)
{
if (dpo_id_is_valid(&hicn_dpo_ctx->next_hops[i]))
{
@@ -739,7 +739,7 @@ send_route_details (vl_api_registration_t * reg,
{
hicn_dpo_vft = hicn_dpo_get_vft (hicn_dpo_id->dpoi_type);
hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx (hicn_dpo_id->dpoi_index);
- for (int i = 0; i < hicn_dpo_ctx->entry_count; i++)
+ for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++)
{
if (dpo_id_is_valid (&hicn_dpo_ctx->next_hops[i]))
{
diff --git a/hicn-plugin/src/mapme_ack_node.c b/hicn-plugin/src/mapme_ack_node.c
index c2fb2b6ef..4f377447d 100644
--- a/hicn-plugin/src/mapme_ack_node.c
+++ b/hicn-plugin/src/mapme_ack_node.c
@@ -82,6 +82,13 @@ hicn_mapme_process_ack (vlib_main_t * vm, vlib_buffer_t * b,
const hicn_dpo_vft_t *dpo_vft = hicn_dpo_get_vft (dpo->dpoi_type);
hicn_mapme_tfib_t *tfib =
TFIB (dpo_vft->hicn_dpo_get_ctx (dpo->dpoi_index));
+
+ if (tfib == NULL)
+ {
+ WARN ("Unable to get strategy ctx.");
+ return false;
+ }
+
fib_seq = tfib->seq;
/*
diff --git a/hicn-plugin/src/mapme_ctrl_node.c b/hicn-plugin/src/mapme_ctrl_node.c
index 57f63dbe1..3985f3073 100644
--- a/hicn-plugin/src/mapme_ctrl_node.c
+++ b/hicn-plugin/src/mapme_ctrl_node.c
@@ -132,6 +132,13 @@ hicn_mapme_process_ctrl (vlib_main_t * vm, vlib_buffer_t * b,
const hicn_dpo_vft_t *dpo_vft = hicn_dpo_get_vft (dpo->dpoi_type);
hicn_mapme_tfib_t *tfib =
TFIB (dpo_vft->hicn_dpo_get_ctx (dpo->dpoi_index));
+
+ if (tfib == NULL)
+ {
+ WARN ("Unable to get strategy ctx.");
+ return false;
+ }
+
fib_seq = tfib->seq;
if (params.seq > fib_seq)
diff --git a/hicn-plugin/src/mapme_eventmgr.c b/hicn-plugin/src/mapme_eventmgr.c
index 93168d059..ef73f9550 100644
--- a/hicn-plugin/src/mapme_eventmgr.c
+++ b/hicn-plugin/src/mapme_eventmgr.c
@@ -283,13 +283,14 @@ hicn_mapme_send_updates (vlib_main_t * vm, hicn_prefix_t * prefix,
{
const hicn_dpo_vft_t *dpo_vft = hicn_dpo_get_vft (dpo.dpoi_type);
hicn_mapme_tfib_t *tfib = TFIB (dpo_vft->hicn_dpo_get_ctx (dpo.dpoi_index));
- u8 tfib_last_idx = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count;
if (!tfib)
{
DEBUG ("NULL TFIB entry id=%d", dpo.dpoi_index);
return;
}
+ u8 tfib_last_idx = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count;
+
mapme_params_t params = {
.protocol = ip46_address_is_ip4 (&prefix->name)
? IPPROTO_IP : IPPROTO_IPV6,
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index 321f11940..e5758eed4 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -320,7 +320,7 @@ hicn_route_set_strategy (fib_prefix_t * prefix, u8 strategy_id)
new_dpo_vft = hicn_dpo_get_vft_from_id (strategy_id);
- if (new_dpo_vft == NULL)
+ if (new_dpo_vft == NULL || old_hicn_dpo_ctx == NULL)
return HICN_ERROR_STRATEGY_NOT_FOUND;
/* Create a new dpo for the new strategy */
diff --git a/hicn-plugin/src/strategies/dpo_mw.c b/hicn-plugin/src/strategies/dpo_mw.c
index 41d2f2526..dfdde3681 100644
--- a/hicn-plugin/src/strategies/dpo_mw.c
+++ b/hicn-plugin/src/strategies/dpo_mw.c
@@ -95,10 +95,11 @@ hicn_dpo_strategy_mw_get_type (void)
void
hicn_strategy_mw_ctx_lock (dpo_id_t * dpo)
{
- if (dpo->dpoi_index != 0)
+ hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
+ (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
+
+ if (hicn_strategy_mw_ctx != NULL)
{
- hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
- (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
hicn_strategy_mw_ctx->default_ctx.locks++;
}
}
@@ -106,10 +107,11 @@ hicn_strategy_mw_ctx_lock (dpo_id_t * dpo)
void
hicn_strategy_mw_ctx_unlock (dpo_id_t * dpo)
{
- if (dpo->dpoi_index != 0)
+ hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
+ (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
+
+ if (hicn_strategy_mw_ctx != NULL)
{
- hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
- (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
hicn_strategy_mw_ctx->default_ctx.locks--;
if (0 == hicn_strategy_mw_ctx->default_ctx.locks)
@@ -132,7 +134,7 @@ format_hicn_strategy_mw_ctx (u8 * s, va_list * ap)
dpo = (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (index);
s = format (s, "hicn-mw");
- for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
+ for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX && dpo != NULL; i++)
{
u8 *buf = NULL;
if (i < dpo->default_ctx.entry_count)
@@ -196,9 +198,10 @@ hicn_strategy_mw_ctx_get (index_t index)
if (!pool_is_free_index (hicn_strategy_mw_ctx_pool, index))
{
hicn_strategy_mw_ctx =
- (pool_elt_at_index (hicn_strategy_mw_ctx_pool, index));
+ (pool_elt_at_index (hicn_strategy_mw_ctx_pool, index));
}
- return &hicn_strategy_mw_ctx->default_ctx;
+
+ return (hicn_dpo_ctx_t *)hicn_strategy_mw_ctx;
}
int
@@ -207,46 +210,43 @@ hicn_strategy_mw_ctx_add_nh (const dpo_id_t * nh, index_t dpo_idx)
hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
(hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo_idx);
- if (hicn_strategy_mw_ctx != NULL)
+ if (hicn_strategy_mw_ctx == NULL)
{
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
+ }
- int empty = hicn_strategy_mw_ctx->default_ctx.entry_count;
-
- /* Iterate through the list of faces to add new faces */
- for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
- {
- if (!memcmp
- (nh, &hicn_strategy_mw_ctx->default_ctx.next_hops[i],
- sizeof (dpo_id_t)))
- {
- /* If face is marked as deleted, ignore it */
- hicn_face_t *face =
- hicn_dpoi_get_from_idx (hicn_strategy_mw_ctx->
- default_ctx.next_hops[i].dpoi_index);
- if (face->shared.flags & HICN_FACE_FLAGS_DELETED)
- {
- continue;
- }
- return HICN_ERROR_DPO_CTX_NHOPS_EXISTS;
- }
- }
+ int empty = hicn_strategy_mw_ctx->default_ctx.entry_count;
- /* Get an empty place */
- if (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX)
- {
- return HICN_ERROR_DPO_CTX_NHOPS_NS;
- }
- if (PREDICT_FALSE (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX))
- {
- return HICN_ERROR_DPO_CTX_NHOPS_NS;
- }
- clib_memcpy (&hicn_strategy_mw_ctx->default_ctx.next_hops[empty], nh,
- sizeof (dpo_id_t));
- hicn_strategy_mw_ctx->default_ctx.entry_count++;
+ /* Iterate through the list of faces to add new faces */
+ for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
+ {
+ if (!memcmp
+ (nh, &hicn_strategy_mw_ctx->default_ctx.next_hops[i],
+ sizeof (dpo_id_t)))
+ {
+ /* If face is marked as deleted, ignore it */
+ hicn_face_t *face =
+ hicn_dpoi_get_from_idx (hicn_strategy_mw_ctx->
+ default_ctx.next_hops[i].dpoi_index);
+ if (face->shared.flags & HICN_FACE_FLAGS_DELETED)
+ {
+ continue;
+ }
+ return HICN_ERROR_DPO_CTX_NHOPS_EXISTS;
+ }
+ }
- return HICN_ERROR_NONE;
+ /* Get an empty place */
+ if (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX)
+ {
+ return HICN_ERROR_DPO_CTX_NHOPS_NS;
}
- return HICN_ERROR_DPO_CTX_NOT_FOUND;
+
+ clib_memcpy (&hicn_strategy_mw_ctx->default_ctx.next_hops[empty], nh,
+ sizeof (dpo_id_t));
+ hicn_strategy_mw_ctx->default_ctx.entry_count++;
+
+ return HICN_ERROR_NONE;
}
int
@@ -256,52 +256,32 @@ hicn_strategy_mw_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx,
hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
(hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo_idx);
int ret = HICN_ERROR_DPO_CTX_NOT_FOUND;
- int nh_id = ~0;
dpo_id_t invalid = NEXT_HOP_INVALID;
if (hicn_strategy_mw_ctx != NULL)
- {
- for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
- {
- if (hicn_strategy_mw_ctx->default_ctx.next_hops[i].dpoi_index ==
- face_id)
- {
- nh_id = i;
- hicn_face_unlock (&hicn_strategy_mw_ctx->default_ctx.
- next_hops[i]);
- hicn_strategy_mw_ctx->default_ctx.next_hops[i] = invalid;
- hicn_strategy_mw_ctx->default_ctx.entry_count--;
- ret = HICN_ERROR_NONE;
- }
- }
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
- if (0 == hicn_strategy_mw_ctx->default_ctx.entry_count)
- {
- fib_table_entry_special_remove (HICN_FIB_TABLE, fib_pfx,
- FIB_SOURCE_PLUGIN_HI);
- }
- }
- else
+ for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
{
- ret = HICN_ERROR_DPO_CTX_NOT_FOUND;
+ if (hicn_strategy_mw_ctx->default_ctx.next_hops[i].dpoi_index ==
+ face_id)
+ {
+ hicn_face_unlock (&hicn_strategy_mw_ctx->default_ctx.
+ next_hops[i]);
+ hicn_strategy_mw_ctx->default_ctx.entry_count--;
+ hicn_strategy_mw_ctx->default_ctx.next_hops[i] = hicn_strategy_mw_ctx->default_ctx.next_hops[hicn_strategy_mw_ctx->default_ctx.entry_count];
+ hicn_strategy_mw_ctx->default_ctx.next_hops[hicn_strategy_mw_ctx->default_ctx.entry_count] = invalid;
+ ret = HICN_ERROR_NONE;
+ break;
+ }
}
- /*
- * Remove any possible hole in the arrays of dpos
- */
- if (hicn_strategy_mw_ctx->default_ctx.entry_count > 0 && nh_id != ~0
- && nh_id < hicn_strategy_mw_ctx->default_ctx.entry_count - 1)
+ if (0 == hicn_strategy_mw_ctx->default_ctx.entry_count)
{
- int i;
- for (i = nh_id; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
- {
- clib_memcpy (&hicn_strategy_mw_ctx->default_ctx.next_hops[i],
- &hicn_strategy_mw_ctx->default_ctx.next_hops[i + 1],
- sizeof (dpo_id_t));
- }
- /* Set as invalid the last dpo */
- hicn_strategy_mw_ctx->default_ctx.next_hops[i] = invalid;
+ fib_table_entry_special_remove (HICN_FIB_TABLE, fib_pfx,
+ FIB_SOURCE_PLUGIN_HI);
}
+
return ret;
}
diff --git a/hicn-plugin/src/strategies/dpo_rr.c b/hicn-plugin/src/strategies/dpo_rr.c
index 447a25c52..4cddd513c 100644
--- a/hicn-plugin/src/strategies/dpo_rr.c
+++ b/hicn-plugin/src/strategies/dpo_rr.c
@@ -95,10 +95,11 @@ hicn_dpo_strategy_rr_get_type (void)
void
hicn_strategy_rr_ctx_lock (dpo_id_t * dpo)
{
- if (dpo->dpoi_index != 0)
+ hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
+ (hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo->dpoi_index);
+
+ if (hicn_strategy_rr_ctx != NULL)
{
- hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
- (hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo->dpoi_index);
hicn_strategy_rr_ctx->default_ctx.locks++;
}
}
@@ -106,10 +107,10 @@ hicn_strategy_rr_ctx_lock (dpo_id_t * dpo)
void
hicn_strategy_rr_ctx_unlock (dpo_id_t * dpo)
{
- if (dpo->dpoi_index != 0)
+ hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
+ (hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo->dpoi_index);
+ if (hicn_strategy_rr_ctx != NULL)
{
- hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
- (hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo->dpoi_index);
hicn_strategy_rr_ctx->default_ctx.locks--;
if (0 == hicn_strategy_rr_ctx->default_ctx.locks)
@@ -135,7 +136,7 @@ format_hicn_strategy_rr_ctx (u8 * s, va_list * ap)
format (s, "hicn-rr, next hop Face %d",
dpo->default_ctx.next_hops[dpo->current_nhop].dpoi_index);
- for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
+ for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX && dpo != NULL; i++)
{
u8 *buf = NULL;
if (i < dpo->default_ctx.entry_count)
@@ -201,7 +202,7 @@ hicn_strategy_rr_ctx_get (index_t index)
hicn_strategy_rr_ctx =
(pool_elt_at_index (hicn_strategy_rr_ctx_pool, index));
}
- return &hicn_strategy_rr_ctx->default_ctx;
+ return (hicn_dpo_ctx_t *)hicn_strategy_rr_ctx;
}
int
@@ -210,46 +211,43 @@ hicn_strategy_rr_ctx_add_nh (const dpo_id_t * nh, index_t dpo_idx)
hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
(hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo_idx);
- if (hicn_strategy_rr_ctx != NULL)
+ if (hicn_strategy_rr_ctx == NULL)
{
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
+ }
- int empty = hicn_strategy_rr_ctx->default_ctx.entry_count;
-
- /* Iterate through the list of faces to add new faces */
- for (int i = 0; i < hicn_strategy_rr_ctx->default_ctx.entry_count; i++)
- {
- if (!memcmp
- (nh, &hicn_strategy_rr_ctx->default_ctx.next_hops[i],
- sizeof (dpo_id_t)))
- {
- /* If face is marked as deleted, ignore it */
- hicn_face_t *face =
- hicn_dpoi_get_from_idx (hicn_strategy_rr_ctx->default_ctx.
- next_hops[i].dpoi_index);
- if (face->shared.flags & HICN_FACE_FLAGS_DELETED)
- {
- continue;
- }
- return HICN_ERROR_DPO_CTX_NHOPS_EXISTS;
- }
- }
+ int empty = hicn_strategy_rr_ctx->default_ctx.entry_count;
- /* Get an empty place */
- if (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX)
- {
- return HICN_ERROR_DPO_CTX_NHOPS_NS;
- }
- if (PREDICT_FALSE (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX))
- {
- return HICN_ERROR_DPO_CTX_NHOPS_NS;
- }
- clib_memcpy (&hicn_strategy_rr_ctx->default_ctx.next_hops[empty], nh,
- sizeof (dpo_id_t));
- hicn_strategy_rr_ctx->default_ctx.entry_count++;
+ /* Iterate through the list of faces to add new faces */
+ for (int i = 0; i < hicn_strategy_rr_ctx->default_ctx.entry_count; i++)
+ {
+ if (!memcmp
+ (nh, &hicn_strategy_rr_ctx->default_ctx.next_hops[i],
+ sizeof (dpo_id_t)))
+ {
+ /* If face is marked as deleted, ignore it */
+ hicn_face_t *face =
+ hicn_dpoi_get_from_idx (hicn_strategy_rr_ctx->default_ctx.
+ next_hops[i].dpoi_index);
+ if (face->shared.flags & HICN_FACE_FLAGS_DELETED)
+ {
+ continue;
+ }
+ return HICN_ERROR_DPO_CTX_NHOPS_EXISTS;
+ }
+ }
- return HICN_ERROR_NONE;
+ /* Get an empty place */
+ if (empty > HICN_PARAM_FIB_ENTRY_NHOPS_MAX)
+ {
+ return HICN_ERROR_DPO_CTX_NHOPS_NS;
}
- return HICN_ERROR_DPO_CTX_NOT_FOUND;
+
+ clib_memcpy (&hicn_strategy_rr_ctx->default_ctx.next_hops[empty], nh,
+ sizeof (dpo_id_t));
+ hicn_strategy_rr_ctx->default_ctx.entry_count++;
+
+ return HICN_ERROR_NONE;
}
int
@@ -258,52 +256,35 @@ hicn_strategy_rr_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx,
{
hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
(hicn_strategy_rr_ctx_t *) hicn_strategy_rr_ctx_get (dpo_idx);
- int ret = HICN_ERROR_NONE;
- int nh_id = ~0;
+ int ret = HICN_ERROR_DPO_CTX_NOT_FOUND;
dpo_id_t invalid = NEXT_HOP_INVALID;
- if (hicn_strategy_rr_ctx != NULL)
+ if (hicn_strategy_rr_ctx == NULL)
{
- for (int i = 0; i < hicn_strategy_rr_ctx->default_ctx.entry_count; i++)
- {
- if (hicn_strategy_rr_ctx->default_ctx.next_hops[i].dpoi_index ==
- face_id)
- {
- nh_id = i;
- hicn_face_unlock (&hicn_strategy_rr_ctx->
- default_ctx.next_hops[i]);
- hicn_strategy_rr_ctx->default_ctx.next_hops[i] = invalid;
- hicn_strategy_rr_ctx->default_ctx.entry_count--;
- }
- }
-
- if (0 == hicn_strategy_rr_ctx->default_ctx.entry_count)
- {
- fib_table_entry_special_remove (HICN_FIB_TABLE, fib_pfx,
- FIB_SOURCE_PLUGIN_HI);
- }
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
}
- else
+
+ for (int i = 0; i < hicn_strategy_rr_ctx->default_ctx.entry_count; i++)
{
- ret = HICN_ERROR_DPO_CTX_NOT_FOUND;
+ if (hicn_strategy_rr_ctx->default_ctx.next_hops[i].dpoi_index ==
+ face_id)
+ {
+ hicn_face_unlock (&hicn_strategy_rr_ctx->
+ default_ctx.next_hops[i]);
+ hicn_strategy_rr_ctx->default_ctx.entry_count--;
+ hicn_strategy_rr_ctx->default_ctx.next_hops[i] = hicn_strategy_rr_ctx->default_ctx.next_hops[hicn_strategy_rr_ctx->default_ctx.entry_count];
+ hicn_strategy_rr_ctx->default_ctx.next_hops[hicn_strategy_rr_ctx->default_ctx.entry_count] = invalid;
+ ret = HICN_ERROR_NONE;
+ break;
+ }
}
- /*
- * Remove any possible hole in the arrays of dpos
- */
- if (hicn_strategy_rr_ctx->default_ctx.entry_count > 0 && nh_id != ~0
- && nh_id < hicn_strategy_rr_ctx->default_ctx.entry_count - 1)
+ if (0 == hicn_strategy_rr_ctx->default_ctx.entry_count)
{
- int i;
- for (i = nh_id; i < hicn_strategy_rr_ctx->default_ctx.entry_count; i++)
- {
- clib_memcpy (&hicn_strategy_rr_ctx->default_ctx.next_hops[i],
- &hicn_strategy_rr_ctx->default_ctx.next_hops[i + 1],
- sizeof (dpo_id_t));
- }
- /* Set as invalid the last dpo */
- hicn_strategy_rr_ctx->default_ctx.next_hops[i] = invalid;
+ fib_table_entry_special_remove (HICN_FIB_TABLE, fib_pfx,
+ FIB_SOURCE_PLUGIN_HI);
}
+
return ret;
}
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index d5ff87303..40e062bd8 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -73,6 +73,9 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
(hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo_idx);
+ if(hicn_strategy_mw_ctx == NULL)
+ return HICN_ERROR_STRATEGY_NOT_FOUND;
+
u8 next_hop_index = 0;
for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
{