diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-28 08:38:05 +0000 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-03-28 08:38:05 +0000 |
commit | ba13c05b8b61365ff9e969c15affd2e1d52b76ed (patch) | |
tree | baa5d6178914dd12106845ca81c81b63e4249c6f /src/ipcpd/normal/fmgr.c | |
parent | 7ee6dadd39f3d4b5874d23bfcdcdd66eb195124e (diff) | |
parent | 6d080d9b9ee2e480717935e4ce94870fc87ea5f7 (diff) | |
download | ouroboros-ba13c05b8b61365ff9e969c15affd2e1d52b76ed.tar.gz ouroboros-ba13c05b8b61365ff9e969c15affd2e1d52b76ed.zip |
Merged in sandervrijders/ouroboros/be-upd-graph (pull request #426)
Be upd graph
Diffstat (limited to 'src/ipcpd/normal/fmgr.c')
-rw-r--r-- | src/ipcpd/normal/fmgr.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index a8a9ba58..5a1bd842 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -198,13 +198,16 @@ void * fmgr_nm1_sdu_reader(void * o) continue; } + pff_lock(fmgr.pff[i]); fd = pff_nhop(fmgr.pff[i], pci.dst_addr); if (fd < 0) { + pff_unlock(fmgr.pff[i]); log_err("No next hop for %lu", pci.dst_addr); ipcp_flow_del(sdb); continue; } + pff_unlock(fmgr.pff[i]); if (ipcp_flow_write(fd, sdb)) { log_err("Failed to write SDU to fd %d.", @@ -293,6 +296,12 @@ int fmgr_init(void) } } + if (shm_pci_init()) { + log_err("Failed to init shm pci."); + fmgr_destroy_flows(); + return -1; + } + memset(&info, 0, sizeof(info)); strcpy(info.ae_name, DT_AE); @@ -689,12 +698,15 @@ int fmgr_nm1_write_sdu(struct pci * pci, if (pci == NULL || sdb == NULL) return -EINVAL; + pff_lock(fmgr.pff[pci->qos_id]); fd = pff_nhop(fmgr.pff[pci->qos_id], pci->dst_addr); if (fd < 0) { + pff_unlock(fmgr.pff[pci->qos_id]); log_err("Could not get nhop for address %lu", pci->dst_addr); ipcp_flow_del(sdb); return -1; } + pff_unlock(fmgr.pff[pci->qos_id]); if (shm_pci_ser(sdb, pci)) { log_err("Failed to serialize PDU."); @@ -720,11 +732,14 @@ int fmgr_nm1_write_buf(struct pci * pci, if (pci == NULL || buf == NULL || buf->data == NULL) return -EINVAL; + pff_lock(fmgr.pff[pci->qos_id]); fd = pff_nhop(fmgr.pff[pci->qos_id], pci->dst_addr); if (fd < 0) { + pff_unlock(fmgr.pff[pci->qos_id]); log_err("Could not get nhop for address %lu", pci->dst_addr); return -1; } + pff_unlock(fmgr.pff[pci->qos_id]); buffer = shm_pci_ser_buf(buf, pci); if (buffer == NULL) { |