aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-05-28 14:09:37 +0000
committerGerrit Code Review <gerrit@fd.io>2019-05-28 14:09:37 +0000
commite7149a6893bb4df7380ce046cc98044b069b0f2d (patch)
tree8c1a5e8bfa28d39449295a0f0bef831de555e98b /hicn-plugin/src
parentba01a54f212e98a13083867431dbb54160b496c6 (diff)
parent38a16f3675366a8d6f53115d85a4382dde2e792e (diff)
Merge "[HICN-208] Removing udp face reference from the internal hash table"
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index 7858db644..19a9d1e56 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -155,14 +155,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);
@@ -221,14 +221,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);
@@ -299,6 +299,23 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
int
hicn_face_udp_del (u32 faceid)
{
+ hicn_face_t *face = hicn_dpoi_get_from_idx (faceid);
+ hicn_face_udp_t *face_udp = (hicn_face_udp_t *) face->data;
+ 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)
+ {
+ 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,
+ face_udp->hdrs.ip6.udp.dst_port, &key);
+ mhash_unset (&hicn_face_udp_hashtb, &key, (uword *) & old_key);
+ }
return hicn_face_del (faceid);
}