Académique Documents
Professionnel Documents
Culture Documents
net
Seek knowledge from the cradle to the grave
Navigate to...
Many people have asked me how to implement malicious drop in AODV. I have decided to write simple code for adding malicious node in AODV ( or in any routing protocol).
First you need to modify aodv.cc and aodv.h files. In aodv.h after
1
2
3
4
5
6
7
8
bool
malicious;
With this variable we are trying to define if the node is malicious or not. In aodv.cc after
1
2
3
4
5
6
7
8
/*
Constructor
*/
AODV::AODV(nsaddr_t id) : Agent(PT_AODV),btimer(this), htimer(this), ntimer(this), rtimer(this), lrtimer(this), rqueue() {
index = id;
seqno = 2;
bid = 1;
...
malicious = false;
The above code is needed to initialize, and all nodes are initially not malicious. Then we will write a code to catch which node is set as malicious. In aodv.cc after
1
2
3
4
5
6
7
if(argc == 2) {
Tcl& tcl = Tcl::instance();
if(strncasecmp(argv[1], "id", 2) == 0) {
tcl.resultf("%d", index);
return TCL_OK;
}
if(strcmp(argv[1], "hacker") == 0) {
malicious = true;
return TCL_OK;
}
Now we will do some work in TCL to set a malicious node. Using script in my post , we add following line to set node 5 as malicious node.
1
converted by Web2PDFConvert.com
3
4
}
...
Alright, we have set malicious node but we did not tell malicious node what to do. As it is known, rt_resolve(Packet *p) function is used to select next hop node
when routing data packets. So, we tell malicious node just drop any packet when it receives. To do that after
1
2
3
4
5
6
7
8
9
/*
Route Handling Functions
*/
void
AODV::rt_resolve(Packet *p) {
struct hdr_cmn *ch = HDR_CMN(p);
struct hdr_ip *ih = HDR_IP(p);
aodv_rt_entry *rt;
...
// if I am malicious node
if (malicious == true ) {
drop(p, DROP_RTR_ROUTE_LOOP);
// DROP_RTR_ROUTE_LOOP is added for no reason.
}
And implementing malicious node is done. I hope the post will be helpful to design your secure routing protocol.
P.S. Guys please dont ask me c/c++ questions, check your book first
Categories: Network Simulator (NS2)
Tags: AODV, malicious node, NS2, routing
31 COMMENTS
Devi G
smartnode
November 2, 2009 at 3:31 pm To work in NS confidently depends on how hard you work. Yet, not less than several months. Best way to learn is analyze whole source code of some protocol (e.g.
DSR or AODV). That will help a lot.
shen.wen
December 10, 2009 at 11:57 am I modified aodv.cc and aodv.h as you demonstrate above,while run the aodv script ,
ns: _o112 hacker:
(_o112 cmd line 1)
invoked from within
_o112 cmd hacker
invoked from within
catch $self cmd $args ret
converted by Web2PDFConvert.com
MEHDI
January 3, 2010 at 4:26 pm I followed your step to change aodv.cc and aodv.h. however, when i compile tcl script, this error occurred:
num_nodes is set 500
INITIALIZE THE LIST xListHead
ns: _o112 hacker:
(_o112 cmd line 1)
invoked from within
_o112 cmd hacker
invoked from within
catch $self cmd $args ret
invoked from within
if [catch $self cmd $args ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error error when calling class $cls: $args $
(procedure _o112 line 2)
(SplitObject unknown line 2)
invoked from within
_o112 hacker
when i modified aodv file then recompile ns2 and the run tcl script again. the error occurred again:
i use this command for recompile ns2:
make clean
make
sudo make install
please, help me. It is really really really important for my thesis
smartnode
January 16, 2010 at 3:18 pm Shen, Mehdi sorry guys. I have made mistake here, which I have fixed.
You must add following code
converted by Web2PDFConvert.com
if(strcmp(argv[1], hacker) == 0) {
malicious = true;
return TCL_OK;
}
In the following place
if(argc == 2) {
Tcl& tcl = Tcl::instance();
if(strncasecmp(argv[1], id, 2) == 0) {
tcl.resultf(%d, index);
return TCL_OK;
}
// ABOVE CODE GOES HERE :
if(strcmp(argv[1], hacker) == 0) {
malicious = true;
return TCL_OK;
}
}
I believe it should work then
MEHDI
smartnode
January 26, 2010 at 4:49 pm sendRequest() is routine which sends RREQ messages. Just add timer function and run sendRequest() in the timer. or You can just call sendRequest() whenever
you need.
MEHDI
converted by Web2PDFConvert.com
Resmy
February 2, 2010 at 5:10 pm Sir i too tried to modify the codes in aodv.cc and aodv.h to introduce malicious nodes..
But the same error what Mehdi told occured again whyI made the modification u told
but its not working..can u plz reply..
Resmy
February 2, 2010 at 7:02 pm its get corrected and i ran the tcl codebut i didnt see any changes
5th node is the malicious nodebut nothing happening for this node
smartnode
February 3, 2010 at 1:23 am Resmy I dont know what you are trying to do. Do you want the node 5 drop all packets those go through this node, or do you want the node 5 flood useless RREQ
continuously? if the latter one is what you want, the above code does not provide it. You have to make more changes. Either you have to create a time function or
the simple method is following code, wich sends RREQ to node 0 at every BCAST_ID_SAVE period.
void
BroadcastTimer::handle(Event*) {
agent->id_purge();
// add form here
if (agent->malicious == true ) {
agent->sendRequest(0);
}
// to here Scheduler::instance().schedule(this, &intr, BCAST_ID_SAVE);
}
Muralidharan
converted by Web2PDFConvert.com
irvan
Ashwin Perti
Ashwin Perti
March 23, 2010 at 6:01 pm When make command is executed it is giving the following error:
allinone-2.34/lib -ltk8.4 -L/home/ashwin/ns-allinone-2.34/lib -ltcl8.4 -lXext -lX11 -lnsl -ldl -lm -lm
trace/cmu-trace.o: In function `hdr_raodv::access(Packet const*):
converted by Web2PDFConvert.com
smartnode
March 24, 2010 at 1:18 am Ashwin I dont understand what you are talking about. What are you trying to compile? Read your question yourself, and tell me do you understand it? You did make
command of what? Why?
Aditi
smartnode
tim
smartnode
April 5, 2010 at 3:39 pm Where did you guys add following lines?
if(strcmp(argv[1], hacker) == 0) {
malicious = true;
return TCL_OK;
converted by Web2PDFConvert.com
is it on the line 86 of the aodv.cc file? If yes, it is hard to understand why this error happens.
tim
jin
smartnode
jin kim
rohitkg
i want to make a node behave as blackhole node, using the above technique. The above method drops all packets that go through it, but it doesnt kind of forces a
packet to go through it by sending a high sequence number.
For that, i have done this within this fn. AODV::recvRequest(Packet *p):
if(malicious==true) {
sendReply(rq->rq_src, // IP Destination
1, // Hop Count
index, // Dest IP Address
4294967295, // Max. Dest Sequence Num if the node is malicious
MY_ROUTE_TIMEOUT, // Lifetime
rq->rq_timestamp); // timestamp
}
else {
sendReply(rq->rq_src, // IP Destination
1, // Hop Count
index, // Dest IP Address
seqno, // Dest Sequence Num
MY_ROUTE_TIMEOUT, // Lifetime
rq->rq_timestamp); // timestamp
}
and removed
if(malicious == true) {
drop(p, DROP_RTR_ROUTE_LOOP);
}
from rt_resolve() fn.
Now, what changes do i need to make, so that the code can distinguish data packets and management packets, so that it could drop the data packets.
rohitkg
smartnode
April 12, 2010 at 2:31 am Rohitg, if you want to drop only data packets you need to check packet type reger HDR_CMN for more info.
Raj i am NOT going to do what you asked. It is whole algorithm
rahul
April 12, 2010 at 11:00 am heythank u for this post.its really helping but i am required to create malicious node in a 20 node tcl script in DSR protocol.plz help me out with that.thanking u
in anticipation urgent.
converted by Web2PDFConvert.com
Raj
Daniel Zvolensky
velkan
Blogroll
Mobile Embedded System Lab.
LifeMap Project
Yohan Chon
converted by Web2PDFConvert.com
Hyojeong Shin
Categories
Algorithms
Android
Linux / Unix
Network Simulator (NS2)
Programming
Research Issues
Uncategorized
Meta
Log in
Entries RSS
Comments RSS
WordPress.org
Search
Search
converted by Web2PDFConvert.com
converted by Web2PDFConvert.com