aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/route.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-03-12 14:51:56 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-03-19 08:32:43 +0000
commit1c15bf737788e31e46efd930d6a2a76253cde29a (patch)
tree78ee447accebe88dc2a31dcdead88016cb006434 /hicn-plugin/src/route.c
parente6a120973cca65ca464d1323a6f7f4308dcb4717 (diff)
[HICN-548] Added node to perform a lookup in the fib with the src address to punt data packets
Change-Id: Ia1d3a5d5b1df8bf17b289954289d449715803cfa Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/route.c')
-rw-r--r--hicn-plugin/src/route.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index 67dedaa88..c208dd4c1 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -138,6 +138,17 @@ hicn_route_add_nhops (hicn_face_id_t * face_id, u32 len,
{
u32 vft_id = hicn_dpo_get_vft_id (hicn_dpo_id);
dpo_vft = hicn_dpo_get_vft (vft_id);
+
+ hicn_face_t *face =
+ hicn_dpoi_get_from_idx (faces_dpo_tmp[i].dpoi_index);
+ //Disable feature on the interface
+ if (prefix->fp_proto == FIB_PROTOCOL_IP4)
+ vnet_feature_enable_disable ("ip4-local", "hicn-data-input-ip4",
+ face->shared.sw_if, 1, 0, 0);
+ else if (prefix->fp_proto == FIB_PROTOCOL_IP6)
+ vnet_feature_enable_disable ("ip6-local", "hicn-data-input-ip6",
+ face->shared.sw_if, 1, 0, 0);
+
ret = dpo_vft->hicn_dpo_add_update_nh (&faces_dpo_tmp[i],
hicn_dpo_id->dpoi_index);
}
@@ -195,6 +206,15 @@ hicn_route_add (hicn_face_id_t * face_id, u32 len,
for (int i = 0; i < n_face_dpo; i++)
{
clib_memcpy (&nhops[i], &face_dpo_tmp[i], sizeof (dpo_id_t));
+ hicn_face_t *face =
+ hicn_dpoi_get_from_idx (face_dpo_tmp[i].dpoi_index);
+ //Disable feature on the interface
+ if (prefix->fp_proto == FIB_PROTOCOL_IP4)
+ vnet_feature_enable_disable ("ip4-local", "hicn-data-input-ip4",
+ face->shared.sw_if, 1, 0, 0);
+ else if (prefix->fp_proto == FIB_PROTOCOL_IP6)
+ vnet_feature_enable_disable ("ip6-local", "hicn-data-input-ip6",
+ face->shared.sw_if, 1, 0, 0);
}
default_dpo.hicn_dpo_create (prefix->fp_proto, nhops, n_face_dpo,
@@ -220,7 +240,8 @@ hicn_route_add (hicn_face_id_t * face_id, u32 len,
fib_table_entry_special_dpo_add (fib_index,
prefix,
hicn_fib_src,
- FIB_ENTRY_FLAG_EXCLUSIVE,
+ (FIB_ENTRY_FLAG_EXCLUSIVE |
+ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT),
&dpo);
/* We added a route, therefore add one lock to the table */
@@ -286,11 +307,22 @@ hicn_route_del_nhop (fib_prefix_t * prefix, hicn_face_id_t face_id)
{
vft_id = hicn_dpo_get_vft_id (hicn_dpo_id);
dpo_vft = hicn_dpo_get_vft (vft_id);
+
+ hicn_face_t *face = hicn_dpoi_get_from_idx (face_id);
+ //Disable feature on the interface
+ if (prefix->fp_proto == FIB_PROTOCOL_IP4)
+ vnet_feature_enable_disable ("ip4-local", "hicn-data-input-ip4",
+ face->shared.sw_if, 0, 0, 0);
+ else if (prefix->fp_proto == FIB_PROTOCOL_IP6)
+ vnet_feature_enable_disable ("ip6-local", "hicn-data-input-ip6",
+ face->shared.sw_if, 0, 0, 0);
+
ret = dpo_vft->hicn_dpo_del_nh (face_id, hicn_dpo_id->dpoi_index);
hicn_dpo_ctx_t *dpo_ctx =
hicn_strategy_dpo_ctx_get (hicn_dpo_id->dpoi_index);
+
if (ret == HICN_ERROR_NONE && !dpo_ctx->entry_count)
ret = hicn_route_del (prefix);
}