diff options
Diffstat (limited to 'hicn-plugin/src/faces/udp')
-rw-r--r-- | hicn-plugin/src/faces/udp/dpo_udp.h | 12 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp.c | 43 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp.h | 2 |
3 files changed, 31 insertions, 26 deletions
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h index 06c65a9c2..98abf3d29 100644 --- a/hicn-plugin/src/faces/udp/dpo_udp.h +++ b/hicn-plugin/src/faces/udp/dpo_udp.h @@ -92,7 +92,7 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo, index_t dpoi_index = hicn_dpoi_get_index (face); dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index); dpo->dpoi_next_node = strategy_face_udp4_vlib_edge; - dpo_lock (dpo); + dpo_unlock (dpo); *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; @@ -138,7 +138,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo, *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index); dpo->dpoi_next_node = node_index; - dpo_lock (dpo); + dpo_unlock (dpo); return; } @@ -148,7 +148,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo, hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face); dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index); dpo->dpoi_next_node = node_index; - dpo_lock (dpo); + dpo_unlock (dpo); } /** @@ -212,7 +212,7 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo, hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face); dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index); dpo->dpoi_next_node = strategy_face_udp6_vlib_edge; - dpo_lock (dpo); + dpo_unlock (dpo); *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; return HICN_ERROR_NONE; @@ -256,7 +256,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo, *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index); dpo->dpoi_next_node = node_index; - dpo_lock (dpo); + dpo_unlock (dpo); return; } @@ -266,7 +266,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo, hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face); dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index); dpo->dpoi_next_node = node_index; - dpo_lock (dpo); + dpo_unlock (dpo); } /** diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c index ec43d9081..6a8e5c9e0 100644 --- a/hicn-plugin/src/faces/udp/face_udp.c +++ b/hicn-plugin/src/faces/udp/face_udp.c @@ -81,17 +81,15 @@ 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 + (default_dpo.hicn_dpo_get_type + ())->get_strategy_node_index (), - hicn_face_udp4_output_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 (), + hicn_dpo_get_strategy_vft + (default_dpo.hicn_dpo_get_type + ())->get_strategy_node_index (), hicn_face_udp6_output_node.index); /* @@ -145,7 +143,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr, 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; + fib_pfx.fp_len = ip46_address_is_ip4 (remote_addr) ? 32 : 128; u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto, HICN_FIB_TABLE, @@ -155,14 +153,14 @@ hicn_face_udp_add (const ip46_address_t * local_addr, ip_adj = fib_entry_get_adj (fib_entry_index); if (ip_adj == ~0) - return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; + return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; hicn_face_t *face = hicn_face_udp4_get (&local_addr->ip4, &remote_addr->ip4, local_port, remote_port); if (face != NULL) - return HICN_ERROR_FACE_ALREADY_CREATED; + return HICN_ERROR_FACE_ALREADY_CREATED; pool_get (hicn_dpoi_face_pool, face); @@ -211,7 +209,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr, 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; + fib_pfx.fp_len = ip46_address_is_ip4 (remote_addr) ? 32 : 128; u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto, HICN_FIB_TABLE, @@ -221,14 +219,14 @@ hicn_face_udp_add (const ip46_address_t * local_addr, ip_adj = fib_entry_get_adj (fib_entry_index); if (ip_adj == ~0) - return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; + return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; hicn_face_t *face = hicn_face_udp6_get (&local_addr->ip6, &remote_addr->ip6, local_port, remote_port); if (face != NULL) - return HICN_ERROR_FACE_ALREADY_CREATED; + return HICN_ERROR_FACE_ALREADY_CREATED; pool_get (hicn_dpoi_face_pool, face); @@ -275,8 +273,7 @@ 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* */ @@ -293,6 +290,9 @@ hicn_face_udp_add (const ip46_address_t * local_addr, }; /* *INDENT-ON* */ + //Take a lock on the face which will be removed when the face is deleted + hicn_face_lock (&(retx->dpo)); + return ret; } @@ -304,15 +304,20 @@ hicn_face_udp_del (u32 faceid) hicn_face_udp_key_t key; hicn_face_udp_key_t old_key; - if (face_udp->hdrs.ip4.ip.ip_version_and_header_length == IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS) + if (face_udp->hdrs.ip4.ip.ip_version_and_header_length == + IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS) { - hicn_face_udp4_get_key (&face_udp->hdrs.ip4.ip.src_address, &face_udp->hdrs.ip4.ip.dst_address, face_udp->hdrs.ip4.udp.src_port, + hicn_face_udp4_get_key (&face_udp->hdrs.ip4.ip.src_address, + &face_udp->hdrs.ip4.ip.dst_address, + face_udp->hdrs.ip4.udp.src_port, face_udp->hdrs.ip4.udp.dst_port, &key); mhash_unset (&hicn_face_udp_hashtb, &key, (uword *) & old_key); } else { - hicn_face_udp6_get_key (&face_udp->hdrs.ip6.ip.src_address, &face_udp->hdrs.ip6.ip.dst_address, face_udp->hdrs.ip6.udp.src_port, + hicn_face_udp6_get_key (&face_udp->hdrs.ip6.ip.src_address, + &face_udp->hdrs.ip6.ip.dst_address, + face_udp->hdrs.ip6.udp.src_port, face_udp->hdrs.ip6.udp.dst_port, &key); mhash_unset (&hicn_face_udp_hashtb, &key, (uword *) & old_key); } diff --git a/hicn-plugin/src/faces/udp/face_udp.h b/hicn-plugin/src/faces/udp/face_udp.h index cea3e7262..5dfc76e22 100644 --- a/hicn-plugin/src/faces/udp/face_udp.h +++ b/hicn-plugin/src/faces/udp/face_udp.h @@ -294,7 +294,7 @@ hicn_iface_udp4_add (const ip4_address_t * local_addr, face->shared.pl_id = (u16) 0; face->shared.face_type = hicn_face_udp_type; face->shared.flags = HICN_FACE_FLAGS_IFACE; - face->shared.locks = 0; + face->shared.locks = 1; face->shared.sw_if = sw_if; hicn_face_udp_key_t key; |