From 2fba74798833331fe6312e8a764688a23918c14a Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 7 Apr 2020 18:27:24 +0200 Subject: [HICN-591] Created new command "hicn enable " that enable hicn on a given prefix The changes include: - we use now a different vrf for the hicn routes. The default vrf (fib) contains every route, we sync the route we marked as hicn on the hicn vrf. In the vrf we use a custom dpo to implement the forwarding strategy. Change-Id: I399805eff8a62a5c41bf7b50831986a35bce4f76 Signed-off-by: Alberto Compagno --- hicn-plugin/src/faces/app/face_prod.c | 2 ++ hicn-plugin/src/faces/face.h | 11 ++++++++++- hicn-plugin/src/faces/iface_node.c | 22 ---------------------- 3 files changed, 12 insertions(+), 23 deletions(-) (limited to 'hicn-plugin/src/faces') diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c index 5aed8c11e..c5b9f93dd 100644 --- a/hicn-plugin/src/faces/app/face_prod.c +++ b/hicn-plugin/src/faces/app/face_prod.c @@ -275,6 +275,7 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved, FIB_SOURCE_CLI, FIB_ENTRY_FLAG_NONE, rpaths); + hicn_route_enable(prefix); hicn_app_state_create (sw_if, prefix); } @@ -307,6 +308,7 @@ hicn_face_prod_del (hicn_face_id_t face_id) if (face->flags & HICN_FACE_FLAGS_APPFACE_PROD) { /* Remove the face from the fib */ + hicn_route_disable(&(face_state_vec[face->sw_if].prefix)); //hicn_route_del_nhop (&(face_state_vec[face->sw_if].prefix), // face_id); diff --git a/hicn-plugin/src/faces/face.h b/hicn-plugin/src/faces/face.h index 1c829d2c2..665492a84 100644 --- a/hicn-plugin/src/faces/face.h +++ b/hicn-plugin/src/faces/face.h @@ -339,7 +339,7 @@ extern mhash_t hicn_face_vec_hashtb; * interface. The former is used to retrieve the incoming face when an interest * is received, the latter when the arring packet is a data. */ -typedef struct hicn_face_key_s +typedef struct __attribute__ ((packed)) hicn_face_key_s { ip46_address_t addr; union { @@ -396,6 +396,15 @@ hicn_face_get (const ip46_address_t * addr, u32 sw_if, mhash_t * hashtb) return NULL; } +/** + * @brief Get the dpoi from the nat address. Does not add any lock. + * + * @param addr Ip v4 address used to create the key for the hash table. + * @param sw_if Software interface id used to create the key for the hash table. + * @param hashtb Hash table (remote or local) where to perform the lookup. + * + * @result Pointer to the face. + */ always_inline hicn_face_t * hicn_face_get_with_dpo (const ip46_address_t * addr, u32 sw_if, const dpo_id_t * dpo, mhash_t * hashtb) { diff --git a/hicn-plugin/src/faces/iface_node.c b/hicn-plugin/src/faces/iface_node.c index 5def03417..b952787a4 100644 --- a/hicn-plugin/src/faces/iface_node.c +++ b/hicn-plugin/src/faces/iface_node.c @@ -34,28 +34,6 @@ vlib_node_registration_t hicn6_iface_output_node; u32 data_fwd_iface_ip4_vlib_edge; u32 data_fwd_iface_ip6_vlib_edge; -void -hicn_iface_ip_init (vlib_main_t * vm) -{ - u32 temp_index4 = vlib_node_add_next (vm, - hicn_interest_hitcs_node.index, - hicn4_iface_output_node.index); - u32 temp_index6 = vlib_node_add_next (vm, - hicn_interest_hitcs_node.index, - hicn6_iface_output_node.index); - - data_fwd_iface_ip4_vlib_edge = vlib_node_add_next (vm, - hicn_data_fwd_node.index, - hicn4_iface_output_node.index); - - data_fwd_iface_ip6_vlib_edge = vlib_node_add_next (vm, - hicn_data_fwd_node.index, - hicn6_iface_output_node.index); - - ASSERT (temp_index4 == data_fwd_iface_ip4_vlib_edge); - ASSERT (temp_index6 == data_fwd_iface_ip6_vlib_edge); -} - static char *hicn4_iface_input_error_strings[] = { #define _(sym, string) string, foreach_hicnfwd_error -- cgit 1.2.3-korg