Вы находитесь на странице: 1из 2

I have tried to implement SAODV in which hash function and digital signature is

used to protect routing packets like RREQ and RREP


!hanges are done with comments containing m" name S#A$I
I have tried for securing RREQ packet only Same procedure can %e repeated for
other packets also
&efore doing an" changes take a %ack up of the original code
'or %ackup( cop" the whole ns)*+ folder and rename the folder for e,ample
%ackup
-ow in ns)*+ folder( we have aodv folder containing aodv source code files
aodv.packeth file contains definition of all the AODV packets So in this file we
have to add * varia%les sign( top.hash and ma,.hop.count in hdr_aodv_request
/ash function can also %e added here &ut as I don0t know how to add function( I
have made the function fi, for all
//-----------------ADDED BY SWATI---------------
u_int32_t sign;
u_int32_t top_hash;
u_int8_t max_hop_count;
//------------------END ! ADDITIN-----------------------------
As we need one random value %ased on one seed( we have to fi, the seed So in
aodvcc file we have to add one constant 1$his constant can should %e added in aodvh file I have
added in aodvcc file as I added it in %etween the implementation and it will take time to compile if it will %e added
in aodvh file So while doing changes in the aodvh file( do the as man" changes together as possi%le2
// "NSTANT #AND$_SEED ADDED BY SWATI
%&'(in' #AND$_SEED )*+
#hen source want to send the RREQ packet( it has to first sign it 'or sending RREQ
packet function sendRequest() is defined in aodvcc file where implementation of
AODV class is there /ere an" method for digital signature can %e added or called
//--------------DI,ITA- SI,NAT.#E BY SWATI-----------------------------
/0-1sign2in&'x34;
p/int(56Sou/c'7 At no&' 8& Sign 7 8& 9n6:in&'x:/0-1sign;;
//-----------------END ! DI,ITA- SI,NAT.#E----------------------------------
As we have added digital signature( now we have to appl" hash function
//---------------------<AS< !.N"TIN BY SWATI-------------------------
/0-1max_hop_count 2 ih-1tt=_;
int i 2+;
/0-1top_hash2);
(o/5 i2+ ; i > /0-1max_hop_count ; i33 ;
/0-1top_hash ?2 #AND$_SEED ? #AND$_SEED; // hash (unction is a
2
//-----------------END ! <AS< !.N"TIN---------------------------
Source have sent the RREQ An" intermediate node( who will receive this packet
has to verif" the digital signature and hash function So this verification code can %e
put in receiveRequest() function In this unction we will add this code after the
code where re3uest duplication is checked and %efore we record %roadcast id
&efore we set up reverse path
i&_ins'/t5/0-1/0_s/c: /0-1/0_@cast_i&;; 44after this line
//-----------------DI,ITA- SI,NAT.#E BY SWATI-------------------
i(55 5 5ih-1s/c_;Aa&&/_ ; 3 4 ;B2 /0-1sign;
C
p/int(56Int'/ No&'7 Signatu/' not Da/i(i'&B at 8&9n6:in&'x;;
&/op5p: D#E_#T#_TT-;;
/'tu/n;
F
'=s'
C
p/int(56 Int'/ No&'7 Signatu/' Da/i(i'& at 8&B 9n6:in&'x;;
/0-1sign2in&'x34;
p/int(56 Int'/ No&'7 At no&' 8& Sign 7 8& 9n6:in&'x:/0-1sign;;
F
//-------END ! DI,ITA- SI,NAT.#E-------------------------
//----------------<AS< !.N"TIN BY SWATI------------------------
int i 2+;
int t'mp2);
(o/5 i2+ ; i > /0-1max_hop_count ; i33 ;
t'mp ?2 #AND$_SEED ? #AND$_SEED;
i(5t'mp22/0-1top_hash;
p/int(56<ash (unction Da/i(i'& at 8&9n6:in&'x;;
'=s'
p/int(56<ash (unction not Da/i(i'& at 8&9n6:in&'x;;
//------------------END ! <AS< !.N"TIN----------------
ao&D_/t_'nt/G ?/t+; // /t+ is th' /'D'/s' /out' 44%efore this line
!hanges are done in the files -ow we have to compile the ns)
'or this go to the ns)*+ folder in terminal( and write the commands5
maH' c='an
maH'
After successful compilation( we can run an" tcl file as usual
All the pritf12 function in the code is to 6ust for de%ugging purpose and can %e
removed or replaced %" appropriate code

Вам также может понравиться