--disLte in dce-mptcp-lte-wifi.cc for multiple clients

96 views
Skip to first unread message

SmartBoy

unread,
Nov 14, 2015, 6:05:06 PM11/14/15
to ns-3-users
Hi,
I am working on the DCE (ns-3-dce) example ns-3-dce/example/dce-mptcp-lte-wifi.cc. In the original program, there is one server and one client. I modified the code dynamic for multiple clients. The code works fine except one portion and that is the case when LTE is disabled i.e. --disLte=1. The program build is successful but it doesn't give output in wifi files.

The code portion is like this:
if (disLte)
        {
          cmd_oss.str ("");
          cmd_oss << "route add default via " << if1.GetAddress (1, 0) << " dev sim" 
                  << devices1.Get (0)->GetIfIndex ();
          LinuxStackHelper::RunIp (nodes.Get (0), Seconds (0.1), cmd_oss.str ().c_str ());
        }

I modified it to:
uint32_t devices[n], interfaces[n];
for (uint32_t i=0; i<number_of_client_nodes; i++)
{
if (disLte)
        {
          cmd_oss.str ("");
          cmd_oss << "route add default via " << if1.GetAddress (1, 0) << " dev sim" 
                  << devices[i].Get (i)->GetIfIndex ();
          LinuxStackHelper::RunIp (nodes.Get (0), Seconds (0.1), cmd_oss.str ().c_str ());
        }
}


I am not getting the dev sim << devices[i].Get (i) -> GetIfIndex() right. Kindly explain this portion of code a bit and correct me.


Regards,
B

Tommaso Pecorella

unread,
Nov 14, 2015, 6:41:38 PM11/14/15
to ns-3-users
Seriously, WE should explain to YOU what YOU did write ?
What's the next step, shall we come there and explain also what you're thinking ?

I don't want to be rude, but you must really read a primer about C (not even C++, plain C) and read the ns-3 API documentation before writing code. We're not here to fix code that is written just smashing together instructions that could do the job just because they seems to have the right name.

T.

Hajime Tazaki

unread,
Nov 23, 2015, 6:42:56 PM11/23/15
to ns-3-...@googlegroups.com

At Sat, 14 Nov 2015 15:05:05 -0800 (PST),
SmartBoy wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (7bit)>]
> Hi,
> I am working on the DCE (ns-3-dce) example ns-3-dce/example/
> dce-mptcp-lte-wifi.cc
> <https://github.com/direct-code-execution/ns-3-dce/blob/master/example/dce-mptcp-lte-wifi.cc>.
> In the original program, there is one server and one client. I modified the
> code dynamic for multiple clients. The code works fine except one portion
> and that is the case when LTE is disabled i.e. --disLte=1. The program
> build is successful but it doesn't give output in wifi files.
>
> The code portion is like this:
>
>
>
>
>
>
>
> *if (disLte) { cmd_oss.str (""); cmd_oss << "route
> add default via " << if1.GetAddress (1, 0) << " dev sim"
> << devices1.Get (0)->GetIfIndex (); LinuxStackHelper::RunIp
> (nodes.Get (0), Seconds (0.1), cmd_oss.str ().c_str ()); }*
> I modified it to:
> uint32_t devices[n], interfaces[n];
>
>
>
>
>
>
>
>
>
> *for (uint32_t i=0; i<number_of_client_nodes; i++){if (disLte)
> { cmd_oss.str (""); cmd_oss << "route add default via "
> << if1.GetAddress (1, 0) << " dev sim" << devices[i].Get
> (i)->GetIfIndex (); LinuxStackHelper::RunIp (nodes.Get (0),
> Seconds (0.1), cmd_oss.str ().c_str ()); }}*
>
> I am not getting the *dev sim << devices[i].Get (i) -> GetIfIndex()* right.
> Kindly explain this portion of code a bit and correct me.

it looks like devices[n] is not properly generated and can't
find the device to configure the route.

please make it sure how you generated devices[n].

-- Hajime

Ahmad

unread,
Nov 24, 2015, 12:07:38 AM11/24/15
to ns-3-users
Sir thanks for the reply. 
I have modified it in a way that the NetDeviceContainer wifidevices stores the netdevices of all the nodes. and then I access them using the Get method like wifidevices.Get (0) to get the netdevice of the first node (Node 0) and so on...But it didn't work. Can you please have a look at the code lines below and tell me what can be the problem.

 NetDeviceContainer wifidevices = WifiHelper.Install (PhyHelper, macHelper, NodeContainer (nodes, routers.Get (0)));

      for (uint32_t i=0; i < nNodes; i++)
      {
      // Assign ip addresses
      wifiinterface[i] = address[i].Assign (wifidevices.Get (i));
      address[i].NewNetwork ();
  *****************Code Omitted***********************
      }

      // Global default route
         for (uint32_t i=0; i < nNodes; i++)
         {
          cmd_oss.str ("");
          cmd_oss << "route add default via " << wifiinterface[i].GetAddress (1, 0) << " dev sim"
                  << wifidevices.Get (i)->GetIfIndex ();
          LinuxStackHelper::RunIp (nodes.Get (i), Seconds (0.1), cmd_oss.str ().c_str ());
        }
The program builds successfully but gives an error in the end. 
'build' finished successfully (2.975s)
Command ['/home/ahmad/mptcp/arch/sim/test/buildtop/source/ns-3-dce/build/bin/dce-mptcp-lte-wifi'] terminated with signal SIGSEGV.

MJ

unread,
Jun 18, 2016, 6:16:24 PM6/18/16
to ns-3-...@googlegroups.com




Hi,

I have got this error:

lab123@engEE-e123-d06:~/mptcp/arch/sim/test/buildtop/source/n
s-3-dce$ ./waf
--run dce-mptcp-lte-wifi
Waf: Entering directory
`/home/lab123/mptcp/arch/sim/test/buildtop/source/ns-3-dce/build'

--------------------------------------------------------------------
Python bindings compilation
--------------------------------------------------------------------
[ 10/375] lib/pkgconfig/libns3-dev-netlink-debug.pc: ->
build/lib/pkgconfig/libns3-dev-netlink-debug.pc
[119/375] lib/pkgconfig/libns3-dev-dce-debug.pc: ->
build/lib/pkgconfig/libns3-dev-dce-debug.pc
Waf: Leaving directory
`/home/lab123/mptcp/arch/sim/test/buildtop/source/ns-3-dce/build'
'build' finished successfully (0.491s)
Command
['/home/lab123/mptcp/arch/sim/test/buildtop/source/ns-3-dce/build/bin/
dce-mptcp-lte-wifi']
terminated with signal SIGSEGV. Run it under a debugger to get more
information (./waf --run <program> --command-template="gdb --args %s <args>").


Do you have any suggestion how I solve it.


Thank you,
MJ




Konstantinos

unread,
Jun 19, 2016, 2:18:39 PM6/19/16
to ns-3-users, mijanur...@siu.edu
Hi,

The output of your terminal is the best suggestion we can give:

Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>"). 

Regards,
K
Reply all
Reply to author
Forward
0 new messages