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

Distributed NSE changes. In other words, simulation resources are

now mapped to more than one PC if required. The simnode_capacity
column in the node_types table determines how many sim nodes can
be packed on one PC. The packing factor can also be controlled via
tb-set-colocate-factor to be smaller than simnode_capacity.

- No frontend code changes. To summarize:
  $ns make-simulated {
    ...
  }
  is still the easy way to put a whole bunch of Tcl code to be
  in simulation.
  One unrelated fix in the frontend code is to fix the
  xmlencode() function which prior to this would knock off
  newlines from columns in the XML output. This affected
  nseconfigs since it is one of the few columns with embedded
  newlines. Also changed the event type and event object type
  in traffic.tcl from TRAFGEN/MODIFY to NSE/NSEEVENT.

- More Tcl code in a new directory tbsetup/nseparse
  -> Runs on ops similar to the main parser. This is invoked
     from assign_wrapper in the end if there are simnodes
  -> Partitions the Tcl code into multiple Tcl specifications
     and updates the nseconfigs table via xmlconvert
  -> Comes with a lot of caveats. Arbitrary Tcl code such as user
     specified objects or procedures will not be re-generated. For
     example, if a user wanted a procedure to be included in Tcl
     code for all partitions, there is no way for code in nseparse
     to do that. Besides that, it needs to be tested more thoroughly.

- xmlconvert has a new option -s. When invoked with this option,
  the experiments table is not allowed to be modified. Also,
  virtual tables are just updated (as opposed to deleting
  all rows in the first invocation before inserting new rows)

- nse.patch has all the IP address related changes committed in
  iversion 1.11 + 2 other changes. 1) MTU discovery support in
  the ICMP agent 2) "$ns rlink" mechanism for sim node to real
  node links

- nseinput.tcl includes several client side changes to add IP
  routes in NSE and the kernel routing table for packets crossing
  pnodes. Also made the parsing of tmcc command output more robust
  to new changes. Other client side changes in libsetup.pm and other
  scripts to run nse, are also in this commit

- Besides the expected changes in assign_wrapper for simulated nodes,
  the interfaces and veth_interfaces tables are updated with
  routing table identifiers (rtabid). The tmcd changes are already
  committed. This field is used only by sim hosts on the client side.
  Of course, they can be used by jails as well if desired.
