Saturday, January 21, 2012

Re: [ns] how to print routing table

Hello ,

I guess in order to black list a node in a network, you first have to
declare malicious nodes in your network and ask them to perform a task (
like dropping of packets or generating and broadcasting those packets with
a Frequency parameter set to a small interval of time ). So what you have
to do is to define a variable of type bool in the
aodv.h file where you are defining your routing agent and then in the
aodv.cc , in the constructor initialize that bool variable as false.

Now i guess you have to insert an if statement in the int AODC :: comand ()
function for strcmp of an arg which you will pass from your tcl script .
Let say in your tcl script the malacious node you define passes an arg as
"bad node" etc .

if the comparison turns true then in a AODV, use a timer for this node (
take an example from broadcast timer etc) which can call a function to
boradcast the packets more frequently .

use if statements when receiving a packet from malicious node. or put a
limit of getting no of packets from this node. you can #define it after
header files in aodv.h.

I hope this lil knowledge can help you a bit .

regards

On Sat, Jan 21, 2012 at 3:15 PM, shanmugha priya balasubramanian <
shanmughapriyab@gmail.com> wrote:

> sir
>
> i am implementing "preventing flooding attack in MANET"
>
> sir i want to create a function that checks the whether t number of
> packets received from each of its neighbor has exceeded the particular
> threshold value and blacklist them
>
> please where can i declare the function structure of that blaclist in
> aodv.cc
>
> Awaiting ur reply
> Shanmugha Priya
>
> On 1/21/12, shoaib saleem <shoaib.saleem@it-sudparis.eu> wrote:
> >
> > Hello Kader ,
> >
> > i think you are asking about the routing table maintained by each node in
> > the network topology . In order to print that routing table for any node
> > you have to declare a function in the class AODV (aodv.h file) as a
> > protected member function as follows .
> >
> > *************** void rt_print(nsaddr_t node_id);
> >
> >
> > then in the aodv.cc file define this function anywhere you want as
> follows
> >
> > void AODV::rt_print(nsaddr_t id) {
> > FILE *dumpFile;
> > char dumpFileName[50] = "rtable.txt";
> >
> > dumpFile = fopen("rtable.txt", "a");
> >
> > aodv_rt_entry *rt;
> >
> > fprintf (dumpFile,
> > "=======================================================");
> > for (rt=rtable.head();rt; rt = rt->rt_link.le_next) {
> >
> > fprintf (dumpFile, "NODE: %it %.4lft %it %it %it %it %it %.4lft %d n",
> > id, CURRENT_TIME, rt->rt_dst, rt->rt_nexthop, rt->rt_hops,
> > rt->rt_seqno, rt->rt_expire, rt->rt_flags);
> >
> > }
> >
> > fclose(dumpFile);
> > }
> >
> >
> > ****************Calling the function *****************
> > you can call this function any where in aodv .cc to print the routing
> table
> > information as follows .
> >
> > rt_print(index); // where the index is the node id of which RT
> > table will be displayed
> >
> >
> >
> > **************************************************Recompile and run
> > **************************
> > Recompile ns 2 using
> > make clean
> > make depend
> > make
> > sudo make install
> >
> > and run your script .
> >
> > The output file rtable.txt file gave the following output , i just called
> > the function once.
> >
> > =======================================================NODE: 2t 28.0059t
> 0t
> > 0t 1t 14t 1t 38.0059t 13157952
> > n=======================================================NODE: 0t 34.5030t
> > 2t 2t 1t 10t 1t 44.5030t 13157952 nNODE: 0t 34.5030t 1t 0t 255t 0t 0t
> > 0.0000t 13157952
> > n=======================================================NODE: 0t 39.0149t
> > 2t 2t 1t 10t 1t 44.5030t 13157952 nNODE: 0t 39.0149t 1t 2t 2t 6t 1t
> > 49.0149t 13157952
> > n=======================================================NODE: 0t 45.0326t
> > 2t 2t 1t 12t 1t 55.0326t 13157952 nNODE: 0t 45.0326t 1t 2t 2t 6t 1t
> > 55.0203t 13157952
> > n=======================================================NODE: 0t 55.5618t
> > 2t 2t 1t 14t 1t 65.5618t 13157952 nNODE: 0t 55.5618t 1t 2t 2t 6t 1t
> > 65.5365t 13157952
> > n=======================================================NODE: 0t 66.0167t
> > 2t 2t 1t 16t 1t 76.0167t 13157952 nNODE: 0t 66.0167t 1t 2t 2t 6t 1t
> > 76.0049t 13157952
> > n=======================================================NODE: 0t 76.5285t
> > 2t 2t 1t 20t 1t 86.5285t 13157952 nNODE: 0t 76.5285t 1t 2t 2t 6t 1t
> > 86.5166t 13157952
> > n=======================================================NODE: 2t 76.5511t
> > 1t 1t 1t 6t 1t 86.5493t 13157952 nNODE: 2t 76.5511t 0t 0t 1t 30t 1t
> > 86.5511t 13157952
> > n=======================================================NODE: 1t 83.0483t
> > 2t 0t 2t 20t 1t 86.0483t 13157952 nNODE: 1t 83.0483t 0t 0t 1t 28t 1t
> > 93.0364t 13157952
> > n=======================================================NODE: 1t 83.0719t
> > 2t 2t 1t 22t 1t 93.0719t 13157952 nNODE: 1t 83.0719t 0t 0t 1t 28t 1t
> > 93.0364t 13157952
> > n=======================================================NODE: 2t 87.0160t
> > 1t 1t 1t 10t 1t 93.0819t 13157952 nNODE: 2t 87.0160t 0t 0t 1t 34t 1t
> > 97.0160t 13157952
> > n=======================================================NODE: 2t 93.5197t
> > 1t 1t 1t 14t 1t 103.5197t 13157952 nNODE: 2t 93.5197t 0t 0t 1t 34t 1t
> > 97.0160t 13157952
> > n=======================================================NODE: 2t 97.5183t
> > 1t 1t 1t 14t 1t 103.5197t 13157952 nNODE: 2t 97.5183t 0t 0t 1t 36t 1t
> > 107.5183t 13157952
> > n=======================================================NODE: 0t
> 104.0130t
> > 2t 2t 1t 32t 1t 114.0130t 13157952 nNODE: 0t 104.0130t 1t 1t 1t 10t 1t
> > 114.0098t 13157952
> > n=======================================================NODE: 2t
> 104.0280t
> > 1t 1t 1t 18t 1t 114.0280t 13157952 nNODE: 2t 104.0280t 0t 0t 1t 38t 1t
> > 110.0083t 13157952
> > n=======================================================NODE: 1t
> 104.0300t
> > 2t 0t 2t 32t 1t 113.0300t 13157952 nNODE: 1t 104.0300t 0t 0t 1t 38t 1t
> > 114.0229t 13157952
> > n=======================================================NODE: 1t
> 104.0385t
> > 2t 2t 1t 34t 1t 114.0385t 13157952 nNODE: 1t 104.0385t 0t 0t 1t 38t 1t
> > 114.0229t 13157952
> > n=======================================================NODE: 2t
> 110.5249t
> > 1t 1t 1t 18t 1t 114.0280t 13157952 nNODE: 2t 110.5249t 0t 0t 1t 40t 1t
> > 120.5249t 13157952
> > n=======================================================NODE: 2t
> 114.5243t
> > 1t 1t 1t 20t 1t 124.5243t 13157952 nNODE: 2t 114.5243t 0t 0t 1t 40t 1t
> > 120.5249t 13157952
> > n=======================================================NODE: 0t
> 121.0234t
> > 2t 2t 1t 42t 1t 131.0234t 13157952 nNODE: 0t 121.0234t 1t 1t 1t 16t 1t
> > 130.9986t 13157952
> > n=======================================================NODE: 2t
> 121.0272t
> > 1t 1t 1t 20t 1t 124.5243t 13157952 nNODE: 2t 121.0272t 0t 0t 1t 44t 1t
> > 131.0272t 13157952
> > n=======================================================NODE: 1t
> 121.0774t
> > 2t 2t 1t 44t 1t 131.0774t 13157952 nNODE: 1t 121.0774t 0t 0t 1t 42t 1t
> > 131.0736t 13157952
> > n=======================================================NODE: 2t
> 127.5210t
> > 1t 1t 1t 24t 1t 137.5210t 13157952 nNODE: 2t 127.5210t 0t 0t 1t 44t 1t
> > 131.0272t 13157952
> > n=======================================================NODE: 2t
> 131.5320t
> > 1t 1t 1t 24t 1t 137.5210t 13157952 nNODE: 2t 131.5320t 0t 0t 1t 46t 1t
> > 141.5320t 13157952
> > n=======================================================NODE: 1t
> 138.0045t
> > 2t 2t 1t 52t 1t 148.0045t 13157952 nNODE: 1t 138.0045t 0t 0t 1t 42t 1t
> > 147.9986t 13157952
> > n=======================================================NODE: 2t
> 138.0082t
> > 1t 1t 1t 28t 1t 148.0082t 13157952 nNODE: 2t 138.0082t 0t 0t 1t 46t 1t
> > 141.5320t 13157952
> > n=======================================================NODE: 0t
> 138.0283t
> > 2t 2t 1t 54t 1t 148.0283t 13157952 nNODE: 0t 138.0283t 1t 1t 1t 26t 1t
> > 148.0235t 13157952
> > n=======================================================NODE: 1t
> 143.0407t
> > 2t 0t 2t 54t 1t 148.0407t 13157952 nNODE: 1t 143.0407t 0t 0t 1t 48t 1t
> > 153.0378t 13157952
> > n=======================================================NODE: 2t
> 144.0934t
> > 1t 0t 2t 32t 1t 153.0934t 13157952 nNODE: 2t 144.0934t 0t 0t 1t 48t 1t
> > 144.0267t 13157952
> > n=======================================================NODE: 2t
> 144.5543t
> > 1t 0t 2t 32t 1t 153.0934t 13157952 nNODE: 2t 144.5543t 0t 0t 1t 50t 1t
> > 154.5543t 13157952
> > n=======================================================NODE: 1t
> 148.5243t
> > 2t 0t 2t 60t 1t 150.5243t 13157952 nNODE: 1t 148.5243t 0t 0t 1t 48t 1t
> > 158.5204t 13157952 n
> >
> > I hope this wil help you .
> >
> > regards
> >
> > On Sat, Jan 21, 2012 at 11:10 AM, Fatima Kader <kader.eliza@gmail.com
> >wrote:
> >
> >> hello sir
> >>
> >> please i want to ask you about AODV
> >>
> >> i want each node maintain an activity table, in this table there some
> >> fields like node id, number of data received from a node,...etc
> >>
> >> please where can i declare the structure table, in node.h or in aodv.cc
> >>
> >> many thanks in advance for your reply
> >>
> >> --
> >> [image: http://www.etudinfo.com/image/logo-ecole/telecom-sudparis.jpg]
> >> Muhammad Shoaib SALEEM
> >> PhD Student
> >> Wireless Networks & Multimedia Services Department
> >> Institut Télécom - Télécom SudParis
> >> 9 Rue Charles Fourier 91011 Evry, France.
> >> Office: +33 1 60 76 43 91
> >> https://sites.google.com/site/shoaibsal/
> >>
> >> <https://sites.google.com/site/shoaibsal/>
> >>
> >>
> >>
> >> <https://sites.google.com/site/shoaibsal/>
> >>
> >>
> >
>

--
[image: http://www.etudinfo.com/image/logo-ecole/telecom-sudparis.jpg]
Muhammad Shoaib SALEEM
PhD Student
Wireless Networks & Multimedia Services Department
Institut Télécom - Télécom SudParis
9 Rue Charles Fourier 91011 Evry, France.
Office: +33 1 60 76 43 91
https://sites.google.com/site/shoaibsal/

<https://sites.google.com/site/shoaibsal/>

No comments:

Post a Comment

Counter

blogger analytics