Ns2 code for Selfish Nodes

Ns2 code for Selfish Nodes, Selfish node aims also to save its resources to the maximum Nodes that do not forward other’s packets, thus maximizing their benefit also at the expense of all others.

What is selfish node?

  • It is one such attack also in which a malicious node doing a routing misbehavior in the route discovery packets of the routing protocol, also to advertise itself as having the shortest path also to the node whose packets it wants to intercept.

Sample Ns2 Code for Selfish Nodes

MAODV_rt_entry*
MAODV_rtable::rt_lookup(nsaddr_t id)
{
MAODV_rt_entry *rt = rthead.lh_first;

 for(; rt; rt = rt->rt_link.le_next) {
   if(rt->rt_dst == id)
     break;
 }
 return rt;

}

void
MAODV_rtable::rt_delete(nsaddr_t id)
{
MAODV_rt_entry *rt = rt_lookup(id);

 if(rt) {
   LIST_REMOVE(rt, rt_link);
   delete rt;
 }

}

MAODV_rt_entry*
MAODV_rtable::rt_add(nsaddr_t id)
{
MAODV_rt_entry *rt;

 assert(rt_lookup(id) == 0);
 rt = new MAODV_rt_entry;
 assert(rt);
 rt->rt_dst = id;
 LIST_INSERT_HEAD(&rthead, rt, rt_link);
 return rt;
}
Architecture-of-selfish-nodes

Architecture-of-selfish-nodes

Characteristics of-selfish node:

  • Dropping of data packets.
  • Don’t participate in routing process.
  • Don’t-reply or send hello messages.
  • Intentionally delay the RREQ packets.


NS2 Member Accounts | |
© 2005 - 2024 Vanet Projects

© 2005 - 2024 Matlab Projects