Manually Associating and De-Associating AP and Client

817 views
Skip to first unread message

Chinmay Naugaria

unread,
May 15, 2015, 1:39:51 PM5/15/15
to ns-3-...@googlegroups.com
Hello ns3-users,

I am trying to manually associate and de associate a client with a particular AP. I am unable to find the relevant code which say that this client has associated to this AP. Here is the part from sta-wifi-mac.cc which is called on receiving association response from AP. But all I see here is checking of some rate capabilities and supported rates. Which part of this code actually associates the client and AP together?

 else if (hdr->IsAssocResp ())
    {
      if (m_state == WAIT_ASSOC_RESP)
        {
          MgtAssocResponseHeader assocResp;
          packet->RemoveHeader (assocResp);
          if (m_assocRequestEvent.IsRunning ())
            {
              m_assocRequestEvent.Cancel ();
            }
          if (assocResp.GetStatusCode ().IsSuccess ())
            {
              SetState (ASSOCIATED);
              NS_LOG_DEBUG ("assoc completed");
              SupportedRates rates = assocResp.GetSupportedRates ();
              if (m_htSupported)
                {
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
                  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (),htcapabilities);
                }

              for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
                {
                  WifiMode mode = m_phy->GetMode (i);
                  if (rates.IsSupportedRate (mode.GetDataRate ()))
                    {
                      m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
                      if (rates.IsBasicRate (mode.GetDataRate ()))
                        {
                          m_stationManager->AddBasicMode (mode);
                        }
                    }
                }
              if(m_htSupported)
                {
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
                  for (uint32_t i = 0; i < m_phy->GetNMcs(); i++)
                    {
                       uint8_t mcs=m_phy->GetMcs(i);
                       if (htcapabilities.IsSupportedMcs (mcs))
                         {
                           m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
                          //here should add a control to add basic MCS when it is implemented
                         }
                    }
                }
              if (!m_linkUp.IsNull ())
                {
                  m_linkUp ();
                }
            }
          else
            {
              NS_LOG_DEBUG ("assoc refused");
              SetState (REFUSED);
            }
        }
      return;
    }

Ricardo Filho

unread,
May 15, 2015, 3:20:14 PM5/15/15
to ns-3-...@googlegroups.com
Hello Chinmay,

you can see it in the line 556 from sta-wifi-mac.cc: SetState (ASSOCIATED); On this code the station checks if the packet is a association response (line 544), if the current state is WAIT_ASSOC_RESP(line 546) and if the association response is succeed (line 554), so it get associated.

Cheers

Tommaso Pecorella

unread,
May 15, 2015, 4:16:26 PM5/15/15
to ns-3-...@googlegroups.com
Hi,

that is the part processing the reply. Probably what you want is the part where the STA is asking for an association.

Check StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr). It checks if the packet is a beacon and, if it is, it will send an association request (assuming he beacon is ok and the node is not already associated).
The function is called (no wonder) SendAssociationRequest ();

Have fun,

T.

Chinmay Naugaria

unread,
May 16, 2015, 3:12:13 AM5/16/15
to ns-3-...@googlegroups.com
Hello Ricardo and Tommaso,

Thanks for replying. I went through the part you mentioned. It is clear that the particular client got associated. But doesn't some table/database ( or linked list or anything like that ) need to get updated saying that client "ABC" is now associated AP named "XYZ". As in, it not be a global table, it can be some local data field with client that says I am associated to AP "XYZ". I wonder if I have conveyed it properly.

I basically want to keep changing association manually in my code. So I am trying to find the part which labels association with a particular AP.





--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/aw01JC6qBLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
Chinmay Naugaria
Final Year
Dual Degree
Electrical Engineering
IIT Madras
"It is the hottest fire, that forges the hardest steel"

Tommaso Pecorella

unread,
May 16, 2015, 3:18:58 AM5/16/15
to ns-3-...@googlegroups.com
Hi,

such a table should be in the AP, not in the STA. The STA only needs to store the BBSID and the MAC of the AP it is associated with.
Search for RegularWifiMac::SetBssid (Mac48Address bssid)

Hope this helps,

T.

Ricardo Filho

unread,
May 16, 2015, 9:10:36 AM5/16/15
to ns-3-...@googlegroups.com
Hi Chinmay,

search for WifiRemoteStationManager, the ap-wifi-mac.cc use this for manage the associated station. 

