[CMU Monarch Project]


ad-hockey and ns FAQ

Frequently Asked Questions

Frequently Asked Questions

Some answers to very frequently asked questions are here:


Integration Status, Building and Bugs


Date: Mon May 22 14:23:11 EDT 2000

We simulated different routing protocols by simple replace the value of "$NS_PROTO" and "$NS_PROTO_SCRIPT" in the "run-setup" file. The others protocols such as DSDV, DSR and AODV are OK, but the TORA could not run. It continued to print the error message like the following:

        Hacked for tora20 runs!! No RTR revc trace
May TORA should be specially configured ? Thanks a lots.

This is not actually an error message. Because the TORA code sends so many packets and produces such large trace files, I had to remove all but the critically required logging agents in order to keep the size of the files managable.

mobile-node.tcl prints out that warning so I'd remember why there wasn't any data recorded by the RTR receive tracer.


Date: Thu Sep 23 09:16:59 EDT 1999

I found some documentation on your page, but I want to look deeper into the code. So please let me know if there is any object-diagram or object-communication-diagram about the programs.

I'm afraid the ns document on our web page is the only documentation that exists outside of the code and its comments. You'll also want to read through the ns documentation from the VINT website to understand the basic ns system.

In general, the easiest way to understand one of the modules is to start reading the code at the recv() function.


Date: Wed Aug 25 11:21:09 EDT 1999

I see that some wireless files are present in the main VINT ns release. Are those all of the CMU extensions?

The ns-allinone-2.1b5 contains part of the CMU ns extensions. But the work of incorporating of CMU extensions is still on going. Here is a newer snapshot: http://www-mash.cs.berkeley.edu/dist/vint/ns-src-wireless-ver.tar.gz that you may want to check out.

Also please check http://www-mash.CS.Berkeley.EDU/ns/ so that you can keep informed if there is a newer version released by the VINT project team.

Is there any difference in the trace files produced by ns2.1b6 and the CMU extensions? When I run totals.pl I am getting a error message for every line in my trace file of the form:

Error, 1: 'f 135.56 _1_ RTR --- 6 cbr 544 [a2 1 0 800] ------- [0:0 2:0 32 2] [2] 1 0'

Well, the problem is that somebody changed the format logged by the CMUTrace object. Your trace file contains lines of the form

f 135.56 _1_ RTR  --- 6 cbr 544 [a2 1 0 800] ------- [0:0 2:0 32 2] [2] 1 0
whereas our CMUTrace object makes lines of the form
f 23.95 _23_ RTR  --- 8 cbr 556 [20 a2 17 10 800] ------- [16:0 17:0 32 39] [0] 1 4

Note that the number of fields printed for both MAC and IP headers is different. I don't know why the tracing objects would have been changed. I think Ya Xu posted something about this on the ns-users mailing list, and I'm afraid I'll have to send you back there for more information.

Here are the relevant lines from our version of cmu-trace.cc::CMUTrace

	sprintf(wrk_ + offset, "------- [%d:%d %d:%d %d %d] ",
		ih->src_, ih->sport_,
		ih->dst_, ih->dport_,
		ih->ttl_, (ch->next_hop_ < 0) ? 0 : ch->next_hop_);

	sprintf(wrk_ + offset,
		"%c %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x %x] ",
		op,
		Scheduler::instance().clock(),
                src_,                           // this node

		tracename,
		why,

                ch->uid(),                      // identifier for this event
		pt_names[ch->ptype()],
		ch->size(),

		GET2BYTE(&mh->dh_fc),
		mh->dh_duration,
		ETHER_ADDR(mh->dh_da),
		ETHER_ADDR(mh->dh_sa),
		GET_ETHER_TYPE(mh->dh_body));

Date: Thu Aug 12 19:38:41 EDT 1999

I get compile errors like

cmu/adhockey-slaver.cc:  In method `AdHockeySlaver::AdHockeySlaver()':
adhockey-slaver.cc:53: `struct sockaddr_in' has no member named `sin_len'
when I compile on Linux. What's up?

