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

Tags: , , , ,

29 Responses to “Patching AODV-UU-0.9.6 Into NS-2.34”

  1. Huong Lien Do Says:

    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. Dan Tam Le Says:

    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. abdusy Says:

    @Huong Lien Do and Dan Tam Le : You should change your TCL script. Not only the protocol, but also the node configuration. You can see my AODV-UU tcl script in and for other protocol you can see my tcl script in


  4. septian Says:

    pak kalo patch ZRP di ns 2.33 or 2.34 punya g?
    sekalian kalo ada contoh file tclnya.

    salam kenal dan terimakasih sebelumnya


  5. yat Says:

    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


    • abdusy syarif Says:

      You can follow or edit the patch file in directory aodv-uu-0.9.x/patches/, you fill find the patch files that appropriate with your NS-2.


      • yat Says:

        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


  6. abdusy syarif Says:

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


  7. Mukul Shukla Says:

    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.



    • abdusy syarif Says:

      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).


  8. Mukul Shukla Says:

    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


  9. Mukul Shukla Says:

    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.


  10. T. S. Alankar Says:

    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.


    • abdusy syarif Says:

      maybe some files are missing. You could replace / use them with aodv-0.9.5 instead.


    • T.S. Alankar Says:

      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…??


      • abdusy syarif Says:

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


  11. hitesh parmar Says:

    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


  12. hitesh parmar Says:

    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


  13. sakhayudha Says:

    terima kasih Pak,

    mau nanya sedikit, bagaimana caranya mengetahui kalo patch AODVUU sudah terinstal dengan benar?


  14. daxes Says:

    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


  15. rose Says:

    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


  16. Anurag Sewak Says:

    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


  17. nedawp Says:

    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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: