summaryrefslogtreecommitdiff
path: root/src/lib/frct.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2018-10-05 17:04:16 +0200
committerSander Vrijders <[email protected]>2018-10-05 18:08:25 +0200
commit070075812728a9949a636e7629fa8235b41ce41b (patch)
tree6eb8ee6ee20b331b71ab16427c2858cc0f603411 /src/lib/frct.c
parent3034822918dec909b1e2ffae2447b4ee05426057 (diff)
downloadouroboros-070075812728a9949a636e7629fa8235b41ce41b.tar.gz
ouroboros-070075812728a9949a636e7629fa8235b41ce41b.zip
lib: Split error checking from FRCT
This splits off the CRC from FRCT so it can be set independently. Ouroboros now allows raw flows with error checking. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib/frct.c')
-rw-r--r--src/lib/frct.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c
index 2e5c385d..424367c3 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -31,7 +31,6 @@
#define TW_RESOLUTION 1 /* ms */
#define FRCT_PCILEN (sizeof(struct frct_pci))
-#define FRCT_CRCLEN (sizeof(uint32_t))
struct frct_cr {
uint32_t lwe;
@@ -204,22 +203,6 @@ static ssize_t __frcti_queued_pdu(struct frcti * frcti)
return idx;
}
-static int frct_chk_crc(uint8_t * head,
- uint8_t * tail)
-{
- uint32_t crc;
-
- mem_hash(HASH_CRC32, &crc, head, tail - head);
-
- return crc == *((uint32_t *) tail);
-}
-
-static void frct_add_crc(uint8_t * head,
- uint8_t * tail)
-{
- mem_hash(HASH_CRC32, tail, head, tail - head);
-}
-
static struct frct_pci * frcti_alloc_head(struct shm_du_buff * sdb)
{
struct frct_pci * pci = NULL;
@@ -252,18 +235,6 @@ static int __frcti_snd(struct frcti * frcti,
pci->flags |= FRCT_DATA;
- if (snd_cr->cflags & FRCTFERRCHCK) {
- uint8_t * tail = shm_du_buff_tail_alloc(sdb, FRCT_CRCLEN);
- if (tail == NULL) {
- pthread_rwlock_unlock(&frcti->lock);
- return -1;
- }
-
- frct_add_crc((uint8_t *) pci, tail);
-
- pci->flags |= FRCT_CRC;
- }
-
/* Set DRF if there are no unacknowledged packets. */
if (frcti->seqno == snd_cr->lwe)
pci->flags |= FRCT_DRF;
@@ -317,13 +288,6 @@ static int __frcti_rcv(struct frcti * frcti,
idx = shm_du_buff_get_idx(sdb);
- /* PDU may be corrupted. */
- if (pci->flags & FRCT_CRC) {
- uint8_t * tail = shm_du_buff_tail_release(sdb, FRCT_CRCLEN);
- if (frct_chk_crc((uint8_t *) pci, tail))
- goto drop_packet;
- }
-
seqno = ntoh32(pci->seqno);
/* Check if receiver inactivity is true. */