As a System V extract, Linux doesn't define a sa_len for the struct sockaddr. You can comment out this line, and things will compile fine. Be advised that the emulation code doesn't work on Linux, due to limitations with libpcap. We're looking for an OS independent interface to BPF and raw sockets.


Date: Thu Aug 26 09:11:11 EDT 1999

We encounter the following err or message while simulating DSDV:

ns:cmu/dsdv/dsdv.cc:122:void DSDV TriggerHandler::handle(class Event*): Assertion `prte && prte->trigger_event == e' failed.
Abort (core dumped)
Error: ns on logs/out-1000x1000-50-1-15-1-cbr-50-10-4-512
Is this caused by the mistake in parameter setting in the dsdv.tcl or dsdv.cc?

There is a bug somewhere in the implementation of DSDV that causes the event timers to get into an inconsistent state. When this happens, the assertions detect it and stop the simulation before any bad data can be generated.

In the past I've spent a bit of time looking for this bug, but haven't found it, so I've notified the architect of the DSDV code (Yih-Chun Hu yihchun@cs.cmu.edu). If either of you can find and kill the bug, I'd be grateful for your patches. Currently, simply changing the seed of the simulation or the movement pattern is often enough to keep the DSDV implementation from entering this infrequent bad state.


ad-hockey


Date: Tue Oct 12 11:36:57 EDT 1999

Is there a version of ad-hockey that will run with the current Perl/Tk?

Yes! Thanks to Josh Broch, this version of ad-hockey now runs with Perl/Tk800.015

Date: Mon Nov 1 10:00:43 EST 1999

Perl core dumps on me when I try to build Perl/Tk400.200 using Linux Red Hat 6.0 or FreeBSD 3.3. What should I do?

For reasons we haven't tracked down, newer versions of perl and/or its libraries won't build Perl/Tk400.200 without crashing. We suggest using the new version of ad-hockey and the Perl/Tk800.015 that it works with, and that does build with newer versions of perl. To get Perl/Tk800.015, see the Perl/Tk FAQ. The next snapshot release will include only the new version of ad-hockey, and require a current Perl/Tk. Please let monarch@monarch.cs.cmu.edu know of any problems with the new version of ad-hockey.


Date: Fri Sep 17 12:55:28 EDT 1999

When i execute ad-hockey, i have the folowing error:

can't locate Tk.pm

Check the ``use'' lines a the top of ad-hockey (it's an editable script). Trying changing the path in them to point to the directory where you've built Perl/Tk

ps: What do you mean by favorite location for binaries?

Based on OS convention and personal preference, binaries are typically stored in one or more of the following places.

/usr/bin
/usr/local/bin
/usr/ns/bin
/usr/X11/bin
/usr/X11R6/bin

You can determine where your setup looks for binaries by examining your shell's search path. Try

echo $path

or

echo $PATH

Date: Wed Mar 22 14:49:44 PST 2000

When i run ad-hockey i had the following error message

"open2 : exec of what-time failed at ./ad-hockey line 1640"

As described in the ad-hockey manual, you must type

make
what-time
and then move the ad-hockey, what-time, and viz-trace programs to the appropriate directory on your machine. See the previous question for information on the currect directory.

This error message arises because the system is unable to find and execute the what-time program, upon which the ad-hockey script depends for telling it what the current time is.


Date: Thu Aug 12 19:38:41 EDT 1999

ad-hockey dies with a DFU error when replaying traces? I ran the simulator's output trace file through viz-trace like the instructions said to....

DFU: unknown event:
s 1.316136379 _22_ MAC  --- 0 MAC 44 [1b 28f d 16 0] 

Died at /home/tyan/work/ns-allinone-2.1b5/bin/ad-hockey line 1521,
 chunk 1096.
Teresa Yan pointed out this bug and provided the fix. ad-hockey doesn't know how to display MAC events. She updated viz-trace to remove the MAC events from the replay trace.
<    if (/^[srf] /) {
>    if (/^[srf] / && !/MAC/) {
This change will go out in snapshot 1.1.3
Date: Tue, 16 Feb 99 20:24:30 EST

When I try to complile Perl/Tk 400.200 it complains about Perl_gv_fullname as in

tkGlue.c: In function `LangCatArg':
tkGlue.c:205: too many arguments to function `Perl_gv_fullname'
tkGlue.c:215: too many arguments to function `Perl_gv_fullname'
make: *** [tkGlue.o] Error 1
[root@bpvanle Tk400.200]# exit


