aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/udp
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-05-28 15:39:02 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-05-28 15:39:02 +0200
commit38a16f3675366a8d6f53115d85a4382dde2e792e (patch)
tree205e55d1681c7a6b0ceefbc9d9f30d754e4db043 /hicn-plugin/src/faces/udp
parentcb549cad953a0578f6908382a90e4eb01b2b26a6 (diff)
[HICN-208] Removing udp face reference from the internal hash table
Change-Id: I15306e87a1e8b4207c116b57cbca9fb5b686cf41 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/faces/udp')
-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);
}