From e14d0da88d4f3fcd0c19c231b59d31189c4d71ad Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 15 Jul 2016 15:49:23 +0200 Subject: irmd: Fix accessing reg_api struct after destroy The destroy now only frees after all threads stopped using the object. Also fixes a SEGV when trying to allocate a flow to a remote name. --- src/irmd/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/irmd/main.c') diff --git a/src/irmd/main.c b/src/irmd/main.c index 1da4b310..625c28c8 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -247,6 +247,36 @@ static pid_t get_ipcp_by_dst_name(char * dst_name) struct list_head * pos = NULL; char * dif_name = registry_get_dif_for_dst(&instance->registry, dst_name); + if (dif_name == NULL) { + list_for_each(pos, &instance->ipcps) { + struct ipcp_entry * e = + list_entry(pos, struct ipcp_entry, next); + if (e->type == IPCP_NORMAL) { + dif_name = e->dif_name; + break; + } + } + + list_for_each(pos, &instance->ipcps) { + struct ipcp_entry * e = + list_entry(pos, struct ipcp_entry, next); + if (e->type == IPCP_SHIM_ETH_LLC) { + dif_name = e->dif_name; + break; + } + } + + + list_for_each(pos, &instance->ipcps) { + struct ipcp_entry * e = + list_entry(pos, struct ipcp_entry, next); + if (e->type == IPCP_SHIM_UDP) { + dif_name = e->dif_name; + break; + } + } + } + if (dif_name == NULL) return -1; -- cgit v1.2.3