I do recall having a problem with compiling Perl/Tk400.200 on some
platforms, and recall a quick read through tkGlue.c found the cause.
At the top of my tkGlue.c I have:

#include 
#if 0
#if PATCHLEVEL > 3 || SUBVERSION >= 4
#define Tkgv_fullname(x,y,z) gv_fullname(x,y,z)
#else
#define Tkgv_fullname(x,y,z) gv_fullname(x,y)
#endif
#else
/* -dam 2/8/98 */
#define Tkgv_fullname(x,y,z) gv_fullname(x,y)
#endif

If this suggested change doesn't work, a few greps for
'_fullname' should discover and enable you to fix the problem.

Date: Wed Jul 21 09:09:42 EDT 1999

Is that possible for me to convert the output files generated by the run.tcl (*.tr) to a *.nam format? If so, how?

No. NAM is the VINT visualizer, and it doesn't know how to represent mobility yet. For the momment, you will need to use ad-hockey, the visualizer provided with the CMU extensions.


Date: Mon Aug 30 22:35:44 EDT 1999

After I make what-time I move ad-hockey, viz-trace and what-time to my favorite executable directory. How do I run ad-hockey however? Is that by the command ./ad-hockey , and ./viz-trace ? When I did that I get the error message ``No such file or directory'' ?

Just to be clear, if you have installed the files into other than the current directory, you can't run the programs by typing ``./ad-hockey'' You'll have to either put the directory where the programs are located on your search path, or type the full path to the executable.

I'm guessing the problem is actually that perl v5 isn't installed in /usr/local/bin where the ad-hockey script expects it. Either make a symlink in /usr/local/bin to /usr/bin/perl, or change the first line in ad-hockey. (Is there a good way to get a perl script to locate where the perl interpreter lives? I can imagine a cheap shell hack that finds the interpreter and then execs it, but someone must have solved this already.)


Support Utilities


Date: Sun, 7 Mar 99 15:24:02 EST

I use Ad-Hockey to generate a scenario file. Do I need to use cmu/setdest/emulate to create an operational scenario file for NS. The files I create with just Ad-Hockey have a different form than those you provide.

The movement pattern files and communication pattern files created by
ad-hockey can be directly fed into the ns simulation using the -cp
and -sc flags to run.tcl

The scenario files we provide look different since they were
automaticly generated by the setdest program, which uses the random
waypoint model described in our MobiCom 98 paper.  The output of
setdest is annotated with the the ``god'' information that describes
the length of the shortest path between any two nodes at any point in
time.  If you would like to perform shortest-path analysis on your
manually created scenarios, you can run the movement pattern (aka a
scenario file) you created with ad-hockey through the calcdest program
(ns/ns-src/cmu/setdest/calcdest) which will annotate the file with the
``god'' information.


usage: ./calcdest       [-n ] 
            [-t ]
            -i  -o 
            #nodes, max time, and range read from scenario file if possible


Date: Sun, 7 Mar 99 15:24:02 EST

What are emulate and the macfilter used for?

emulate and macfilter are for use in emulating the connection patterns of a physical ad hoc network. We use it for in-lab debugging and regression testing of our implementation of DSR. In order to use it you need real machines with real interfaces running a kernel with a real implementation of the ad hoc routing protocol. As described in the ad-hockey docs, it allows you to draw a movement pattern on the screen with ad-hockey, and then cause the machines to behave as though they had radio connectivity as you drew on the screen, even though they are all in physical radio range of each other. There is some more information in the ad-hockey User's Guide.


Data Analysis


Date: Wed Nov 8 16:59:04 PST 2000

I am getting the error,

Actual RT Length while using totals.pl ,for performance comparison of wireless protocols. Is this normal for a run,or is there some error.

