1 .\" $NetBSD: debug.nr,v 1.3 1998/01/09 06:34:40 perry Exp $
3 .\"WISC: Header: debug.nr,v 1.4 88/12/06 16:05:36 nhall Exp $
4 .\"WISC: Source: /usr/argo/doc/kernel/RCS/debug.nr,v $
6 .\" Program names should be in italics
8 .NC "Debugging, Testing, and Statistics"
11 This section describes the methods used
12 to test and debug the ARGO kernel.
13 Three facilities are used in combination:
15 simple statistics gathering,
17 protocol event tracing.
18 Many of the debug options
19 simply cause information to be printed on the console, but
20 several of these options cause
21 TP to behave pathologically
22 so that errors are be introduced in desirable ways.
24 TP and CLNP keep simple statistics.
25 These statistics include such things as the total
26 number of PDUs that are sent and received,
27 a count of various types of errors
28 that can be encountered when parsing an incoming PDU,
29 and the average and standard deviation of round trip times for
31 These statistics are useful for debugging.
33 if an incoming CC TPDU is rejected because one of the optional
34 parameters is faulty, this are noted in the statistics.
35 The statistics are kept on a system-wide basis rather than
36 on a per-connection basis.
37 They can be printed or cleared by user-level utility programs.
39 The tracing facility allows selective tracing of events.
40 Events are grouped into categories relating to different
42 For example, it is possible to
43 trace only the events that pertain to acknowledgments.
45 At run time the debugging and tracing options can
46 be set and cleared by privileged utility programs.
47 Each of these facilities is described in more
51 Most of the debugging options
52 print messages on the console.
53 Kernel printing is done by busy-waiting at high priority,
54 so debugging options should be used very sparingly.
55 A sample of the code is:
60 printf("tp_input m 0x%x tpdu_len 0x%x\n", m, tpdu_len);
67 IFDEBUG and ENDDEBUG are macros that are defined in one of two ways.
68 If the system is configured with the ARGO_DEBUG
72 IFDEBUG and ENDDEBUG are defined thus:
76 #define IFDEBUG(option) if(argo_debug[option]) {
82 If the system is configured without the ARGO_DEBUG option, these
83 two macros resolve to the C comment delimiters, \fC/*\fR and \fC*/\fR,
84 causing all the debugging code lying between the macros
87 TP, CLNP, and CONS debugging can be enabled independently.
88 All debugging requires that the code be compiled with the
90 The \fIconfig(8)\fR option CLNP_DEBUG will include debugging printfs for CLNP.
91 TP_DEBUG has the same effect for TP.
93 The array elements of \fCargo_debug[]\fR are set by
96 which reads and writes
98 See the manual page \fIbark(8)\fR.
100 Several debugging options cause TP to behave pathologically,
101 for the purpose of reproducing difficult-to-reproduce
102 error conditions that the protocol must correct.
104 \fID_DROP\fR, or \fIbark -on T.drop\fR
107 to discard TPDUs on a pseudo-random basis.
108 These will be described below.
111 .sh 2 "CLNP Statistics"
113 CLNP keeps a set of statistics related to its operation.
114 Statistics include such things as NPDUs sent, received, and dropped.
115 These statistics are stored in the global structure \fIclnp_stat\fR.
116 The utility program \fInetstat(8)\fR may be used to print these statistics.
117 .sh 2 "TP Statistics"
119 TP keeps a set of running counts of certain events.
120 The statistics include such things as the numbers
121 of each type of TPDU sent and received, TPDUs dropped,
122 and the numbers of occurrences of certain types of errors.
123 The statistics are stored in the global structure \fItp_stat\fR.
127 read \fC/dev/kmem\fIN\fR
128 and prints the contents of the statistics structure
129 in a human-readable form.
130 \fITpstat\fR prints the statistics on any ascii screen or printer.
131 \fITpmon\fR uses the \fIcurses\fR library and assumes that is has
132 a screen or window of size 53(long) X 80(wide), and it updates the
133 screen every 30 seconds.
135 \fITpstat\fR and \fItpmon\fR can be used to clear the statistics (set them
136 all to zero); the \fB-c\fR option causes the statistics to be cleared.
138 Statistics are observed using \fItpstat(8)\fR
139 to clear statistics before a test, and to print
140 the statistics after the test.
141 See the manual pages \fItpstat(8)\fR and \fItpmon(8)\fR.
146 CLNP does not support event tracing.
149 The tracing facility consists of a circular buffer (an array)
150 of structures that are written by the kernel at various times,
151 and a utility program that reads \fC/dev/kmem\fIN\fR
152 to interpret the contents of the buffer.
153 The trace structure is a union of the structures that
154 will be interpreted by the utility program.
155 A trace event consists of a call to the trace routine \fItpTrace\fR
156 with a set of arguments containing the information relevant to the
158 The procedure tpTrace is actually called through a macro \fItptrace\fR.
164 tptrace(TPPTtpduin, h->tpdu_type, h, h->tpdu_li+1, 0, 0);
170 The tracing macros are defined in the same manner as the
175 #define IFTRACE(option) if(tp_traceflags[option]) {
181 If the kernel is configured with the option TPPT, these macros
182 are defined as shown above, but if the TPPT option is not
183 used, these macros become C-style comment delimiters.
185 The tracing procedure copies \fIh->tpdu_li + 1\fR bytes beginning at
186 location \fIh\fR into a trace structure in the circular buffer.
187 The utility program \fItppt\fR
188 reads the trace structure,
189 interprets the data as a TPDU header,
190 and prints the header in hexadecimal form, with a banner identifying
191 the event as an incoming TPDU:
195 1a: Ref 22 arg 14(0xe), @ 91990 : 0000.453125 tpdu
197 HDRLEN: 21+1 CR_TPDU_type cdt 0(0x0) dref 0x0
198 + 0: 0x15 0xe0 0x00 0x00 4: 0x00 0x03 0x00 0xc1
199 + 8: 0x06 0x74 0x70 0x70 12: 0x69 0x6e 0x67 0xc2
200 +16: 0x02 0x00 0x07 0xc0 20: 0x01 0x08 0x00 0x00
206 In addition to the data copied from the arguments to tpTrace(),
207 each trace structure contains
208 a time stamp and an event sequence number, and in many cases, the
209 connection reference to which the traced event applies.
210 The utility program \fItppt\fR is be used to turn on and off the
213 This facility can be used for debugging the source
214 code as well as for studying the behavior of the protocol.
215 For example, by adding the appropriate trace events,
216 it is possible to "see" the resequencing function of TP
217 working when a debug option is used to cause
218 TPDUs to be dropped occasionally.
220 See the manual page \fItppt(8)\fR.
225 CLNP was tested in two rather different ways.
226 The first method of testing used the
227 raw CLNP interface with the program \fIclnptest\fR.
228 \fIclnptest\fR allows a user to send or receive CLNP NSDUs.
229 With \fIclnptest\fR, a user can send CLNP NSDUs with various
230 combinations of options and observe the result.
232 The second method of testing CLNP was to have TP use CLNP as its network
234 This method provides a good stress test for CLNP.
235 Unfortunately, TP generally calls CLNP in the same manner, so that not all
236 of the CLNP options are exercised.
239 The program \fIclnptest\fR can be invoked as either
240 a reader or as a writer:
246 The \fI-r\fR option invokes \fIclnptest\fR as a reader, the
247 \fI-w\fR option invokes it as a writer.
248 Other options allow the user to indicate the destination, number of NSDUs,
251 See \fIclnptest(8)\fR for more information.
253 \fIclnptest\fR is normally used in the following manner.
254 On one machine, invoke \fIclnptest\fR as a reader:
260 On a different machine, transmit an NSDU.
261 For example, to test the source route function, one invokes:
264 clnptest -w -h a -oR "b, c, d"
267 This sends an NSDU to host 'a', source routing it via
268 hosts 'b', 'c', and 'd'.
270 In order to test CLNP reassembly certain errors must be generated.
271 The mechanism used has two parts,
272 the user program \fIclnptroll\fR, which enables and disables
273 the generation of these errors, and the
274 kernel resident error-creation routines.
276 Troll options allow one to duplicate an NSDU with a specified frequency.
277 The kernel must be compiled with the \fIconfig\fR option \fITROLL\fR
278 in order to include troll code.
279 See \fIclnptroll(8)\fR for more information.
280 .sh 3 "Debugging CLNP"
282 The following sections describe the \fIbark\fR options
283 appropriate for testing parts of CLNP.
284 Refer to \fIbark(8)\fR for more information about debugging
286 .sh 4 "Sending NSDUs"
288 Turning on the \fIbark\fR
289 option \fIC.output\fR causes information to be
290 printed whenever an NSDU is transmitted.
291 Translation of NSAP addresses to SNPA can be monitored by turning on
292 the \fIC.un\fR, or \fIC.lan\fR options.
293 Parts of outgoing NSDUs can be dumped when the \fIC.dumpout\fR
295 Routing activity can be watched by turning on \fIC.route\fR and \fIC.iso\fR.
296 Information about CLNP option processing is available with \fIC.options\fR.
297 .sh 4 "Forwarding NSDUs"
299 The \fIforward\fR switch will cause debugging information to be displayed
300 whenever NSDUs are forwarded.
301 .sh 4 "Receiving NSDUs"
303 Information is displayed about incoming NSDUs when the \fIC.input\fR
305 A portion of incoming NSDUs can be dumped by turning on the
306 \fIC.dumpin\fR option.
307 .sh 4 "Fragmentation and Reassembly"
309 The options \fIC.frag\fR and \fIC.reass\fR turn on debugging for the
310 CLNP fragmentation and reassembly functions.
313 Five services were used for most of the testing:
314 the \fIdiscard\fR service,
315 the \fIecho\fR service,
316 the \fIremote login\fR service,
317 the \fIremote shell\fR service,
319 the \fIsimple file transfer\fR service.\**
321 \** In fact, ancestors of these services were used for testing the
322 ARGO transport implementation during development.
323 These programs in their original forms were very cumbersome to use;
324 consequently they evolved to become the services described here.
326 Each service consists of a daemon process or server that listens
327 on a well-known transport selector (which is listed in the
328 ARGO directory service), and an active process that contacts the
330 Four of these services,
331 discard, echo, remote login, and remote shell,
333 \fIisod\fR suite of daemons, which is a
334 version of the \fIinetd\fR programs that uses
335 the ISO protocol suite.
336 .sh 3 "The Discard Service"
337 The discard server listens on the transport selector
338 registered in the ARGO directory service for the application
340 The server accepts incoming connection requests,
341 receives TSDUs, and throws away the TSDUs.
342 It never initiates a disconnect, but expects its peer
343 to disconnect the transport connection.
345 The program \fItpdiscard\fR connects to the
347 The transport service and protocol options it uses are those
348 indicated in the ARGO directory service.
349 By changing the directory service entry for the
350 discard service, each of the transport service options and
351 protocol options can be demonstrated.
357 for more information.
358 .sh 3 "The Echo Service"
359 The echo server listens on the transport selector
360 registered in the ARGO directory service for the application
362 The server accepts incoming connection requests,
363 receives TSDUs, and returns the TSDUs to the sender.
364 It never initiates a disconnect, but expects its peer
365 to disconnect the transport connection.
368 program \fItpping\fR connects to the
370 The transport service and protocol options it uses are those
371 indicated in the ARGO directory service.
372 By changing the directory service entry for the
373 echo service, each of the transport service options and
374 protocol options can be demonstrated.
380 for more information.
381 .sh 3 "The Remote Login Service"
382 The remote login server listens on the transport selector
383 registered in the ARGO directory service for the application
385 The server accepts incoming connection requests,
386 implements the BSD remote login protocol, checks permissions using
387 the \fC~/.rhosts\fR, and \fC/etc/passwd\fR files, and
388 uses the ARGO directory service to discover name-to-NSAP-address
390 If the remote user is authorized to log in to the end system on which
391 the server runs, a login is started.
393 The program \fIrlogin.iso\fR connects to the remote login server.
394 The transport service and protocol options it uses are those
395 indicated in the ARGO directory service.
396 By changing the directory service entry for the
397 login service, each of the transport service options and
398 protocol options can be demonstrated.
404 for more information.
405 .sh 3 "The Remote Shell Service"
406 The remote shell server listens on the transport selector
407 registered in the ARGO directory service for the application
409 The server accepts incoming connection requests,
410 implements the BSD remote command authorization protocol,
411 checks permissions using
412 the \fC~/.rhosts\fR, and \fC/etc/passwd\fR files, and
413 uses the ARGO directory service to discover name-to-NSAP-address
415 If the remote user is authorized to execute a shell on
416 the end system on which
417 the server runs, a shell is started.
419 The program \fIrcp.iso\fR connects to the remote shell server to
420 effect a remote copy.
421 The transport service and protocol options it uses are those
422 indicated in the ARGO directory service.
423 By changing the directory service entry for the
424 shell service, each of the transport service options and
425 protocol options can be demonstrated.
431 for more information.
432 .sh 3 "The Simple File Transfer Service"
434 The last service consists of a pair of programs,
437 which cooperate to transfer one file.
438 The passive program, \fItpfileget\fR,
439 listens on the transport selector registered in the ARGO directory service
440 to support the application named "tptestsel".
441 The sending program, \fItpfileput\fR,
442 connects to the passive program, transfers in one TSDU
443 the file named on the \fItpfileput\fR command line, and waits for the
444 passive end to close the connection.
446 opens a file of the name given on its command line,
447 accepts one connection request, receives
448 one TSDU, writes the contents of that TSDU to the opened file,
449 and when it receives the end-of-TSDU indication,
450 \fItpfileget\fR closes the transport connection.
451 The transport service options and protocol options used by
452 \fItpfileput\fR are determined by the ARGO directory service
453 record that describes the applicaition "tptestsel".
459 for more information.
460 .sh 3 "Internal TP Testing"
462 The methods used to test each of the various functions
463 of TP are described in this section.
464 One or more of the services described above were used, while
465 the TP activity was observed with tracing or debugging or both.
466 The statistics were cleared before each test and inspected
468 Each test can be run with different protocol and service options,
469 by changing the transport parameters in records
470 in the ARGO directory service file.
479 for more information.
480 .sh 4 "Normal and Expedited Data Transfer:"
483 distinguished by the presence or absence of the
484 EOTSDU bit in the \fIflags\fR parameter of the
485 \fIsendv()\fR system call.
486 The data of a TSDU are copied into chains of \fImbufs\fR
487 in the kernel so that the end of a TSDU lies in an mbuf
488 with the \fIm_act\fR field non-zero.
489 The end of a TSDU never lies in the middle of an
491 This is true on the receiving side as well.
492 On output, the segmenting function,
493 the function that copies user data into mbuf chains
494 reorganizes mbuf chains into TPDUs,
495 is observed using several debug options
497 in the routines \fIsosend()\fR
498 and \fItp_sbsend()\fR.
499 On input, the reassembling mechanism
500 is observed in the routine \fItp_stash()\fR.
506 pertinent to this function.
508 Expedited data complicates the matter of segmenting
509 because markers must be kept in the chains of outgoing
510 TPDUs to indicate the precedence of expedited data TPDUs
511 over normal data TPDUs.
512 The pertinent trace options are \fBT.sb\fR and \fBT.ndata\fR.
513 With the trace and (or) debugging options on,
514 and with \fItpdiscard\fR running, one can observe the segmentation
515 and reassembly of TPDUs.
517 Using the file transfer programs to transfer a file,
518 then transferring it back with \fIrcp\fR (the TCP version) if necessary, and
520 \fIdiff\fR, one can see that data are transferred correctly.
521 The \fBT.input\fR trace option creates a readable hexadecimal dump of incoming TPDUs.
524 trace option creates the same sort of dump for outgoing
525 TPDUs in \fItp_emit()\fR.
527 can be observed by using the
534 to see the sequence numbers assigned to TPDUs.
538 debug option causes \fItp_input()\fR
539 to throw away occasional TPDUs.
540 (The formula for determining when to discard a TPDU
541 is ad hoc and simplistic. It causes TPDUs to be
542 discarded frequently but not so frequently that the
543 receiving side has no chance to recover.)
544 With tracing on and the file transfer programs running,
545 resequencing can be observed
546 and the correctness of the transferred data
547 can be verified with \fIdiff(1)\fR.
549 The use of both normal and extended formats
550 can be observed with the \fBT.input\fR and \fBT.emit\fR trace options.
552 The following statistics are of interest:
555 \fIn\fR connections used extended format
556 \fIn\fR connections allowed transport expedited data
557 \fIn\fR connections turned off checksumming
558 \fIn\fR connections dropped due to retrans limit
559 \fIn\fR EOT bits on incoming TPDUs
560 \fIn\fR EOT bits on outgoing TPDUs
561 \fIn\fR XPD marks discarded
562 \fIn\fR XPD stopped data flow \fIm\fR times
563 \fIn\fR DTs out of order
564 \fIn\fR DTs not in window
565 \fIn\fR duplicate DTs
566 \fIn\fR XPDs not in window
567 \fIn\fR XPDs w/o credit to stash
569 \fIn\fR DT (received)
570 \fIn\fR DT (retransmitted)
572 \fIn\fR XPD (received)
573 \fIn\fR random DTs dropped
576 .sh 4 "Checksumming, use and non-use:"
578 The checksum generation and checking
579 routines were first written and debugged as user-level
580 routines before they were modified for kernel use.
581 The kernel routines may be observed with the
584 Various sizes of mbufs can be created by creative use of the
585 ARGO directory service, particularly by changing the value of the
586 attribute \fItp.tpdusize\fR.
587 There is no trace option for checksumming.
588 Checksumming has been used with transfers to and from at least
589 one other TP implementation.
591 The statistics that are pertinent to checksumming are:
594 \fIn\fR connections turned off checksumming
595 \fIn\fR invalid checksums
598 .sh 4 "Acknowledgment:"
600 Acknowledgment can be observed by using the
601 debug and trace options
608 The transport driver (finite state machine) and the routine
609 \fItp_goodack()\fR dump information appropriate to acknowledgments.
610 If the \fBT.ndata\fR, and \fBT.emit\fR or \fBT.input\fR trace options are used
611 along with the \fBT.aks\fR and \fBT.akr\fR trace options,
612 a complete picture of the data transfer and acknowledgment
613 activity can be created.
614 The acknowledgments for expedited data are traced with
618 The routine \fItp_goodXack()\fR and the finite state
619 machine dump information when the
621 debug and trace options are used.
622 To cause expedited data to be generated,
623 the -e or -E option on the discard programs or the file
624 transfer programs are used.
625 To observe the different acknowledgment strategies,
626 the protocol options were changed in the ARGO directory service.
628 The pertinent statistics are:
631 \fIn\fR AK (received)
634 \fIn\fR not acked immediately
635 \fIn\fR strategy==each
636 \fIn\fR strategy==fullwindow
645 The smoothed average round trip time is kept
646 for outgoing TPDUs for each transport connection
647 and for the entire TP entity.
648 The time each TPDU is transmitted is recorded, and when an acknowledgment
649 arrives, the round trip time is computed for the lowest
650 sequence number that this AK TPDU acknowledges.
651 The computation of round trip times can be observed
656 In addition to average round trip times, the kernel
657 maintains the standard deviation of the round trip times.
658 This statistic is kept for each connection and for the entire
660 In fact, four such sets of statistics are kept for the TP entity:
662 for traffic not on a public data network (PDN) and on the same network as this end system,
664 for traffic not on a public data network (PDN) and on not the same network as this end system,
666 for traffic on a public data network (PDN) and on the same network as this end system,
669 for traffic on a public data network (PDN) and not on the same network as this end system.
670 The determination of whether traffic is on the same network as this end system
671 is based on the "network portion" of the peer's NSAP-address.
672 For more information about this, see the section of this document titled
673 \fB"Network Layer Routing"\fR.
675 The smoothed average round trip time statistics for a given
676 can be observed with the -t option to
678 The global round trip statistics can be observed with the -s option to
680 .sh 4 "Flow Control:"
682 Flow control activity is the transfer of credit information
683 from end to end and the proper use of that information.
684 To see that it works properly, one must observe three
686 the receiving window must shut down and reopen,
687 the sender must transmit enough TPDUs to fill the receiver's window
688 but no more, and the receiver must renege previously advertised credit.
689 These three behaviors have been observed as follows.
700 The program \fItpdiscard\fR or a simple file transfer
701 is run with various window
702 and maximum TPDU sizes, various acknoledgment strategies, and
703 various retransmission strategies,
704 and the activity is observed with the trace.
707 must be used to fake a reneging of credit, since
708 the ARGO transport entity does not renege its advertised credit
709 under normal operation.
710 At the beginning of a connection a closed window may almost always
712 The receiving user process may be stopped
713 to force a window to shut down.
714 The interesting statistics are
717 \fIn\fR times local cdt reneged (receiving)
718 \fIn\fR foreign window closed (sending)
719 \fIn\fR faked reneging of cdt
720 \fIn\fR DT TPDUs (sent)
721 \fIn\fR DT TPDUs (received)
722 \fIn\fR AK TPDUs (sent)
723 \fIn\fR AK TPDUs (received)
725 \fIn\fR not acked immediately
726 \fIn\fR strategy==each
727 \fIn\fR strategy==fullwindow
735 .sh 4 "Retransmission and retention until acknowledgment:"
737 To observe that the sender retains TPDUs until they are
738 acknowledged, one needs only to use the
740 debug option to cause TPDUs to be dropped by the receiving side.
741 They are then retransmitted by the sender
742 and finally dropped when the acknowledgment arrives.
743 That the buffers used to hold retained TPDUs are freed
745 running \fInetstat(8)\fR with the -m option
746 on a quiescent system to observe the number of mbufs in use,
748 running a test with the
749 \fBT.drop\fR debug option on to cause retransmission,
752 running netstat -m again after the test is over,
753 to see that all the mbufs have been freed by TP.
754 The actual retransmission activity can be observed in a trace
758 \fBT.input\fR trace options.
759 The retransmission strategy to be used is controlled by the
760 ARGO directory service.
764 \fIn\fR DT (retransmissions)
765 \fIn\fR XPD (retransmissions)
766 \fIn\fR CR (retransmissions)
767 \fIn\fR CC (retransmissions)
768 \fIn\fR DR (retransmissions)
772 indicate the number of retransmissions that actually occurred.
775 The debug and trace option
777 dumps information about the timers as they are set,
778 as they are cancelled, and as they expire.
784 \fIn\fR timers expired
785 \fIn\fR timers cancelled
786 \fIn\fR inactive timers cancelled
787 \fIn\fR connections dropped due to retrans limit
788 \fIn\fR CCs sent to zero dref
792 are printed for both the E-type timers and for the C-type timers.
793 The effect of timers can be seen by observing retransmissions.
794 Two simple ways to force retransmissions are:
796 to use the \fBT.zdref\fR debug option,
797 which causes CCs to contain a zero destination reference,
798 so that connection establishment will time out, and
800 to attempt to open a connection to a transport selector on which
801 no process is listening.
802 Either of these actions, along with the
804 trace or debug option will permit
805 observation of the timeout facilities.
806 .sh 4 "TPDU creation and parsing:"
808 TPDUs are created for output in
813 option dumps TPDUs as they are transmitted.
814 \fITp_input()\fR parses TPDUs on input.
818 option dumps TPDUs as they are received.
819 The debug options \fBT.emit\fR and \fBT.input\fR dump a lot of excess information
820 to the console, and are used primarily for debugging
821 extremely pathological behavior.
823 By tracing the execution of
824 \fItpdiscard\fR or a simple file transfer,
825 with a variety protocol and service options,
836 one can verify the correct placement of TPDU options
837 on all types of TPDUs.
838 The interesting statistics are
841 \fIn\fR variable parameters ignored
842 \fIn\fR invalid parameter codes
843 \fIn\fR invalid parameter values
844 \fIn\fR invalid dutypes
845 \fIn\fR invalid negotiation failures
846 \fIn\fR invalid destinagion referencess
847 \fIn\fR invalid suffix parameters
848 \fIn\fR invalid checksums
849 \fIn\fR connections used extended format
850 \fIn\fR connections allowed transport XPD
851 \fIn\fR connections turned off checksumming
852 \fIn\fR TP 4 connections
853 \fIn\fR TP 0 connections
856 .sh 4 "Separation and concatenation:"
858 Concatenation is not supported by this implementation.
859 Separation is supported, however, and to test separation,
860 some sort of concatenated TPDUs had to be created.
861 The code for this is no longer supported.
862 After testing locally with some temporary code to create concatenated
864 the ARGO transport implementation was tested with another transport
865 implementation that does generate concatenated TPDUs.
866 The interesting statistics are:
869 \fIn\fR concatenated TPDUs
873 .sh 4 "Length limits for TPDUs:"
875 Some TPDUs may take user data:
876 the CR, CC, DR, DT, and XPD.
877 All of these but the DT TPDU have limits to the amount
878 of data they may carry.
879 The limits are enforced for CR, CC, and DR TPDUs by
880 \fItp_ctloutput()\fR,
881 the routine that accepts data from the user.
882 The limit for XPD TPDUs is enforced by
883 \fItp_usrreq()\fR, which accepts expedited
885 To test the effectiveness of the checks on output, one may attempt
886 to send expedited data with amounts larger than the limit (16 bytes).
888 On input the limits are checked in
890 To test the effectiveness of the checks on input, it was necessary
891 to create an illegally large TPDU.
895 does this - it will turn a legitimate
896 XPD TPDU into a XPD TPDU with 18 bytes
898 The interesting statistics are:
901 \fIn\fR illegally large XPD TPDU
902 \fIn\fR invalid length
905 .sh 4 "Frozen References:"
907 The key issue here is to see that references are not reassigned
908 until the reference timer expires.
909 This can be observed by watching the timer activity as described
910 above and by observing the reference numbers chosen for sockets
911 with the \fBT.emit\fR
912 or \fBT.input\fR trace options, which trace the TPDU headers.
913 .sh 4 "Inactivity Control:"
915 Inactivity control can be observed by turning on the trace options
916 \fBT.aks\fR, \fBT.akr\fR and \fBT.emit\fR
917 during a simple file transfer.
918 In the middle of the transfer, if the sender process
919 is stopped, both TP entities continue
920 to send acknowledgments.
921 This can be observed in the trace.
922 If the file transfer is between machines, taking down one of the machines
923 will cause the inactivity timer on the other machine to expire.
924 The TP entity will respond to this by sending a DR TPDU
925 to close the connection, which can be observed in the trace.
926 The expiration of the timer can be observed in a trace if the
927 \fBT.driver\fR option is used.
928 This option traces all events and state changes in the
930 finite state machine.
931 .sh 4 "Connection establishment:"
933 The process of connection establishment can be observed with the
935 trace and debug options, and
939 Various states of the connection establishment state machine
940 may be observed with the
944 causes \fItp_input()\fR
945 to change the foreign reference on an incoming CC TPDU to zero,
946 eventually causing the CC TPDU to be dropped,
947 retransmissions of the CC to occur,
948 and the connection to time out before being established.
949 The statistics of interest are:
952 \fIn\fR CCs sent to zero dref
953 \fIn\fR invalid dest refs
954 \fIn\fR CC (received)
956 \fIn\fR CC (retransmitted)
957 \fIn\fR (connections) timed out on retrans
960 .sh 4 "Disconnection:"
962 Various states of the connection breakdown part of the state machine
963 may be observed with the
971 discard or file transfer programs.
972 .sh 4 "Association of TPDUs with Transport Connection:"
974 The problem of locating a transport connection
975 given a TPDU is handled in
976 \fItp_input()\fR in one of two ways.
977 For an incoming CR TPDU, the transport suffix
978 is used to locate a transport protocol
979 control block (PCB), to which a transport
980 connection is made by creating a new socket and PCB.
981 For all other TPDU types, the destination reference is used
982 to locate the appropriate transport connection.
983 This is done by scanning the list of reference blocks.
984 Debug and trace options
985 were used to debug these sections of code but have since been
986 removed due to their effect on the readability
987 and maintainability of this code.
992 creates trace records that contain the address of the
993 socket as well as that of the PCB
994 when a socket is opened.
995 When a TPDU arrives for a given socket,
996 the trace records created by the
998 option will also contain the address of the PCB that is found
1001 These two addresses can be compared in the trace output to observe
1002 that the proper association is made.
1003 .sh 4 "Protocol Errors and the ER TPDU:"
1005 Certain types of errors are intended to evoke the response
1006 from the TP entity of sending an ER or a DR TPDU.
1008 \fItp_error_emit()\fR
1009 creates ER and DR TPDUs for this purpose.
1010 The debug and trace option
1012 dumps information about the activity of this routine.
1013 Since ER TPDUs are not generated under normal circumstances,
1014 the parsing of ER TPDUs was tested in this
1015 implementation by code that generated (illegitimate) ER TPDUs,
1016 This code was removed because it significantly complicated code maintenance.
1017 .sh 4 "User Interface:"
1019 The debug and trace options
1025 dump information about the user interface.
1026 Most of the debugging code added to the socket-layer
1027 routines for debugging has since been removed so that
1028 the source (which is functionally unchanged from the 4.3 release)
1029 would not unnecessarily be changed.
1030 \fIRlogin.iso\fR, the TP version of remote login,
1031 exercises some of the original BSD data transfer system calls
1032 (\fIread()\fR and \fIwrite()\fR)
1033 rather than \fIsendv()\fR and \fIrecv()\fR.
1034 The interesting statistics are
1037 \fIn\fR EOT indications
1039 \fIn\fR connections used extended format
1040 \fIn\fR connections allowed transport XPD
1041 \fIn\fR connections turned off checksumming
1042 \fIn\fR TP 4 connections
1043 \fIn\fR TP 0 connections