Skip to content

Patching AODV-UU-0.9.6 Into NS-2.34

Since the latest aodv-uu version (aodv-uu-0.9.6) only support till ns-2.32, I have to make my own patch aodv-uu-0.9.6 for ns-2.34.
1. Installing NS-2.34
This is my experience when I was installing ns-2.34 on Ubuntu 10.4. Make sure that before you perform installation, the following packages installed:

 ~$ sudo apt-get install libxt-dev libx11-dev libxmu-dev

I noticed that ns-2.34 did not build on the new version Ubuntu such as 9.10 – 10.10, due to this error when linking:

otcl.o: In function `OTclDispatch':
/home/abdusy/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
undefined reference to `__stack_chk_fail_local'
ld: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [] Error 1
otcl-1.13 make failed! Exiting ...
See for problems

The problem is that otcl is trying to use the ld linker instead of the gcc linker to build a shared library. I have read that this problem can occur with gcc versions 4 and greater. There is a one line fix to otcl-1.13/configure file that is posted here: NS-2 Ubuntu Installation Guide
It means that we have to edit one line in otcl-1.13/configure as follows:

#SHLIB_LD="ld -shared"  //disabled this line
SHLIB_LD="gcc -shared" // add this line

And rerun install, it should work.
2. Patch AODV-UU-0.9.6
Before we installing aodv-uu into ns-2, we need to patch aodv-uu. The following files need to modify :
– ns-2.34/common/packet.h
– ns-2.34/
– ns-2.34/queue/
– ns-2.34/tcl/lib/ns-agent.tcl
– ns-2.34/tcl/lib/ns-default.tcl
– ns-2.34/tcl/lib/ns-lib.tcl
– ns-2.34/tcl/lib/ns-mobilenode.tcl
– ns-2.34/trace/
– ns-2.34/trace/cmu-trace.h
To define new routing protocol packet type such as aodv-uu we have to modify ~/ns-allinone-2.34/ns-2.34/common/packet.h file. We change PT_NTYPE to 63, and for aodv-uu PT_AODVUU = 62. . Just make sure PT_NTYPE is the last, and protocol number is ordered sequentially. So from line 185 changes would be as follows :

#ifdef AODV_UU
        // AODV packets in AODV-UU
//        PT_AODVUU;
static const packet_t PT_AODVUU = 62;
#endif /* AODV_UU */
        // insert new packet types here
static packet_t PT_NTYPE = 63; // This MUST be the LAST. The original value =  62

That is the different part from the previous patch. Because since modified ns-2.33, it adding support for dynamic libraries. ‘packet_t’ is changed from enum to unsigned int in order to allow dynamic definition of new packet types within dynamic libraries. Pre-defined packet types are implemented as static const.
If we are installing aodv-uu-0.9.6 into an existing already compiled ns-2.34
installation, ns-2.34 needs to be recompiled before the changes take

  > cd ~/ns-allinone-2.34/ns-2.34
  > ./configure
  > make distclean
  > ./configure
  > make

