diff options
author | Sander Vrijders <[email protected]> | 2016-10-27 16:40:39 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-10-27 18:40:31 +0200 |
commit | 09a348b325e2b819e3deb952c1b3a6b141d75572 (patch) | |
tree | 8b9a093c36db09513dfb333cc1c90763c3112df9 /src/ipcpd/normal/shm_pci.c | |
parent | 6a61274c2289a06b4c23d5c8b2e36d924eb72a48 (diff) | |
download | ouroboros-09a348b325e2b819e3deb952c1b3a6b141d75572.tar.gz ouroboros-09a348b325e2b819e3deb952c1b3a6b141d75572.zip |
ipcpd: normal: Fix bugs in connection establishment
This fixes some bugs in connection establishment over the normal IPCP.
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; |