Steps in Details

August 27, 2017 | Author: Chintan Parekh | Category: Computer File, Software Development, Computer Data, Computer Engineering, Software Engineering
Share Embed Donate


Short Description

SAodv...

Description

I have tried to implement SAODV in which hash function and digital signature is used to protect routing packets like RREQ and RREP. Changes are done with comments containing my name SWATI. I have tried for securing RREQ packet only. Same procedure can be repeated for other packets also. Before doing any changes take a back up of the original code. For backup, copy the whole ns2.34 folder and rename the folder for example backup. Now in ns2.34 folder, we have aodv folder containing aodv source code files. aodv_packet.h file contains definition of all the AODV packets. So in this file we have to add 3 variables sign, top_hash and max_hop_count in hdr_aodv_request . Hash function can also be added here. But as I don’t know how to add function, I have made the function fix for all. //-----------------ADDED BY SWATI--------------u_int32_t sign; u_int32_t top_hash; u_int8_t max_hop_count; //------------------END OF ADDITION-----------------------------

As we need one random value based on one seed, we have to fix the seed. So in aodv.cc file we have to add one constant. (This constant can should be added in aodv.h file. I have added in aodv.cc file as I added it in between the implementation and it will take time to compile if it will be added in aodv.h file. So while doing changes in the aodv.h file, do the as many changes together as possible.)

// CONSTANT RANDOM_SEED ADDED BY SWATI #define RANDOM_SEED 190

When source want to send the RREQ packet, it has to first sign it. For sending RREQ packet function sendRequest() is defined in aodv.cc file where implementation of AODV class is there. Here any method for digital signature can be added or called. //--------------DIGITAL SIGNATURE BY SWATI----------------------------rq->sign=index+5; printf("Source: At node %d Sign : %d \n",index,rq->sign); //-----------------END OF DIGITAL SIGNATURE----------------------------------

As we have added digital signature, now we have to apply hash function.

//---------------------HASH FUNCTION BY SWATI------------------------rq->max_hop_count = ih->ttl_; int i =0; rq->top_hash=1; for( i=0 ; i < rq->max_hop_count ; i++ ) rq->top_hash *= RANDOM_SEED * RANDOM_SEED; // hash function is a2 //-----------------END OF HASH FUNCTION---------------------------

Source have sent the RREQ. Any intermediate node, who will receive this packet has to verify the digital signature and hash function. So this verification code can be put in receiveRequest() function. In this unction we will add this code after the code where request duplication is checked and before we record broadcast id. Before we set up reverse path. id_insert(rq->rq_src, rq->rq_bcast_id); //after this line //-----------------DIGITAL SIGNATURE BY SWATI------------------if(( {

} else {

( (ih->src_).addr_ )

+ 5 )!= rq->sign)

printf("Inter Node: Signature not varified! at %d\n",index); drop(p, DROP_RTR_TTL); return;

printf(" Inter Node: Signature varified at %d! \n",index); rq->sign=index+5; printf(" Inter Node: At node %d Sign : %d \n",index,rq->sign);

} //-------END OF DIGITAL SIGNATURE------------------------//----------------HASH FUNCTION BY SWATI-----------------------int i =0; int temp=1; for( i=0 ; i < rq->max_hop_count ; i++ ) temp *= RANDOM_SEED * RANDOM_SEED; if(temp==rq->top_hash) printf("Hash function varified at %d\n",index); else printf("Hash function not varified at %d\n",index); //------------------END OF HASH FUNCTION---------------aodv_rt_entry *rt0; // rt0 is the reverse route //before this line

Changes are done in the files. Now we have to compile the ns2. For this go to the ns2.34 folder in terminal, and write the commands: make clean make

After successful compilation, we can run any tcl file as usual. All the pritf() function in the code is to just for debugging purpose and can be removed or replaced by appropriate code.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF