diff options
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/local/main.c | 10 | ||||
-rw-r--r-- | src/ipcpd/normal/main.c | 10 | ||||
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 6 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 6 |
4 files changed, 30 insertions, 2 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 99580a45..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, @@ -621,6 +621,12 @@ int main(int argc, char * argv[]) pthread_rwlock_unlock(&_ipcp->state_lock); + if (ipcp_create_r(getpid())) { + LOG_ERR("Failed to notify IRMd we are initialized."); + close_logfile(); + exit(EXIT_FAILURE); + } + pthread_join(_ap_instance->mainloop, NULL); shim_ap_fini(); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 2d416942..38789ddd 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -27,6 +27,7 @@ #include <ouroboros/shm_du_map.h> #include <ouroboros/shm_ap_rbuff.h> #include <ouroboros/dev.h> +#include <ouroboros/ipcp.h> #include <stdbool.h> #include <signal.h> @@ -326,6 +327,15 @@ int main(int argc, char * argv[]) pthread_rwlock_unlock(&_ipcp->state_lock); + if (ipcp_create_r(getpid())) { + LOG_ERR("Failed to notify IRMd we are initialized."); + normal_ipcp_data_destroy(); + fmgr_fini(); + free(_ipcp); + close_logfile(); + exit(EXIT_FAILURE); + } + pthread_join(normal_data(_ipcp)->mainloop, NULL); normal_ipcp_data_destroy(); diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 7471e319..b8689ac7 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -1379,6 +1379,12 @@ int main(int argc, char * argv[]) pthread_rwlock_unlock(&_ipcp->state_lock); + if (ipcp_create_r(getpid())) { + LOG_ERR("Failed to notify IRMd we are initialized."); + close_logfile(); + exit(EXIT_FAILURE); + } + pthread_join(shim_data(_ipcp)->mainloop, NULL); eth_llc_ipcp_data_destroy(); diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 9d6d15a7..8d9ac25c 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -1609,6 +1609,12 @@ int main(int argc, char * argv[]) pthread_rwlock_unlock(&_ipcp->state_lock); + if (ipcp_create_r(getpid())) { + LOG_ERR("Failed to notify IRMd we are initialized."); + close_logfile(); + exit(EXIT_FAILURE); + } + pthread_join(_ap_instance->mainloop, NULL); shim_ap_fini(); |