Commit c24f8667 authored by Shashi Guruprasad's avatar Shashi Guruprasad
Browse files

Merged all of my changes into ns2.1b9. Now we don't have to depend on

the flux repository to have ns-2. The install file just downloads the
ns2.1b9 distribution, patches it and installs it.
parent e8779169
For NSE based TCP traffic generation, we need the following files
For NSE integration and traffic generation, we need the following files
as part of the FBSD disk image or it should be part of
/usr/testbed/sup/sup/FBSD43-STD/root*/etc/testbed on the boss node.
......@@ -9,7 +9,7 @@ b) NSE executable file. To build it the first time, chdir to
./nse-install
c) Then do a
cp nse nseinput.tcl startnse init.tcl <sup_directory>
cp nse nseinput.tcl startnse <sup_directory>
The current NSE trafgen comes with a major caveat:
......
#!/bin/sh
if [ ! -d ns-2 ]; then
echo "Checking out ns-2 source to ."
cvs co ns-2
echo "Downloading ns2.1b9 source ..."
fetch http://www.emulab.net/ns-allinone-2.1b9.tar.gz
tar xzf ns-allinone-2.1b9.tar.gz
patch -p0 < nse.patch
cd ns-2
cd ns-allinone-2.1b9
./install
cp ns-2.1b8a/nse ..
cp lib/tcl8.3/init.tcl ..
cp ns-2.1b9/nse ..
fi
Index: ns-2/install
diff -u ns-2/install:1.2 ns-2/install:1.3
--- ns-2/install:1.2 Tue Mar 12 01:05:34 2002
+++ ns-2/install Thu Mar 21 11:51:21 2002
@@ -16,7 +16,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Header: /foo/x/flux/CVS/ns-2/install,v 1.2 2002/03/12 08:05:34 shash Exp $
+# $Header: /foo/x/flux/CVS/ns-2/install,v 1.3 2002/03/21 18:51:21 shash Exp $
die() {
echo "$@" 1>&2
@@ -53,7 +53,7 @@
blame='Tcl is not part of the ns project. Please see www.Scriptics.com
to see if they have a fix for your platform.'
-./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..."
+./configure --enable-gcc --disable-shared --disable-load --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..."
if make
then
echo "tcl$TCLVER make succeeded."
Index: ns-2/ns-2.1b8a/scheduler.cc
diff -u ns-2/ns-2.1b8a/scheduler.cc:1.2 ns-2/ns-2.1b8a/scheduler.cc:1.3
--- ns-2/ns-2.1b8a/scheduler.cc:1.2 Tue Mar 12 01:03:06 2002
+++ ns-2/ns-2.1b8a/scheduler.cc Thu Mar 14 16:46:45 2002
@@ -304,11 +304,7 @@
return;
for (p = &queue_; *p != e; p = &(*p)->next_)
if (*p == 0) {
- fprintf( stderr,
- "Scheduler Cancel fails. Should have aborted\n"); // XXX: hack -> abort();
- e->uid_ = - e->uid_;
- return;
- //abort();
+ abort();
}
*p = (*p)->next_;
Index: ns-2/ns-2.1b8a/tcp-full.cc
diff -u ns-2/ns-2.1b8a/tcp-full.cc:1.3 ns-2/ns-2.1b8a/tcp-full.cc:1.4
--- ns-2/ns-2.1b8a/tcp-full.cc:1.3 Wed Mar 20 17:30:12 2002
+++ ns-2/ns-2.1b8a/tcp-full.cc Tue Apr 9 14:49:20 2002
@@ -89,6 +89,7 @@
#include "flags.h"
#include "random.h"
#include "template.h"
+#include <stdlib.h>
#define TRUE 1
#define FALSE 0
@@ -96,6 +97,20 @@
#define MIN(x,y) (((x)<(y))?(x):(y))
#define MAX(x,y) (((x)>(y))?(x):(y))
diff -ru dist-ns-allinone-2.1b9/install ns-allinone-2.1b9/install
--- dist-ns-allinone-2.1b9/install Mon Apr 22 18:42:09 2002
+++ ns-allinone-2.1b9/install Thu Jun 13 21:46:32 2002
@@ -39,224 +39,82 @@
+#define SEQ_LT(a,b) (((a)<(b) && (b)-(a) < TCP_MAXSEQ/2) || ((a)>(b) && (a)-(b) >= TCP_MAXSEQ/2))
+#define SEQ_LE(a,b) (((a)<=(b) && (b)-(a) < TCP_MAXSEQ/2) || ((a)>(b) && (a)-(b) >= TCP_MAXSEQ/2))
+#define SEQ_GT(a,b) (((a)>(b) && (a)-(b) < TCP_MAXSEQ/2) || ((a)<(b) && (b)-(a) >= TCP_MAXSEQ/2))
+#define SEQ_GE(a,b) (((a)>=(b) && (a)-(b) < TCP_MAXSEQ/2) || ((a)<(b) && (b)-(a) >= TCP_MAXSEQ/2))
+#define INCR_SEQ(num, val) (num) = ((num) + (val)) % TCP_MAXSEQ
+#define SEQ_ADD(num, val) (((num) + (val)) % TCP_MAXSEQ)
+inline int SEQ_SUB(int num, int val) {
+ int ret = num - val;
+ return( abs(ret) < TCP_MAXSEQ/2 ? ret : ((int)(((long long)(num) - (val) + TCP_MAXSEQ) % TCP_MAXSEQ)) );
+}
+#define DECR_SEQ(num, val) (num) = SEQ_SUB((num), (val))
+#define SEQ_MIN(x,y) (SEQ_LT((x),(y))?(x):(y))
+#define SEQ_MAX(x,y) (SEQ_GT((x),(y))?(x):(y))
# Get current path
CUR_PATH=`pwd`
+
+if [ -x /usr/local/tcl8.3.2/bin/tclsh8.3 ] ; then
+ V_TCLSH=/usr/local/tcl8.3.2/bin/tclsh8.3
+ export V_TCLSH
+ WITHTCL_PATH=/usr/local/tcl8.3.2
+ export WITHTCL_PATH
+
static class FullTcpClass : public TclClass {
public:
FullTcpClass() : TclClass("Agent/TCP/FullTcp") {}
@@ -229,8 +244,8 @@
FullTcpAgent::pack(Packet *pkt)
{
hdr_tcp *tcph = hdr_tcp::access(pkt);
- return (tcph->ackno() >= highest_ack_ &&
- tcph->ackno() < recover_);
+ return (SEQ_GE(tcph->ackno(), highest_ack_) &&
+ SEQ_LT(tcph->ackno(), recover_) );
}
/*
@@ -335,13 +350,13 @@
return;
} else if (state_ == TCPS_CLOSED) {
reset();
- curseq_ = iss_ + nb;
+ INCR_SEQ( curseq_, SEQ_ADD(iss_, nb));
connect(); // initiate new connection
} else if (state_ == TCPS_ESTABLISHED) {
closed_ = 0;
- if (curseq_ < iss_)
+ if ( SEQ_LT(curseq_, iss_) )
curseq_ = iss_;
- curseq_ += nb;
+ INCR_SEQ(curseq_, nb);
send_much(0, REASON_NORMAL, maxburst_);
}
return;
@@ -390,7 +405,7 @@
+else
+
+ # Build Tcl8.3.2
+
+ echo "============================================================"
+ echo "* Build tcl$TCLVER"
+ echo "============================================================"
+
+ cd ./tcl$TCLVER/unix
+ if [ -f Makefile ] ; then
+ make distclean
+ fi
+
+ blame='Tcl is not part of the ns project. Please see www.Scriptics.com
+ to see if they have a fix for your platform.'
+ ./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..."
+ if make
+ then
+ echo "tcl$TCLVER make succeeded."
+ make install || die "tcl$TCLVER installation failed."
+ echo "tcl$TCLVER installation succeeded."
+ cp ../generic/*.h ../../include
+ else
+ echo "tcl$TCLVER make failed! Exiting ..."
+ echo "For problems with Tcl/Tk see http://www.scriptics.com"
+ exit
+ fi
+
+ cd ../../
+
+ WITHTCL_PATH=$CUR_PATH/tcl$TCLVER
+
+fi
+
+if [ -d /usr/local/otcl-1.0a8 ] ; then
+
+ WITHOTCL_PATH=/usr/local/otcl-1.0a8
+ export WITHOTCL_PATH
+
+else
+
+ # Build otcl
+
+ echo "============================================================"
+ echo "* Build OTcl-$OTCLVER"
+ echo "============================================================"
+
+ cd ./otcl-$OTCLVER
+
+ blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html
+ for common problems and bug fixes.'
+ ./configure --with-tcl=$WITHTCL_PATH || die "otcl-$OTCLVER configuration failed! Exiting ..."
+
+ if make
+ then
+ echo "otcl-$OTCLVER has been installed successfully."
+ else
+ echo "otcl-$OTCLVER make failed! Exiting ..."
+ echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
+ exit
+ fi
+
+ cd ..
int FullTcpAgent::rcvseqinit(int seq, int dlen)
{
- return (seq + dlen + 1);
+ return (SEQ_ADD(seq, dlen + 1));
}
-# Compile and install xgraph
+ WITHOTCL_PATH=`pwd`/otcl-$OTCLVER
+ export WITHOTCL_PATH
int
@@ -468,6 +483,7 @@
-echo "============================================================"
-echo "* Build XGraph-$XGRAPHVER"
-echo "============================================================"
-
-cd ./xgraph-$XGRAPHVER
-./configure
-if make
-then
- echo "xgraph has been installed successfully. "
-else
- echo "Can not create xgraph; But xgraph is an optional package, continuing..."
-fi
-
-cd ../
-
-# Compile and install cweb and sgblib
-
-echo "============================================================"
-echo "* Build CWeb"
-echo "============================================================"
-
-cd ./cweb
-
-if [ ! -f ./Makefile ]
-then
- echo "ns-allinone unable to install cweb for you. Please install it manually. cweb is used by sgb to create sgblibrary needed by scenario-generator. But this will not affect the use of ns as such, so continue.."
-else
- echo "Making cweb"
- touch *.c
- make all || warn "cweb failed to make, but it's optional"
- # xxx: other stuff will fail...
- chmod 755 cweave
- chmod 755 ctangle
- cd ..
- #echo "cd .."
- if [ ! -d bin ]
- then
- mkdir bin
- fi
- cd bin
- ln -s $CUR_PATH/cweb/cweave cweave
- ln -s $CUR_PATH/cweb/ctangle ctangle
-fi
-
-cd ..
-PATH=$CUR_PATH/bin:$PATH
-export PATH
-
-echo "============================================================"
-echo "* Build Stanford GraphBase"
-echo "============================================================"
-
-cd ./sgb
-if [ ! -f ./Makefile ]
- then
- echo "Unable to create sgb library. This library is used by gt-itm and so for scenario generators. If you already have sgblib (possible if you are on solaris,sunos or freebsd platforms) you may still be able to run gt-itm. so continuing.."
-else
- echo "Making sgb"
- if make tests
- then
- if [ -f libgb.a ] ; then
- rm -f ../gt-itm/lib/libgb.a
- cp libgb.a ../gt-itm/lib/libgb.a
- else
- echo "* Wierd: sgb said it has been built but we can't find libgb.a!
-"
- exit -1
- fi
- else
- echo "Unable to create sgb library, but it's optional, so continuing..."
- fi
-fi
-
-cd ..
-
-# Compile and install gt-itm & sgb2ns
-
-echo "============================================================"
-echo "* Build GT-ITM"
-echo "============================================================"
-
-if [ -f ./gt-itm/lib/libgb.a ]
-then
- if [ ! -f ./gt-itm/src/Makefile ]
- then
- echo "ns-alline is unable to install gt-itm sgb2ns for you, please install"
- echo "them manually. You can't run scenario generator without gt-itm"
- echo "and sgb2ns. But it will not affect you use ns, so continue ..."
- else
- cd ./gt-itm/src
- if make
- then
- echo "gt-itm has been installed successfully."
- fi
-
- cd ../sgb2ns
- if make
- then
- echo "sgb2ns has been installed successfully."
- fi
- cd ../../
- fi
-else
- echo "sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing.."
-fi
-
-# Build zlib
-
-echo "============================================================"
-echo "* Build zlib"
-echo "============================================================"
-
-cd ./zlib-1.1.3
-
-if ./configure --exec-prefix=../ --prefix=../
-then
- if make
- then
- echo "Zlib has been installed successfully."
- else
- warn "Zlib make failed, but it's optional Continue ..."
- fi
-else
- warn "Zlib-1.1.3 configuration failed, but it's optional, so continuing ..."
-fi
-
-cd ../
-
-# Build Tcl8.3.2
-
-echo "============================================================"
-echo "* Build tcl$TCLVER"
-echo "============================================================"
-
-cd ./tcl$TCLVER/unix
-if [ -f Makefile ] ; then
- make distclean
-fi
-
-blame='Tcl is not part of the ns project. Please see www.Scriptics.com
-to see if they have a fix for your platform.'
-./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..."
-if make
-then
- echo "tcl$TCLVER make succeeded."
- make install || die "tcl$TCLVER installation failed."
- echo "tcl$TCLVER installation succeeded."
- cp ../generic/*.h ../../include
-else
- echo "tcl$TCLVER make failed! Exiting ..."
- echo "For problems with Tcl/Tk see http://www.scriptics.com"
- exit
-fi
-
-cd ../../
-
-# compile and install tk
-
-echo "============================================================"
-echo "* Build Tk$TKVER"
-echo "============================================================"
-
-cd ./tk$TKVER/unix
-if [ -f Makefile ] ; then
- make distclean
-fi
-
-blame='Tk is not part of the ns project. Please see www.Scriptics.com
-to see if they have a fix for your platform.'
-./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tk8.3.2 configuration failed! Exiting ..."
-if make
-then
- echo "tk$TKVER build succeeded."
- make install || die "tk$TKVER installation failed."
- echo "tk$TKVER installation succeeded."
-else
- echo "tk$TKVER make failed! Exiting ..."
- echo "For problems with Tcl/Tk see http://www.scriptics.com"
- exit
fi
-cd ../../
-
-#
-# Since our configures search for tclsh in $PATH, the following
-# is needed. This is necessary for otcl/tclcl/ns/nam
-#
-PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$PATH
-export PATH
-LD_LIBRARY_PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH
-
-# Build otcl
-
-echo "============================================================"
-echo "* Build OTcl-$OTCLVER"
-echo "============================================================"
-
-cd ./otcl-$OTCLVER
-
-blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html
-for common problems and bug fixes.'
-./configure || die "otcl-$OTCLVER configuration failed! Exiting ..."
-
-if make
-then
- echo "otcl-$OTCLVER has been installed successfully."
-else
- echo "otcl-$OTCLVER make failed! Exiting ..."
- echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
- exit
-fi
-
-cd ..
-
# Build tclcl
last_ack_sent_ = ackno;
send(p, 0);
+
}
echo "============================================================"
@@ -265,7 +123,7 @@
void FullTcpAgent::cancel_timers()
@@ -498,23 +514,23 @@
maxseg_ = size_ - headersize();
else
size_ = maxseg_ + headersize();
- int is_retransmit = (seqno < maxseq_);
+ int is_retransmit = SEQ_LT(seqno, maxseq_) ;
int quiet = (highest_ack_ == maxseq_);
int pflags = outflags();
int syn = (seqno == iss_);
int emptying_buffer = FALSE;
int buffered_bytes = (infinite_send_) ? TCP_MAXSEQ :
- curseq_ - highest_ack_ + 1;
+ SEQ_ADD( SEQ_SUB(curseq_, highest_ack_), 1);
cd ./tclcl-$TCLCLVER
int win = window() * maxseg_; // window (in bytes)
- int off = seqno - highest_ack_; // offset of seg in window
+ int off = SEQ_SUB(seqno, highest_ack_); // offset of seg in window
int datalen;
-./configure || die "tclcl-$TCLCLVER configuration failed! Exiting ..."
+./configure --enable-static --with-tcl=$WITHTCL_PATH --with-otcl=$WITHOTCL_PATH || die "tclcl-$TCLCLVER configuration failed! Exiting ..."
// be careful if we have not received any ACK yet
if (highest_ack_ < 0) {
if (!infinite_send_)
- buffered_bytes = curseq_ - iss_;;
- off = seqno - iss_;
+ buffered_bytes = SEQ_SUB(curseq_, iss_);
+ off = SEQ_SUB(seqno, iss_);
}
if make
then
@@ -286,40 +144,22 @@
echo "============================================================"
if (syn && !data_on_syn_)
@@ -535,7 +551,6 @@
datalen = maxseg_;
}
cd ./ns-$NSVER
-./configure || die "Ns configuration failed! Exiting ..."
-if make
+./configure --enable-static --with-tcl=$WITHTCL_PATH --with-otcl=$WITHOTCL_PATH || die "Ns configuration failed! Exiting ..."
+
+
+if make nse
then
- echo " Ns has been installed successfully."
+ echo " Nse has been installed successfully."
else
- echo "Ns make failed!"
+ echo "Nse make failed!"
echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
exit
fi
cd ../
-# Build nam
-
//
// this is an option that causes us to slow-start if we've
// been idle for a "long" time, where long means a rto or longer
@@ -552,8 +567,8 @@
// see if sending this packet will empty the send buffer
// a dataless SYN packet counts also
//
- if (!infinite_send_ && ((seqno + datalen) > curseq_ ||
- (syn && datalen == 0))) {
+ if (!infinite_send_ && SEQ_GT(SEQ_ADD(seqno, datalen), curseq_) ||
+ (syn && datalen == 0)) {
emptying_buffer = TRUE;
//
// if not a retransmission, notify application that
@@ -638,7 +653,7 @@
* around until we actually send a segment
*/
-echo "============================================================"
-echo "* Build nam-$NAMVER"
-echo "============================================================"
-
-cd ./nam-$NAMVER
-
-./configure || die "Nam configuration failed! Exiting ..."
-
-if make
-then
- echo "Nam has been installed successfully."
-else
- echo "Nam make failed! Continue ..."
- echo "See http://www.isi.edu/nsnam/ns-problems.html for problems"
-fi
-
-cd ../
-
-# Install nam, ns, xgraph into bin
+# Install nse
- int reliable = datalen + syn + fin; // seq #'s reliably sent
+ int reliable = SEQ_ADD(datalen, syn + fin); // seq #'s reliably sent
if (cong_action_ && reliable > 0)
cong_action_ = FALSE;
if [ ! -d bin ] ; then
mkdir bin
@@ -327,55 +167,14 @@
@@ -648,15 +663,15 @@
*/
cd bin
if (!fin && seqno == t_seqno_) {
- t_seqno_ += reliable;
+ INCR_SEQ(t_seqno_, reliable);
}
-ln -s $CUR_PATH/ns-$NSVER/ns ns
-
-if test -x $CUR_PATH/nam-$NAMVER/nam
-then
- ln -s $CUR_PATH/nam-$NAMVER/nam nam
-else
- echo "Please compile your nam separately."
-fi
-
-if test -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph
-then
- ln -s $CUR_PATH/xgraph-$XGRAPHVER/xgraph xgraph
-else
- echo "Please compile your xgraph separately."
-fi
-
-if test -x $CUR_PATH/gt-itm/bin/sgb2ns
-then
- ln -s $CUR_PATH/gt-itm/bin/sgb2ns sgb2ns
- ln -s $CUR_PATH/gt-itm/bin/sgb2hierns sgb2hierns
- ln -s $CUR_PATH/gt-itm/bin/sgb2comns sgb2comns
- ln -s $CUR_PATH/gt-itm/bin/itm itm
- ln -s $CUR_PATH/gt-itm/bin/sgb2alt sgb2alt
- ln -s $CUR_PATH/gt-itm/bin/edriver edriver
-else
- echo "Please compile your gt-itm & sgb2ns separately."
-fi
+ln -s $CUR_PATH/ns-$NSVER/nse nse
echo "Ns-allinone package has been installed successfully."
echo "Here are the installation places:"
echo "tcl$TCLVER: $CUR_PATH/{bin,include,lib}"
-echo "tk$TKVER: $CUR_PATH/{bin,include,lib}"
echo "otcl: $CUR_PATH/otcl-$OTCLVER"
echo "tclcl: $CUR_PATH/tclcl-$TCLCLVER"
-echo "ns: $CUR_PATH/ns-$NSVER/ns"
-
-if [ -x $CUR_PATH/nam-$NAMVER/nam ]
-then
-echo "nam: $CUR_PATH/nam-$NAMVER/nam"
-fi
-
-if [ -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph ]
-then
-echo "xgraph: $CUR_PATH/xgraph-$XGRAPHVER"
-fi
-if [ -x $CUR_PATH/gt-itm/bin/sgb2ns ]
-then
-echo "gt-itm: $CUR_PATH/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns"
-fi
+echo "nse: $CUR_PATH/ns-$NSVER/nse"
echo ""
echo "----------------------------------------------------------------------------------"
diff -ru dist-ns-allinone-2.1b9/ns-2.1b9/Makefile.in ns-allinone-2.1b9/ns-2.1b9/Makefile.in
--- dist-ns-allinone-2.1b9/ns-2.1b9/Makefile.in Mon Mar 18 15:39:26 2002
+++ ns-allinone-2.1b9/ns-2.1b9/Makefile.in Thu Jun 13 18:46:54 2002
@@ -78,6 +78,14 @@
CFLAGS = $(CCOPT) $(DEFINE)
+#### with event system
+INCLUDES += -I../.. -I../../../lib -I../../../../lib/libtb `elvin-config --cflags vin4c`
+CFLAGS += -DUSEEVENTS -DUSEROUTES
+LIB += -L../../../lib -L../../../../lib/libtb -levent -ltb
+LIB += `elvin-config --libs vin4c`
+STATIC += -static
+####
+
# Explicitly define compilation rules since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
@@ -285,6 +293,10 @@
emulate/nat.o \
emulate/iptap.o \
emulate/tcptap.o
+
+##### nse with event system
+OBJ_EMULATE_CC += ../../tbevent.o ../../tbnexthop.o
+####
OBJ_EMULATE_C = \
emulate/inet.o
diff -ru dist-ns-allinone-2.1b9/ns-2.1b9/apps/telnet.cc ns-allinone-2.1b9/ns-2.1b9/apps/telnet.cc
--- dist-ns-allinone-2.1b9/ns-2.1b9/apps/telnet.cc Fri Aug 14 14:09:33 1998
+++ ns-allinone-2.1b9/ns-2.1b9/apps/telnet.cc Thu Jun 13 20:01:59 2002