Some messages of this form are normal, as the optimal path length is set in the header of the packet when it is originated, based on the information in the scenario file. Since the nodes can move during the time the packet is traversing the network (particularily when there is congestion causing large router queues), the packet can arrive over a shorter path than existed when the packet was originated.

Large number of these messages usually mean the propagation model used in the simulation is different than the one used in calculating the optimal path lengths when creating the scenario.


Date: Tue Oct 26 10:47:35 EDT 1999

I was wondering how you had been able to trace the average node degree in the simulation work for DSR described in "The effects of on- demand behavior in routing protocols for multi-hop wireless ad hoc networks". We are trying to create networks of varying node degrees and observe some of DSR's behavior but am very curious now how you had determined the average node degrees (16.5 for the square area and 11.5 for the rectangle area - as I remember from reading...).

Turn on MAC tracing. For each broadcast packet sent, count up the MAC layer recvs. bc-tally.pl may be a helpful starting place. For better estimates, consider using a special traffic load with lots of broadcasts, or altering calcdest to track the node degree.


Date: Wed Aug 4 07:26:05 EDT 1999

What tools were used for the analysis in the Mobicom '98 paper?

For analysis, we used a large variety of scripts and grep expressions. Most of the Mobicom '98 plots came from processing the totals files into a format Matlab could read, and then doing the remainder of the analysis there. See totals.{csh,pl} and post-totals.{csh.pl} in ns-src/cmu/scripts for the scripts. Running any of the scripts w/o arguments should tell you what arguments it expects. Please be advised that most of the spew that totals.pl and post-totals.pl spit out can be ignored. However, the validation of any data you produce is up to you.

My trace files are huge!

Yep. We have 3 18GB disks we fill regularily when doing many runs. The remote logging options to run.csh are helpful for organizing a ``farm'' of machines with small disks running the simulations and directing the outputs to a collection machine with a large disk. You may also reduce the amount of trace data collected by turning off logging you don't need. For example, see run.tcl to turn off tracing at the MAC, RTR, or AGT layer (often MAC tracing can be turned off if you are interested in only network layer events). Many C++ source files also have a

static const int verbose = 1 
flag in them that can be shut off.

Luckily, disk space keeps getting cheaper, though backing up ``good'' runs to tape is still a real pain for which we don't have a good solution.


Date: Tue Nov 23 18:28:01 EST 1999

I need reproduce the results your group presented in MobiComm 98. Namely the %packets delivered, overhead and path optimality.

Unfortunately, if you don't have the time to really read through the code and figure out what's going on, you shouldn't be messing with simulators. They're guaranteed to give you answers, but it's on your head to make sure the answers mean something, and validating the answers is what actually takes the most time.

What scripts were involved in retreving the number of packets sent...

My recollection is that all the MobiCom'98 data can be retrieved from the file produced by totals.pl.

If you use run-setup to describe your simulation run, then

run.csh -auto

will do all the simulations, and

totals.csh

will run totals on all the trace files.

You will need to think about and understand which packets are logged by which tracers in order to interpret the difference between the numbers in the AGT, RTR, and MAC totals files. See the diagram in the manual for our extensions.

Also do the verbose_ switches need to be on, or were these just prints for your debugging?

The packet counts in totals are based solely on packets going through the tracers, and so don't depend on the verbose flags. The verbose flags are for getting extra information about the protocols and disecting their performance to understand why we're getting the results we're getting.


Configuring and Setting Up Simulations


Date: Wed Oct 20 14:36:41 EDT 1999

By null-MAC do u mean ignoring collisions and contention? or the ideal mac probably with central arbitration which has no collisions?

MAC/Null ignores collisions and contention. Every packet sent with enough energy to be received by the receiver will be received. All offered packets are sent after a constant delay (no contention).

Does the wavelan MAC in the simulator conform to the latest WaveLan Specs?

The 802.11 MAC is already pretty close to the WaveLAN-IEEE (aka WaveLAN-2) specs. CSMA/CA WaveLAN implements the WaveLAN-1 MAC protocol designed by the WaveLAN builders.


Date: Mon Oct 4 11:27:10 EDT 1999

What is each node's transmission radius set to? and which C++ module can it be found in ?

