diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2017-11-09 09:07:11 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-09 11:20:29 +0100 |
commit | 470c33a44d58e65a28979e016b1a4fc692da0503 (patch) | |
tree | 64a21342facd6c24b452a4c09657d4282b5dd4c6 /src | |
parent | 35c43358a110758090b48dd18628bb285ffddfc6 (diff) | |
download | ouroboros-470c33a44d58e65a28979e016b1a4fc692da0503.tar.gz ouroboros-470c33a44d58e65a28979e016b1a4fc692da0503.zip |
lib: Fix FRCT sequence number network endianness
Endianness conversion from/to the network for the sequence number was
missing in 68694bc.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/dev.c | 2 | ||||
-rw-r--r-- | src/lib/frct.c | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index e80bf9f9..e2e864fc 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -20,6 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#include <ouroboros/endian.h> + #define _POSIX_C_SOURCE 200809L #include "config.h" diff --git a/src/lib/frct.c b/src/lib/frct.c index 5f45f522..34b6b64d 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -293,7 +293,7 @@ static int __frcti_snd(struct frcti * frcti, } } - pci->seqno = snd_cr->seqno++; + pci->seqno = hton32(snd_cr->seqno++); if (snd_cr->cflags & FRCTFERRCHCK) { uint8_t * tail = shm_du_buff_tail_alloc(sdb, FRCT_CRCLEN); @@ -325,6 +325,7 @@ static int __frcti_rcv(struct frcti * frcti, struct frct_pci * pci; struct timespec now; struct frct_cr * rcv_cr; + uint32_t seqno; assert(frcti); @@ -353,11 +354,13 @@ static int __frcti_rcv(struct frcti * frcti, if (rcv_cr->drf && !(pci->flags & FRCT_DRF)) goto fail_clean; + seqno = ntoh32(pci->seqno); + /* Queue the PDU if needed. */ if (rcv_cr->cflags & FRCTFORDERING) { - if (pci->seqno != frcti->rcv_cr.lwe) { + if (seqno != frcti->rcv_cr.lwe) { /* NOTE: queued PDUs head/tail without PCI. */ - if (rq_push(frcti->rq, pci->seqno, idx)) + if (rq_push(frcti->rq, seqno, idx)) shm_rdrbuff_remove(ai.rdrb, idx); goto fail; } else { @@ -367,7 +370,7 @@ static int __frcti_rcv(struct frcti * frcti, /* If the DRF is set, reset the state of the connection. */ if (pci->flags & FRCT_DRF) { - rcv_cr->lwe = pci->seqno; + rcv_cr->lwe = seqno; if (pci->flags & FRCT_CFG) rcv_cr->cflags = pci->cflags; } |