Good luck!


Em sexta-feira, 15 de maio de 2015 14:39:51 UTC-3, Chinmay Naugaria escreveu:

Chinmay Naugaria

unread,
May 17, 2015, 8:32:04 AM5/17/15
to ns-3-...@googlegroups.com
This will sound like a very naive question but how do I access SetBssid function for the client STA? Does it work like attributes?
First I should use the GetBssid on the 2 APs and assign it to the STA using SetBssid to manually change association? Have I understood it correctly?





--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/aw01JC6qBLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Chinmay Naugaria

unread,
May 17, 2015, 10:24:55 AM5/17/15
to ns-3-...@googlegroups.com
I am trying something like this for SetBssid but it doesn't compile. I am not able to find an example. Can you correct this for me?

    Config::Set ("/NodeList/3/DeviceList/1/$ns3::WifiNetDevice/Mac/SetBssid", "00::00::00::00::00::09");

I want to finally replace the second argument by what I read from GetBssid on AP. Can you help me out?

Tommaso Pecorella

unread,
May 17, 2015, 11:53:43 AM5/17/15
to ns-3-...@googlegroups.com
Hi,

GetBssid (and SetBssid) are regular functions of RegularWifIMac, and they are inherited by StaWifiMac. You can't use them as you'd do for Attributes.
As I said, you need to write your own code, at the moment there's no explicit support for this functionality.

Hope this helps,

T.

Chinmay Naugaria

unread,
May 17, 2015, 12:42:19 PM5/17/15
to ns-3-...@googlegroups.com
Hi Tommaso,

Can you give me some pointers on how to go about writing my own code for this? I am feeling little lost as to what all I need to write and how to start?

Thanks a lot for helping me out.



Tommaso Pecorella

unread,
May 17, 2015, 5:04:09 PM5/17/15
to ns-3-...@googlegroups.com
Hi,

sorry but I don't know how to help you for real. I'd start by writing a class to manage the change between the APs. Something like the connection manager in Android.
Of course the class will have to access the IP layer (Addresses) and the WiFi interfaces (association and dissociation). However I can't really help much on this... sorry.

Hope this helps,

T.

Chinmay Naugaria

unread,
May 18, 2015, 1:50:04 PM5/18/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I am trying the following ( I was hoping this easier way would work ) :

1. I access the StaWiFiMac using this
Ptr<StaWifiMac> staMac = DynamicCast<StaWifiMac> (myNetDevice.Get(0)->GetMac () );

Here myNetDevice is a NetDeviceContianer.

Now I add this function to sta-wifi-mac.cc and definition to sta-wifi-mac.h :

void
StaWifiMac::PrintHello (void)
{
    NS_LOG_INFO ("Printing Hello");
}

Now, In my script, I write this:
staMac.PrintHello()

I was hoping that if this works, I can do everything I want through this function. But the error I get is StaWiFiMac has no member named PrintHello.

Where else do I need to define this to get this to work?








Chinmay Naugaria

unread,
May 18, 2015, 1:54:58 PM5/18/15
to ns-3-...@googlegroups.com
My bad, Even the GetMac isn't working. Is something wrong with how I am accessing the instance of stawifiac?

I just installed the sta and AP to this net device and sta earlier. ( So I use Get(0) ).

Tommaso Pecorella

unread,
May 18, 2015, 4:04:51 PM5/18/15
to ns-3-...@googlegroups.com
Hi,

perhaps a little bit more care would do.Try this:
Ptr<StaWifiMac> staMac = DynamicCast<StaWifiMac> (DynamicCast<WifiNetDevice> (myNetDevice.Get(0))->GetMac () );

Moreover, "staMac is a Ptr, and it should be used like a pointer. I.e.:
staMac->PrintHello()

Try...

T.


Chinmay Naugaria

unread,
May 19, 2015, 3:21:35 AM5/19/15
to ns-3-...@googlegroups.com
Hey Tommaso, thanks it worked!

Now, I am trying to put it in a schedule it. This doesn't seem to work:

Simulator::Schedule (Seconds (20.0), staMac->PrintHello);

Is it correct?

Tommaso Pecorella

unread,
May 19, 2015, 4:14:50 AM5/19/15
to ns-3-...@googlegroups.com
No, it's not correct. Please study the tutorial and the manual,

Cheers,

T.

Chinmay Naugaria

