diff options
author | Luca Muscariello <muscariello@ieee.org> | 2020-03-23 06:44:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2020-03-23 06:44:13 +0000 |
commit | ac2f69f34a616c0af6384a617c6f42ad0e658c72 (patch) | |
tree | 05db216e585c24d55738e957d511406841bab37a /hicn-plugin/src/route.c | |
parent | e0db9608e092c5b1381f1bc8df68ef17f9f7ec87 (diff) | |
parent | 1c15bf737788e31e46efd930d6a2a76253cde29a (diff) |
Merge "[HICN-548] Added node to perform a lookup in the fib with the src address to punt data packets"
Diffstat (limited to 'hicn-plugin/src/route.c')
-rw-r--r-- | hicn-plugin/src/route.c | 34 |
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); } |