home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3271 < prev    next >
Encoding:
Internet Message Format  |  1991-05-01  |  11.2 KB

  1. From: golding@saturn.ucsc.edu (Richard A. Golding)
  2. Newsgroups: alt.sources
  3. Subject: Experiment to measure Internet communication performance
  4. Message-ID: <15204@darkstar.ucsc.edu>
  5. Date: 30 Apr 91 18:46:00 GMT
  6.  
  7. At UC Santa Cruz we are conducting a series of measurements of the
  8. Internet, as part of a project to understand how to build efficient
  9. wide-area applications (and not incidentally as part of my MS thesis
  10. work).  As a part of these measurements, we need to obtain traces of
  11. communication failure rates and latency.
  12.  
  13. If you are at a site on the Internet which can send and receive UDP
  14. packets to and from UCSC, we need your assistance.(1)
  15.  
  16. We are asking that people at several sites throughout the Internet run
  17. a simple daemon for two weeks, from Thursday, 2 May 1991 through
  18. Thursday, 16 May 1991.  We will be sending this daemon a UDP packet a
  19. few times each day.  The daemon simply echoes this packet back to the
  20. sender, so we can time how long it takes.
  21.  
  22. The source for this daemon is enclosed in this message, and should
  23. take less than five minutes to install.  We're providing the source
  24. code so you can look it over and convince yourself it doesn't pose a
  25. significant load or security risk for your machine.  (More on this in
  26. the installation instructions.)
  27.  
  28. The daemon runs on Sun3 and Sun4 systems under SunOS 4.x, and on
  29. HP9000 systems under HPUX 7.0.  (It also runs under BSD 4.3 and
  30. Ultrix, but see the instructions file.)
  31.  
  32. The attached shar file contains a C program, makefile, wand
  33. installation instructions.  The installation involves compiling the
  34. program, adding the program to crontab (or some other mechanism to
  35. ensure it runs regularly), and sending mail to us informing us of your
  36. host, port, and organization.
  37.  
  38. If you have concerns or questions, please feel free to contact us.
  39.  
  40. Thank you.
  41.  
  42. Richard Golding
  43. Graduate Student, Computer & Info Sciences
  44. Baskin Center for CE&IS
  45. University of California
  46. Santa Cruz, CA 95064
  47. (408) 458-3613
  48. Internet:  golding@cis.ucsc.edu, or
  49.            golding@cello.hpl.hp.com, or 
  50.            golding@slice.ooc.uva.nl
  51.  
  52. (1)  This rules out sites inside several companies, such as HP, Sun,
  53. and Apple, which do not pass certain classes of traffic from the
  54. outside. 
  55.  
  56. ---- Cut Here and unpack ----
  57. #!/bin/sh
  58. # shar:    Shell Archiver  (v1.22)
  59. #    Packed Tue Apr 30 11:33:59 PDT 1991 by midgard!golding
  60. #    from directory /terra/a/grads/golding/evrep/validate/distrib
  61. #
  62. #    Run the following text with /bin/sh to create:
  63. #      INSTRUCTIONS
  64. #      Makefile
  65. #      udptestd.c
  66. #      validate.h
  67. #
  68. if test -f INSTRUCTIONS; then echo "File INSTRUCTIONS exists"; else
  69. echo "x - extracting INSTRUCTIONS (Text)"
  70. sed 's/^X//' << 'SHAR_EOF' > INSTRUCTIONS &&
  71. XHosts on which this runs
  72. X------------------------
  73. X
  74. XThese instructions have been verified for Sun3 and Sun4 systems
  75. Xrunning SunOS 4.x, and for HP9000/800 systems running HPUX 7.0.  They
  76. Xmay work on other systems; however, I don't guarantee anything.  If
  77. Xyou have problems please mail golding@cis.ucsc.edu and we'll try to
  78. Xwork it out.  
  79. X
  80. XThe daemon has been verified to build and run under Ultrix and BSD 4.3
  81. XUnix, but these systems do not provide individual crontab files and so
  82. Xcron cannot be used to restart the daemon after failure.  If you work
  83. Xout an easy way to ensure the daemon runs continuously, then please
  84. Xlet me know.
  85. X
  86. XInstallation instructions
  87. X-------------------------
  88. X
  89. X1.  Unpack the shar file into an otherwise empty directory.  
  90. X
  91. X2.  Configure the test daemon to use the proper UDP port.  By default
  92. Xthe daemon uses port 4296, an unprivileged, unreserved port.  If this
  93. Xconflicts with some other daemon on your system, change the port by
  94. Xediting the third line in the Makefile:
  95. X
  96. X    CFLAGS = -DUDPPORT=<new UDP port number>
  97. X
  98. X3.  Compile the daemon by typing
  99. X
  100. X    make
  101. X
  102. X4.  Add an entry to your crontab to ensure that the daemon continues
  103. Xto run by editing your current crontab.  If you are on a SunOS system,
  104. Xyou can edit your crontab entry using the command:
  105. X
  106. X    crontab -e
  107. X
  108. XOn HPUX and similar systems you will need to save your current crontab
  109. Xinto a file, edit that file, and reset your crontab from that file:
  110. X
  111. X    crontab -l >file
  112. X    (edit) file
  113. X    crontab file
  114. X
  115. XYou should add an entry of the form:
  116. X
  117. X    5,20,35,50 * * 4,5 * $DIR/udptestd > /dev/null 2>&1
  118. X
  119. Xreplacing `$DIR' with the path for the directory in which you
  120. Xinstalled the daemon.
  121. X
  122. X5.  Send mail to golding@cis.ucsc.edu with the following information:
  123. X
  124. X    - The (full) name of the host on which the daemon is being run
  125. X      (e.g. sequoia.ucsc.edu)
  126. X    - The UDP port number the daemon will use (default is 4296)
  127. X    - The host type (e.g. Sun 4/20 using SunOS 4.1.1, or VAX 11/780
  128. X      using BSD4.3 Unix)
  129. X    - A name and organization to be credited in the thesis (or an 
  130. X          indication you prefer to remain anonymous)
  131. X
  132. X    I'd also appreciate comments on how long it took you to install
  133. X    this software, and if it posed any particular problems.
  134. X
  135. XThat's all there is.  
  136. X
  137. X
  138. XCleaning up after the experiment
  139. X--------------------------------
  140. X
  141. XThe measurement experiment is scheduled to last two weeks, from 2 May
  142. X1991 through 16 May 1991.  To allow for problems, I'd ask that you
  143. Xkeep the measurement daemon running through 1 June 1991.  
  144. X
  145. XAfter the experiment is over, you will need to do two things to clean
  146. Xup: 
  147. X
  148. X1.  Remove the entry from your crontab.  On a SunOS 4.x system, use
  149. Xthe command
  150. X    crontab -e
  151. Xto edit your crontab file, and delete the line 
  152. X    5,20,35,50 * * 4,5 * <directory>/udptest > /dev/null 2>&1
  153. Xwhich was added by step 5 in the installation.
  154. X
  155. XOn an HPUX or similar system, you will need save your crontab to a
  156. Xfile, edit the file, and reset your crontab from the file.  The
  157. Xcommands are the same as were used in the last section to add the line
  158. Xto your crontab.
  159. X
  160. X2.  Delete the directory containing the daemon and all its contents. 
  161. X
  162. XSecurity considerations
  163. X-----------------------
  164. X
  165. XWe believe that this program is neither a security nor performance
  166. Xproblem.  However, we're sending out the source code so you can look
  167. Xat it for yourself.  If you feel there is a problem, don't use it.
  168. X
  169. XThe daemon uses an unprivileged UDP port for communication.  You
  170. Xshould choose the port number so that it doesn't conflict with
  171. Xanything else on your system.  The default is probably fine, but you
  172. Xshould check.
  173. X
  174. XCare has been taken that it does not require root privileges either to
  175. Xrun or for installation.  I would recommend _not_ installing it as
  176. Xroot.  It uses a crontab entry to ensure that it will be run following
  177. Xa system restart, rather than requiring that it be added to the
  178. Xsystem's startup configuration.
  179. X
  180. XThe daemon neither writes nor reads files, so there is no
  181. Xpossibility of the daemon using file system space beyond what is
  182. Xrequired for the source and binary.
  183. X
  184. XThe only resources this daemon uses are the memory required to run it,
  185. Xand a trivial amount per message.  We will be sending a few messages
  186. Xeach day -- on the order of 800 per day (11 messages, three times an
  187. Xhour) -- so the daemon should not interfere with normal operations.
  188. X(We found that it added no measurable load to a local Sun4 system, as
  189. Xmeasured by the kernel's 1-, 5-, and 15-minute load averages.)
  190. X
  191. X-----
  192. X
  193. XA technical report on some preliminary work on this problem is
  194. Xavailable as TR # UCSC-CRL-91-01, and can be obtained by ftp from
  195. Xmidgard.ucsc.edu in the file pub/tr/ucsc-crl-91-01.ps.Z .
  196. X
  197. XThank you for your assistance is this experiment.
  198. X
  199. XRichard Golding
  200. Xgolding@cis.ucsc.edu
  201. XConcurrent Systems Lab
  202. XBaskin Center for Computer Engr. & Info. Sci.
  203. XApplied Sciences Building
  204. XUniversity of California
  205. XSanta Cruz CA 95064
  206. SHAR_EOF
  207. chmod 0444 INSTRUCTIONS || echo "restore of INSTRUCTIONS fails"
  208. fi
  209. if test -f Makefile; then echo "File Makefile exists"; else
  210. echo "x - extracting Makefile (Text)"
  211. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  212. XLIBS =
  213. XCFLAGS = -DUDPPORT=4296 # -DDEBUG
  214. XPROGS = udptestd 
  215. X
  216. Xall: $(PROGS)
  217. X
  218. Xudptestd: udptestd.o
  219. X    cc -o udptestd udptestd.o $(LIBS)
  220. X
  221. Xudptestd.o: udptestd.c validate.h
  222. X
  223. Xclean:
  224. X    -rm -f *.o core *~
  225. X
  226. Xspotless: clean
  227. X    -rm -f $(PROGS)
  228. SHAR_EOF
  229. chmod 0444 Makefile || echo "restore of Makefile fails"
  230. fi
  231. if test -f udptestd.c; then echo "File udptestd.c exists"; else
  232. echo "x - extracting udptestd.c (Text)"
  233. sed 's/^X//' << 'SHAR_EOF' > udptestd.c &&
  234. X#include <sys/types.h>
  235. X#include <sys/time.h>
  236. X#include <sys/socket.h>
  237. X#include <netinet/in.h>
  238. X#include <netdb.h>
  239. X#include <stdio.h>
  240. X#include "validate.h"
  241. X
  242. X#ifdef DEBUG
  243. Xchar *
  244. Xhostnameof(sa)
  245. Xstruct sockaddr_in *sa;
  246. X{
  247. X  struct hostent *h;
  248. X
  249. X  h = gethostbyaddr(sa->sin_addr,sizeof(struct in_addr),AF_INET);
  250. X  return h->h_name;
  251. X}
  252. X
  253. Xint
  254. Xportof(sa)
  255. Xstruct sockaddr_in *sa;
  256. X{
  257. X  return ntohl(sa->sin_port);
  258. X}
  259. X#endif
  260. X
  261. Xvoid
  262. Xgettimestamp(ps,pus)
  263. Xint *ps, *pus;     
  264. X{
  265. X  struct timeval t;
  266. X  
  267. X  gettimeofday(&t, NULL);
  268. X  *ps = htonl(t.tv_sec);
  269. X  *pus = htonl(t.tv_usec);
  270. X}
  271. X
  272. Xvoid
  273. Xdoecho(sock)
  274. Xint sock;
  275. X{
  276. X  req inreq;
  277. X  int len;
  278. X  int flags;
  279. X  struct sockaddr_in from;
  280. X  int fromlen;
  281. X  int rc;
  282. X  rep outrep;
  283. X
  284. X  /* get a request message */
  285. X#ifdef DEBUG
  286. X  printf("waiting for message\n");
  287. X#endif
  288. X  len = sizeof(inreq);
  289. X  fromlen = sizeof(from);
  290. X  flags = 0;
  291. X  rc = recvfrom(sock, &inreq, len, flags, (struct sockaddr *)&from, &fromlen);
  292. X  if (rc < 0) {
  293. X    perror("In recvfrom");
  294. X    return;
  295. X  } 
  296. X
  297. X  /* process it:  grab a timestamp, fill out reply, and sleep */
  298. X#ifdef DEBUG
  299. X  printf("got message:  from host [%s] port %d, sequence %d, delay %d\n",
  300. X     hostnameof(&from),portof(&from),ntohl(inreq.seq),ntohl(inreq.delaytime));
  301. X#endif
  302. X  outrep.seq = inreq.seq;
  303. X  outrep.delaytime = inreq.delaytime;
  304. X  gettimestamp(&outrep.tinsec, &outrep.tinusec);
  305. X  sleep(ntohl(inreq.delaytime));
  306. X  
  307. X  /* done processing, grab another timestamp and reply */
  308. X  gettimestamp(&outrep.toutsec, &outrep.toutusec);
  309. X  sendto(sock,&outrep,sizeof(outrep),0,&from,sizeof(from));
  310. X}
  311. X
  312. Xmain()
  313. X{
  314. X  int sock;
  315. X  int length;
  316. X  struct sockaddr_in name;
  317. X
  318. X  /* create socket from which to read */
  319. X  sock = socket(AF_INET, SOCK_DGRAM, 0);
  320. X  if (sock < 0) {
  321. X    perror("opening datagram socket");
  322. X    exit(-1);
  323. X  }
  324. X  
  325. X  /* create name and bind */
  326. X  name.sin_family = AF_INET;
  327. X  name.sin_addr.s_addr = INADDR_ANY;
  328. X  name.sin_port = UDPPORT;
  329. X  if (bind(sock, &name, sizeof(name))) {
  330. X    perror("binding datagram socket");
  331. X    exit(-2);
  332. X  }
  333. X
  334. X  /* check port value */
  335. X  length = sizeof(name);
  336. X  if (getsockname(sock, &name, &length)) {
  337. X    perror("getting socket name");
  338. X    exit(-3);
  339. X  }
  340. X#ifdef DEBUG
  341. X  printf("Socket has port #%d\n",ntohs(name.sin_port));
  342. X#endif
  343. X
  344. X  for (;;) {
  345. X    doecho(sock);
  346. X  }
  347. X
  348. X  /* NOTREACHED */
  349. X}
  350. SHAR_EOF
  351. chmod 0444 udptestd.c || echo "restore of udptestd.c fails"
  352. fi
  353. if test -f validate.h; then echo "File validate.h exists"; else
  354. echo "x - extracting validate.h (Text)"
  355. sed 's/^X//' << 'SHAR_EOF' > validate.h &&
  356. Xtypedef struct _req {
  357. X  int seq;
  358. X  int delaytime;
  359. X} req;
  360. X
  361. Xtypedef struct _rep {
  362. X  int seq;
  363. X  int delaytime;
  364. X  int tinsec, tinusec, toutsec, toutusec;
  365. X} rep;
  366. SHAR_EOF
  367. chmod 0444 validate.h || echo "restore of validate.h fails"
  368. fi
  369. exit 0
  370. --
  371. Richard A. Golding                 golding@cello.hpl.hp.com or
  372.   UC Santa Cruz CIS Board (grad student)     golding@cis.ucsc.edu (best) or
  373.                         golding@slice.ooc.uva.nl 
  374. Post: Baskin Centre for CE & IS, Appl. Sci. Bldg., UC, Santa Cruz CA 95064
  375.