How to set up some selfish/malicious node

1,537 views
Skip to first unread message

Hacken

unread,
Jun 16, 2011, 11:17:30 AM6/16/11
to ns-3-users
Hi All,

I am using AODV routing in a wireless ad hoc network. I would like to
set up some nodes in the network to be selfish. That is, they drop
data packets based on a preset probability.

Currently, all the nodes are forwarding packets in my program. I have
no idea on how to implement selfish node (packet drop) . Any
suggestion will be appreciated.

Thanks a lot!

Regards,
Huanyu

NSimidjievski

unread,
Jun 16, 2011, 8:02:15 PM6/16/11
to ns-3-...@googlegroups.com
Hi,

You could do that by adding a custom attribute in the source code that will be a bool variable (i.e. IsSelfish).
 After that you will implement your "selfish" behavior in the code in if-then-else clause (i.e. if its true droppacket code, if its false the normal code).
In the simulation script you will be able to add this attribute to the desired node and it will  be malicious. There you go!

Regards,
Nikola

Lalith Suresh

unread,
Jun 17, 2011, 5:39:05 AM6/17/11
to ns-3-...@googlegroups.com
To add to what Nikola said, look into the RouteInput() method of the aodv::RoutingProtocol class (src/aodv/model/aodv-routing-protocol.cc).
 
Thanks a lot!

Regards,
Huanyu

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Lalith Suresh
Department of Computer Science and Engineering
Instituto Superior Técnico
www.lalith.in

Mukul Shukla

unread,
Jun 19, 2011, 12:53:47 PM6/19/11
to ns-3-users
Dear All,

I am also trying to create malicious nodes which behave selfishly in
my simulation. What about the idea of duplicating the AODV code into
new protocol, say SelfishAODV? Without modifications this protocol
will work very similar to AODV protocol. Now, I can hack the AODV code
and change the behavior of the code to be selfish. In the simulation
scenario, I can choose to put the SelfishAODV protocol on some of the
nodes, which will make that corresponding node to behave selfishly.
Can anybody comment on this?

The problem is that it is easy to understand than to actually
implement it on ns3 (or for that matter on any other simulator). The
problems I am facing are as under:

1. Inspite of reading the Manuals and the Tutorials, I am not able to
simulate and analyze a 25/50 Node MANET using AODV protocol. The
problem is the statistics collected at the end of the simulation. One
has to learn the complicated mechanism of Source/Sinks to collect the
enough statistics to analyze the protocol. This shifts attention from
simulation to programming.
2. How to duplicate the code of the AODV protocol to a new protocol
(SelfishAODV)? I couldn't find the help on the topic of adding a new
protocol.
3. Where to find the documentation for the code of the AODV protocol?
4. How to specify the new SelfishAODV routing for some of the nodes?

It would be a great help to us if somebody can elaborate and comment
on the queries. As I am new to ns3, a detailed answer would be highly
appreciated.

Thanking you.

Mukul

On Jun 17, 2:39 pm, Lalith Suresh <suresh.lal...@gmail.com> wrote:
> *Instituto Superior Técnico*www.lalith.in

NSimidjievski

unread,
Jun 19, 2011, 7:36:16 PM6/19/11
to ns-3-...@googlegroups.com
Hi,

