summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/fmgr.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-03-13 15:52:56 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-03-13 15:52:56 +0000
commit366fcbec4fb7de21c553f24efb977b45bf27f2e6 (patch)
tree6b7cdf38253b4b416f185a50470cc6ad8ffbfb74 /src/ipcpd/normal/fmgr.c
parent80dcc9aae225de1228347b91eb114b3e40022623 (diff)
parent25ddfa73bf24734765e892cfa1c4304b714fd9cc (diff)
downloadouroboros-366fcbec4fb7de21c553f24efb977b45bf27f2e6.tar.gz
ouroboros-366fcbec4fb7de21c553f24efb977b45bf27f2e6.zip
Merged in sandervrijders/ouroboros/be-rib-routing (pull request #400)
ipcpd: normal: Add Flow State Objects to RIB
Diffstat (limited to 'src/ipcpd/normal/fmgr.c')
-rw-r--r--src/ipcpd/normal/fmgr.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index 2593e8fd..184baf82 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -68,7 +68,7 @@ struct {
pthread_t nm1_sdu_reader;
struct pff * pff[QOS_CUBE_MAX];
- struct routing * routing[QOS_CUBE_MAX];
+ struct routing_i * routing[QOS_CUBE_MAX];
struct gam * gam;
struct nbs * nbs;
@@ -238,7 +238,7 @@ static void fmgr_destroy_routing(void)
int i;
for (i = 0; i < QOS_CUBE_MAX; ++i)
- routing_destroy(fmgr.routing[i]);
+ routing_i_destroy(fmgr.routing[i]);
}
static void fmgr_destroy_pff(void)
@@ -316,9 +316,18 @@ int fmgr_init(void)
return -1;
}
+ if (routing_init(fmgr.nbs)) {
+ log_err("Failed to init routing.");
+ nbs_destroy(fmgr.nbs);
+ fmgr_destroy_flows();
+ connmgr_ae_destroy(fmgr.ae);
+ return -1;
+ }
+
fmgr.nb_notifier.notify_call = fmgr_neighbor_event;
if (nbs_reg_notifier(fmgr.nbs, &fmgr.nb_notifier)) {
log_err("Failed to register notifier.");
+ routing_fini();
nbs_destroy(fmgr.nbs);
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);
@@ -328,6 +337,7 @@ int fmgr_init(void)
if (pthread_rwlock_init(&fmgr.np1_flows_lock, NULL)) {
gam_destroy(fmgr.gam);
nbs_unreg_notifier(fmgr.nbs, &fmgr.nb_notifier);
+ routing_fini();
nbs_destroy(fmgr.nbs);
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);
@@ -341,19 +351,21 @@ int fmgr_init(void)
pff_destroy(fmgr.pff[j]);
pthread_rwlock_destroy(&fmgr.np1_flows_lock);
nbs_unreg_notifier(fmgr.nbs, &fmgr.nb_notifier);
+ routing_fini();
nbs_destroy(fmgr.nbs);
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);
return -1;
}
- fmgr.routing[i] = routing_create(fmgr.pff[i], fmgr.nbs);
+ fmgr.routing[i] = routing_i_create(fmgr.pff[i]);
if (fmgr.routing[i] == NULL) {
for (j = 0; j < i; ++j)
- routing_destroy(fmgr.routing[j]);
+ routing_i_destroy(fmgr.routing[j]);
fmgr_destroy_pff();
pthread_rwlock_destroy(&fmgr.np1_flows_lock);
nbs_unreg_notifier(fmgr.nbs, &fmgr.nb_notifier);
+ routing_fini();
nbs_destroy(fmgr.nbs);
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);
@@ -368,6 +380,7 @@ int fmgr_init(void)
fmgr_destroy_pff();
pthread_rwlock_destroy(&fmgr.np1_flows_lock);
nbs_unreg_notifier(fmgr.nbs, &fmgr.nb_notifier);
+ routing_fini();
nbs_destroy(fmgr.nbs);
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);
@@ -396,6 +409,8 @@ void fmgr_fini()
fmgr_destroy_pff();
+ routing_fini();
+
fmgr_destroy_flows();
connmgr_ae_destroy(fmgr.ae);