summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/local/main.c4
-rw-r--r--src/irmd/main.c17
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c9
3 files changed, 24 insertions, 6 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 62f9e0aa..3f5bf908 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -261,14 +261,14 @@ static int ipcp_local_bootstrap(struct dif_config * conf)
return -1;
}
+ pthread_rwlock_wrlock(&_ipcp->state_lock);
+
if (_ipcp->state != IPCP_INIT) {
pthread_rwlock_unlock(&_ipcp->state_lock);
LOG_ERR("IPCP in wrong state.");
return -1;
}
- pthread_rwlock_wrlock(&_ipcp->state_lock);
-
_ipcp->state = IPCP_ENROLLED;
pthread_create(&_ap_instance->sduloop,
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 27f57077..d0ba969f 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1379,6 +1379,8 @@ void * irm_flow_cleaner()
struct timespec now;
struct list_head * pos = NULL;
struct list_head * n = NULL;
+ struct list_head * h = NULL;
+ struct list_head * t = NULL;
struct timespec timeout = {IRMD_CLEANUP_TIMER / BILLION,
IRMD_CLEANUP_TIMER % BILLION};
@@ -1444,10 +1446,10 @@ void * irm_flow_cleaner()
pthread_rwlock_unlock(&irmd->flows_lock);
- registry_sanitize_apis(&irmd->registry);
-
pthread_rwlock_wrlock(&irmd->reg_lock);
+ registry_sanitize_apis(&irmd->registry);
+
list_for_each_safe(pos, n, &irmd->spawned_apis) {
struct spawned_api * api =
list_entry(pos, struct spawned_api, next);
@@ -1457,6 +1459,17 @@ void * irm_flow_cleaner()
LOG_INFO("Spawned process %d terminated "
"with exit status %d.",
api->api, status);
+
+ list_for_each_safe(h, t, &irmd->ipcps) {
+ struct ipcp_entry * e =
+ list_entry(h, struct ipcp_entry,
+ next);
+ if (e->api == api->api) {
+ list_del(&e->next);
+ ipcp_entry_destroy(e);
+ }
+ }
+
list_del(&api->next);
free(api);
}
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index d5fa97da..34c5d223 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -184,12 +184,17 @@ int do_bootstrap_ipcp(int argc, char ** argv)
}
len = irm_list_ipcps(name, &apis);
- if (len <= 0)
- return -1;
+ if (len <= 0) {
+ if (!irm_create_ipcp(name, conf.type))
+ return -1;
+ len = irm_list_ipcps(name, &apis);
+ }
for (i = 0; i < len; i++)
if (irm_bootstrap_ipcp(apis[i], &conf))
return -1;
+ free(apis);
+
return 0;
}