bug 1923: Patch for disabling active probe requests
authorl.salameh@cs.ucl.ac.uk
Wed, 11 Jun 2014 20:26:02 -0700
changeset 10809 5a0879005e4c
parent 10808 8fa02a3cca47
child 10810 b253af519662
bug 1923: Patch for disabling active probe requests
src/wifi/model/sta-wifi-mac.cc
src/wifi/model/sta-wifi-mac.h
--- a/src/wifi/model/sta-wifi-mac.cc	Fri Jun 06 12:43:03 2014 -0700
+++ b/src/wifi/model/sta-wifi-mac.cc	Wed Jun 11 20:26:02 2014 -0700
@@ -84,7 +84,7 @@
                    MakeUintegerChecker<uint32_t> ())
     .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't. NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.",
                    BooleanValue (false),
-                   MakeBooleanAccessor (&StaWifiMac::SetActiveProbing),
+                   MakeBooleanAccessor (&StaWifiMac::SetActiveProbing, &StaWifiMac::GetActiveProbing),
                    MakeBooleanChecker ())
     .AddTraceSource ("Assoc", "Associated with an access point.",
                      MakeTraceSourceAccessor (&StaWifiMac::m_assocLogger))
@@ -152,6 +152,12 @@
     {
       m_probeRequestEvent.Cancel ();
     }
+  m_activeProbing = enable;
+}
+  
+bool StaWifiMac::GetActiveProbing (void) const
+{
+  return m_activeProbing;
 }
 
 void
@@ -250,8 +256,11 @@
        * We try to initiate a probe request now.
        */
       m_linkDown ();
-      SetState (WAIT_PROBE_RESP);
-      SendProbeRequest ();
+      if (m_activeProbing) 
+        {
+          SetState (WAIT_PROBE_RESP);
+          SendProbeRequest ();
+        }
       break;
     case WAIT_ASSOC_RESP:
       /* we have sent an assoc request so we do not need to
--- a/src/wifi/model/sta-wifi-mac.h	Fri Jun 06 12:43:03 2014 -0700
+++ b/src/wifi/model/sta-wifi-mac.h	Wed Jun 11 20:26:02 2014 -0700
@@ -187,6 +187,7 @@
   EventId m_beaconWatchdog;
   Time m_beaconWatchdogEnd;
   uint32_t m_maxMissedBeacons;
+  bool m_activeProbing;
 
   TracedCallback<Mac48Address> m_assocLogger;
   TracedCallback<Mac48Address> m_deAssocLogger;