diff options
author | dimitri staessens <[email protected]> | 2016-10-27 16:41:03 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-10-27 16:41:03 +0000 |
commit | 64c8f8f3371799b8e818569666fd85e723c84d3a (patch) | |
tree | 9eea2090fc2083b5cd27d8fde2829075ef8cdeb0 /src/ipcpd/normal/shm_pci.c | |
parent | e84e294de2e73db418e8f249d795d2dd6c6faae0 (diff) | |
parent | 09a348b325e2b819e3deb952c1b3a6b141d75572 (diff) | |
download | ouroboros-64c8f8f3371799b8e818569666fd85e723c84d3a.tar.gz ouroboros-64c8f8f3371799b8e818569666fd85e723c84d3a.zip |
Merged in sandervrijders/ouroboros/be-fix-conn (pull request #291)0.3
ipcpd: normal: Fix bugs in connection establishment
Diffstat (limited to 'src/ipcpd/normal/shm_pci.c')
-rw-r--r-- | src/ipcpd/normal/shm_pci.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c index aa18fa38..3c55d081 100644 --- a/src/ipcpd/normal/shm_pci.c +++ b/src/ipcpd/normal/shm_pci.c @@ -34,6 +34,7 @@ #include "crc32.h" #include "ribmgr.h" +#define PDU_TYPE_SIZE 1 #define QOS_ID_SIZE 1 #define DEFAULT_TTL 60 #define TTL_SIZE 1 @@ -43,7 +44,7 @@ static size_t shm_pci_head_size(struct dt_const * dtc) { size_t len = 0; - len = dtc->addr_size * 2 + dtc->cep_id_size * 2 + len = PDU_TYPE_SIZE + dtc->addr_size * 2 + dtc->cep_id_size * 2 + dtc->pdu_length_size + dtc->seqno_size + QOS_ID_SIZE; if (dtc->has_ttl) @@ -64,7 +65,9 @@ static void ser_pci_head(uint8_t * head, int offset = 0; uint8_t ttl = DEFAULT_TTL; - memcpy(head, &pci->dst_addr, dtc->addr_size); + memcpy(head, &pci->pdu_type, PDU_TYPE_SIZE); + offset += PDU_TYPE_SIZE; + memcpy(head + offset, &pci->dst_addr, dtc->addr_size); offset += dtc->addr_size; memcpy(head + offset, &pci->src_addr, dtc->addr_size); offset += dtc->addr_size; @@ -174,7 +177,9 @@ struct pci * shm_pci_des(struct shm_du_buff * sdb) if (pci == NULL) return NULL; - memcpy(&pci->dst_addr, head, dtc->addr_size); + memcpy(&pci->pdu_type, head, PDU_TYPE_SIZE); + offset += PDU_TYPE_SIZE; + memcpy(&pci->dst_addr, head + offset, dtc->addr_size); offset += dtc->addr_size; memcpy(&pci->src_addr, head + offset, dtc->addr_size); offset += dtc->addr_size; |