summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 23:05:07 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 23:13:24 +0100
commit089c71cdb6bcb3eec696f64818377c80cde9b62f (patch)
treecee4e49f4b21099e928ae404f5516ed96302a82c /src/ipcpd/normal/main.c
parent66d495656348ae04b5ab725e0b44dad5f45e1a9b (diff)
downloadouroboros-089c71cdb6bcb3eec696f64818377c80cde9b62f.tar.gz
ouroboros-089c71cdb6bcb3eec696f64818377c80cde9b62f.zip
ipcpd: Fix boot order of normal
irm_bind has to be called after ipcp_init() since it targets the AP-I and needs the pid to be registered with the IRMd. Also fixes missing unbinding of the AP-I.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 5d8af688..2b30dba3 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -457,18 +457,20 @@ int main(int argc,
sigaction(SIGHUP, &sig_act, NULL);
sigaction(SIGPIPE, &sig_act, NULL);
- if (irm_bind_api(getpid(), ipcpi.name)) {
- log_err("Failed to bind AP name.");
+ if (ipcp_init(argc, argv, THIS_TYPE, &normal_ops) < 0) {
+ log_err("Failed to create instance.");
exit(EXIT_FAILURE);
}
- if (ipcp_init(argc, argv, THIS_TYPE, &normal_ops) < 0) {
- log_err("Failed to create instance.");
+ if (irm_bind_api(getpid(), ipcpi.name)) {
+ log_err("Failed to bind AP name.");
+ ipcp_fini();
exit(EXIT_FAILURE);
}
if (rib_init()) {
log_err("Failed to initialize RIB.");
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -478,6 +480,7 @@ int main(int argc,
if (ipcp_boot() < 0) {
log_err("Failed to boot IPCP.");
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -489,6 +492,7 @@ int main(int argc,
ipcp_set_state(IPCP_NULL);
ipcp_shutdown();
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
ipcp_fini();
exit(EXIT_FAILURE);
}
@@ -500,6 +504,8 @@ int main(int argc,
rib_fini();
+ irm_unbind_api(getpid(), ipcpi.name);
+
ipcp_fini();
exit(EXIT_SUCCESS);