unread,
May 21, 2015, 2:51:30 PM5/21/15
to ns-3-...@googlegroups.com
Hello Tommaso,

Please correct me if I am wrong. If BSSID of a wireless client is set to say that of AP1, it is equivalent to saying that this client is associated to AP1.Now if I manually set this BSSID to that of AP2, we can say that it is now associated to AP2. How will this affect a routing protocol like say OLSR ? Will routing from a common server node take place through the AP whose BSSID is set for the client?

Tommaso Pecorella

unread,
May 21, 2015, 2:54:39 PM5/21/15
to ns-3-...@googlegroups.com
Hi,

more or less yes, you could say that the node is now associated with AP2, but...
1) this could not work on the long run. What if we decide to implement a real association table and reject packets from non-associated STAs ?
2) the node address must change accordingly.
3) the routing tables have to be recalculated.

It's not that easy :(

T.

Chinmay Naugaria

unread,
May 21, 2015, 3:43:03 PM5/21/15
to ns-3-...@googlegroups.com
Hi,
more or less yes, you could say that the node is now associated with AP2, but...
1) this could not work on the long run. What if we decide to implement a real association table and reject packets from non-associated STAs ?

If I set the state of STA's as 'ASSOCIATED', it should be fine right? You'll ultimately be seeing which nodes have state as this and get their BSSID, if I am correct.
 
2) the node address must change accordingly.

I didn't understand this. Why should I change the client's address?
 
3) the routing tables have to be recalculated.

If I use a proactive routing protocol like OLSR, Will the routing table re-computation be taken care of?

Tommaso Pecorella

unread,
May 21, 2015, 3:55:08 PM5/21/15
to ns-3-...@googlegroups.com
On Thursday, May 21, 2015 at 9:43:03 PM UTC+2, Chinmay Naugaria wrote:
Hi,
more or less yes, you could say that the node is now associated with AP2, but...
1) this could not work on the long run. What if we decide to implement a real association table and reject packets from non-associated STAs ?

If I set the state of STA's as 'ASSOCIATED', it should be fine right? You'll ultimately be seeing which nodes have state as this and get their BSSID, if I am correct.

The list of associated nodes should be in the AP. If you change the AP in the STA, you're not telling the AP that the node is not anymore associated with it (and you're not telling the new AP that a new node is associated with it). 
 
2) the node address must change accordingly.

I didn't understand this. Why should I change the client's address?

Because the two APs should belong to different subnets ? or you want a good ol' routing loop ? 

3) the routing tables have to be recalculated.

If I use a proactive routing protocol like OLSR, Will the routing table re-computation be taken care of?

After the routing table is expired, yes. You'll have a transient period, which can be quite large.


Chinmay Naugaria

unread,
May 21, 2015, 4:22:56 PM5/21/15
to ns-3-...@googlegroups.com
On Fri, May 22, 2015 at 1:25 AM, Tommaso Pecorella <tomm...@gmail.com> wrote:
On Thursday, May 21, 2015 at 9:43:03 PM UTC+2, Chinmay Naugaria wrote:
Hi,
more or less yes, you could say that the node is now associated with AP2, but...
1) this could not work on the long run. What if we decide to implement a real association table and reject packets from non-associated STAs ?

If I set the state of STA's as 'ASSOCIATED', it should be fine right? You'll ultimately be seeing which nodes have state as this and get their BSSID, if I am correct.

The list of associated nodes should be in the AP. If you change the AP in the STA, you're not telling the AP that the node is not anymore associated with it (and you're not telling the new AP that a new node is associated with it). 

