bug 1901: set mesh frames to type QOSDATA
authorTom Henderson <tomh@tomh.org>
Mon, 17 Aug 2015 13:44:25 -0700
changeset 11584 42b7c1e05e11
parent 11583 ae9a74963f62
child 11585 a4ee9fd2ae07
bug 1901: set mesh frames to type QOSDATA
src/mesh/model/mesh-wifi-interface-mac.cc
src/wifi/model/qos-utils.cc
--- a/src/mesh/model/mesh-wifi-interface-mac.cc	Sat Aug 15 19:30:10 2015 +0200
+++ b/src/mesh/model/mesh-wifi-interface-mac.cc	Mon Aug 17 13:44:25 2015 -0700
@@ -220,7 +220,7 @@
   // copy packet to allow modifications
   Ptr<Packet> packet = const_packet->Copy ();
   WifiMacHeader hdr;
-  hdr.SetTypeData ();
+  hdr.SetType (WIFI_MAC_QOSDATA);
   hdr.SetAddr2 (GetAddress ());
   hdr.SetAddr3 (to);
   hdr.SetAddr4 (from);
@@ -255,19 +255,20 @@
         }
       m_stationManager->RecordDisassociated (hdr.GetAddr1 ());
     }
-  //Classify: application sets a tag, which is removed here
-  // Get Qos tag:
-  AcIndex ac = AC_BE;
+  // Classify: application may have set a tag, which is removed here
+  AcIndex ac;
   QosTag tag;
   if (packet->RemovePacketTag (tag))
     {
-      hdr.SetType (WIFI_MAC_QOSDATA);
       hdr.SetQosTid (tag.GetTid ());
-      //Aftre setting type DsFrom and DsTo fields are reset.
-      hdr.SetDsFrom ();
-      hdr.SetDsTo ();
       ac = QosUtilsMapTidToAc (tag.GetTid ());
     }
+  else
+    {
+      // No tag found; set to best effort 
+      ac = AC_BE;
+      hdr.SetQosTid (0);
+    }
   m_stats.sentFrames++;
   m_stats.sentBytes += packet->GetSize ();
   NS_ASSERT (m_edca.find (ac) != m_edca.end ());
--- a/src/wifi/model/qos-utils.cc	Sat Aug 15 19:30:10 2015 +0200
+++ b/src/wifi/model/qos-utils.cc	Mon Aug 17 13:44:25 2015 -0700
@@ -27,6 +27,7 @@
 AcIndex
 QosUtilsMapTidToAc (uint8_t tid)
 {
+  NS_ASSERT_MSG (tid < 8, "Tid " << (uint16_t) tid << " out of range");
   switch (tid)
     {
     case 0: