diff --git a/net/sixlowpan/README.txt b/net/sixlowpan/README.txt index ca8a513d6a..5b6b4e298d 100644 --- a/net/sixlowpan/README.txt +++ b/net/sixlowpan/README.txt @@ -49,7 +49,7 @@ The length of the fragment header length is four bytes for the first header (FRAG1) and five bytes for all subsequent headers (FRAGN). For example, this is a HC1 compressed first frame of a packet - 41 88 01 cefa 3412 cdab ### 9-byte MAC header + 41 88 2a cefa 3412 cdab ### 9-byte MAC header c50e 000b ### 4-byte FRAG1 header 42 ### SIXLOWPAN_DISPATCH_HC1 fb ### RIME_HC1_HC_UDP_HC1_ENCODING @@ -66,7 +66,7 @@ this is a HC1 compressed first frame of a packet This is the second frame of the same transfer: - 41 88 01 cefa 3412 cdab ### 9-byte MAC header + 41 88 2b cefa 3412 cdab ### 9-byte MAC header e50e 000b 0d ### 5 byte FRAGN header 42 ### SIXLOWPAN_DISPATCH_HC1 fb ### RIME_HC1_HC_UDP_HC1_ENCODING diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index c9985872ba..9f7a68a1f7 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -281,7 +281,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, ninfo("Sending packet length %d\n", buflen); - /* Set the source and destinatino address */ + /* Set the source and destination address */ rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER], &ieee->i_dev.d_mac.ieee802154); @@ -348,7 +348,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, ninfo("Sending fragmented packet length %d\n", buflen); /* Create 1st Fragment */ - /* Add the frame header using the pre-allocated IOB. */ + /* Add the frame header using the pre-allocated IOB using the DSN + * selected by sixlowpan_send_hdrlen(). + */ verify = sixlowpan_framecreate(ieee, iob, ieee->i_panid); DEBUGASSERT(verify == framer_hdrlen); @@ -434,11 +436,17 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, iob->io_pktlen = 0; fptr = iob->io_data; - /* Copy the frame header at the beginning of the frame. */ + /* Add a new frame header to the IOB (same as the first but with a + * different DSN). + */ - memcpy(fptr, frame1, framer_hdrlen); + g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = 0; - /* Move HC1/HC06/IPv6 header the frame header from first + verify = sixlowpan_framecreate(ieee, iob, ieee->i_panid); + DEBUGASSERT(verify == framer_hdrlen); + UNUSED(verify); + + /* Copy the HC1/HC06/IPv6 header the frame header from first * frame, into the correct location after the FRAGN header * of subsequent frames. */ diff --git a/net/sixlowpan/sixlowpan_framer.c b/net/sixlowpan/sixlowpan_framer.c index 13aa9fecd3..da52303c6c 100644 --- a/net/sixlowpan/sixlowpan_framer.c +++ b/net/sixlowpan/sixlowpan_framer.c @@ -322,12 +322,12 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee, if (g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] != 0) { - params->seq = g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO]; + params->seq = g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] & 0xff; } else { params->seq = ieee->i_dsn++; - g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = params->seq; + g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = params->seq | 0x100; } /* Complete the addressing fields. */ diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index af1320fccf..f914b5db1a 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -618,6 +618,10 @@ int ieee8021514_loopback(void) priv->lo_polldog = wd_create(); /* Create periodic poll timer */ + /* Initialize the DSN to a "random" value */ + + priv->lo_ieee.i_dsn = 42; + /* Register the loopabck device with the OS so that socket IOCTLs can b * performed. */