Dear Knudfl;

74 views
Skip to first unread message

gebeyaw mengistu

unread,
Apr 27, 2022, 1:58:08 AM4/27/22
to Network Simulator 2 (NS2)
error.pngwhen i add malicious nodes and recompile the code i get the following errors,so,how to fix ? and also i wanna modifying normal routing protocols (AODV) in to blackholeAODV how to do this ?
Regards,
Gebeyehu Mengistu

knudfl

unread,
Apr 27, 2022, 3:53:25 AM4/27/22
to Network Simulator 2 (NS2)
Hi.                aodv27.tcl :  Unknown file.  If you want an answer,  please attach / upload the file.
                                                                             And tell which code was added to aodv.
                     Anyway, the "black" definition must match your aodv  code :
                     If blackhole is defined as  "hacker" in your code, the simulation file must say hacker, not malicious.
                     If blackhole is defined as  "malicious" .... the simulation file must say  malicious, not Malicious.


P.S.:  Pictures of text are not usable / readable.    I guess you know how to copy-paste a text ...
---------

.  blackholeaodv2013-ns235_1.patch
. blackhole-MohitTahiliani__ns235.patch

gebeyaw mengistu

unread,
Apr 27, 2022, 4:35:46 AM4/27/22
to Network Simulator 2 (NS2)
[root@home ~]# cd ns-allinone-2.34/ns-2.34/aodv
[root@home aodv]# ns aodv27.tcl
num_nodes is set 50
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
ns: _o777 hacker:
    (_o777 cmd line 1)
    invoked from within
"_o777 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 "_o777" line 2)
    (SplitObject unknown line 2)
    invoked from within
"_o777 hacker"
[root@home aodv]#

knudfl

unread,
Apr 27, 2022, 5:34:27 AM4/27/22
to Network Simulator 2 (NS2)
Missing information :
1.  Which code was added to ns2/aodv/ ? ?
2.  The unknown file aodv27.tcl  must be visible : upload / attach.
                    I.e. the error output shows you are doing something wrong ....
                    ? May be you are using a copy of the executable 'ns' with no blackhole added?
                   The suggestion is to do   $ ns-blackhole file.tcl
I.e.  i.e.  use a copy of the executable which you know has "blackholeaodv" included.

gebeyaw mengistu

unread,
Apr 27, 2022, 5:50:16 AM4/27/22
to Network Simulator 2 (NS2)
first thanks for your support

aodv.h
protected:
        int             command(int, const char *const *);
        int             initialized() { return 1 && target_; }
       bool        malicious; // add by gebeyehu
aodv.cc
int
AODV::command(int argc, const char*const* argv) {
  if(argc == 2) {
  Tcl& tcl = Tcl::instance();
   
    if(strncasecmp(argv[1], "hacker", 6) == 0) {// add by Gebeyehu ++++++++++++++++++++++++
       malicious = true; // / add by Gebeyehu ++++++++++++++++++++++++
      return TCL_OK; /// add by Gebeyehu ++++++++++++++++++++++++
        }


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;

  LIST_INIT(&nbhead);
  LIST_INIT(&bihead);

  logtarget = 0;
  ifqueue = 0;
  malicious = false; // add by gebeyehu ++++++++++++++++++++++++
}



ODV::rt_resolve(Packet *p) {
struct hdr_cmn *ch = HDR_CMN(p);
struct hdr_ip *ih = HDR_IP(p);
aodv_rt_entry *rt;

    if (malicious == true ) {// add by gebeyehu  ++++++++++++++++++++++++
        drop(p, DROP_RTR_ROUTE_LOOP); // add by gebeyehu  ++++++++++++++++++++++++
     }

knudfl

unread,
Apr 27, 2022, 8:04:23 AM4/27/22
to Network Simulator 2 (NS2)
Well,  the "gebeyehu code" is an example of the ancient AODVmalicious / maliciousaodv.
This basic / primitive code has a (slightly different) version which actually works :
→ blackhole-MohitTahiliani__ns235.patch
tar xvf ns-allinone-2.35_gcc5.tar.gz
patch -p0 < blackhole-MohitTahiliani__ns235.patch
export CC=gcc-5 CXX=g++-5 && ./install
......... The problem with "primitive" is that usually no results can be seen in e.g. the file.tr .
___________________________

The advanced blackholeaodv is "blackholeaodv2013-ns235_1.patch"
ns-2.35/
├── blackholeaodv/
│   ├── blackholeaodv.cc
│   ├── blackholeaodv.h
│   ├── blackholeaodv_logs.cc
│   ├── blackholeaodv_rqueue.cc
│   ├── blackholeaodv_rqueue.h
│   ├── blackholeaodv_rtable.cc
│   ├── blackholeaodv_rtable.h
├── common/
│   └── packet.h
├── Makefile.in
├── queue/
│   └── priqueue.cc
└── tcl/
    └── lib/
        ├── ns-agent.tcl
        ├── ns-lib.tcl
        ├── ns-mobilenode.tcl
        └── ns-packet.tcl

Plenty of simulation examples :  blackholeaodv2005-2013-examples-1119.tar.gz

gebeyaw mengistu

unread,
Apr 27, 2022, 8:16:20 AM4/27/22
to Network Simulator 2 (NS2)
Thanks sir!!! but finally i have one question 
1.i  simulate by using NS-2.34 on vmware  workstation is there any side effect on the result?

knudfl

unread,
Apr 27, 2022, 9:02:17 AM4/27/22
to Network Simulator 2 (NS2)
wmWare .... as the text says : ".. VirtualBox and wmWare have resulted in poor unusable 'ns' executable since 2017"
.... But this is old information :  You may be lucky .... may be.
On the negative side, things are getting worse every year :  ns2 code is now fundamentally 22 years old.
.... If things don't work, install the preferred 'Linux OS' (old is better than new) to an USB stick.  
Reply all
Reply to author
Forward
0 new messages