parent de16d8e4
......@@ -1221,6 +1221,7 @@ else
event/trafgen/GNUmakefile \
event/proxy/GNUmakefile \
event/nsetrafgen/GNUmakefile \
event/nsetrafgen/nseinput.tcl \
event/delay-agent/GNUmakefile \
event/program-agent/GNUmakefile \
event/stated/waitForState \
......@@ -1294,7 +1295,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1298: checking for a BSD compatible install" >&5
echo "configure:1299: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -1396,7 +1397,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/db2ns \
tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -334,6 +334,7 @@ else
event/trafgen/GNUmakefile \
event/proxy/GNUmakefile \
event/nsetrafgen/GNUmakefile \
event/nsetrafgen/nseinput.tcl \
event/delay-agent/GNUmakefile \
event/program-agent/GNUmakefile \
event/stated/waitForState \
......@@ -439,7 +440,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/db2ns \
tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -24,10 +24,13 @@ sub usage()
exit(-1);
}
my $optlist = "x:nd";
my $optlist = "x:nds";
my $fromxml = 0;
my $impotent = 0;
my $debug = 0;
# Results of parsing nse specifications. Therefore different treatment.
# In particular, we don't expect updates to the experiments table
my $simparse = 0;
#
# Configure variables
......@@ -105,6 +108,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"s"})) {
$simparse = 1;
}
if (defined($options{"x"})) {
$fromxml = 1;
$xmlfile = $options{"x"};
......@@ -180,21 +186,27 @@ sub readXML($$$) {
fatal($@)
if (eval { $parser->parse(*STDIN); return 1; } != 1);
#
# Verify.
#
# Must be exactly one experiments table row, and we prune out lots
# of stuff that is not allowed. Note that we never insert a
# experiment, but only allow updates of certain values.
#
if (scalar(@{$virtual_tables{"experiments"}}) != 1) {
fatal("Must be exactly one experiments table row!");
}
my %experiments_table = %{@{$virtual_tables{"experiments"}}[0]};
foreach my $key (keys(%experiments_table)) {
delete($experiments_table{$key})
if (!exists($experiment_fields{$key}));
# If these are the results of parsing the nse specifications,
# we don't expect updates to the experiments table
my %experiments_table;
if ( ! $simparse ) {
#
# Verify.
#
# Must be exactly one experiments table row, and we prune out lots
# of stuff that is not allowed. Note that we never insert a
# experiment, but only allow updates of certain values.
#
if (scalar(@{$virtual_tables{"experiments"}}) != 1) {
fatal("Must be exactly one experiments table row!");
}
%experiments_table = %{@{$virtual_tables{"experiments"}}[0]};
foreach my $key (keys(%experiments_table)) {
delete($experiments_table{$key})
if (!exists($experiment_fields{$key}));
}
}
#
......@@ -218,7 +230,7 @@ sub readXML($$$) {
# First the experiments table, which gets an update statement, if there
# is anything to update.
#
if (scalar(keys(%experiments_table))) {
if ( (! $simparse) && scalar(keys(%experiments_table))) {
my @setlist = ();
foreach my $key (keys(%experiments_table)) {
......@@ -257,10 +269,13 @@ sub readXML($$$) {
next
if ($table eq "experiments");
# Delete always.
DBQueryFatal("delete from $table ".
"where eid='$eid' and pid='$pid'")
if (!$impotent);
# Delete only during the initial parsing and not
# during parsing of nse specifications
if ( ! $simparse ) {
DBQueryFatal("delete from $table ".
"where eid='$eid' and pid='$pid'")
if (!$impotent);
}
next
if (!defined($virtual_tables{$table}));
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -9,8 +9,8 @@ TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = event/nsetrafgen
INSTALL_SUPDIR = /usr/testbed/sup/sup/FBSD45-STD/root
INSTALL_FILES = $(SRCDIR)/nseinput.tcl $(SRCDIR)/startnse
INSTALL_NSE = $(SRCDIR)/nse
INSTALL_FILES = nseinput.tcl $(SRCDIR)/startnse
INSTALL_NSE = nse
include $(OBJDIR)/Makeconf
......@@ -18,7 +18,7 @@ all: msg
msg:
@echo ""
@echo -n "WARNING! You must first do a \"make buildnse\""
@echo -n "WARNING! You must first do a \"make buildnse\" "
@echo "if nse is not built"
@echo "WARNING! It takes about 15 minutes for buildnse"
@echo ""
......@@ -30,19 +30,21 @@ include $(TESTBED_SRCDIR)/GNUmakerules
# the testbed as well as ns configure script, we need to resort
# to this kind of hack
buildnse:
ln -s $(SRCDIR)/tbevent.h .
ln -s $(SRCDIR)/tbevent.cc .
ln -s $(SRCDIR)/tbnexthop.h .
ln -s $(SRCDIR)/tbnexthop.cc .
ln -s $(SRCDIR)/ip_fw.h .
ln -s $(SRCDIR)/../../lib/libtb/log.h .
ln -s $(SRCDIR)/../../lib/libtb/tbdefs.h .
ln -s $(SRCDIR)/../lib/event.h .
ln -sf $(SRCDIR)/tbevent.h .
ln -sf $(SRCDIR)/tbevent.cc .
ln -sf $(SRCDIR)/tbnexthop.h .
ln -sf $(SRCDIR)/tbnexthop.cc .
ln -sf $(SRCDIR)/ip_fw.h .
ln -sf $(SRCDIR)/../../lib/libtb/log.h .
ln -sf $(SRCDIR)/../../lib/libtb/tbdefs.h .
ln -sf $(SRCDIR)/../lib/event.h .
$(SRCDIR)/nse-install $(SRCDIR)/nse.patch
sup-install:
cp -p $(INSTALL_FILES) $(INSTALL_SUPDIR)$(CLIENT_BINDIR)
cp -p $(INSTALL_NSE) $(INSTALL_SUPDIR)/usr/local/bin
-mkdir -p $(INSTALL_SUPDIR)/$(CLIENT_BINDIR)/
-cp $(INSTALL_FILES) $(INSTALL_SUPDIR)/$(CLIENT_BINDIR)
-mkdir -p $(INSTALL_SUPDIR)/usr/local/bin/
-cp $(INSTALL_NSE) $(INSTALL_SUPDIR)/usr/local/bin
client-install:
cp -p $(INSTALL_FILES) $(DESTDIR)$(CLIENT_BINDIR)
......
ns-2.26/trace/cmu-trace.cc
ns-2.26/tools/random.cc
ns-2.26/tcp/tcp-full.cc
ns-2.26/tcp/tcp-full.h
ns-2.26/tcp/tcp.h
ns-2.26/tcl/lib/ns-address.tcl
ns-2.26/tcl/lib/ns-default.tcl
ns-2.26/tcl/lib/ns-lib.tcl
ns-2.26/tcl/lib/ns-link.tcl
ns-2.26/tcl/lib/ns-node.tcl
ns-2.26/tcl/lib/ns-rtmodule.tcl
ns-2.26/apps/telnet.cc
ns-2.26/classifier/classifier-hash.h
ns-2.26/classifier/classifier.cc
ns-2.26/classifier/classifier.h
ns-2.26/common/ip.h
ns-2.26/common/packet.h
ns-2.26/common/scheduler.cc
ns-2.26/common/scheduler.h
ns-2.26/common/simulator.cc
ns-2.26/common/simulator.h
ns-2.26/common/tclAppInit.cc
ns-2.26/common/timer-handler.cc
ns-2.26/common/timer-handler.h
ns-2.26/routing/address.cc
ns-2.26/routing/address.h
ns-2.26/emulate/iptap.cc
ns-2.26/emulate/iptap.h
ns-2.26/emulate/icmp.cc
ns-2.26/emulate/icmp.h
ns-2.26/emulate/net-ip.cc
ns-2.26/emulate/net-pcap.cc
ns-2.26/emulate/net.cc
ns-2.26/emulate/net.h
ns-2.26/emulate/tap.cc
ns-2.26/emulate/tap.h
ns-2.26/emulate/tcptap.cc
ns-2.26/link/delay.h
ns-2.26/mcast/lms.h
ns-2.26/Makefile.in
ns-2.26/config.h
install
......@@ -17,3 +17,5 @@ fi
cd ns-allinone-2.26
./install
cp ns-2.26/nse ..
cd ..
strip nse
--- dist-ns-allinone-2.26/install Wed Feb 26 16:07:51 2003
+++ ns-allinone-2.26/install Thu Jun 5 16:55:16 2003
@@ -41,301 +41,47 @@
# Get current path
CUR_PATH=`pwd`
--- dist-ns-allinone-2.26/ns-2.26/trace/cmu-trace.cc Wed Feb 26 15:11:29 2003
+++ ns-allinone-2.26/ns-2.26/trace/cmu-trace.cc Fri Nov 28 16:55:25 2003
@@ -941,6 +941,8 @@
case PT_GAF:
case PT_PING:
break;
+ case PT_LIVE:
+ break;
default:
fprintf(stderr, "%s - invalid packet type (%s).\n",
__PRETTY_FUNCTION__, packet_info.name(ch->ptype()));
--- dist-ns-allinone-2.26/ns-2.26/tools/random.cc Wed Feb 26 15:11:28 2003
+++ ns-allinone-2.26/ns-2.26/tools/random.cc Fri Nov 28 16:55:25 2003
@@ -47,11 +47,13 @@
#define GCC_THROW
#endif
-# Check if we are using Cygwin, and if so, if it is a bona fide install
-# Cygwin patches contributed by Nicolas Christin <nicolas@cs.virginia.edu>
+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
+#if 0
RANDOM_RETURN_TYPE
random() GCC_THROW
{
printf("random() called in ns.\nRandom is not portable, please use Random::uniform() instead.\n");
abort();
}
+#endif
-echo "============================================================"
-echo "* Testing for Cygwin environment"
-echo "============================================================"
-
-if [ -x /usr/bin/uname ]; then
- # it may be a Cygwin install
- test_cygwin=`uname | tr [a-z] [A-Z] | sed -e 's|.*CYGWIN.*|true|'`;
- if [ "${test_cygwin}" = "true" ]; then
- echo "Cygwin detected";
- echo "Note: Cygwin install is still considered EXPERIMENTAL";
- echo "";
- echo -n "Checking Cygwin version is >=1.3.12... "
- cmaj=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\1/'`;
- echo $cmaj | grep -v [0-9] >/dev/null 2>&1
- if [ "$?" -eq "0" ]; then
- cmaj=0;
- fi;
- cmin=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\2/'`;
- echo $cmin | grep -v [0-9] >/dev/null 2>&1
- if [ "$?" -eq "0" ]; then
- cmin=0;
- fi;
- cpat=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\3/'`;
- echo $cpat | grep -v [0-9] >/dev/null 2>&1
- if [ "$?" -eq "0" ]; then
- cpat=0;
- fi;
- echo -n "$cmaj.$cmin.$cpat ";
- if ([ "$cmaj" -gt "1" ]) || ([ "$cmaj" -eq "1" ] && [ $cmin -gt "3" ]) || ([ "$cmaj" -eq 1 ] && [ $cmin -eq "3" ] && [ "$cpat" -ge "12" ]); then
- echo "should be ok";
- else
- echo "*** POSSIBLE PROBLEM ***";
- echo "";
- echo "ns-allinone-${NSVER} has not been tested under versions of Cygwin older than";
- echo "1.3.12. Your version ($cmaj.$cmin.$cpat) appears to be older than that. Success of";
- echo "the install process is therefore NOT GUARANTEED.";
- echo "";
- cygversion="failed";
- fi;
- echo -n "Checking filesystems are mounted as UNIX filetype... ";
- mount | grep "textmode" >/dev/null 2>&1;
- if [ "$?" -eq "0" ]; then
- echo "*** NO! ***";
- mount_test="failed";
- echo "";
- echo "It appears that some of your Cygwin shares are mounted as DOS file";
- echo "type. This has not been tested, but is likely to result in failure of";
- echo "validation tests. Success of the install process is also NOT";
- echo "GUARANTEED.";
- echo "";
- echo "Refer to the Cygwin user guide for how to install Cygwin with the UNIX";
- echo "file text mode.";
- echo "";
- else
- echo "yes";
- echo -n "Checking default mode is binmode... ";
- echo ${CYGWIN} | grep "nobinmode" >/dev/null 2>&1;
- if [ "$?" -eq "0" ]; then
- cyg_env_var="failed";
- echo "*** NO! ***";
- echo "";
- echo "Your \$CYGWIN environment variable specifies \"nobinmode\". This is";
- echo "likely to result in failure of validation tests, and (possibly) of";
- echo "the whole install process. You need to have the \$CYGWIN environment";
- echo "variable set to \"binmode\". Please refer to the Cygwin user guide for";
- echo "details on how to change this.";
- echo "";
- else
- echo "yes";
- fi;
- fi;
- if [ "$cygversion" = "failed" ] || [ "$cyg_env_var" = "failed" ] || [ "$mount_test" = "failed" ]; then
- echo "";
- echo "Tests indicate that your installation of Cygwin may not be suitable for";
- echo "installing ns-2 allinone.";
- echo "";
- echo -n "Do you wish to proceed regardless? [y/n] "
- read answer;
- if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
- die "Installation aborted...";
- fi;
- fi;
- echo "Patching Tcl for Cygwin.";
- if [ ! -f ./tcl${TCLVER}/generic/tcl.h.orig ]; then
- cp ./tcl${TCLVER}/generic/tcl.h ./tcl${TCLVER}/generic/tcl.h.orig;
- echo "The original tcl${TCLVER}/generic/tcl.h is backed up as tcl${TCLVER}/generic/tcl.h.orig";
- sed -e 's/\#define _TCL/\#define _TCL\`\`\#ifdef __CYGWIN__\`\#define HAVE_TM_ZONE 1\`\#endif \/\* __CYGWIN__ \*\//g' ./tcl${TCLVER}/generic/tcl.h.orig | tr '\`' '\n' > ./tcl${TCLVER}/generic/tcl.h;
- fi;
- touch ./tcl${TCLVER}/generic/tclStubInit.c;
- echo "Patching sgb for Cygwin.";
- cp ./sgb/Makefile ./sgb/Makefile.orig;
- echo "The original sgb/Makefile is backed up as sgb/Makefile.orig";
- sed -e 's|rm \(.*\)test_io test_graph test_flip test_sample\(.*\)|rm -f \1test_io.exe test_graph.exe test_flip.exe test_sample.exe\2|' ./sgb/Makefile.orig > ./sgb/Makefile;
- echo "Setting executable format to .exe...";
- EXE=".exe";
- else
- echo "Cygwin not detected, proceeding with regular install.";
- EXE=;
- fi;
-else
- echo "Cygwin not detected, proceeding with regular install.";
-fi;
-
-
-
-# Compile and install xgraph
-
-echo "============================================================"
-echo "* Build XGraph-$XGRAPHVER"
-echo "============================================================"
-
-cd ./xgraph-$XGRAPHVER
-./configure --prefix=../
-if [ "${test_cygwin}" = "true" ]; then
- touch stamp-h;
-fi;
-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${EXE}
- chmod 755 ctangle${EXE}
- cd ..
- #echo "cd .."
- if [ ! -d bin ]
- then
- mkdir bin
- fi
- cd bin
- ln -s $CUR_PATH/cweb/cweave${EXE} cweave${EXE}
- ln -s $CUR_PATH/cweb/ctangle${EXE} ctangle${EXE}
-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 "* Weird: 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.4
-
-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.4 configuration failed, but it's optional, so continuing ..."
-fi
-
-cd ../
-
-# Build Tcl8.3.5
-
-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
#endif /* !WIN32 */
--- dist-ns-allinone-2.26/ns-2.26/tcp/tcp-full.cc Wed Feb 26 15:11:24 2003
+++ ns-allinone-2.26/ns-2.26/tcp/tcp-full.cc Fri Nov 28 16:55:25 2003
@@ -76,7 +76,7 @@
*
* Some warnings and comments:
* this version of TCP will not work correctly if the sequence number
- * goes above 2147483648 due to sequence number wrap
+ * goes above 1073741824 due to sequence number wrap
*
* this version of TCP by default sends data at the beginning of a
* connection in the "typical" way... That is,
@@ -360,16 +360,16 @@
case TCPS_CLOSED:
case TCPS_LISTEN:
reset();
- curseq_ = iss_ + nb;
+ INCR_SEQ( curseq_, SEQ_ADD(iss_, nb));
connect(); // initiate new connection
break;
case TCPS_ESTABLISHED:
case TCPS_SYN_SENT:
case TCPS_SYN_RECEIVED:
- if (curseq_ < iss_)
+ if (SEQ_LT(curseq_, iss_) )
curseq_ = iss_;
- curseq_ += nb;
+ INCR_SEQ(curseq_, nb);
break;
default:
@@ -454,7 +454,7 @@
void
FullTcpAgent::usrclosed()
{
- curseq_ = maxseq_ - 1; // now, no more data
+ curseq_ = SEQ_SUB(maxseq_, 1); // now, no more data
infinite_send_ = FALSE; // stop infinite send
switch (state_) {
@@ -736,7 +736,7 @@
int
FullTcpAgent::rcvseqinit(int seq, int dlen)
{
- return (seq + dlen + 1);
+ return (SEQ_ADD(seq, dlen + 1));
}
/*
@@ -764,8 +764,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_));
}
/*
@@ -822,6 +822,9 @@
tcph->hlen() = tcpip_base_hdr_size_;
tcph->hlen() += build_options(tcph);
+ /* Fill in maxseg_ for MSS negotiation in TCPTap (NSE) */
+ tcph->maxseg() = maxseg_;
+
/*
* Explicit Congestion Notification (ECN) related:
* Bits in header:
@@ -930,24 +933,24 @@
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);