First of all, copying the whole code into a new one and then making all the necessary changes for binding is too much work, I think the first solution (by adding custom attributes) is simpler and already working (believe me, I've tried it). Having said that...
1. I don't quite understand what is your question.
2. There is no need for creating new SelfishAODV protocol
3. The code for the AODV is done by the RFC 3561
4. Setting some of the nodes to be selfish can be done by adding the "selfish" attribute to the desired nodes
    More precisely, you will create 2 AODVHelper objects and 2 stacks (one for the selfish nodes and one for the good ones), then you will set your SELFISH attribute to true (for the selfish nodes) and vice versa. Every node created by the Selfish Helper will be malicious, and every other will be "good" node.

Hope this helps,
Regards,
Nikola

Adhocwireless

unread,
Jul 25, 2011, 9:42:32 AM7/25/11
to ns-3-users
Hello friends,

Is there a difference in behaviour between selfish and malicious
nodes?

If someone knows, can that be explained?

Best Regards


On Jun 19, 4:36 pm, NSimidjievski <nikola.simidziev...@gmail.com>
wrote:

Lalith Suresh

unread,
Jul 25, 2011, 10:48:56 AM7/25/11
to ns-3-...@googlegroups.com
Hello,

On Mon, Jul 25, 2011 at 7:12 PM, Adhocwireless <anoopt...@gmail.com> wrote:
Hello friends,

Is there a difference in behaviour between selfish and malicious
nodes?

If someone knows, can that be explained?


Being selfish is a type of malicious activity in MANETs. For instance, a node can refuse to forward packets in order to save energy. The term 'malicious' can mean a lot of things: corrupting routing tables of other nodes, hogging the channel unnecessarily, being selfish, routing protocol DoS, and so forth.

There are *MANY* papers out there on MANET security. Have a look through some of the survey papers to get a feel of things.
 
Best Regards


On Jun 19, 4:36 pm, NSimidjievski <nikola.simidziev...@gmail.com>
wrote:
> Hi,
>
> First of all, copying the whole code into a new one and then making all the
> necessary changes for binding is too much work, I think the first solution
> (by adding custom attributes) is simpler and already working (believe me,
> I've tried it). Having said that...
> 1. I don't quite understand what is your question.
> 2. There is no need for creating new SelfishAODV protocol
> 3. The code for the AODV is done by the RFC 3561
> 4. Setting some of the nodes to be selfish can be done by adding the
> "selfish" attribute to the desired nodes
>     More precisely, you will create 2 AODVHelper objects and 2 stacks (one
> for the selfish nodes and one for the good ones), then you will set your
> SELFISH attribute to true (for the selfish nodes) and vice versa. Every node
> created by the Selfish Helper will be malicious, and every other will be
> "good" node.
>
> Hope this helps,
> Regards,
> Nikola

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Lalith Suresh
Department of Computer Science and Engineering
Instituto Superior Técnico
www.lalith.in

Anoop thesis

unread,
Jul 26, 2011, 5:18:37 PM7/26/11
to ns-3-...@googlegroups.com
Thanks a lot for your kind reply Lalith.

best Regards

Tasvinder Singh

unread,
Nov 13, 2011, 8:18:26 AM11/13/11
to ns-3-...@googlegroups.com
Lalith Suresh <suresh.lalith@...> writes:

>
>
> On Thu, Jun 16, 2011 at 4:17 PM, Hacken <zhao.huanyu <at> gmail.com> wrote:
> Hi All,
> I am using AODV routing in a wireless ad hoc network. I would like to
> set up some nodes in the network to be selfish. That is, they drop
> data packets based on a preset probability.
> Currently, all the nodes are forwarding packets in my program. I have
> no idea on how to implement selfish node (packet drop) . Any
> suggestion will be appreciated.
>
>
> To add to what Nikola said, look into the RouteInput() method of the
aodv::RoutingProtocol class (src/aodv/model/aodv-routing-protocol.cc).
>  
>
>
> Thanks a lot!
> Regards,
> Huanyu
> --
> You received this message because you are subscribed to the Google Groups
"ns-3-users" group.
> To post to this group, send email to
ns-3-...@googlegroups.com.
> To unsubscribe from this group, send email to
ns-3-users+...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/ns-3-users?hl=en.
>
>

> -- Lalith SureshDepartment of Computer Science and Engineering
> Instituto Superior Técnicowww.lalith.in
>
>
>
>

Dear All,
I created the malicious node for aodv as per above discussion and changed the
RouteInput() method according to this.
if(GetEnableMalicious()){
NS_LOG_UNCOND ("-----Packet Dropped ");
return false;
}
else
return Forwarding (p, header, ucb, ecb);

But this behaviour is not affecting the no. of packets reached at destination
with or without malicious nodes. But still i am getting the message printed like
"-----Packet Dropped."

But in DSDV protocol I am getting the difference between no. of packets reached
at destination with or without malicious nodes. I used a global counter to count
the packets in ReceivePacket() function in my user script.

Please Help.
--
Tasvinder Singh
B.Tech Final Year,
Department of Computer Engineering,
Malaviya National Institute Of Technology, Jaipur.

Lalith Suresh

unread,
Nov 13, 2011, 5:24:39 PM11/13/11
to ns-3-...@googlegroups.com
Hi,

On Sun, Nov 13, 2011 at 2:18 PM, Tasvinder Singh <tasvi...@gmail.com> wrote:

Dear All,
I created the malicious node for aodv as per above discussion and changed the
RouteInput() method according to this.
if(GetEnableMalicious()){
      NS_LOG_UNCOND ("-----Packet Dropped   ");
       return false;
 }
 else
       return Forwarding (p, header, ucb, ecb);

But this behaviour is not affecting the no. of packets reached at destination
with or without malicious nodes. But still i am getting the message printed like
"-----Packet Dropped."


Which protocol are you using? To be honest, you'll need to debug this a lot more closely in any case. Try running the simulation using "NS_LOG=Ipv4L3Protocol ./waf --run blah" and try to trace what's happening, what path the packets take, and where the behaviour is awkward. It is always a good idea to start with a smaller simulation scenario.
 
But in DSDV protocol I am getting the difference between no. of packets reached
at destination with or without malicious nodes. I used a global counter to count
the packets in ReceivePacket() function in my user script.

Please Help.
--
Tasvinder Singh
B.Tech Final Year,
Department of Computer Engineering,
Malaviya National Institute Of Technology, Jaipur.
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Lalith Suresh

Vipul Gupta

unread,
Apr 12, 2013, 1:52:58 AM4/12/13
to ns-3-...@googlegroups.com
Hi!

For a routing experiment, i am using NodeContainer object(with a square grid of 25 nodes) and i need some of these nodes to act selfishly. By following this thread, i am still not able to get how to select some nodes particularly and set them to behave selfishly. Please, can you help me with this.

Thanks & Regards
Vipul Gupta

Abhilash Kk

unread,
Mar 10, 2014, 12:21:37 PM3/10/14
to ns-3-...@googlegroups.com




hi
        where i want to edit the code to setup selfish nodes
        * in my code or in the AODV source file?
        can you please specify that too
      
          thanks

Abhilash Kk

unread,
Mar 10, 2014, 3:14:16 PM3/10/14
to ns-3-...@googlegroups.com
hi
      i am doing a ns3 project to detect malicious nodes in MANET,
      by behavioral method for this i'm using AODV as routing protocol.
      i want to count the number of acknowledgment received by each
      nodes.
      can any one help...



        thanks

Mohamed Nazir

unread,
Apr 22, 2015, 6:13:15 AM4/22/15
to ns-3-...@googlegroups.com
Hi Guys,
I wanted to ask if I wanted to implement the malicious node to be used in the AODV protocol in the MANET, what files do I need to create and where and how to call the protocol from the file I need to create in the scratch folder. And what do I need to alter in existing files.
Thanks in advance
Reply all
Reply to author
Forward
0 new messages