I looked at ap-wifi-mac.cc for such a list but I am able to locate it. Is it implemeted as of now? This is the the part testing for association request header.

      else if (hdr->GetAddr1 () == GetAddress ())
        {
          if (hdr->IsAssocReq ())
            {
              // first, verify that the the station's supported
              // rate set is compatible with our Basic Rate set
              MgtAssocRequestHeader assocReq;
              packet->RemoveHeader (assocReq);
              SupportedRates rates = assocReq.GetSupportedRates ();
              bool problem = false;
              for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
                {
                  WifiMode mode = m_stationManager->GetBasicMode (i);
                  if (!rates.IsSupportedRate (mode.GetDataRate ()))
                    {
                      problem = true;
                      break;
                    }
                }
               if (m_htSupported)
                    {//check that the STA supports all MCSs in Basic MCS Set
                      HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
                      for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
                        {
                          uint8_t mcs = m_stationManager->GetBasicMcs (i);
                          if (!htcapabilities.IsSupportedMcs (mcs))
                            {
                              problem = true;
                              break;
                            }
                         }
                     
                     }
              if (problem)
                {
                  // one of the Basic Rate set mode is not
                  // supported by the station. So, we return an assoc
                  // response with an error status.
                  SendAssocResp (hdr->GetAddr2 (), false);
                }
              else
                {
                  // station supports all rates in Basic Rate Set.
                  // record all its supported modes in its associated WifiRemoteStation
                  for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
                    {
                      WifiMode mode = m_phy->GetMode (j);
                      if (rates.IsSupportedRate (mode.GetDataRate ()))
                        {
                          m_stationManager->AddSupportedMode (from, mode);
                        }
                    }
                   if (m_htSupported)
                    {
                      HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
                      m_stationManager->AddStationHtCapabilities (from,htcapabilities);
                      for (uint32_t j = 0; j < m_phy->GetNMcs (); j++)
                       {
                         uint8_t mcs = m_phy->GetMcs (j);
                         if (htcapabilities.IsSupportedMcs (mcs))
                           {
                             m_stationManager->AddSupportedMcs (from, mcs);
                           }
                        }
                     }
                  m_stationManager->RecordWaitAssocTxOk (from);
                  // send assoc response with success status.
                  SendAssocResp (hdr->GetAddr2 (), true);
                }
              return;
            }

 Am I looking at the correct place or this list is somewhere else?


 
2) the node address must change accordingly.

I didn't understand this. Why should I change the client's address?

Because the two APs should belong to different subnets ? or you want a good ol' routing loop ? 

Alright, I have put two interfaces on client for testing right now. I'll try to putting one interface and changing the address.
 

3) the routing tables have to be recalculated.

If I use a proactive routing protocol like OLSR, Will the routing table re-computation be taken care of?

After the routing table is expired, yes. You'll have a transient period, which can be quite large.


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/aw01JC6qBLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
May 21, 2015, 4:41:14 PM5/21/15
to ns-3-...@googlegroups.com
I said "on the long run". IF we decide to implement a real association process, your code will fail. You'll be bound to use an outdated ns-3 version, etc.
Right now there's no associated STAs list in the AP.

T.

Chinmay Naugaria

unread,
May 23, 2015, 5:17:39 PM5/23/15
to ns-3-...@googlegroups.com
Hello Tommaso,
I learnt how to change a node's IP address but I have a small confusion here.
Earlier I was having different wifi helper, phy,mac and channel helper for the two interfaces installed on the client. I basically did this for each set of AP and corresponding interface on client: (MobileDevice1 and AP1 are WifiNetDevices)

WifiHelper wifi1;
     
  wifi1.SetStandard (WIFI_PHY_STANDARD_80211g);
  YansWifiPhyHelper phy1 =  YansWifiPhyHelper::Default ();
  phy1.Set ("RxGain", DoubleValue (0) );
  phy1.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
   
  YansWifiChannelHelper channel1;
  channel1.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
  channel1.AddPropagationLoss ("ns3::FriisPropagationLossModel");
  phy1.SetChannel (channel1.Create ());
  phy1.Set ("ChannelNumber", UintegerValue (1) ); 
  NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
  wifi1.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                   "DataMode",StringValue (phyMode),
                                   "ControlMode",StringValue (phyMode));
     
  Ssid ssid = Ssid ("ns-3-ssid");
  mac.SetType ("ns3::StaWifiMac","Ssid", SsidValue (ssid),"ActiveProbing", BooleanValue (false));

  MobileDevice1.Add(wifi1.Install(phy1,mac,c.Get(3)));

  mac.SetType ("ns3::ApWifiMac","Ssid", SsidValue (ssid),"BeaconGeneration", BooleanValue (true),"BeaconInterval", TimeValue     (Seconds (2.5)));
    AP1 = wifi1.Install(phy1,mac,c.Get(1)); //Add the mobile devices
   

So using different helper and mac I had  installed AP2 and the 2nd interface on client and simulation worked fine.

