Skip to content

Patching TORA Manet Routing Protocol

Here we assume that the student is a PG level/research level student with an elementary knowledge of Linux and ns2.

(The given procedure is meant for ns2.28 only – for higher versions, one should to the necessary changes in directory and file names)

For installation of Linux and ns2.28, refer internet for the procedure for installing Linux and installing ns2 on Linux or consult your lab admin or your friend or anybody who knows installation of Linux and ns2

Installing ns-2.28

The Ns2.28 Installation Procedure :

1. Download ns2.28 from the following link
http://www.isi.edu/nsnam/dist/ns-allinone-2.28.tar.gz

Log in as root or any user and copy the ns-allinone-2.28.tar.gz file in the home folder of the user (in this example, the user name is “jason”)

#cd /home/jason

 #gunzip –d ns*.gz this will extract ns-allinone-2.28.tar in the / file system

#tar –xvf ns*.tar this will extract ns.28 under the directory /ns-allinone-2.28

First install ns2.28

# cd /home/jason/ns-allinone-2.28/

#./ install – to install ns2.

After successful installation, edit the /home/jason/.bash_profile with the following values – then only the following commands will work from any project directory) [/.bash_profile is a hidden file and here we assume the user is using bash shell]

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jason/ns-allinone-2.28/otcl-1.9:/home/jason/ns-allinone-2.28/lib:/root/bin/glnx86/
TCL_LIBRARY=/home/jason/ns-allinone-2.28/tcl8.4.5/library

PATH=$PATH:$HOME/bin:/home/jason/ns-allinone-2.28/bin:/home/jason/ns-allinone-2.28/tcl8.4.5/unix:/ns-allinone-2.28/tk8.4.5/unix

 

export USERNAME BASH_ENV PATH LD_LIBRARY_PATH TCL_LIBRARY

 

Checking the ns-2 Installation

 Reboot the system and login again

Check the good working of ns2 by just typing the following command.
#ns – this will produce % prompt (Ctrl+C to exit)
#nam – This will start nam
#xgraph – it should wait for input (Ctrl+C to exit)

If all the above three commands are working, then only you may proceed with the following.

 

Applying Tora patch

If you are successfully running all the three commands, ns, nam and xgraph, then you may proceed with the TORA patch as follows (see the next page).

The TORA protocol will work without error if and only if you have applied this patch successfully.
Even the latest versions of ns2 will not contain this modification. So we have to apply this patch in all versions of ns2.
I have tested it only on ns2.28 (since ns2.28 is a more stable version I always try to use this version) But you are having good knowledge of ns2, you may try it on any higher version. 

The TORA patch operation :

Step 1: Change to /ns-allinone-2.XX/ns-2.XX/tora/
In tora.cc you have to edit this block of code

int
toraAgent::command(int argc, const char*const* argv)
{
if(argc == 2) {
Tcl& tcl = Tcl::instance();

if(strncasecmp(argv[1], "id", 2) == 0) {
tcl.resultf("%d", index);
return TCL_OK;
}
}
else if(argc == 3) {

if(strcmp(argv[1], "log-target") == 0 || strcmp(argv[1], "tracetarget") == 0 ) {
logtarget = (Trace*) TclObject::lookup(argv[2]);
if(logtarget == 0)
return TCL_ERROR;
return TCL_OK;
}
else if(strcmp(argv[1], "drop-target") == 0) {
int stat = rqueue.command(argc,argv);
if (stat != TCL_OK) return stat;
return Agent::command(argc, argv);
}
else if(strcmp(argv[1], "if-queue") == 0) {
ifqueue = (PriQueue*) TclObject::lookup(argv[2]);
if(ifqueue == 0)
return TCL_ERROR;
return TCL_OK;
}
else if(strcmp(argv[1], "imep-agent") == 0) {
imepagent = (imepAgent*) TclObject::lookup(argv[2]);
if(imepagent == 0)
return TCL_ERROR;
imepagent->imepRegister((rtAgent*) this);
return TCL_OK;
}
//******************************************************************************
//======Extra coding to introduce port-dmux=======
else if(strcmp(argv[1], "port-dmux") == 0) {
dmux_ = (PortClassifier*) TclObject::lookup(argv[2]);
if(dmux_ == 0){
//fprintf(stderr, "%s: %s lookup of %s failedn", _FILE_, argv[1], argv[2]);
printf("%s lookup of %s failedn", argv[1], argv[2]);
return TCL_ERROR;
}
return TCL_OK;
}
//====================================
//*******************************************************************************
}
return Agent::command(argc, argv);
}

Step 2: In tora.h, you have to edit this block of code

 

/*
* Logging Routines
*/
void log_route_loop(nsaddr_t prev, nsaddr_t next);

void log_link_layer_feedback(Packet *p);
void log_link_layer_recycle(Packet *p);
void log_lnk_del(nsaddr_t dst);
void log_lnk_kept(nsaddr_t dst);

void log_nb_del(nsaddr_t dst, nsaddr_t id);
void log_recv_qry(Packet *p);
void log_recv_upd(Packet *p);
void log_recv_clr(Packet *p);
void log_route_table(void);

void log_dst_state_change(TORADest *td);

void logNextHopChange(TORADest *td);
void logNbDeletedLastDN(TORADest *td);
void logToraDest(TORADest *td);
void logToraNeighbor(TORANeighbor *tn);
protected: PortClassifier *dmux_;
};



 

 

Step 3 :
# cd /home/jason/ns-allinone-2.XX/ns-2.XX/tora/

# rm *.o

Step 4 :
# cd /home/jason/ns-allinone-2.XX/ns-2.XX/

# touch *

Step 5 :
#cd /home/jason/ns-allinone-2.XX/ns-2.XX/
# make
# make install.

If everything ok, you can test any simulation with TORA protocol.
If you are receiving any errors related to ‘port’ or ‘PortClassifier’ then it means you did not do the previous patch correctly.
In that case, verify and repeat everything from Step 1.

 

Final Note :

First of all, doing research, based on Tora routing protocol implementation available on ns-2 is not at all advisable.

 
The reasons are:
1. By default, the ns-2 implementation of Tora probably will not work as it is – and may need a patch to make it work. (You will need the above patch  operations)
 
2. Even after successfully applying that patch, if you try to increase the number of nodes or trying different topology in a typical manet simulation, probably you will end up with a “core-dumped” error (I mean the simulation will just crash).
 
3. Most of all, the present level of Tora implemented on ns-2 will never give the results as per its theoretical expectation. (I mean it will never work as shown in some earlier papers)
 
There may be some strange reasons for this kind of behaviour in a typical simulation. And one may be able to make Tora work – but just making it work will itself become a big task and Ph.D level research work.
 
The results that you may see in most of the published papers by “Students and scholars” may be just fake or cooked-up things. 
 
Often it was realized that the ns2 implementation of TORA needs some modification, even for trouble-free execution. The poor performance of TORA may be a reason related to the present level of implementation of it in ns2  or some unknown bugs in it. For serious research work,  further examination on ns2 implementation of TORA should be made to understand its weakness.
 
 
The final line of advice is:  “Do not waste your time with Tora”

 

Leave a Reply

WhatsApp Discuss Through WhatsApp