The nominal range in the snapshot is 250m. The exact ``range'' of any particular transmission depends on the location and number of other concurrent transmitters (since they interfere with each other).

The constants that control the range, if you crank the math, are in run.tcl. In the newest (?) snapshot's run.tcl is a function that given a ``nominal range:'' in the scenario file reverse engineers the power constants. Think carefully if you tweak this knob (e.g., the egg is on your face if you request a xmit power that'll fry birds). Also be aware that 802.11 stops working at much more than a 2km range (there isn't enough time for the RTS/CTS exchange to complete before the offical timeout). The WaveLAN MAC will continue to work past this range.


Date: Thu, 5 Aug 99 7:52:31 EDT

I would like to know how can I set the TCP sources in-active in the simulation? As I checked with RUN.TCL, there is a setting for "Agent/TCP set packetSize_ 14 60", however, I could not find where the main switch for not deactivating the TCP in the simulation. (I also checked with RUN-SETUP, DSR.TCL...)

The communication pattern is dictated by the communication pattern file provided as input to the simulation using the -cp command line argument. If that file doesn't list any TCP sources, none are used during the simulation. Since there is no traffic by default, there's no global switch to turn anything off.


Date: Thu Aug 5 07:50:36 EDT 1999

I would like to know in which file(s) can I change the constants used in a protocol simulation? (For example, DSR -- Time between retransmitted ROUTE REQUESTS, Size of source route header carrying "n" addresses, Timeout for nonpropagating search...)

Before you change the value of the constants, you'll want to read and understand how they are used in the code. As always, variables aren't always named for exactly what they do, or their use shifts over time from when they're first created. Using grep to look for all occurrences of the constant is a great help. Start by reading through the header files and main .cc files in each of the protocol directories. eg:

bush dsr % grep -n arp_timeout *.{cc,h}
dsragent.cc:45:Time arp_timeout = 30.0e-3;      // (sec) arp request timeout
dsragent.cc:1165:         delay += arp_timeout;
constants.h:14:extern Time arp_timeout; // (sec) arp request timeout

Date: Sun Aug 8 23:39:23 EDT 1999

In wireless extension, if a node want to broadcast a packet whose destination is "dst" to all its neighbors, the "des_" in ip header must be set as "dst", then how I set the "next_hop" in the struct hdr_cmn, 0 or IP_BROADCAST?

The 8/5/99 release of the wireless-extensions manual provides a brief description of writing packet sources. In sum, you would set the next_hop to IP_BROADCAST, and type to AF_INET. This will work correctly if done at the ``network layer'' for packets being handed to the link layer. For examples, you can read the provided routing protocols to see how they create the broadcast packets they send out. Please beware that none of the routing modules we provided will interpret an IP destination address of IP_BROADCAST as meaning the packet should be broadcast locally. They simply haven't had that functionality put in them. If you decide to add this functionality, please send me your patches and some short example code and I will include it in the next release.


Dynamic Source Routing Questions


Date: Mon Dec 6 12:16:45 EST 1999

The DSR ns code (1.4b) has the following types of packets: RREQ, RREP, RERR and the CBR data traffic.

1. Can any of these packets be piggybacked with any other packet?

2. Does your code actually make use of piggybacking, thus reducing the total number of packets.

The simulator does not implement the general structure described in the Internet Draft. This is a result of historical accident and a (mistaken) belief that the system currently in use would be simplier to program.

Currently, the sr header (cmu/dsr/hdr_sr.cc) in the simulator can represent simultaneously carrying (a single Route Request XOR a single source route), a single Route Reply, and a nested series of Route Errors.

The simulator uses piggybacking, though not as extensively as it could. In particular, DSR control messages are not piggybacked onto data packets. Piggybacking can be more than an optimization, for example, when launching a Route Request to find a route with with to return a Route Reply, correctness requires that the Route Reply be piggybacked on the Route Request.


Date: Wed Oct 27 12:22:15 EDT 1999

1. If node A overhars a route M N O (P) Q R, DSR adds route A P Q R to its cache. Why does it not cache the reverse route A P O N M?

2. Why are the _reverse_ routes in route requests and data packets being forwarded, not cached at intermediate nodes?

The code is currently (10/27/99) schizophrenic on the issue of how much to believe that links are bidirectional. The code originally assumed that many links would be unidirectional, and was all written and working for that assumption. 802.11, as used in the simulator, requires that a link be bidirectional before data can be passed across it (since an ACK must be returned directly to the transmitter by the receiver). When we added the 802.11 MAC layer for the MobiCom'98 paper, not all possible optimizations were made in the DSR code to leverage the new bidirectional assumption. I would expect performance to go up if the additional optimizations were made. As it sez in the code:

bool dsragent_require_bi_routes = true;
// do we need to have bidirectional source routes? 
// [XXX this flag doesn't control all the behaviors and code that assume
// bidirectional links -dam 5/14/98]

3. The primary and secondary caches store routes passing through me and overheard routes, respectively. But both the caches are fetched while searching for routes . What is the key motivation for having two separate caches? Are they maintained differently in any other way?

Node N stores in its primary cache is routes that it did discovery for, or has used to send packets. Routes that are overheard, or otherwise learned oportunistically are stored into the secondary cache. When we fetch a route, we search both caches, and if the best route is found in the secondary cache, it is promoted to the primary cache.

Both caches use round-robin replacement, but with independent victim pointers. Having two caches prevents oportunistially learned routes from flushing routes that N is actually using, since turnover in the secondary cache is higher than in the primary cache (i.e., the victim pointer cycles more frequently). Clearly a wide range of other cache algorithms and data structures are possible. For example, we also have a ``link-state'' cache, but we haven't tried things such as implementing LRU policy in the ``mobicache''.


Misc.


Date: Wed Jul 21 09:09:42 EDT 1999

When I run the totals.csh, it appers to have some problems. It cannot find the totals.pl file. the command line are as follow

                ~/ns2> ./cmu/scripts/totals.csh
and the error message is
                   unzipping out-xxxxxxxxxxxxx
                   totals.pl: command not found
I have also checked in the directory "scripts" and I find the totals.pl file actually exists. I also have my perl installed. I do not know what have I done wrong. Is that caused by the different perl version? Or will I need to do something for the totals.pl file before the totals.csh runs? Could you give me some more guildline on this?

This is a basic UNIX usage issue. You will need to learn about search paths, and how UNIX looks for executables.

Hints:
  set path = ($path mumble )
or
  fully qualified path name in totals.csh

Date: Wed Jul 21 09:09:42 EDT 1999

I have also tried out the run.tcl and run.csh as mentioned in the document. It appears the simulations are alright. the command lines are

       ~ns2> ./cmu/scripts/run.csh -auto
After the simulation, I have got some message like below
       NS EXITING
       Num events : 5915926            Max. scheduler: 72110
       113.250u  1.430s   2:10.37   87.9%  0+0k   0+0io 278pf+0w
what does the above message stands for? What are numerical values stand for?

I apologize for my rudeness, but if you are going to work with this code, you are going to have to make a much greater effort to read and understand it on your own. Please carefully read run.csh. It uses the time (1) command. Read the manual page for time (e.g., man time). Grep the ns source code for the string ``Num events'' to find where it is printed from. Read and understand the code around it.


Date: Mon Sep 6 11:33:48 EDT 1999

sorry for annoying again , i just have a question ? how can i modify the source code of TCP protocol ? is the TCP agent included in ns is a file that can be edited ? if yes what is the file name and in what language it is written ? if not how i can modify the current version of TCP for evaluation

We're the experts on only the wireless and mobility portions ns. For other questions you'll get better answers from the main ns-users mailling list (see the web pages for subscripition instructions).

Honestly, though, your question is sufficiently basic I doubt it would be answered. It suggests that you haven't tried to read and understand the code base. Without that effort you are certain to fail. There is a large amount of documentation available from the ns web pages --- have you read it?



[Back to the CMU Monarch ns-2 extensions page]
[Back to our Software Distributions page]
[Back to CMU Monarch Project home page]


Last day on which I remembered to update the modified date: Mon May 22 14:23:11 EDT 2000, <monarch@monarch.cs.cmu.edu>.