Now when I tried use to use the same helpers for second AP and interface 2 ( MobileDevice2 and AP2 are WifiNetDevices ) , the simulation doesn't work as expected.
This is what I do in continuation to above code using same helpers

  mac.SetType ("ns3::StaWifiMac","Ssid", SsidValue (ssid),"ActiveProbing", BooleanValue (false));

  MobileDevice2.Add(wifi1.Install(phy1,mac,c.Get(3)));

  mac.SetType ("ns3::ApWifiMac","Ssid", SsidValue (ssid),"BeaconGeneration", BooleanValue (true),"BeaconInterval", TimeValue     (Seconds (2.5)));
    AP2 = wifi1.Install(phy1,mac,c.Get(2)); //Add the mobile devices
   
    MobileDevice2.Add(AP2.Get(0));

Is something wrong when I do this ? Because when I will use different helpers for different APs and change the IP address on the single interface on the client, won't it affect the data flow based on what mac and phy client was installed on (the one corresponding to AP1 or the one corresponding to AP2)?




Tommaso Pecorella

unread,
May 23, 2015, 5:42:27 PM5/23/15
to ns-3-...@googlegroups.com
Hi,

you asked for association and dissociation. I thought you was using a single NetDevice on the STA, and you was trying to change the AP this NetDevice is associated with.
If you have two NetDevices on the STA, you have a completely different setup and scenario.

I'd strongly suggest to double check your scenario and how to simulate it.
Moreover, as I said earlier, "it's not that easy". Changing the IP address (which is mandatory when you re-asociate) will break any ongoing TCP connection. I bet you didn't think to this...

T.

Chinmay Naugaria

unread,
May 28, 2015, 11:34:23 AM5/28/15
to ns-3-...@googlegroups.com
Hello Tommaso,

I managed to have a single IP address on client and change it dynamically during runtime. But when I do UDP data transfers from a common server node connected to both the APs ( I am not changing IP address in middlle of connection as of now ) using OLSR the data transfer doesnt seem to happen. The information on link  here : https://www.nsnam.org/docs/release/3.13/models/html/routing-overview.html says that OLSR doesnt respond to dynamic changes in IP addresses as of now. Is there some other routing protocol I can use for this purpose (one which can also take care of mobile clients unlike Ipv4 Global Routing Helper ) ?

Chinmay Naugaria

unread,
May 28, 2015, 11:37:25 AM5/28/15
to ns-3-...@googlegroups.com
I forgot to mention, I change the AP to which the client is associated to as well so that data transfer can take place.

Tommaso Pecorella

unread,
May 28, 2015, 3:18:58 PM5/28/15
to ns-3-...@googlegroups.com
Hi,

please use the latest documentation, not one from TEN releases ago. Still, that description is still valid. But you have read it wrong.
OLSR doesn't react to the IP / interfaces changes in the node, but it will react to loss of connectivity (no more replies from neighbors). This means that it will be slower to react to your changes. Well, it should. I never tested it.
You can also try DSR or AODV.
About why the nodes don't talk to each other... no idea.

Have fun,

T.

Chinmay Naugaria

unread,
May 28, 2015, 4:28:20 PM5/28/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I am trying to use static routing along with OLSR to get this working. I have put the following piece of code as I saw in some example:

  OlsrHelper olsr;

  Ipv4StaticRoutingHelper staticRouting;

  Ipv4ListRoutingHelper list;
  list.Add (staticRouting, 0);
  list.Add (olsr, 10);

For changing the ip and assign a new route I use the following function:

void ObtainNewIpAddress1(NodeContainer node_container)
{

     Ipv4StaticRoutingHelper ipv4RoutingHelper;


     Ptr<Node> node = node_container.Get(3); // 3 is the client
     Ptr <Ipv4> ipv4 = node->GetObject<Ipv4> ();
   
     // cout<<ipv4->GetAddress(2,0)<<endl;

     int32_t interface_id = ipv4->GetInterfaceForAddress(Ipv4Address("10.1.3.2"));//old ip on client

     ipv4->RemoveAddress(interface_id,0);

     ipv4->AddAddress(interface_id,Ipv4InterfaceAddress("10.1.4.2","255.255.255.0"));//new ip

     Ptr<Ipv4StaticRouting> staticRouting_n0 = ipv4RoutingHelper.GetStaticRouting (ipv4);

     while (staticRouting_n0->GetNRoutes() > 1) staticRouting_n0->RemoveRoute(1); //delete the old routes

     staticRouting_n0->SetDefaultRoute(Ipv4Address ("10.1.4.1"),2);  //10.1.4.1 is the address ap to which I associated the client
}

