aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/faces')
-rw-r--r--hicn-plugin/src/faces/app/face_cons.c22
-rw-r--r--hicn-plugin/src/faces/face.c4
-rw-r--r--hicn-plugin/src/faces/ip/face_ip.c466
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c22
4 files changed, 250 insertions, 264 deletions
diff --git a/hicn-plugin/src/faces/app/face_cons.c b/hicn-plugin/src/faces/app/face_cons.c
index f258da787..e51201c21 100644
--- a/hicn-plugin/src/faces/app/face_cons.c
+++ b/hicn-plugin/src/faces/app/face_cons.c
@@ -73,10 +73,7 @@ hicn_face_cons_add (ip4_address_t * nh_addr4, ip6_address_t * nh_addr6,
face = hicn_dpoi_get_from_idx (*faceid2);
face->shared.flags |= HICN_FACE_FLAGS_APPFACE_CONS;
- return vnet_feature_enable_disable ("ip6-unicast",
- "hicn-iface-ip6-input", swif, 1, 0,
- 0) ==
- 0 ? HICN_ERROR_NONE : HICN_ERROR_APPFACE_FEATURE;
+ return HICN_ERROR_NONE;
}
int
@@ -89,13 +86,7 @@ hicn_face_cons_del (hicn_face_id_t face_id)
if (face->shared.flags & HICN_FACE_FLAGS_APPFACE_CONS)
{
- int ret = hicn_face_ip_del (face_id);
-
- return ret ==
- HICN_ERROR_NONE
- ? (vnet_feature_enable_disable
- ("ip6-unicast", "hicn-iface-ip6-input", face->shared.sw_if, 0,
- 0, 0) == 0 ? HICN_ERROR_NONE : HICN_ERROR_APPFACE_FEATURE) : ret;
+ return hicn_face_ip_del (face_id);
}
else
{
@@ -114,15 +105,6 @@ format_hicn_face_cons (u8 * s, va_list * args)
return s;
}
-/* *INDENT-OFF* */
-VNET_FEATURE_INIT(hicn_cons_app, static)=
-{
- .arc_name = "ip6-unicast",
- .node_name = "hicn-iface-ip6-input",
- .runs_before = VNET_FEATURES("ip6-inacl"),
-};
-/* *INDENT-ON* */
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c
index fa9d0d203..f2dcdd151 100644
--- a/hicn-plugin/src/faces/face.c
+++ b/hicn-plugin/src/faces/face.c
@@ -42,7 +42,7 @@ const char *HICN_FACE_CTRX_STRING[] = {
u8 *
face_show (u8 * s, int face_id, u32 indent)
{
- s = format (s, "Faces:\n", indent);
+ s = format (s, "%U Faces:\n", format_white_space, indent);
indent += 4;
int i;
vec_foreach_index (i, face_dpo_vec)
@@ -97,7 +97,7 @@ format_hicn_face_all (u8 * s, int n, ...)
va_start (ap, n);
u32 indent = va_arg (ap, u32);
- s = format (s, "Faces: %d\n", indent);
+ s = format (s, "%U Faces:\n", format_white_space, indent);
hicn_face_t *face;
diff --git a/hicn-plugin/src/faces/ip/face_ip.c b/hicn-plugin/src/faces/ip/face_ip.c
index f4ae5429d..a2fe069ed 100644
--- a/hicn-plugin/src/faces/ip/face_ip.c
+++ b/hicn-plugin/src/faces/ip/face_ip.c
@@ -41,22 +41,12 @@ hicn_face_ip_init (vlib_main_t * vm)
/* Default Strategy has index 0 and it always exists */
strategy_face_ip4_vlib_edge = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft
- (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index
- (),
- hicn_face_ip4_output_node.
- index);
+ hicn_strategy_node.index,
+ hicn_face_ip4_output_node.index);
strategy_face_ip6_vlib_edge = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft
- (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index
- (),
- hicn_face_ip6_output_node.
- index);
+ hicn_strategy_node.index,
+ hicn_face_ip6_output_node.index);
/*
* Create and edge between al the other strategy nodes and the
* ip_encap nodes.
@@ -64,12 +54,10 @@ hicn_face_ip_init (vlib_main_t * vm)
for (int i = 1; i < strategy_nodes_n; i++)
{
u32 temp_index4 = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft_from_id
- (i)->get_strategy_node_index (),
+ hicn_strategy_node.index,
hicn_face_ip4_output_node.index);
u32 temp_index6 = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft_from_id
- (i)->get_strategy_node_index (),
+ hicn_strategy_node.index,
hicn_face_ip6_output_node.index);
ASSERT (temp_index4 == strategy_face_ip4_vlib_edge);
ASSERT (temp_index6 == strategy_face_ip6_vlib_edge);
@@ -104,66 +92,74 @@ hicn_face_ip_del (hicn_face_id_t face_id)
{
hicn_face_ip4_get_key (&(face_ip->local_addr.ip4), face->shared.sw_if,
&key);
- hicn_face_ip_input_faces_t * in_faces_vec = hicn_face_ip4_get_vec(&(face_ip->local_addr.ip4), face->shared.sw_if,
- &hicn_face_ip_local_hashtb);
+ hicn_face_ip_input_faces_t *in_faces_vec =
+ hicn_face_ip4_get_vec (&(face_ip->local_addr.ip4), face->shared.sw_if,
+ &hicn_face_ip_local_hashtb);
if (in_faces_vec != NULL)
- {
- hicn_face_ip_vec_t * vec = pool_elt_at_index (hicn_vec_pool, in_faces_vec->vec_id);
- u32 index_face = vec_search(*vec, face_id);
- vec_del1(*vec, index_face);
-
- if (vec_len(*vec) == 0)
- {
- pool_put_index(hicn_vec_pool, in_faces_vec->vec_id);
- mhash_unset (&hicn_face_ip_local_hashtb, &key, (uword *) & old_key);
- vec_free(*vec);
- }
- else
- {
- /* Check if the face we are deleting is the preferred one. */
- /* If so, repleace with another. */
- if (in_faces_vec->face_id == face_id)
- {
- in_faces_vec->face_id = (*vec)[0];
- }
- }
- hicn_face_ip4_get_key (&(face_ip->remote_addr.ip4), face->shared.sw_if,
- &key);
- mhash_unset (&hicn_face_ip_remote_hashtb, &key, (uword *) & old_key2);
- }
+ {
+ hicn_face_ip_vec_t *vec =
+ pool_elt_at_index (hicn_vec_pool, in_faces_vec->vec_id);
+ u32 index_face = vec_search (*vec, face_id);
+ vec_del1 (*vec, index_face);
+
+ if (vec_len (*vec) == 0)
+ {
+ pool_put_index (hicn_vec_pool, in_faces_vec->vec_id);
+ mhash_unset (&hicn_face_ip_local_hashtb, &key,
+ (uword *) & old_key);
+ vec_free (*vec);
+ }
+ else
+ {
+ /* Check if the face we are deleting is the preferred one. */
+ /* If so, repleace with another. */
+ if (in_faces_vec->face_id == face_id)
+ {
+ in_faces_vec->face_id = (*vec)[0];
+ }
+ }
+ hicn_face_ip4_get_key (&(face_ip->remote_addr.ip4),
+ face->shared.sw_if, &key);
+ mhash_unset (&hicn_face_ip_remote_hashtb, &key,
+ (uword *) & old_key2);
+ }
}
else
{
hicn_face_ip6_get_key (&(face_ip->local_addr.ip6), face->shared.sw_if,
&key);
- hicn_face_ip_input_faces_t * in_faces_vec = hicn_face_ip6_get_vec(&(face_ip->local_addr.ip6), face->shared.sw_if,
- &hicn_face_ip_local_hashtb);
+ hicn_face_ip_input_faces_t *in_faces_vec =
+ hicn_face_ip6_get_vec (&(face_ip->local_addr.ip6), face->shared.sw_if,
+ &hicn_face_ip_local_hashtb);
if (in_faces_vec != NULL)
- {
- hicn_face_ip_vec_t * vec = pool_elt_at_index (hicn_vec_pool, in_faces_vec->vec_id);
- u32 index_face = vec_search(*vec, face_id);
- vec_del1(*vec, index_face);
-
- if (vec_len(*vec) == 0)
- {
- pool_put(hicn_vec_pool, vec);
- mhash_unset (&hicn_face_ip_local_hashtb, &key, (uword *) & old_key);
- vec_free(*vec);
- }
- else
- {
- /* Check if the face we are deleting is the preferred one. */
- /* If so, repleace with another. */
- if (in_faces_vec->face_id == face_id)
- {
- in_faces_vec->face_id = (*vec)[0];
- }
- }
- hicn_face_ip6_get_key (&(face_ip->remote_addr.ip6), face->shared.sw_if,
- &key);
- mhash_unset (&hicn_face_ip_remote_hashtb, &key, (uword *) & old_key);
- }
+ {
+ hicn_face_ip_vec_t *vec =
+ pool_elt_at_index (hicn_vec_pool, in_faces_vec->vec_id);
+ u32 index_face = vec_search (*vec, face_id);
+ vec_del1 (*vec, index_face);
+
+ if (vec_len (*vec) == 0)
+ {
+ pool_put (hicn_vec_pool, vec);
+ mhash_unset (&hicn_face_ip_local_hashtb, &key,
+ (uword *) & old_key);
+ vec_free (*vec);
+ }
+ else
+ {
+ /* Check if the face we are deleting is the preferred one. */
+ /* If so, repleace with another. */
+ if (in_faces_vec->face_id == face_id)
+ {
+ in_faces_vec->face_id = (*vec)[0];
+ }
+ }
+ hicn_face_ip6_get_key (&(face_ip->remote_addr.ip6),
+ face->shared.sw_if, &key);
+ mhash_unset (&hicn_face_ip_remote_hashtb, &key,
+ (uword *) & old_key);
+ }
}
return hicn_face_del (face_id);
}
@@ -171,17 +167,18 @@ hicn_face_ip_del (hicn_face_id_t face_id)
/**
* @brief Helper for handling midchain adjacencies
*/
-void face_midchain_fixup_t (vlib_main_t * vm,
- const struct ip_adjacency_t_ * adj,
- vlib_buffer_t * b0,
- const void *data) {
+void
+face_midchain_fixup_t (vlib_main_t * vm,
+ const struct ip_adjacency_t_ *adj,
+ vlib_buffer_t * b0, const void *data)
+{
vnet_buffer (b0)->sw_if_index[VLIB_TX] = 0;
};
/**
* @brief Build a rewrite string for the face.
*/
-static u8*
+static u8 *
face_build_rewrite_i (void)
{
/*
@@ -192,51 +189,56 @@ face_build_rewrite_i (void)
*/
u8 *rewrite = NULL;
- vec_validate(rewrite, 0);
- vec_reset_length(rewrite);
+ vec_validate (rewrite, 0);
+ vec_reset_length (rewrite);
return (rewrite);
}
always_inline int
hicn_face_ip_find_adj (const ip46_address_t * remote_addr,
- int sw_if, adj_index_t * adj)
+ int sw_if, adj_index_t * adj)
{
fib_prefix_t fib_pfx;
fib_node_index_t fib_entry_index;
fib_prefix_from_ip46_addr (remote_addr, &fib_pfx);
- fib_pfx.fp_len = ip46_address_is_ip4(remote_addr)? 32 : 128;
- vnet_link_t link_type = ip46_address_is_ip4(&fib_pfx.fp_addr)? VNET_LINK_IP4 : VNET_LINK_IP6;
- *adj = adj_nbr_find(fib_pfx.fp_proto, link_type, &fib_pfx.fp_addr, sw_if);
+ fib_pfx.fp_len = ip46_address_is_ip4 (remote_addr) ? 32 : 128;
+ vnet_link_t link_type =
+ ip46_address_is_ip4 (&fib_pfx.fp_addr) ? VNET_LINK_IP4 : VNET_LINK_IP6;
+ *adj = adj_nbr_find (fib_pfx.fp_proto, link_type, &fib_pfx.fp_addr, sw_if);
if (*adj == ADJ_INDEX_INVALID)
{
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
- HICN_FIB_TABLE,
- FIB_SOURCE_PRIORITY_HI);
+ HICN_FIB_TABLE,
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
if (fib_entry_index == (FIB_NODE_INDEX_INVALID))
- return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
+ return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
*adj = fib_entry_get_adj (fib_entry_index);
- ip_adjacency_t * temp = NULL;
+ ip_adjacency_t *temp = NULL;
if (*adj != ~0)
- temp = adj_get(*adj);
+ temp = adj_get (*adj);
if (temp == NULL || temp->lookup_next_index <= IP_LOOKUP_NEXT_MIDCHAIN)
- {
- if(sw_if != ~0)
- *adj = adj_nbr_add_or_lock(fib_pfx.fp_proto, link_type, remote_addr, sw_if);
- else
- return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
- }
+ {
+ if (sw_if != ~0)
+ *adj =
+ adj_nbr_add_or_lock (fib_pfx.fp_proto, link_type, remote_addr,
+ sw_if);
+ else
+ return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
+ }
else
- {
- adj_nbr_midchain_update_rewrite(*adj, &face_midchain_fixup_t, NULL, ADJ_FLAG_NONE, face_build_rewrite_i());
- adj_midchain_delegate_stack(*adj, fib_index, &fib_pfx);
- }
+ {
+ adj_nbr_midchain_update_rewrite (*adj, &face_midchain_fixup_t, NULL,
+ ADJ_FLAG_NONE,
+ face_build_rewrite_i ());
+ adj_midchain_delegate_stack (*adj, fib_index, &fib_pfx);
+ }
}
return HICN_ERROR_NONE;
@@ -249,8 +251,7 @@ hicn_face_ip_find_adj (const ip46_address_t * remote_addr,
int
hicn_face_ip_add (const ip46_address_t * local_addr,
const ip46_address_t * remote_addr,
- int sw_if, hicn_face_id_t * pfaceid,
- u8 is_app_prod)
+ int sw_if, hicn_face_id_t * pfaceid, u8 is_app_prod)
{
dpo_proto_t dpo_proto;
@@ -280,78 +281,83 @@ hicn_face_ip_add (const ip46_address_t * local_addr,
}
if (!(face->shared.flags & HICN_FACE_FLAGS_IFACE))
- return HICN_ERROR_FACE_ALREADY_CREATED;
+ return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_face_ip_key_t key;
hicn_face_ip4_get_key (&(local_addr->ip4), sw_if, &key);
- hicn_face_ip_input_faces_t * in_faces =
+ hicn_face_ip_input_faces_t *in_faces =
hicn_face_ip4_get_vec (&(local_addr->ip4), sw_if,
- &hicn_face_ip_local_hashtb);
+ &hicn_face_ip_local_hashtb);
if (in_faces == NULL)
- {
- adj_index_t adj;
- int ret = hicn_face_ip_find_adj(remote_addr, sw_if, &adj);
- if (ret != HICN_ERROR_NONE)
- return ret;
-
- hicn_face_ip_input_faces_t in_faces_temp;
- hicn_face_ip_vec_t *vec;
- pool_get(hicn_vec_pool, vec);
- *vec = vec_new(hicn_face_ip_vec_t, 0);
- u32 index = vec - hicn_vec_pool;
- in_faces_temp.vec_id = index;
- vec_add1(*vec, *pfaceid);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- clib_memcpy (&ip_face->local_addr, local_addr, sizeof (ip4_address_t));
- clib_memcpy (&ip_face->remote_addr, remote_addr,
- sizeof (ip4_address_t));
- face->shared.sw_if = sw_if;
- face->shared.flags = flags;
- face->shared.adj = adj;
-
- dpo_proto = DPO_PROTO_IP4;
-
- in_faces_temp.face_id = *pfaceid;
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) &in_faces_temp, 0);
- }
+ {
+ adj_index_t adj;
+ int ret = hicn_face_ip_find_adj (remote_addr, sw_if, &adj);
+ if (ret != HICN_ERROR_NONE)
+ return ret;
+
+ hicn_face_ip_input_faces_t in_faces_temp;
+ hicn_face_ip_vec_t *vec;
+ pool_get (hicn_vec_pool, vec);
+ *vec = vec_new (hicn_face_ip_vec_t, 0);
+ u32 index = vec - hicn_vec_pool;
+ in_faces_temp.vec_id = index;
+ vec_add1 (*vec, *pfaceid);
+
+ hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
+ clib_memcpy (&ip_face->local_addr, local_addr,
+ sizeof (ip4_address_t));
+ clib_memcpy (&ip_face->remote_addr, remote_addr,
+ sizeof (ip4_address_t));
+ face->shared.sw_if = sw_if;
+ face->shared.flags = flags;
+ face->shared.adj = adj;
+
+ dpo_proto = DPO_PROTO_IP4;
+
+ in_faces_temp.face_id = *pfaceid;
+
+ mhash_set_mem (&hicn_face_ip_local_hashtb, &key,
+ (uword *) & in_faces_temp, 0);
+ }
else
- {
- hicn_face_ip_vec_t * vec = pool_elt_at_index(hicn_vec_pool, in_faces->vec_id);
-
- /* */
- if (vec_search(*vec, *pfaceid) != ~0)
- return HICN_ERROR_FACE_ALREADY_CREATED;
-
- adj_index_t adj;
- int ret = hicn_face_ip_find_adj(remote_addr, sw_if, &adj);
- if (ret != HICN_ERROR_NONE)
- return ret;
-
- vec_add1(*vec, *pfaceid);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- clib_memcpy (&ip_face->local_addr, local_addr, sizeof (ip4_address_t));
- clib_memcpy (&ip_face->remote_addr, remote_addr,
- sizeof (ip4_address_t));
- face->shared.sw_if = sw_if;
- face->shared.flags = flags;
- face->shared.adj = adj;
-
- dpo_proto = DPO_PROTO_IP4;
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) in_faces, 0);
-
- /* If the face is an application producer face, we set it as the preferred incoming face. */
- /* This is required to handle the CS separation, and the push api in a lightway*/
- if (is_app_prod)
- {
- in_faces->face_id = *pfaceid;
- }
- }
+ {
+ hicn_face_ip_vec_t *vec =
+ pool_elt_at_index (hicn_vec_pool, in_faces->vec_id);
+
+ /* */
+ if (vec_search (*vec, *pfaceid) != ~0)
+ return HICN_ERROR_FACE_ALREADY_CREATED;
+
+ adj_index_t adj;
+ int ret = hicn_face_ip_find_adj (remote_addr, sw_if, &adj);
+ if (ret != HICN_ERROR_NONE)
+ return ret;
+
+ vec_add1 (*vec, *pfaceid);
+
+ hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
+ clib_memcpy (&ip_face->local_addr, local_addr,
+ sizeof (ip4_address_t));
+ clib_memcpy (&ip_face->remote_addr, remote_addr,
+ sizeof (ip4_address_t));
+ face->shared.sw_if = sw_if;
+ face->shared.flags = flags;
+ face->shared.adj = adj;
+
+ dpo_proto = DPO_PROTO_IP4;
+
+ mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) in_faces,
+ 0);
+
+ /* If the face is an application producer face, we set it as the preferred incoming face. */
+ /* This is required to handle the CS separation, and the push api in a lightway */
+ if (is_app_prod)
+ {
+ in_faces->face_id = *pfaceid;
+ }
+ }
}
else
{
@@ -371,83 +377,87 @@ hicn_face_ip_add (const ip46_address_t * local_addr,
}
if (!(face->shared.flags & HICN_FACE_FLAGS_IFACE))
- return HICN_ERROR_FACE_ALREADY_CREATED;
+ return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_face_ip_key_t key;
hicn_face_ip6_get_key (&(local_addr->ip6), sw_if, &key);
- hicn_face_ip_input_faces_t * in_faces =
+ hicn_face_ip_input_faces_t *in_faces =
hicn_face_ip6_get_vec (&(local_addr->ip6), sw_if,
- &hicn_face_ip_local_hashtb);
+ &hicn_face_ip_local_hashtb);
if (in_faces == NULL)
- {
- adj_index_t adj;
- int ret = hicn_face_ip_find_adj(remote_addr, sw_if, &adj);
- if (ret != HICN_ERROR_NONE)
- return ret;
-
- hicn_face_ip_input_faces_t in_faces_temp;
- hicn_face_ip_vec_t *vec;
- pool_get(hicn_vec_pool, vec);
- vec_alloc(*vec, 1);
- u32 index = vec - hicn_vec_pool;
- in_faces_temp.vec_id = index;
- vec_add1(*vec, *pfaceid);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- clib_memcpy (&ip_face->local_addr, local_addr, sizeof (ip6_address_t));
- clib_memcpy (&ip_face->remote_addr, remote_addr,
- sizeof (ip6_address_t));
- face->shared.sw_if = sw_if;
- face->shared.flags = flags;
- face->shared.adj = adj;
-
- dpo_proto = DPO_PROTO_IP6;
-
- in_faces_temp.face_id = *pfaceid;
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) &in_faces_temp, 0);
- }
+ {
+ adj_index_t adj;
+ int ret = hicn_face_ip_find_adj (remote_addr, sw_if, &adj);
+ if (ret != HICN_ERROR_NONE)
+ return ret;
+
+ hicn_face_ip_input_faces_t in_faces_temp;
+ hicn_face_ip_vec_t *vec;
+ pool_get (hicn_vec_pool, vec);
+ vec_alloc (*vec, 1);
+ u32 index = vec - hicn_vec_pool;
+ in_faces_temp.vec_id = index;
+ vec_add1 (*vec, *pfaceid);
+
+ hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
+ clib_memcpy (&ip_face->local_addr, local_addr,
+ sizeof (ip6_address_t));
+ clib_memcpy (&ip_face->remote_addr, remote_addr,
+ sizeof (ip6_address_t));
+ face->shared.sw_if = sw_if;
+ face->shared.flags = flags;
+ face->shared.adj = adj;
+
+ dpo_proto = DPO_PROTO_IP6;
+
+ in_faces_temp.face_id = *pfaceid;
+
+ mhash_set_mem (&hicn_face_ip_local_hashtb, &key,
+ (uword *) & in_faces_temp, 0);
+ }
else
- {
- hicn_face_ip_vec_t *vec = pool_elt_at_index(hicn_vec_pool, in_faces->vec_id);
-
- /* */
- if (vec_search(*vec, *pfaceid) != ~0)
- return HICN_ERROR_FACE_ALREADY_CREATED;
-
- adj_index_t adj;
- int ret = hicn_face_ip_find_adj(remote_addr, sw_if, &adj);
- if (ret != HICN_ERROR_NONE)
- return ret;
-
- vec_add1(*vec, *pfaceid);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- clib_memcpy (&ip_face->local_addr, local_addr, sizeof (ip6_address_t));
- clib_memcpy (&ip_face->remote_addr, remote_addr,
- sizeof (ip6_address_t));
- face->shared.sw_if = sw_if;
- face->shared.flags = flags;
- face->shared.adj = adj;
-
- dpo_proto = DPO_PROTO_IP6;
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) in_faces, 0);
-
- /* If the face is an application producer face, we set it as the preferred incoming face. */
- /* This is required to handle the CS separation, and the push api in a lightway*/
- if (is_app_prod)
- {
- in_faces->face_id = *pfaceid;
- }
- }
+ {
+ hicn_face_ip_vec_t *vec =
+ pool_elt_at_index (hicn_vec_pool, in_faces->vec_id);
+
+ /* */
+ if (vec_search (*vec, *pfaceid) != ~0)
+ return HICN_ERROR_FACE_ALREADY_CREATED;
+
+ adj_index_t adj;
+ int ret = hicn_face_ip_find_adj (remote_addr, sw_if, &adj);
+ if (ret != HICN_ERROR_NONE)
+ return ret;
+
+ vec_add1 (*vec, *pfaceid);
+
+ hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
+ clib_memcpy (&ip_face->local_addr, local_addr,
+ sizeof (ip6_address_t));
+ clib_memcpy (&ip_face->remote_addr, remote_addr,
+ sizeof (ip6_address_t));
+ face->shared.sw_if = sw_if;
+ face->shared.flags = flags;
+ face->shared.adj = adj;
+
+ dpo_proto = DPO_PROTO_IP6;
+
+ mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) in_faces,
+ 0);
+
+ /* If the face is an application producer face, we set it as the preferred incoming face. */
+ /* This is required to handle the CS separation, and the push api in a lightway */
+ if (is_app_prod)
+ {
+ in_faces->face_id = *pfaceid;
+ }
+ }
}
retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.
- index,
+ hicn_mapme_eventmgr_process_node.index,
HICN_MAPME_EVENT_FACE_ADD, 1,
sizeof (retx_t));
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index e2fa3227b..e610cbd14 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -80,16 +80,11 @@ hicn_face_udp_init (vlib_main_t * vm)
/* Default Strategy has index 0 and it always exists */
strategy_face_udp4_vlib_edge = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft
- (default_dpo.hicn_dpo_get_type
- ())->get_strategy_node_index
- (),
- hicn_face_udp4_output_node.index);
+ hicn_strategy_node.index,
+ hicn_face_udp4_output_node.
+ index);
strategy_face_udp6_vlib_edge =
- vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft
- (default_dpo.hicn_dpo_get_type
- ())->get_strategy_node_index (),
+ vlib_node_add_next (vm, hicn_strategy_node.index,
hicn_face_udp6_output_node.index);
/*
@@ -99,12 +94,10 @@ hicn_face_udp_init (vlib_main_t * vm)
for (int i = 1; i < strategy_nodes_n; i++)
{
u32 temp_index4 = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft_from_id
- (i)->get_strategy_node_index (),
+ hicn_strategy_node.index,
hicn_face_udp4_output_node.index);
u32 temp_index6 = vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft_from_id
- (i)->get_strategy_node_index (),
+ hicn_strategy_node.index,
hicn_face_udp6_output_node.index);
ASSERT (temp_index4 == strategy_face_udp4_vlib_edge);
ASSERT (temp_index6 == strategy_face_udp6_vlib_edge);
@@ -269,7 +262,8 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
}
retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.index,
+ hicn_mapme_eventmgr_process_node.
+ index,
HICN_MAPME_EVENT_FACE_ADD, 1,
sizeof (retx_t));
/* *INDENT-OFF* */