LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   NS2 (https://www.linuxquestions.org/questions/linux-networking-3/ns2-4175734171/)

nahid91 02-23-2024 12:57 PM

NS2
 
how to patch the zrp-ns235.patch and the ns2 security_ns235.patch so that i can use zrp with encyption

TB0ne 02-23-2024 02:37 PM

Quote:

Originally Posted by nahid91 (Post 6485432)
how to patch the zrp-ns235.patch and the ns2 security_ns235.patch so that i can use zrp with encyption

Essentially a duplicate of your other thread:
https://www.linuxquestions.org/quest...ol-4175733095/

At some point, you're going to have to do research on your own for your own homework. We aren't going to type up step-by-step instructions for you or look up things and give you links. There are several threads on this very site that answer this, along with many on any search-engine for "ns2.35 zrp encryption patch". Start there.

knudfl 02-23-2024 03:21 PM

The ns2 "Security" is not a genuine encryption, but is a very simple code.
security_ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing

Patching an ns-2.35 which is already patched with zrp :
Code:

cd ns-allinone-2.35/
patch -p0 < security_ns235.patch

.... There is one file to edit: common/packet.h → Edit to
Code:

  203        static const packet_t PT_ZRP = 73; // [CHANGE-2(for_ZRP-AGENT) : Lines#2]
  204       
  205        static const packet_t PT_SECURITY_PACKET = 74;
  206               
  207                // insert new packet types here
  208        static packet_t      PT_NTYPE = 75; // This MUST be the LAST one

For encryption, suggest code like "aodv + SSL" → saodv-with-ssl_ns235.diff
https://drive.google.com/file/d/1GCg...usp=drive_link
.... which is this in aodv.cc: +#include <openssl/aes.h> +#include <openssl/ec.h>
and Makefile.in (line 23) + -lcrypto @LIBS@ -lssl @LIBS@
? Might work with ZRP? zrp.cc ?
INFO http://www.linuxquestions.org/questi...67#post5305067 etc. posts https://www.linuxquestions.org/quest...raries-530848/

-

nahid91 02-24-2024 12:23 AM

@knudfl so I tried to patch an ns-2.35 which is already patched with zrp as you have mentioned above and while running the
Code:

patch -p0 < security_ns235.patch
it shows me this error:
Code:

nahid@nahid-ROG-Strix-G614JU-G614JU:~/ns-allinone-2.35$ patch -p0 < security_ns235.patch
patching file ns-2.35/common/packet.h
Hunk #1 FAILED at 198.
Hunk #2 FAILED at 325.
2 out of 2 hunks FAILED -- saving rejects to file ns-2.35/common/packet.h.rej
patching file ns-2.35/Makefile.in
Reversed (or previously applied) patch detected!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ns-2.35/Makefile.in.rej
The next patch would create the file ns-2.35/README-Security,
which already exists!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file ns-2.35/security/security.cc,
which already exists!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file ns-2.35/security/security.h,
which already exists!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file ns-2.35/security/security.tcl,
which already exists!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored
patching file ns-2.35/tcl/lib/ns-default.tcl
Hunk #1 succeeded at 1596 (offset 6 lines).
patching file ns-2.35/tcl/lib/ns-packet.tcl
Reversed (or previously applied) patch detected!  Assume -R? [n] R
Apply anyway? [n] R
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ns-2.35/tcl/lib/ns-packet.tcl.rej

i edited the packet.h file as you have stated. I am not sure why is it showing failed. I have tried multiple times it shows the same

knudfl 02-24-2024 04:04 AM

Re #4

The zrp + security sequence ....

Code:

tar xvf ns-allinone-2.35_gcc5.tar.gz
https://drive.google.com/file/d/0B7S...FDb7ul0VFk6FZQ
cd ns-allinone-2.35/
patch -p0 < zrp-ns235.patch
patch -p0 < security_ns235.patch
export CC=gcc-4.8 CXX=g++-4.8 && ./install
cd ns-2.35/
cp ns ns235-zrp+security
sudo cp ns235-zrp+security /usr/local/bin/

The packet.h.rej and the "patch.log" https://drive.google.com/drive/folde...usp=drive_link

Sorry, you will also have to add
Code:

                name_[PT_SECURITY_PACKET]= "Security_packet";
... to line ~333 in packet.h, see packet.h.rej
(So no real errors during patching but the 2 edits in common/packet.h)

Alternatively, you can setup a new ns-allinone-2.35/ in a new folder in /home/name/ns2/, and use the new patch zrp+security_ns235.patch
https://docs.google.com/document/d/1...usp=share_link
i.e. you can have as many ns-allinone-2.xx as you want installed at the same time.

The example zrp_guindy-Security.tcl (+ mobility31) is also included in https://drive.google.com/drive/folde...usp=drive_link
My test
Code:

$ ns235-zrp+security zrp_guindy-Security.tcl
num_nodes is set 31
.
INITIALIZE THE LIST xListHead
Starting Simulation...
Message sent itisalongmessageIcansend with hashing 541705348
Message sent Itisashotermessage with hashing 9128228
Message sent test3 with hashing 406
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
Message sent test4 with hashing 486
data intergity ensured
node 1 received packet from  4 with trip-time 341.2 ms - contend: whvw6 - decrypted test3 -hash: 406
data intergity ensured
node 4 received packet from  1 with trip-time 500.5 ms - contend: Lwlvdvkrwhuphvvdjh - decrypted Itisashotermessage -hash: 9128228
node 4 received packet from  1 with trip-time 484.1 ms - contend: Message_Accepted - decrypted _ -hash: 0
node 1 received packet from  4 with trip-time 514.5 ms - contend: Message_Accepted - decrypted _ -hash: 0
data intergity ensured
node 5 received packet from  0 with trip-time 661.7 ms - contend: lwlvdorqjphvvdjhLfdqvhqg - decrypted itisalongmessageIcansend -hash: 541705348
data intergity ensured
node 0 received packet from  5 with trip-time 844.6 ms - contend: whvw7 - decrypted test4 -hash: 486
node 0 received packet from  5 with trip-time 947.8 ms - contend: Message_Accepted - decrypted _ -hash: 0
node 5 received packet from  0 with trip-time 917.9 ms - contend: Message_Accepted - decrypted _ -hash: 0

Security-ex-6_2024.tar.xz
https://drive.google.com/file/d/1Kai...ew?usp=sharing

-

WinnifredNitzsche 03-06-2024 02:03 AM

Thank you for the link.


All times are GMT -5. The time now is 03:44 AM.