Does this seem to correct to you? I am unable to get the data transfer to happen after I change the association to new AP. (The code compiles fine and data tranfer before changing ip takes place as it should )




Tommaso Pecorella

unread,
May 28, 2015, 4:49:26 PM5/28/15
to ns-3-...@googlegroups.com
Hi,

stupid question maybe... the apps. Do they know of the new address ?

T.

Chinmay Naugaria

unread,
May 28, 2015, 5:46:41 PM5/28/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I was earlier using a dummy CSMA ip for destination. But now I changed it to the actual interface id and it still doesn't transfer data. I am attaching the script if you could look at it.

The function GetBssidValue() is added in ap-wifi-mac.cc and returns Bssid of AP and SetNewAssociation is in sta-wifi-mac.cc which associates client to new AP. (Functions defined by me)

I have two apps, one for data transfer before changing association and one after.

changeaddress1.cc

Chinmay Naugaria

unread,
May 29, 2015, 1:17:04 PM5/29/15
to ns-3-...@googlegroups.com
Hi Tommaso,

I also tried putting everything on the same subnet ( the 2 Aps and the client ) so that I wouldn't need to change Ip address of the client, but the data transfer still doesn't happen. ( I used OLSR )

Any alternative you can suggest?


Tommaso Pecorella

unread,
May 29, 2015, 1:21:09 PM5/29/15
to ns-3-...@googlegroups.com
Hi,

sorry but I have no idea. Try checking the routing tables and where the packet is lost (if it's not sent, or if it's dropped by an intermediate node). Wireshark and traces can help.

T.

Chinmay Naugaria

unread,
May 29, 2015, 2:48:42 PM5/29/15
to ns-3-...@googlegroups.com
Hi Tommaso,

When everything is on same subnet, for the second connection (the one after association change), I see only couple of UDP packets being sent to AP1 from server node ( the packets were supposed to go to AP2). So, I can assume that routing is happening to subnet and not the actual location. So, everything on same subnet probably wouldn't work.

When I have two different subnets for each AP, the data transfer doesn't take place from the source to AP2 at all (neither to AP1). So, I believe I didn't upgrade the routes properly after changing the association and IP address?

Here is what I wrote as a function for that (I posted it earlier ):

void ObtainNewIpAddress1(NodeContainer node_container)
{

     Ipv4StaticRoutingHelper ipv4RoutingHelper;


     Ptr<Node> node = node_container.Get(3); // 3 is the client
     Ptr <Ipv4> ipv4 = node->GetObject<Ipv4> ();
   
     // cout<<ipv4->GetAddress(2,0)<<endl;

     int32_t interface_id = ipv4->GetInterfaceForAddress(Ipv4Address("10.1.3.2"));//old ip on client

     ipv4->RemoveAddress(interface_id,0);

     ipv4->AddAddress(interface_id,Ipv4InterfaceAddress("10.1.4.2","255.255.255.0"));//new ip

     Ptr<Ipv4StaticRouting> staticRouting_n0 = ipv4RoutingHelper.GetStaticRouting (ipv4);

     while (staticRouting_n0->GetNRoutes() > 1) staticRouting_n0->RemoveRoute(1); //delete the old routes

     staticRouting_n0->SetDefaultRoute(Ipv4Address ("10.1.4.1"),2);  //10.1.4.1 is the address of ap to which I associated the client
}


Is the static routing part I have put correct?



Chinmay Naugaria

unread,
May 30, 2015, 2:58:04 PM5/30/15
to ns-3-...@googlegroups.com
Hi Tomasso,

I tried using global routing helper instead of OLSR, I get the following error .

aborted. cond="!(networkHere == networkThere)", msg="GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion", file=../src/internet/model/global-router-interface.cc, line=843

the error is without even without having any association change ( Just assigning one subnet to ap and client and another subnet to the other ap  and doing data transfer from server to client)

You said on this post that bug has been fixed:
https://groups.google.com/forum/#!searchin/ns-3-users/networkhere$20networkthere/ns-3-users/0e2n4OpzaZ8/cG7B-WyTGy0J

but I still get the error.

Is there some way out to fix this?










Chinmay Naugaria

unread,
May 30, 2015, 2:59:08 PM5/30/15
to ns-3-...@googlegroups.com
With two interface of client things were fine, the error comes when I have one interface on client.

