summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/local/main.c8
-rw-r--r--src/ipcpd/normal/fmgr.c1
-rw-r--r--src/ipcpd/normal/main.c31
-rw-r--r--src/ipcpd/normal/pol/complete.c2
-rw-r--r--src/ipcpd/normal/routing.c5
-rw-r--r--src/irmd/api_table.c2
-rw-r--r--src/irmd/irm_flow.c5
7 files changed, 31 insertions, 23 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index f025afa2..38a901c0 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -233,13 +233,19 @@ static int ipcp_local_flow_alloc(int fd,
if (ipcp_get_state() != IPCP_OPERATIONAL) {
pthread_rwlock_unlock(&ipcpi.state_lock);
- log_dbg("Won't register with non-enrolled IPCP.");
+ log_dbg("Won't allocate over non-operational IPCP.");
return -1; /* -ENOTENROLLED */
}
pthread_rwlock_wrlock(&local_data.lock);
out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube);
+ if (out_fd < 0) {
+ log_dbg("Flow allocation failed.");
+ pthread_rwlock_unlock(&local_data.lock);
+ pthread_rwlock_unlock(&ipcpi.state_lock);
+ return -1;
+ }
local_data.in_out[fd] = out_fd;
local_data.in_out[out_fd] = fd;
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/api_table.c b/src/irmd/api_table.c
index 3b80ac91..1c655004 100644
--- a/src/irmd/api_table.c
+++ b/src/irmd/api_table.c
@@ -167,7 +167,7 @@ int api_entry_sleep(struct api_entry * e)
e->re = NULL;
- clock_gettime(CLOCK_REALTIME, &now);
+ clock_gettime(PTHREAD_COND_CLOCK, &now);
ts_add(&now, &timeout, &dl);
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 <stdbool.h>
#include <assert.h>
-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;