Generating Patch for NS-2

If you need to generate a patch file for a set of file(s) residing in a directory structure or just for one file, then you can use "diff" command. You can find a very nice article in Linux Magazine named "What's the diff?". Basically, this command finds out the difference between two files.

If you want to generate a patch for a directory structure:
diff -rau "old_dir" "modified_dir" > "patch_file"

r: recursive
a: treat all files as text.
u: Output NUM (default 3) lines of unified context.
In case of two file, ignoring -r would be enough.

For more details please go to http://docs.moodle.org/dev/How_to_create_a_patch 

69 comments:

  1. sir how to check the ns2 version in ubuntu 12.04..I actually installed ns2.35 intially and using gcc4.4(cant able to installed gcc4.3)..but i need bgp protocol,but its interfaced in ns2.34..i tried to install ns2.34 but its getting error

    ReplyDelete
  2. While installing ns-2.34 i am getting this error..please help me out..




    In file included from /home/yashwanth/ns-allinone-2.34/tk8.4.18/unix/../generic/tkInt.h:21:0,
    from /home/yashwanth/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.h:18,
    from /home/yashwanth/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:16:
    /home/yashwanth/ns-allinone-2.34/tk8.4.18/unix/../generic/tk.h:81:23: fatal error: X11/Xlib.h: No such file or directory
    compilation terminated.
    make: *** [tk3d.o] Error 1
    tk8.4.18 make failed! Exiting ...


    ReplyDelete
  3. HOW TO INSTALL DTN PATCH IN NS2.34 SIR??

    ReplyDelete
  4. Hello Sir,
    Can you please help us to provide steps to install leach protocol which is available as patch for ns2.34 but i need to install it in ns2.35.
    I am facing more errors while installing it in ubuntu 12.04 in ns2.35

    Thank you!!!

    ReplyDelete
    Replies
    1. Hi,

      I can help if you provide the error details.

      Delete
  5. I want to apply Blackholeaodv on wsn and security for it..plz help...
    which version should i use with which patch?
    Mannasim or NRLsensorsim.?
    Reply soon..

    ReplyDelete
    Replies
    1. Hi,

      BlackholeAODV is available online. I have not worked in Mannasim and NRLsensorsim, so I don't know about it.

      Delete
    2. Have u worked With WIRELESS SENSOR NETWORKS???

      Delete
    3. Hi,

      I have worked a bit in WSN.

      Delete
  6. hi,
    can you please tell me how to include clustering patches for ns2.34?

    ReplyDelete
    Replies
    1. Hi,

      Can give more details about your requirement?

      Delete
    2. hi,

      Thank you for replying.My project is, efficiently deploying clusters and selecting cluster-head based on energy and hence save energy in a WSN. As and when the nodes die due to low energy, the topology changes hence change the cluster-head.

      Delete
    3. Hi,

      I think you can try LEACH and PEGASIS.

      Delete
    4. Sir,

      Please send me the patch for PEGASIS.I am stuck in project and also the tcl file for leach i am not getting after adding the patch of LEACH

      Delete
  7. Sir How to install nrlsensorsim in ns-2.34???

    ReplyDelete
  8. sir,
    i want the patch files for implementation of wormhole attack in AODV. Can you help me with the wormhole attack.. I have already implemented AODV

    ReplyDelete
  9. hello sir.
    i have installed ns2.35 in fedora-16. i have downloaded leach.tcl(filename "leach-sims" ) algorithm code from "www.verysource.com" . but i am not getting how to patch those files. please help me out . my project deadline is nearing. . please provide some guidelines and useful links

    ReplyDelete
  10. Sir.

    I wants to add SCTP patch to NS2 in Ubantu and I did't find any patch for SCTP in ns2 can please help me ?

    to find out the sctp patch for ns2.

    ReplyDelete
  11. hi ramakrishna

    i need a tcl script of black hole attack implemented on ZRP Protocol.

    ReplyDelete
  12. hello sir
    i have installed ns2.34 and i have fallowed your steps. i have editted Makefile and Makefile.in and then i have ./configure.... configure was successful.. but while using "make clean" i am getting following error

    make: ***No rule to make target 'clean' stop

    and while using "make depend" commond

    make: ***No rule to make target 'depend'.stop

    please help me out sir... i am new to this linux
    ... reply as soon as possible

    ReplyDelete
  13. - i run patch file following:
    root@ubuntu:~/ns-allinone-2.34/ns-2.34# patch -p1 <mptcp.patch.20100810
    patching file Makefile.in
    patching file tcp/mptcp.cc
    patching file tcp/mptcp-full.cc
    patching file tcp/mptcp-full.h
    patching file tcp/mptcp.h
    patching file tcp/tcp.h
    patching file trace/trace.cc3
    - After runed patch file, i continue run mptcp-sample.tcl
    and result showed below:
    root@ubuntu:~/ns-allinone-2.34/ns-2.34# ns mptcp-sample.tcl
    invalid command name "Agent/TCP/FullTcp/Sack/Multipath"
    while executing
    "Agent/TCP/FullTcp/Sack/Multipath create _o292 "
    invoked from within
    "catch "$className create $o $args" msg"
    invoked from within
    "if [catch "$className create $o $args" msg] {
    if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
    delete $o
    return ""
    }
    global errorInfo
    error "class $..."
    (procedure "new" line 3)
    invoked from within
    "new Agent/TCP/FullTcp/Sack/Multipath"
    invoked from within
    "set tcp0 [new Agent/TCP/FullTcp/Sack/Multipath]"
    (file "mptcp-sample.tcl" line 98)
    root@ubuntu:~/ns-allinone-2.34/ns-2.34#

    -------
    Help me to solve it, please!

    ReplyDelete
    Replies
    1. Hi,

      Follow the steps:

      ./configure
      make clean
      make
      sudo make install

      Delete
    2. Dear Ramakrishna M.
      i try to excute list commands
      ./configure
      make clean
      make
      sudo make install
      ----
      after i installed ns-2.34 again but stiil show error below:
      root@ubuntu:~# ns mptcp-sample.tcl
      invalid command name "Agent/TCP/FullTcp/Sack/Multipath"
      while executing
      "Agent/TCP/FullTcp/Sack/Multipath create _o292 "
      invoked from within
      "catch "$className create $o $args" msg"
      invoked from within
      "if [catch "$className create $o $args" msg] {
      if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
      delete $o
      return ""
      }
      global errorInfo
      error "class $..."
      (procedure "new" line 3)
      invoked from within
      "new Agent/TCP/FullTcp/Sack/Multipath"
      invoked from within
      "set tcp0 [new Agent/TCP/FullTcp/Sack/Multipath]"
      (file "mptcp-sample.tcl" line 98)
      ---------
      - in file mptcp-sample.tcl has been lack function library?
      - in folder ns-2.34 i copied all file in folder multipath-tcp into /ns-allinone-2.34/ns-2.34 and after i tried ns2 again but not excute command: "ns mptcp-sample.tcl" still appear errors above.
      regards.

      Delete
    3. Hi, was this problem solved? If yes, how? Thank you.

      Delete
  14. thanks so much, i excuted "ns mptcp-sample.tcl" successfully.
    again thanks, good health for you.

    ReplyDelete
    Replies
    1. i have the same problem. Could you tell me how to execute mptcp-sample.tcl.
      Thanks a lot

      Delete
    2. hello Sir , i am new to this blog and ns2 as well...i have compared all tcp variants as tahoe,reno,newreno for wired network through simulation...now in next phase i need to compare tcp reno with reno based on RTT for hetrogeneous network...So while referring to all related documents i came to one conclusion that i will need to modify existing tcp reno protol..and to best of my knowledge now i have made some changes in existing files as ns-default.tcl,tcp.h,tcp,cc,tcp-reno.cc according to suggested algorithm....

      Now what should be my next step to make those changes and to recompile it in ns2

      plz help me..

      Thanks and regargs

      Delete
  15. Hello,
    I have seen a lot of problems solved in this blog, i hope you will help me as well, I am working on mSCTP handovers and after much study i found that i can simulate it in ns2, however ns2 provides SCTP module but it does not provide mSCTP module. can you please help me out in this regard like how to simulate mSCTP in ns2 for handovers?
    i will be really very thankful to you


    Regards

    ReplyDelete
    Replies
    1. Hi,

      What is mSCTP? You can simulate only if you have that module or else you need to those feature in SCTP and use.

      Delete
  16. Hello,
    My project is to compare multicast protocol like PUMA, ODMRP in ns2 for vehicular simulation but only AODV, DSR and DSDV protocols are available in ns-2.34. Can you help me out how to add those protocols in NS2

    ReplyDelete
  17. Hi,
    I have added LEACH protocole with NS2.34 but i have this error, please help me:

    trace/cmu-trace.cc: In member function ‘void CMUTrace::nam_format(Packet*, int)’:
    trace/cmu-trace.cc:1120:9: attention : variable ‘distance’ set but not used [-Wunused-but-set-variable]
    trace/cmu-trace.cc: In member function ‘void CMUTrace::format_rca(Packet*, int)’:
    trace/cmu-trace.cc:1530:14: erreur: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
    trace/cmu-trace.cc:1533:14: erreur: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
    trace/cmu-trace.cc:1536:14: erreur: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
    make: *** [trace/cmu-trace.o] Erreur 1

    the function in the .cc file is :


    #ifdef MIT_uAMPS
    void CMUTrace::format_rca(Packet *p, int offset)
    {
    struct hdr_rca *rca_hdr = HDR_RCA(p);
    char op = type_;
    switch (rca_hdr -> msg_type())
    {
    case ADV:
    op = ADV_CHAR;
    break;
    case REQ:
    op = REQ_CHAR;
    break;
    case DATA:
    op = DATA_CHAR;
    break;
    default:
    //printf("format_rca: Warning, unknown meta-data type %dn",rca_hdr->msg_type());
    op = (char) type_;
    break;
    }
    sprintf(pt_ -> buffer() + offset, "------- [%c %d %d %d] ",
    op,
    rca_hdr->rca_src(),
    rca_hdr->rca_link_dst(),
    rca_hdr->rca_mac_dst()
    );
    return;
    }
    #endif

    please tell me what i have to do

    ReplyDelete
  18. hi
    can you tell me about cellular simulation on ns-2 how it is done?
    how can i make center base station through which other nodes can communicate with each another

    ReplyDelete
  19. Dear Sir..
    I want to add TDMA patch in my ns 2.34 version.?
    I have ns2.29 tdma patch but is it support to ns 2.34?
    Please give me installation commands for the install tdma patch.
    Thank You Sir..........!

    ReplyDelete
  20. hi
    i want to implement wormhole attack in NS2. i changed some file in mac.such
    ll.h, ll.cc, arp.cc.
    i find this mudule from internet.
    i want to add 5 wormhole node in simulation. how can don it???????
    thanks

    ReplyDelete
  21. hi sir....
    I want to implement LEACH in NS2.34.And I want to run LEACH protocol in NS2.Can u tell me how to run LEACH and calculate residual energy for sensor nodes in NS2.34.Please give me step by step commands for LEACH implementation.And also want to get LEACH Energy calculation tcl code.Thanks alot sir.

    ReplyDelete
  22. Hello Sir,

    I am trying to implement blackhole attck in zrp. But for this I should not change its header. But zrp is implemented having a single header file (.h file).
    So I have to modify it. But if I keep the methods and classes using packet header same i.e if I do not change them then it gives multiple definition error. And if I change them then no longer they will be the ZRP packet. so other zrp nodes will not accept the packets.
    So please help me to implement blackhole attack in ZRP.
    Thanks

    ReplyDelete
    Replies
    1. Hi,

      Blackhole attack implementation is available, use the same procedure for ZRP too. It will work.

      Delete
    2. Sir please can you give me the link for it.
      I am using zrp file given in this link http://magnet.daiict.ac.in/magnet_members/MTech/2007/PatelBrijesh/Simulation.html#Sec_3.1
      this is not having separate zrp_packet.h file.
      Also I am using the below link for blackhole implementation.
      http://www.btechnos.com/2012/05/blackhole-attack-in-mobile-adhoc.html
      Please guide me.
      Thanks

      Delete
    3. Hi,

      The packet.h implementation might be included in zrp.cc.

      Delete
  23. Sir I am working on olsr protocol.I have install olsr patch and olsr is working properly than I have done some modification in olsr protocol to implement wormhole attack and created a new protocol olsrw.But sir i am not able to run both protocols simultaneously.They are compile properly but packets are not displaying in NAM file...
    Sir give some suggestions......
    Thank You sir

    ReplyDelete
    Replies
    1. Hi,

      The nam will not work for patched protocol most of the time.

      Delete
  24. Good day sir.
    I'm trying to reproduce the results of the PUMA protocol implementation that comes included with ns2.35. As you may know is a Multicast protocol for ad hoc network.
    So far the tcl results give me results that don't actually reproduce the behavior of the original protocol, so I'm stuck right now in this.
    If there's a tcl file that you have used to run this protocol or any advice on its configuration this would be really helpful for my research.
    Thank you very much in advance,
    Aldo

    ReplyDelete
  25. Thank you very much for your prompt answer sir. Let me detail a little bit more the barrier that I found about the protocol:
    In the original Puma behavior only the receivers would join the multicast group and then the elected core (among the receivers) will generate Multicast Announcement to form the mesh of the network that will contain other receivers and the intermediate nodes that connect these receivers with the elected core. Also, these multicast announcement are supposed to create connectivity lists (routing information) in each node of the network even though they don't belong to the mesh and with this information a sender won't need to join the mesh, it would just send the data packet to the parent node (next hop) that sent the multicast announcement to it. And the packet will travel so, until reaches one mesh member and then it would be propagated through the mesh. So this behavior is expected from the implementation in ns2.35 of the puma protocol but analyzing (and running) the tcl file that comes with the puma patch I noticed two things:
    1.- If the senders DON'T join explicitly the mcast group, the other nodes won't forward their packets.
    2.- There's no mesh formation since the nodes that don't join the mesh explicitly don't even forward the multicast announcements generated by the receivers.

    Any comment about this situation would be really helpful.
    Thanks in advance.

    ReplyDelete
    Replies
    1. Hi,

      I have not worked much in PUMA. Sorry, my helpless situation.

      Delete
  26. hi,
    i installed ns2.34 and i got error as command not found. similar command is nc


    how to rectify it...pls give solution

    ReplyDelete
  27. hello Sir , i am new to this blog and ns2 as well...i have compared all tcp variants as tahoe,reno,newreno for wired network through simulation...now in next phase i need to compare tcp reno with reno based on RTT for hetrogeneous network...So while referring to all related documents i came to one conclusion that i will need to modify existing tcp reno protol..and to best of my knowledge now i have made some changes in existing files as ns-default.tcl,tcp.h,tcp,cc,tcp-reno.cc according to suggested algorithm....

    after modification i executed following commands...
    sudo make clean
    sudo make depend
    sudo make

    it was not showing any errors...but wen i tried running my tcl file i m getting same output..
    what should i do now???

    plz help me..

    Thanks and regargs

    ReplyDelete
  28. hi
    Can you suggest me measures to minimise e2edelay in aodv protocol?
    i tried by varying rxthresh but didnt worked out well.
    thanks

    ReplyDelete
  29. Sir,
    I want to add multicast routing protocols (MAODV,ODMRP) in NS2.35. Kindly help to find the patches for those protocols.

    ReplyDelete
    Replies
    1. HI,

      Search online.
      or
      Put query in http://transinntech.wordpress.com/, they will implement and give you.

      Delete
  30. Hello Sir,
    How can i simulate the Sybil, hello flooding , sinkhole attacks.Whether can i make algorithm in C++ or in TCL? can u pls provide sample coding? sir

    ReplyDelete
    Replies
    1. Hi,

      I dont have the sample code.

      You need implement it in C++.

      Delete
  31. hi sir how can i install cluster patch in ns2

    ReplyDelete
  32. Hello can any one help me to achieve the results of Energy Consumption by running the LEACH Protocol on 100 Nodes and with different values of N i.e N=3, 5, 7, 9 and the Packet Size should be = 0.

    I need these results as soon as possible. I have a problem in my LEACH protocol as it is now not running and i have my presentation this week. I just require the results. Who ever is currently able to run LEACH please do help me.

    ReplyDelete
  33. hello sir,

    I m working on ns2.34 and I want to patch it in the same. I have successfully patched all the files but after that i applied the following commands and following error

    ./configure
    make distclean
    ./configure
    make
    ./configure

    In file included from trace/cmu-trace.cc:56:0:
    ./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
    Ns make failed!

    ReplyDelete
  34. Hi,

    Please check the header file declaration.

    ReplyDelete
  35. Hello sir,

    I'm doing my project in load balancing in content delivery networks in ns2 2.34.. I tried to patch a file "ns2_cdn_extension" of version ns2 2.33..
    While trying to patch the following occured

    [root@localhost ~]# cd Desktop
    [root@localhost Desktop]# cd ns-allinone-2.34
    [root@localhost ns-allinone-2.34]# cd ns-2.34
    [root@localhost ns-2.34]# make clean
    make: *** No rule to make target `Makefile.in', needed by `Makefile'. Stop.
    [root@localhost ns-2.34]# patch -p1 < ns2_cdn_extension.patch
    patching file ns-2.33/cdn/cdnagents.cc
    patching file ns-2.33/cdn/cdnagents.h
    patching file ns-2.33/cdn/cdnclient.cc
    patching file ns-2.33/cdn/cdnclient.h
    patching file ns-2.33/cdn/cdn_hdr.h
    patching file ns-2.33/cdn/cdnserver.cc
    patching file ns-2.33/cdn/cdnserver.h
    patching file ns-2.33/cdn/hd_queue.cc
    patching file ns-2.33/cdn/hd_queue.h
    patching file ns-2.33/cdn/httpdata.h
    can't find file to patch at input line 3811
    Perhaps you used the wrong -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff -rupN ns-2 orig/ns-2.33/common/packet.h ns-allinone-2.33/ns-2.33/common/packet.h
    |--- ns-2 orig/ns-2.33/common/packet.h 2008-04-01 04:00:25.000000000 +0200
    |+++ ns-allinone-2.33/ns-2.33/common/packet.h 2010-05-13 13:16:53.000000000 +0200
    --------------------------
    File to patch:

    It is asking for a file to patch.. i dont know which file to patch..
    Moreover i couldnt run the "make clean" command in the begining

    [root@localhost ns-2.34]# make clean
    make: *** No rule to make target `Makefile.in', needed by `Makefile'. Stop.

    Can u help me please..? Waiting for your valuable reply.....

    ReplyDelete
    Replies
    1. Hi,

      You can not patch ns2.33 in ns2.34. due to changes in line number in the files.

      Delete
  36. hi pls help me im trying to patch EURANE+LTE patch in ns2 pls give me any suggestions

    ReplyDelete
    Replies
    1. im doing my project in ns2.32 by using vmware workstation
      can we patch EURANE+LTE in ns2.32 or should we use anyother

      Delete
    2. sir i need your help please mail me
      chandanasree2@gmail.com

      Delete
  37. Hello Sir,
    I want to simulate Location Aided Routing Protocol over NS2.35 in FANET(flying adhoc network). So, i need LAR tcl file and also how to patch this file on nS2.35. Please give response regarding this.

    ReplyDelete
  38. I am getting this error while running ZRP protocol in NS2. How to remove this?
    invalid command name "Agent/ZRP"
    while executing
    "Agent/ZRP set radius_1 "
    (file "zrp.tcl" line 27)

    ReplyDelete
  39. Network Simulator - 2: Generating Patch For Ns-2 >>>>> Download Now

    >>>>> Download Full

    Network Simulator - 2: Generating Patch For Ns-2 >>>>> Download LINK

    >>>>> Download Now

    Network Simulator - 2: Generating Patch For Ns-2 >>>>> Download Full

    >>>>> Download LINK GJ

    ReplyDelete