diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-30 12:15:07 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-30 12:15:07 +0200 |
commit | 4ac9e1dc24c0799568d28b48fa1d869e5fd2c563 (patch) | |
tree | dc7dee2b2ea4e2f4720e113d18ba198d2cda20bb /src/ipcpd | |
parent | cd6801dc8746a79cfc116f3e73fc3afc5276a127 (diff) | |
download | ouroboros-4ac9e1dc24c0799568d28b48fa1d869e5fd2c563.tar.gz ouroboros-4ac9e1dc24c0799568d28b48fa1d869e5fd2c563.zip |
ipcpd: normal: Fix cleanup of FRCT instance
The FRCT instance was not properly cleaned when the PFF could not find
the next hop.
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/normal/frct.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c index 4ba88c88..662a47d8 100644 --- a/src/ipcpd/normal/frct.c +++ b/src/ipcpd/normal/frct.c @@ -149,8 +149,15 @@ static struct frct_i * create_frct_i(uint64_t address, return instance; } -static void destroy_frct_i(struct frct_i * instance) +static void destroy_frct_i(cep_id_t id) { + struct frct_i * instance; + + instance = frct.instances[id]; + frct.instances[id] = NULL; + + release_cep_id(instance->cep_id); + free(instance); } @@ -173,7 +180,7 @@ static void fini_instances(void) for (i = 0; i < IRMD_MAX_FLOWS; i++) if (frct.instances[i] != NULL) - destroy_frct_i(frct.instances[i]); + destroy_frct_i(i); pthread_mutex_unlock(&frct.instances_lock); @@ -197,8 +204,8 @@ int frct_init() int frct_fini() { - fini_cep_ids(); fini_instances(); + fini_cep_ids(); return 0; } @@ -291,7 +298,9 @@ cep_id_t frct_i_create(uint64_t address, pci.qos_id = cube; if (fmgr_nm1_write_buf(&pci, buf)) { - free(instance); + pthread_mutex_lock(&frct.instances_lock); + destroy_frct_i(id); + pthread_mutex_unlock(&frct.instances_lock); log_err("Failed to hand PDU to FMGR."); return INVALID_CEP_ID; } @@ -372,11 +381,7 @@ int frct_i_destroy(cep_id_t id, pci.seqno = 0; pci.qos_id = instance->cube; - frct.instances[id] = NULL; - - release_cep_id(instance->cep_id); - - destroy_frct_i(instance); + destroy_frct_i(id); pthread_mutex_unlock(&frct.instances_lock); |