diff --git a/RELEASE_NOTES b/RELEASE_NOTES index dacd3a30f..2bc2df08a 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -82,6 +82,7 @@ Bugs fixed - Bug 2257 - Ipv[4,6]InterfaceContainer::Add are not consistent - Bug 2259 - GSL not successfully enabled for Wi-Fi DSSS error rate model - Bug 2267 - Wrong channel bandwidth value in pcap files +- Bug 2272 - SixLowPan NetDevice can not send uncompressed packets larger than 802.15.4 MTU Known issues ------------ diff --git a/src/sixlowpan/doc/sixlowpan.rst b/src/sixlowpan/doc/sixlowpan.rst index 5c7145cbb..9c81357d8 100644 --- a/src/sixlowpan/doc/sixlowpan.rst +++ b/src/sixlowpan/doc/sixlowpan.rst @@ -62,8 +62,8 @@ The attributes are: The CompressionThreshold attribute is similar to Contiki's SICSLOWPAN_CONF_MIN_MAC_PAYLOAD option. If a compressed packet size is less than the threshold, the uncompressed version is used (plus one byte for the correct dispatch header). -This option is useful only when a MAC with specific requirement for minimum frame size is -used (e.g., ContikiMAC). +This option is useful when a MAC requires a minimum frame size (e.g., ContikiMAC) and the +compression would violate the requirement. The last two attributes are needed to use the module with a NetDevice other than 802.15.4, as neither IANA or IEEE did reserve an EtherType for 6LoWPAN. As a consequence there might be a diff --git a/src/sixlowpan/model/sixlowpan-net-device.cc b/src/sixlowpan/model/sixlowpan-net-device.cc index e57ed375a..810f28e12 100644 --- a/src/sixlowpan/model/sixlowpan-net-device.cc +++ b/src/sixlowpan/model/sixlowpan-net-device.cc @@ -437,13 +437,25 @@ bool SixLowPanNetDevice::DoSend (Ptr packet, protocolNumber = m_etherType; } - if (m_useIphc) + if (origPacketSize > m_compressionThreshold) { - origHdrSize += CompressLowPanIphc (packet, m_netDevice->GetAddress (), dest); + if (m_useIphc) + { + NS_LOG_LOGIC ("Compressing packet using IPHC"); + origHdrSize += CompressLowPanIphc (packet, m_netDevice->GetAddress (), dest); + } + else + { + NS_LOG_LOGIC ("Compressing packet using HC1"); + origHdrSize += CompressLowPanHc1 (packet, m_netDevice->GetAddress (), dest); + } } else { - origHdrSize += CompressLowPanHc1 (packet, m_netDevice->GetAddress (), dest); + NS_LOG_LOGIC ("Compressed packet too short, using uncompressed one"); + packet = origPacket; + SixLowPanIpv6 ipv6UncompressedHdr; + packet->AddHeader (ipv6UncompressedHdr); } if ( packet->GetSize () > m_netDevice->GetMtu () ) @@ -471,14 +483,6 @@ bool SixLowPanNetDevice::DoSend (Ptr packet, } else { - if (packet->GetSize () < m_compressionThreshold) - { - NS_LOG_LOGIC ("Compressed packet too short, using uncompressed one"); - packet = origPacket; - SixLowPanIpv6 ipv6UncompressedHdr; - packet->AddHeader (ipv6UncompressedHdr); - } - m_txTrace (packet, m_node->GetObject (), GetIfIndex ()); if (doSendFrom) {