Diogo Magalhães Martins

unread,
Aug 24, 2015, 8:54:49 AM8/24/15
to ns-3-users
Chimney, 
Would you mind sharing your SetNewAssociation implementation ? I'm trying to accomplish something like that in my simulation and i'm having a hard time doing that.

Chinmay Naugaria

unread,
Aug 25, 2015, 1:16:03 AM8/25/15
to ns-3-...@googlegroups.com
Hi Diogo, 

Give me a day. Will have to dig it in my old laptop.


(Pt-BR) Antes de imprimir, pense se realmente é necessário. Pense em seu compromisso com o Meio Ambiente. Nós preservamos o Meio Ambiente! E você? A UNIRIO não envia e-mails que solicitem senhas, dados bancários, informações pessoais, cadastramento ou recadastramento em sistemas. Cuidado, tais solicitações são fraudulentas. Caso você receba alguma mensagem desse tipo, não abra os arquivos anexos, não acione os links nela indicados e não siga nenhuma instrução. Também não preencha formulários ou envie qualquer tipo de informação. Esta mensagem pode conter informação confidencial ou privilegiada, sendo seu sigilo protegido por lei. Se você não for o destinatário ou a pessoa autorizada a receber esta mensagem, não pode usar, copiar ou divulgar as informações nela contidas ou tomar qualquer ação baseada nessas informações. Se você recebeu esta mensagem por engano, por favor, avise imediatamente ao remetente, respondendo o e-mail e em seguida apague-a. Agradecemos sua cooperação.

(EN) Before printing, think about whether it is really necessary. Think about your commitment to the environment. We preserve the environment! And you? UNIRIO does not send emails requesting passwords, banking information, personal information, registration or re-registration systems. Care, such requests are fraudulent. If you receive such a message, do not open any attachments, do not activate the links contained therein and not follow any instructions. Nor fill forms or submit any information. This message may contain confidential or privileged information and its confidentiality is protected by law. If you are not the addressed or authorized person to receive this message, you must not use, copy, disclose or take any action based on it or any information herein. If you have received this message by mistake, please advise the sender immediately by replying the e-mail and then deleting it. Thank you for your cooperation.

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/aw01JC6qBLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Diogo Magalhães Martins

unread,
Aug 26, 2015, 7:52:55 AM8/26/15
to ns-3-users
Thanks a lot! It will be of a great help :)

Chinmay Naugaria

unread,
Aug 27, 2015, 2:58:45 PM8/27/15
to ns-3-...@googlegroups.com
Hi Diogo,

This is what I had written:
void StaWifiMac::SetNewAssociation (Mac48Address Addr)
{
      m_linkDown ();
      SetState (WAIT_ASSOC_RESP);
      SetBssid(Addr);
      SendAssociationRequest ();
      if (!m_linkUp.IsNull ())
      {
            m_linkUp ();
      }
}

The parameter passed is the MAC address of the AP which the Station wants to attach to.

Diogo Magalhães Martins

unread,
Aug 28, 2015, 10:39:18 AM8/28/15
to ns-3-users
Thanks a lot for your help Chinmay !!!

J.Bukhari

unread,
Jan 14, 2016, 7:10:27 AM1/14/16
to ns-3-users
Dear Chinmay,

I want to associate a STA with an AP in a scenario where I am not having more than one STA or AP. Now if I call StaWifiMac::StartActiveAssociation() or any other function of this file, m_linkDown, m_phy, m_stationManager etc. have null value. I am unable to resolve the issue. As discussed in this post (https://www.nsnam.org/bugzilla/show_bug.cgi?id=1060#c6), i resolved the issue with m_linkDown. But I couldn't correct the issue of GetSupportedRates. 

I am new to NS3 but somehow I can see CompleteConfig of WifiNetDevice is called later and StaWifiMac is using it before the pointers are getting any value (I might be wrong). In my case, if i explicitely call any function of StaWifiMac, only then its accessing null pointers. Please guide me. Thanks.  

Mohammed Dahhani

unread,
May 14, 2018, 5:33:35 AM5/14/18
to ns-3-users
Hi Chinmay,

I'm working on a very similar scenario too: I want to have control on which AP my STA should associate to throughout the run.

Have made any progress on your specific issue ?
If so, would you please share with us how you did it

Mohammed
Reply all
Reply to author
Forward
Message has been deleted
0 new messages