29 thoughts on “Patching AODV-UU-0.9.6 Into NS-2.34”

  1. Hi,
    I followed your instructions and aodv-uu was built successfully. However there was errors displayed when I tried to run a sample TCL script in which I changed the routing parameter from DSR to AODVUU. So could you please send me some TCL scripts for aodv-uu if possible?
    Thank you.

  2. Hi,
    I followed your instruction and aodv-uu was built successfully. However errors displayed when I tried to run a sample TCL script in which I changed the routing parameter from DSR to AODVUU. So could you please send me some aodv-uu TCL scripts if possible?
    Thank you.

  3. sorry, i can’t see any patch, what is the modification that we have to made on those file u mentioned, i only see ns-2.34/common/packet.h….i can’t find others

      1. i did found it, but still doesn’t help me, does we have to change all this 9 files manually since force patching the existing patch does not work (since the patch only for ns2.32), i tried to edit the coomn/packet.h file as you suggested, and then save, patch but doesnot work…i tried AODV-UU o.9.5 from this website,, installation successul, but can’t run aodvuu (simply changing prtocol in val(rp) to AODVUU does not work…)
        i know that i’m asking too much, but if you have a complete manual, it sure does help me a lot, Tq

  4. You should edit :
    – packet.h
    – ns-agent.tcl
    – ns-default.tcl
    – ns-lib.tcl
    – ns-mobilenode.tcl
    – ns-packet.tcl
    – cmu-trace.h

  5. Now that the ns-2.35 is released. I am running ns-2.35 in ubuntu 11.10 and want to run aodv-uu-0.9.6 in this setup. Can you please list the steps in order to compile? As I am very new to ns-2 I request you to kindly list all every possible small steps.
    Thanking you.

    1. Before you recompile your ns-2, you need to patch aodv-uu-0.9.6 into your ns-2.35. You can follow the steps which is written in the patch file (it’s located in aodv-uu-0.9.6/patches/ns-2.32-aodv-uu.patch).

  6. Dear abdusy syarif
    I have tried to apply the patch ns-2.32-aodv-uu.patch from the directories of the patches. As the patch is only for the ns-2.32 (and I am using ns-2.3.5) it is giving me errors. As per your post, I have tried to change the patch file but as I have said, I am new to all this I am unable to apply the patch properly. If possible kindly send me the modified patch file or the steps to properly apply the patch in ns-2.35 or ns-2.34 which ever is suitable to you.
    Thanking you.
    Mukul Shukla

      1. How did you patch aodv-uu manually? That is what I am trying to do? Do I have to change the patch file ns-2.32-aodv-uu.patch
        as per instructions above or something else?

  7. Dear abdusy syarif
    Thanks for the reply and sorry for asking too many questions. I want to setup AODV-UU either in ns-2.34 or ns-2.35. I will make my problem clear to you.
    1. Have you patched the new ns-2.35 or you have patched only ns-2.34?
    2. I am getting errors when I am using the patch for ns-2.34 in the patches directory without modifying the patch file. What should I do?
    3. As per you tutorial above what should I do. Should I change the patch file for ns-2.34 or should I change the ns-2.35 files?
    4. If I have to change the patch file for ns-2.32, what are the changes that I should make to uses the patch file for ns-2.32 in patches directory?
    5. I have followed the steps mentioned above to change the patch file ns-2.32-aodv-uu.patch in the patches directory but still it is giving errors? I am doing the things correctly. Can you please elaborate the steps?
    Thanking you for your help and cooperation.

  8. sir, greetings of the day..
    I m trying to add aodv-uu-0.9.6 patch in ns-2.34. I copied the patch file in Aodv-uu-0.9.6 and also create the link for aodv-uu.
    I used the command $ patch -p1 < ./aodv-uu/patches/aodv-uu-0.9.6.patch. But there was an error…"no such file or directory found".
    Please help me to fix this error.

    1. After patching…….. I execute the tcl file, and there was an error “segmentation fault(core dumped)”……… Why is this so…….. and how can I fix it…??

      1. “segmentation fault(core dumped)” usually because of misconfiguration of some array value or pointers.
        Try to fix your TCL.

  9. sir,
    I m trying to add aodv-uu-0.9.5 patch in ns-2.33. I copied the patch file in Aodv-uu-0.9.6 and also create the link for aodv-uu.
    I used the command $ patch -p1 < ./aodv-uu/patches/aodv-uu-0.9.5.patch. But there was an error…"no such file or directory found".
    Please help me to fix this error.
    thanking you

  10. configure: error: Installation of tcl seems incomplete or can’t be found
    > > automatically.
    > > Please correct the problem by telling configure where tcl is
    > > using the argument –with-tcl=/path/to/package
    > > (perhaps after installing it),
    > > or the package is not required, disable it with –with-tcl=no.
    i got error after patching aodv uu in ns 2.32
    please help me to fix this error
    thanking you

  11. Hello I successfully patched AODV-UU but I m getting error while using make command. Following are the errors:
    In file included from trace/
    ./aodv-uu/ns/aodv-uu.h:79:26: fatal error: packet_queue.h: No such file or directory
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1
    please help

  12. Dear Abdusy,
    I’ve successfully patched aodv-uu 0.9.6 manually, but my main problem was having to use the AODVUU as my routing protocol, while using your tcl files didn’t help on how to implement AODVUU at all.
    Your hybrid topologies shows that I got “wrong node routing agent” and when I tried to implement those aodv-uu from readme.ns on my own tcl script, I got errors on declaring a node.
    Is there any simple script on two nodes only using wireless transmission along with aodv-uu script so I can understand how to use aodv-uu on ns2 better?
    I want to simulate a multiple traffic along with movement scenario, aodv-uu is one of the routing agent that is capable of doing so, but the original aodv can’t do multiple routing
    Please reply,
    Thank you for your guides

  13. Dear Sir,
    I am trying to recompile ns-2.34 after patching in aodv-uu 0.9.6., but when recompiling make is giving the following error:
    trace/ fatal error: aodv-uu/ns/aodv-uu.h: No such file or directory
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1
    I am not able to find solution for the error. Kindly help

  14. hi
    can u help me by sending .tcl and .patch file “Detection and Prevention of Blackhole Attack, Wormhole Attack in MANET Using ACO” article
    i simulate Blackhole attack bud can simulate wormhole attack in ns2

Leave a Reply

Your email address will not be published. Required fields are marked *