From 08ac18b4e9660353e9a06909d2603a871890b3e4 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 26 Jun 2017 19:19:49 +0200 Subject: [PATCH] TSCH and CSMA: consistent seqno handling --- core/net/mac/csma/csma-output.c | 2 +- core/net/mac/tsch/tsch.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/net/mac/csma/csma-output.c b/core/net/mac/csma/csma-output.c index a9dded386..47e621063 100644 --- a/core/net/mac/csma/csma-output.c +++ b/core/net/mac/csma/csma-output.c @@ -483,7 +483,7 @@ csma_output_packet(mac_callback_t sent, void *ptr) struct packet_queue *q; struct neighbor_queue *n; static uint8_t initialized = 0; - static uint16_t seqno; + static uint8_t seqno; const linkaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); if(!initialized) { diff --git a/core/net/mac/tsch/tsch.c b/core/net/mac/tsch/tsch.c index 78c86954e..621014416 100644 --- a/core/net/mac/tsch/tsch.c +++ b/core/net/mac/tsch/tsch.c @@ -142,7 +142,7 @@ struct tsch_asn_t tsch_current_asn; * For PAN coordinator: 0 -- lower is better */ uint8_t tsch_join_priority; /* The current TSCH sequence number, used for unicast data frames only */ -static uint8_t tsch_packet_seqno = 0; +static uint8_t tsch_packet_seqno; /* Current period for EB output */ static clock_time_t tsch_current_eb_period; /* Current period for keepalive output */ @@ -925,6 +925,7 @@ tsch_init(void) nbr_table_register(sync_stats, NULL); #endif /* TSCH_AUTOSELECT_TIME_SOURCE */ + tsch_packet_seqno = random_rand(); tsch_is_initialized = 1; #if TSCH_AUTOSTART