summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-03-27 14:12:41 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-03-28 10:26:07 +0200
commit48f12c6466c14f51bc3a2bba9b06772207e9ef33 (patch)
treeee3ce3895efd46f83549676c14046029cff0d567 /src/ipcpd/normal
parentad6a813edab5a14866b045d37fe2ce7e1f9a126d (diff)
downloadouroboros-48f12c6466c14f51bc3a2bba9b06772207e9ef33.tar.gz
ouroboros-48f12c6466c14f51bc3a2bba9b06772207e9ef33.zip
ipcpd: normal: Call shm_pci_init on fmgr init
The shm PCI was never initialized during flow manager init. This commit will do that, and initialize the pdu length correctly as well, since it was not being written into the RIB, nor read in shm_pci_init.
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/fmgr.c6
-rw-r--r--src/ipcpd/normal/main.c13
-rw-r--r--src/ipcpd/normal/shm_pci.c20
3 files changed, 29 insertions, 10 deletions
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index f78d390a..5a1bd842 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -296,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);
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 41e0544d..ef7f07cf 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -85,6 +85,7 @@ static int boot_components(void)
char buf[256];
ssize_t len;
enum pol_addr_auth pa;
+ char path[RIB_MAX_PATH_LEN + 1];
len = rib_read(DIF_PATH, &buf, 256);
if (len < 0) {
@@ -108,7 +109,6 @@ static int boot_components(void)
if (rib_read(BOOT_PATH "/addr_auth/type", &pa, sizeof(pa))
!= sizeof(pa)) {
log_err("Failed to read policy for address authority.");
- connmgr_fini();
return -1;
}
@@ -124,6 +124,14 @@ static int boot_components(void)
return -1;
}
+ path[0] = '\0';
+ rib_path_append(rib_path_append(path, MEMBERS_NAME), ipcpi.name);
+ if (rib_write(path, &ipcpi.dt_addr, sizeof(&ipcpi.dt_addr))) {
+ log_err("Failed to write address to member object.");
+ addr_auth_fini();
+ return -1;
+ }
+
log_dbg("IPCP got address %" PRIu64 ".", ipcpi.dt_addr);
log_dbg("Starting ribmgr.");
@@ -342,6 +350,9 @@ static int normal_ipcp_bootstrap(struct dif_config * conf)
rib_write(BOOT_PATH "/dt/const/seqno_size",
&conf->seqno_size,
sizeof(conf->seqno_size)) ||
+ rib_write(BOOT_PATH "/dt/const/pdu_length_size",
+ &conf->pdu_length_size,
+ sizeof(conf->pdu_length_size)) ||
rib_write(BOOT_PATH "/dt/const/has_ttl",
&conf->has_ttl,
sizeof(conf->has_ttl)) ||
diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c
index 001463eb..e6cd1042 100644
--- a/src/ipcpd/normal/shm_pci.c
+++ b/src/ipcpd/normal/shm_pci.c
@@ -88,30 +88,32 @@ int shm_pci_init(void)
/* read dt constants from the RIB */
if (rib_read(BOOT_PATH "/dt/const/addr_size",
&pci_info.dtc.addr_size,
- sizeof(pci_info.dtc.addr_size)) ||
+ sizeof(pci_info.dtc.addr_size)) < 0 ||
rib_read(BOOT_PATH "/dt/const/cep_id_size",
&pci_info.dtc.cep_id_size,
- sizeof(pci_info.dtc.cep_id_size)) ||
+ sizeof(pci_info.dtc.cep_id_size)) < 0 ||
rib_read(BOOT_PATH "/dt/const/seqno_size",
&pci_info.dtc.seqno_size,
- sizeof(pci_info.dtc.seqno_size)) ||
+ sizeof(pci_info.dtc.seqno_size)) < 0 ||
+ rib_read(BOOT_PATH "/dt/const/pdu_length_size",
+ &pci_info.dtc.pdu_length_size,
+ sizeof(pci_info.dtc.pdu_length_size)) < 0 ||
rib_read(BOOT_PATH "/dt/const/has_ttl",
&pci_info.dtc.has_ttl,
- sizeof(pci_info.dtc.has_ttl)) ||
+ sizeof(pci_info.dtc.has_ttl)) < 0 ||
rib_read(BOOT_PATH "/dt/const/has_chk",
&pci_info.dtc.has_chk,
- sizeof(pci_info.dtc.has_chk)) ||
+ sizeof(pci_info.dtc.has_chk)) < 0 ||
rib_read(BOOT_PATH "/dt/const/min_pdu_size",
&pci_info.dtc.min_pdu_size,
- sizeof(pci_info.dtc.min_pdu_size)) ||
+ sizeof(pci_info.dtc.min_pdu_size)) < 0 ||
rib_read(BOOT_PATH "/dt/const/max_pdu_size",
&pci_info.dtc.max_pdu_size,
- sizeof(pci_info.dtc.max_pdu_size)))
+ sizeof(pci_info.dtc.max_pdu_size)) < 0)
return -1;
pci_info.dst_addr_o = PDU_TYPE_SIZE;
pci_info.src_addr_o = pci_info.dst_addr_o + pci_info.dtc.addr_size;
- pci_info.dst_cep_id_o = pci_info.dst_addr_o + pci_info.dtc.addr_size;
pci_info.dst_cep_id_o = pci_info.src_addr_o + pci_info.dtc.addr_size;
pci_info.src_cep_id_o = pci_info.dst_cep_id_o
+ pci_info.dtc.cep_id_size;
@@ -132,7 +134,7 @@ int shm_pci_init(void)
}
void shm_pci_fini(void) {
- return ;
+ return;
}
int shm_pci_ser(struct shm_du_buff * sdb,