I am recently simulating a algorithm, it requires the fixed roouting in wifi ad-hoc. However, OLSR, AODV routing protocols will select a new route if I change the txpower during simulation. So I want the routes to be fixed. If I use the chain topology, the packet should send on by one.
I am tring to use static routing in wifi, but it has a run-time error, after I dubug it, it showed:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004249c7 in ns3::PeekPointer<ns3::NetDevice> (p=...) at ./ns3/ptr.h:281
I previously used the OLSR, it run correctly. I am looking for help!
I want to creat the routes of two flows:, tcp n0->n3, n2->n5, following is the key part of routing:
......
......
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, c);
..........
.........
Ipv4StaticRoutingHelper staticRoutingHelper;
Ipv4ListRoutingHelper listRouting;
listRouting.Add (staticRoutingHelper, 0);
InternetStackHelper stack;
stack.SetRoutingHelper (listRouting);
stack.Install (c);
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (staDevices);
Ptr<Ipv4StaticRouting> staticRoutingA = staticRoutingHelper.GetStaticRouting (ipv4A);
Ptr<Ipv4StaticRouting> staticRoutingB = staticRoutingHelper.GetStaticRouting (ipv4B);
Ptr<Ipv4StaticRouting> staticRoutingC = staticRoutingHelper.GetStaticRouting (ipv4C);
Ptr<Ipv4StaticRouting> staticRoutingD = staticRoutingHelper.GetStaticRouting (ipv4D);
Ptr<Ipv4StaticRouting> staticRoutingE = staticRoutingHelper.GetStaticRouting (ipv4E);
Ptr<Ipv4StaticRouting> staticRoutingF = staticRoutingHelper.GetStaticRouting (ipv4F);
//N0->N3
staticRoutingA->AddHostRouteTo (Ipv4Address ("10.1.1.4"), Ipv4Address ("10.1.1.2"), 1);//The ifIndex for this outbound route is 1;loopback is 0
staticRoutingB->AddHostRouteTo (Ipv4Address ("10.1.1.4"), Ipv4Address ("10.1.1.3"), 2);
staticRoutingC->AddHostRouteTo (Ipv4Address ("10.1.1.4"), Ipv4Address ("10.1.1.4"), 1);
staticRoutingD->AddHostRouteTo (Ipv4Address ("10.1.1.4"), Ipv4Address ("10.1.1.4"), 0);
//N3->N0
staticRoutingD->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.1.3"), 1);
staticRoutingC->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.1.2"), 2);
staticRoutingB->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.1.1"), 1);
staticRoutingA->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.1.1"), 0);
//N2->N5
staticRoutingC->AddHostRouteTo (Ipv4Address ("10.1.1.6"), Ipv4Address ("10.1.1.4"), 1);
staticRoutingD->AddHostRouteTo (Ipv4Address ("10.1.1.6"), Ipv4Address ("10.1.1.5"), 2);
staticRoutingE->AddHostRouteTo (Ipv4Address ("10.1.1.6"), Ipv4Address ("10.1.1.6"), 1);
staticRoutingD->AddHostRouteTo (Ipv4Address ("10.1.1.6"), Ipv4Address ("10.1.1.6"), 0);
//N5->N2
staticRoutingF->AddHostRouteTo (Ipv4Address ("10.1.1.3"), Ipv4Address ("10.1.1.5"), 1);
staticRoutingE->AddHostRouteTo (Ipv4Address ("10.1.1.3"), Ipv4Address ("10.1.1.4"), 2);
staticRoutingD->AddHostRouteTo (Ipv4Address ("10.1.1.3"), Ipv4Address ("10.1.1.3"), 1);
staticRoutingC->AddHostRouteTo (Ipv4Address ("10.1.1.3"), Ipv4Address ("10.1.1.3"), 0);
......