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;
}