summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/irmd/main.c4
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c6
-rw-r--r--src/tools/irm/irm_ipcp_create.c10
-rw-r--r--src/tools/irm/irm_ipcp_enroll.c5
4 files changed, 20 insertions, 5 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 740472b9..1ac989de 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -590,14 +590,14 @@ static int bind_api(pid_t api,
e = api_table_get(&irmd->api_table, api);
if (e == NULL) {
LOG_ERR("AP-I %d does not exist.", api);
- pthread_rwlock_wrlock(&irmd->reg_lock);
+ pthread_rwlock_unlock(&irmd->reg_lock);
pthread_rwlock_unlock(&irmd->state_lock);
return -1;
}
name_dup = strdup(name);
if (name_dup == NULL) {
- pthread_rwlock_wrlock(&irmd->reg_lock);
+ pthread_rwlock_unlock(&irmd->reg_lock);
pthread_rwlock_unlock(&irmd->state_lock);
return -ENOMEM;
}
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index cc1bf6f9..7d72eb15 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -78,6 +78,7 @@ static void usage(void)
int do_bootstrap_ipcp(int argc, char ** argv)
{
char * name = NULL;
+ pid_t api;
struct dif_config conf;
uint8_t addr_size = DEFAULT_ADDR_SIZE;
uint8_t cep_id_size = DEFAULT_CEP_ID_SIZE;
@@ -186,8 +187,11 @@ int do_bootstrap_ipcp(int argc, char ** argv)
len = irm_list_ipcps(name, &apis);
if (len <= 0) {
- if (!irm_create_ipcp(name, conf.type))
+ api = irm_create_ipcp(name, conf.type);
+ if (api == 0)
return -1;
+ if (conf.type == IPCP_NORMAL)
+ irm_bind_api(api, name);
len = irm_list_ipcps(name, &apis);
}
diff --git a/src/tools/irm/irm_ipcp_create.c b/src/tools/irm/irm_ipcp_create.c
index e9921112..e152af71 100644
--- a/src/tools/irm/irm_ipcp_create.c
+++ b/src/tools/irm/irm_ipcp_create.c
@@ -47,6 +47,7 @@ int do_create_ipcp(int argc, char ** argv)
char * ipcp_type = NULL;
char * ipcp_name = NULL;
enum ipcp_type type = 0;
+ pid_t api;
while (argc > 0) {
if (matches(*argv, "type") == 0) {
@@ -81,5 +82,12 @@ int do_create_ipcp(int argc, char ** argv)
return -1;
}
- return !irm_create_ipcp(ipcp_name, type);
+ api = irm_create_ipcp(ipcp_name, type);
+ if (api == 0)
+ return -1;
+
+ if (type == IPCP_NORMAL)
+ irm_bind_api(api, ipcp_name);
+
+ return 0;
}
diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c
index b5517bcd..911a81a1 100644
--- a/src/tools/irm/irm_ipcp_enroll.c
+++ b/src/tools/irm/irm_ipcp_enroll.c
@@ -40,6 +40,7 @@ int do_enroll_ipcp(int argc, char ** argv)
char * name = NULL;
char * dif_name = NULL;
pid_t * apis = NULL;
+ pid_t api;
ssize_t len = 0;
int i = 0;
@@ -65,8 +66,10 @@ int do_enroll_ipcp(int argc, char ** argv)
len = irm_list_ipcps(name, &apis);
if (len <= 0) {
- if (!irm_create_ipcp(name, IPCP_NORMAL))
+ api = irm_create_ipcp(name, IPCP_NORMAL);
+ if (api == 0)
return -1;
+ irm_bind_api(api, name);
len = irm_list_ipcps(name, &apis);
}