summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-11 16:36:12 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-11 16:36:12 +0200
commite5a7b3bd7ebe473c035df2cee58416f848f56389 (patch)
treec8f8f614015448a69c22e3189240923527e89022
parent97b1d71846bddef59020f5f250d7804617df3763 (diff)
parentb411f856e27b3f76a37128f397a28df45d11db46 (diff)
downloadouroboros-e5a7b3bd7ebe473c035df2cee58416f848f56389.tar.gz
ouroboros-e5a7b3bd7ebe473c035df2cee58416f848f56389.zip
Merged in sandervrijders/ouroboros/be-irm-enroll (pull request #207)
tools: irm: Create IPCP upon enroll if unexisting
-rw-r--r--src/tools/irm/irm_ipcp_destroy.c3
-rw-r--r--src/tools/irm/irm_ipcp_enroll.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/tools/irm/irm_ipcp_destroy.c b/src/tools/irm/irm_ipcp_destroy.c
index ebd4283d..9768b5e1 100644
--- a/src/tools/irm/irm_ipcp_destroy.c
+++ b/src/tools/irm/irm_ipcp_destroy.c
@@ -21,6 +21,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ouroboros/irm.h>
@@ -66,5 +67,7 @@ int do_destroy_ipcp(int argc, char ** argv)
if (irm_destroy_ipcp(apis[i]))
return -1;
+ free(apis);
+
return 0;
}
diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c
index d6b1b27e..b7a12e2c 100644
--- a/src/tools/irm/irm_ipcp_enroll.c
+++ b/src/tools/irm/irm_ipcp_enroll.c
@@ -21,6 +21,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ouroboros/irm.h>
@@ -63,12 +64,17 @@ int do_enroll_ipcp(int argc, char ** argv)
}
len = irm_list_ipcps(name, &apis);
- if (len <= 0)
- return -1;
+ if (len <= 0) {
+ if (!irm_create_ipcp(name, IPCP_NORMAL))
+ return -1;
+ len = irm_list_ipcps(name, &apis);
+ }
for (i = 0; i < len; i++)
if (irm_enroll_ipcp(apis[i], dif_name))
return -1;
+ free(apis);
+
return 0;
}