diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index 66528e542..b75a812ca 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -306,9 +306,16 @@ send_packet(mac_callback_t sent, void *ptr) { struct rdc_buf_list *q; struct neighbor_queue *n; + static uint8_t initialized = 0; static uint16_t seqno; const rimeaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); + if(!initialized) { + initialized = 1; + /* Initialize the sequence number to a random value as per 802.15.4. */ + seqno = random_rand(); + } + if(seqno == 0) { /* PACKETBUF_ATTR_MAC_SEQNO cannot be zero, due to a pecuilarity in framer-802154.c. */