From 470c33a44d58e65a28979e016b1a4fc692da0503 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 9 Nov 2017 09:07:11 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/lib/dev.c | 2 ++ 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 + #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; } -- cgit v1.2.3