Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
158 views
in Technique[技术] by (71.8m points)

linux - How to apply the OSPF patch to ns2 2.35 on ubuntu 14.04

I have been using ns2 and nam for a long time on my ubuntu. Now I have to apply a patch (OSPF) to it. I have been searching for how to apply a patch in linux (as I'm kind of new in it) and all I got was:

1) $ tar xvf ns-allinone-2.35.tar.gz

2) $ cd ns-allinone-2.35/

3) $ ln -s ns-2.35/ ns-2.34

... Then the patch will work, except for one line. (commom/packet.h).

4) $ patch -p0 < 10-ospf4ns2.34-base.patch

http://sourceforge.net/projects/ospf4ns/

5) Replace commom/packet.h with the attached "packet.h" : Edited by hand.

6) export CC=gcc44 CXX=g++44 && ./install

I untared the tar file, copied the .patch file in the ns-allinone-2.35 folder called 10-ospf4ns2.34-base.patch, gone to the directory in a terminal, used ln -s ns-2.35/ ns-2.34 and then patched using line 4. After that I have these messages:

The next patch would create the file ns-2.34/classifier/classifier-mtopology.cc,
which already exists!  Assume -R? [n] y
patching file ns-2.34/classifier/classifier-mtopology.cc
The next patch would create the file ns-2.34/classifier/classifier-mtopology.h,
which already exists!  Assume -R? [n] y
patching file ns-2.34/classifier/classifier-mtopology.h
can't find file to patch at input line 92
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- ns-2.34.old/common/agent.cc    2009-06-14 18:35:45.000000000 +0100
|+++ ns-2.34/common/agent.cc    2010-02-26 23:34:33.161063590 +0000
--------------------------
File to patch:

After this I don't know what to do. What file should I patch? There is no classifier-mtopology.h in ns-2.34. And after that, which packet.h should I replace with the specified new packet.h? Because there are several common folders. Any help would be much appreciated cause I'm a novice in linux.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like you already applied the patch before (at least partially) and that you are not in the correct directory.

Start again, also you can avoid the symlink with the following instructions:

  1. Extract ns-allinone-2.35.tar.gz in a fresh directory.

  2. cd ns-allinone-2.35/ns-2.35

  3. Apply the patch with:

    patch -p1 < 10-ospf4ns2.34-base.patch


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...