From 1d0e634a651f234c3942c6b82164470fa2432058 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 21 Mar 2017 18:01:43 +0100 Subject: ipcpd: normal: Several bugfixes These solve several bugfixes in the normal. --- src/ipcpd/normal/fmgr.c | 1 - src/ipcpd/normal/main.c | 31 +++++++++++++++---------------- src/ipcpd/normal/pol/complete.c | 2 ++ src/ipcpd/normal/routing.c | 5 +++-- src/irmd/irm_flow.c | 5 +++-- 5 files changed, 23 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 790b34dd..e78dd2d6 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -399,7 +399,6 @@ int fmgr_start(void) fmgr.gam = gam_create(pg, fmgr.nbs, fmgr.ae); if (fmgr.gam == NULL) { log_err("Failed to init dt graph adjacency manager."); - nbs_unreg_notifier(fmgr.nbs, &fmgr.nb_notifier); return -1; } diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 7acf3046..82381ba7 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -151,7 +151,8 @@ static int boot_components(void) return -1; } - if (fmgr_start()) { + if (fmgr_init()) { + log_err("Failed to initialize flow manager component."); frct_fini(); dir_fini(); ribmgr_fini(); @@ -160,9 +161,19 @@ static int boot_components(void) return -1; } + if (fmgr_start()) { + fmgr_fini(); + frct_fini(); + dir_fini(); + ribmgr_fini(); + addr_auth_fini(); + log_err("Failed to start flow manager."); + return -1; + } if (enroll_start()) { fmgr_stop(); + fmgr_fini(); frct_fini(); dir_fini(); ribmgr_fini(); @@ -177,6 +188,7 @@ static int boot_components(void) ipcp_set_state(IPCP_INIT); enroll_stop(); fmgr_stop(); + fmgr_fini(); frct_fini(); dir_fini(); ribmgr_fini(); @@ -198,6 +210,8 @@ void shutdown_components(void) fmgr_stop(); + fmgr_fini(); + dir_fini(); ribmgr_fini(); @@ -439,23 +453,11 @@ int main(int argc, exit(EXIT_FAILURE); } - if (fmgr_init()) { - log_err("Failed to initialize flow manager component."); - ipcp_create_r(getpid(), -1); - enroll_fini(); - connmgr_fini(); - rib_fini(); - irm_unbind_api(getpid(), ipcpi.name); - ipcp_fini(); - exit(EXIT_FAILURE); - } - pthread_sigmask(SIG_BLOCK, &sigset, NULL); if (ipcp_boot() < 0) { log_err("Failed to boot IPCP."); ipcp_create_r(getpid(), -1); - fmgr_fini(); enroll_fini(); connmgr_fini(); rib_fini(); @@ -470,7 +472,6 @@ int main(int argc, log_err("Failed to notify IRMd we are initialized."); ipcp_set_state(IPCP_NULL); ipcp_shutdown(); - fmgr_fini(); enroll_fini(); connmgr_fini(); rib_fini(); @@ -484,8 +485,6 @@ int main(int argc, if (ipcp_get_state() == IPCP_SHUTDOWN) shutdown_components(); - fmgr_fini(); - enroll_fini(); connmgr_fini(); diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 1f3f6031..635b573b 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -131,6 +131,8 @@ void * complete_create(struct nbs * nbs, allocator, (void *) complete)) return NULL; + pthread_join(complete->allocator, NULL); + if (pthread_create(&complete->listener, NULL, listener, (void *) complete)) return NULL; diff --git a/src/ipcpd/normal/routing.c b/src/ipcpd/normal/routing.c index 0b82b70d..211becb4 100644 --- a/src/ipcpd/normal/routing.c +++ b/src/ipcpd/normal/routing.c @@ -97,9 +97,10 @@ static int routing_neighbor_event(enum nb_event event, size_t len; uint8_t * data; - sprintf(fso_name, "%" PRIx64 "-%" PRIx64, + path[0] = '\0'; + sprintf(fso_name, "%" PRIu64 "-%" PRIu64, ipcpi.dt_addr, conn.conn_info.addr); - rib_path_append(rib_path_append(path, ROUTING_PATH), fso_name); + rib_path_append(rib_path_append(path, ROUTING_NAME), fso_name); switch (event) { case NEIGHBOR_ADDED: diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c index 20d2511c..8ca25b5b 100644 --- a/src/irmd/irm_flow.c +++ b/src/irmd/irm_flow.c @@ -31,7 +31,9 @@ #include #include -struct irm_flow * irm_flow_create(pid_t n_api, pid_t n_1_api, int port_id) +struct irm_flow * irm_flow_create(pid_t n_api, + pid_t n_1_api, + int port_id) { struct irm_flow * f = malloc(sizeof(*f)); if (f == NULL) @@ -47,7 +49,6 @@ struct irm_flow * irm_flow_create(pid_t n_api, pid_t n_1_api, int port_id) return NULL; } - f->n_api = n_api; f->n_1_api = n_1_api; f->port_id = port_id; -- cgit v1.2.3