Internet stack over lr-wpan

280 views
Skip to first unread message

Filipe R. Freitas

unread,
Feb 19, 2014, 12:20:35 PM2/19/14
to ns-3-...@googlegroups.com
Hi all,
this happened while trying to implement static routing over lr-wpan. I started with the lr-wpan-data.cc example and tried to implement the internet stack but got the error bellow.

Any suggestions?

Thanks for the help



From gdb:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77b2fe6 in ns3::PeekPointer<ns3::Ipv4> (p=...) at ./ns3/ptr.h:281 

Code (simplified):

#include "ns3/log.h"
#include "ns3/core-module.h"
#include "ns3/lr-wpan-module.h"
#include "ns3/propagation-loss-model.h"
#include "ns3/simulator.h"
#include <ns3/single-model-spectrum-channel.h>
#include <ns3/constant-position-mobility-model.h>
#include <iostream>
#include "ns3/network-module.h"
#include "ns3/internet-module.h"

using namespace ns3;

int main (int argc, char *argv[])
{
  bool verbose = false;

  CommandLine cmd;
  cmd.AddValue ("verbose", "turn on all log components", verbose);
  cmd.Parse (argc, argv);

  LrWpanHelper lrWpanHelper;
  if (verbose)
    {
      lrWpanHelper.EnableLogComponents ();
    }

  // Create 2 nodes, and a NetDevice for each one
  Ptr<Node> n0 = CreateObject <Node> ();
  Ptr<Node> n1 = CreateObject <Node> ();

  Ptr<LrWpanNetDevice> dev0 = CreateObject<LrWpanNetDevice> ();
  Ptr<LrWpanNetDevice> dev1 = CreateObject<LrWpanNetDevice> ();

  dev0->SetAddress (Mac16Address ("00:01"));
  dev1->SetAddress (Mac16Address ("00:02"));

  // Each device must be attached to the same channel
  Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel> ();
  Ptr<LogDistancePropagationLossModel> propModel = CreateObject<LogDistancePropagationLossModel> ();
  channel->AddPropagationLossModel (propModel);

  dev0->SetChannel (channel);
  dev1->SetChannel (channel);

  // To complete configuration, a LrWpanNetDevice must be added to a node
  n0->AddDevice (dev0);
  n1->AddDevice (dev1);

  // Internet Stack
  NodeContainer n0n1 = NodeContainer(n0, n1);

  NetDeviceContainer devices01 = lrWpanHelper.Install(n0n1);

  Ipv4AddressHelper ipv4;
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer interfaces01 = ipv4.Assign (devices01);

  std::cout << "Address = " << interfaces01.GetAddress(0,0) << std::endl;

  Simulator::Run ();

  Simulator::Destroy ();
  return 0;
}


Tommaso Pecorella

unread,
Feb 19, 2014, 3:55:47 PM2/19/14
to ns-3-...@googlegroups.com
Hi,

the current lr-wpan model isn't able to support IPv4 or IPv6. There's a patch under review to enable them, but, as I said, it's still under review. The problem is in the LrWpanNetDevice and its helper.

Another problem you might face, however, is about IPv4. I never tested IPv4 on top of LrWpanNetDevice, but one thing is sure: you have to be totally sure that just ONE protocol is used. This is due to an 802.15.4 limitation. If you try to use both IPv4 and IPv6, the system will crash.

Based on this, I'd strongly suggest to use 6LoWPAN and IPv6, as they have been tested and they're working (unless somebody finds a bug).

Cheers,

T.

Filipe R. Freitas

unread,
Feb 20, 2014, 10:26:47 AM2/20/14
to ns-3-...@googlegroups.com
Hi again,
I will try that.

Another question: is there anyway to simulate a multi hop scenario, given the current implementation of lr-wpan, but without the use of IPs? Like some sort of flooding based on some ned device ID?

Thanks again.

Tommaso Pecorella

unread,
Feb 20, 2014, 3:42:19 PM2/20/14
to ns-3-...@googlegroups.com
Hi,

not at the moment. You should handle it at L2.5, by defining a shim layer to forward packets. Use SixLowPan as an example of a shim layer. Then add your logic there.

Mind that simply re-broacasting all the packets you receive is definitely a BAD idea. Even the most stupid flooding algorithm have a way to prevent forwarding a packet that have been just forwarded. if you don't add this logic, even 2 nodes will start an endless ping-pong.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages