Hi,
I want to use AODV protocol to simulate some selfish/malicious(Drop packets with some probability/drop all the packets) nodes in a MANET.
I have gone through
this thread and came up with following. Source files are also attached.
--- aodv-routing-protocol.h
Added a boolean field IsMalicious along with getters and setters.
--- aodv-routing-protocol.cc
In RoutingProtocol::GetTypeId(void) method, I've added
.AddAttribute("IsMalicious", "Is the node malicious",
BooleanValue(false),
MakeBooleanAccessor(&RoutingProtocol::SetMaliciousEnable,
&RoutingProtocol::GetMaliciousEnable),
MakeBooleanChecker())
And at the end of RoutingProtocol::RouteInput(...) method,
if (GetMaliciousEnable()) {
std::cout << "---Malcious Node: Packet dropped\n";
return false;
}
else {
// Forwarding
return Forwarding(p, header, ucb, ecb);
}
I just wanna drop the packet if the node is malicious.
As the simulation script I've used the example "manet-routing-compare.cc" and tweaked it.
-Made AODV as the protocol by setting "m_protocol(2)" in the RoutingExperiment::RoutingExperiment() constructor.
In the script's RoutingExperiment::Run(..) method, I have 3 node containers(One for all nodes, one for malicious, one for good nodes).
Then I created 2 AodvHelpers. First one create good nodes. On the second helper I'm calling Set("IsMalicious", BooleanValue(true)).
Then on the "InternetStackHelper" I'm calling,
internet.SetRoutingHelper(aodv);
internet.Install(goodNodes);
internet.SetRoutingHelper(maliciousAodv);
internet.Install(malNodes);
After all I'm not getting the "---Malcious Node: Packet dropped" message. And there's no increase no. of packets dropped in the FlowMonitor output either.
Can someone help me to figure out the issue here.
Thanks!