add wifi multicast support. Based on patch by Mauchle Fabian.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 12 Jan 2009 13:35:41 +0100
changeset 4079 210d64d11998
parent 4077 d2e461e575f4
child 4080 03e024533100
add wifi multicast support. Based on patch by Mauchle Fabian.
src/devices/wifi/dca-txop.cc
src/devices/wifi/mac-low.cc
src/devices/wifi/mac-rx-middle.cc
src/devices/wifi/mac-tx-middle.cc
src/devices/wifi/nqap-wifi-mac.cc
src/devices/wifi/nqsta-wifi-mac.cc
src/devices/wifi/wifi-net-device.cc
src/devices/wifi/wifi-remote-station-manager.cc
--- a/src/devices/wifi/dca-txop.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/dca-txop.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -388,7 +388,7 @@
     }
   MacLowTransmissionParameters params;
   params.DisableOverrideDurationId ();
-  if (m_currentHdr.GetAddr1 ().IsBroadcast ()) 
+  if (m_currentHdr.GetAddr1 ().IsGroup ())
     {
       params.DisableRts ();
       params.DisableAck ();
--- a/src/devices/wifi/mac-low.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/mac-low.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -613,18 +613,18 @@
         }
       goto rxPacket;
     } 
-  else if (hdr.GetAddr1 ().IsBroadcast ()) 
+  else if (hdr.GetAddr1 ().IsGroup ())
     {
-      if (hdr.IsData () || hdr.IsMgt ()) 
+      if (hdr.IsData () || hdr.IsMgt ())
         {
-          NS_LOG_DEBUG ("rx broadcast from=" << hdr.GetAddr2 ());
+          NS_LOG_DEBUG ("rx group from=" << hdr.GetAddr2 ());
           goto rxPacket;
-        } 
-      else 
+        }
+      else
         {
-          // DROP.
+          // DROP
         }
-    } 
+    }
   else 
     {
       //NS_LOG_DEBUG_VERBOSE ("rx not-for-me from %d", GetSource (packet));
--- a/src/devices/wifi/mac-rx-middle.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/mac-rx-middle.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -157,7 +157,7 @@
   OriginatorRxStatus *originator;
   Mac48Address source = hdr->GetAddr2 ();
   if (hdr->IsQosData () &&
-      !hdr->GetAddr2 ().IsBroadcast ()) 
+      !hdr->GetAddr2 ().IsGroup ()) 
     {
       /* only for qos data non-broadcast frames */
       originator = m_qosOriginatorStatus[std::make_pair(source, hdr->GetQosTid ())];
@@ -293,7 +293,7 @@
   NS_LOG_DEBUG ("forwarding data from="<<hdr->GetAddr2 ()<<
                 ", seq="<<hdr->GetSequenceNumber ()<<
                 ", frag="<<hdr->GetFragmentNumber ());
-  if (!hdr->GetAddr1 ().IsBroadcast ())
+  if (!hdr->GetAddr1 ().IsGroup ())
     {
       originator->SetSequenceControl (hdr->GetSequenceControl ());
     }
--- a/src/devices/wifi/mac-tx-middle.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/mac-tx-middle.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -39,7 +39,7 @@
 {
   uint16_t retval;
   if (hdr->IsQosData () &&
-      !hdr->GetAddr1 ().IsBroadcast ()) 
+      !hdr->GetAddr1 ().IsGroup ()) 
     {
       uint8_t tid = hdr->GetQosTid ();
       NS_ASSERT (tid < 16);
--- a/src/devices/wifi/nqap-wifi-mac.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/nqap-wifi-mac.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -447,8 +447,7 @@
               NS_LOG_DEBUG ("frame for me from="<<from);
               ForwardUp (packet, from, bssid);
             } 
-          else if (to.IsBroadcast () || 
-                   to.IsMulticast () ||
+          else if (to.IsGroup () ||
                    toStation->IsAssociated ())
             {
               NS_LOG_DEBUG ("forwarding frame from="<<from<<", to="<<to);
--- a/src/devices/wifi/nqsta-wifi-mac.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/nqsta-wifi-mac.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -475,8 +475,12 @@
 {
   NS_LOG_FUNCTION (this << packet << hdr);
   NS_ASSERT (!hdr->IsCtl ());
-  if (hdr->GetAddr1 () != GetAddress () &&
-      !hdr->GetAddr1 ().IsBroadcast ()) 
+  if (hdr->GetAddr3 () == GetAddress ())
+    {
+      NS_LOG_LOGIC ("packet sent by us.");
+    }
+  else if (hdr->GetAddr1 () != GetAddress () &&
+           !hdr->GetAddr1 ().IsGroup ()) 
     {
       NS_LOG_LOGIC ("packet is not for us");
     } 
@@ -497,10 +501,7 @@
           NS_LOG_LOGIC ("Received data frame not from the the BSS we are associated with: ignore");
           return;
         }
-      if (hdr->GetAddr3 () != GetAddress ())
-        {
-          ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
-        }
+      ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
     } 
   else if (hdr->IsProbeReq () ||
            hdr->IsAssocReq ()) 
--- a/src/devices/wifi/wifi-net-device.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/wifi-net-device.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -221,7 +221,7 @@
 bool 
 WifiNetDevice::IsMulticast (void) const
 {
-  return false;
+  return true;
 }
 Address 
 WifiNetDevice::GetMulticast (Ipv4Address multicastGroup) const
@@ -291,7 +291,7 @@
     {
       type = NetDevice::PACKET_BROADCAST;
     }
-  else if (to.IsMulticast ())
+  else if (to.IsGroup ())
     {
       type = NetDevice::PACKET_MULTICAST;
     }
--- a/src/devices/wifi/wifi-remote-station-manager.cc	Sun Jan 11 23:26:34 2009 +0000
+++ b/src/devices/wifi/wifi-remote-station-manager.cc	Mon Jan 12 13:35:41 2009 +0100
@@ -227,8 +227,7 @@
 WifiRemoteStation *
 WifiRemoteStationManager::Lookup (Mac48Address address)
 {
-  if (address.IsBroadcast () ||
-      address.IsMulticast ())
+  if (address.IsGroup ())
     {
       return m_nonUnicast;
     }