home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 800s / rfc891.txt < prev    next >
Text File  |  1990-03-18  |  65KB  |  1,405 lines

  1. Network Working Group                                   D.L.  Mills
  2. Request for Comments:  891                              December 1983
  3.  
  4.  
  5.                          DCN Local-Network Protocols
  6.  
  7. This RFC is a description of the protocol used in the DCN local
  8. networks to maintain connectivity, routing, and timekeeping
  9. information.  These procedures may be of interest to designers and
  10. implementers of other networks.
  11.  
  12. 1.  Introduction
  13.  
  14.      This document describes the local-net architecture and protocols
  15. of the Distributed Computer Network (DCN), a family of local nets
  16. based on Internet technology and an implementation of PDP11-based
  17. software called the Fuzzball.  DCN local nets have been in operation
  18. for about three years and now include clones in the USA, UK, Norway
  19. and West Germany.  They typically include a number of PDP11 or LSI-11
  20. Fuzzballs, one of which is elected a gateway, and often include other
  21. Internet-compatible hosts as well.
  22.  
  23.      The DCN local-net protocols are intended to provide connectivity,
  24. routing and timekeeping functions for a set of randomly connected
  25. personal computers and service hosts.  The design philosophy guiding
  26. the Fuzzball implementation is to incorporate complete functionality
  27. in every host, which can serve as a packet switch, gateway and service
  28. host all at the same time.  When a set of Fuzzballs are connected
  29. together using a haphazard collection of serial, parallel and
  30. contention-bus interfaces, they organize themselves into a network
  31. with routing based on minimum delay.
  32.  
  33.      The purpose of this document is to describe the local-net
  34. protocols used by the DCN to maintain connectivity, routing and
  35. timekeeping functions.  The document is an extensive revision and
  36. expansion of Section 4.2 of [1] and is divided into two parts, the
  37. first of which is an informal description of the architecture,
  38. together with explanatory remarks.  The second part consists of a
  39. semi-formal specification of the entities and protocols used to
  40. determine connectivity, establish routing and maintain clock
  41. synchronization and is designed to aid in the implementation of cohort
  42. systems.  The link-level coding is described in the appendix.
  43.  
  44. 2.  Narrative Description
  45.  
  46.      The DCN architecture is designed for local nets of up to 256
  47. hosts and gateways using the Internet Protocol (IP) and client
  48. protocols.  It provides adaptive routing and clock synchronization
  49. functions in an arbitrary topology including point-to-point links and
  50. multipoint bus systems.  It is intended for use in connecting personal
  51. computers to each other and to service machines, gateways and other
  52. hosts of the Internet community.  However, it is not intended for use
  53. in large, complex networks and does not support the sophisticated
  54. routing and control algorithms of, for example, the ARPANET.
  55.  
  56.      A brief description of the process and addressing structure used
  57. in the DCN may be useful in the following.  A DCN physical host is a
  58. PDP11-compatible processor which supports a number of cooperating
  59. sequential processes, each of
  60.  
  61. DCN Local-Network Protocols                                         Page 2
  62. D.L. Mills
  63.  
  64. which is given a unique 8-bit identifier called its port ID.  Every
  65. DCN physical host contains one or more internet processes, each of
  66. which supports a virtual host given a unique 8-bit identifier called
  67. its host ID.
  68.  
  69.      Each virtual host can support multiple internet protocols,
  70. connections and, in addition, a virtual clock.  Each physical host
  71. contains a physical clock which can operate at an arbitrary rate and,
  72. in addition, a 32-bit logical clock which operates at 1000 Hz and is
  73. assumed to be reset each day at 0000 hours UT.  Not all physical hosts
  74. implement the full 32-bit precision; however, in such cases the
  75. resolution of the logical clock may be somewhat less.
  76.  
  77.      There is a one-to-one correspondence between Internet addresses
  78. and host IDs.  The host ID is formed from a specified octet of the
  79. Internet address to which is added a specified offset.  The octet
  80. number and offset are selected at configuration time and must be the
  81. same for all DCN hosts sharing the local net.  For class-B and class-C
  82. nets normally the fourth octet is used in this way for routing within
  83. the local net.  In the case of class-B nets, the third octet is
  84. considered part of the net number by DCN hosts; therefore, this octet
  85. can be used for routing between DCN local nets.  For class-A nets
  86. normally the third octet (ARPANET logical-host field) is used for
  87. routing where necessary.
  88.  
  89.      Each DCN physical host is identified by a host ID for the purpose
  90. of detecting loops in routing updates, which establish the
  91. minimum-delay paths between the virtual hosts.  By convention, the
  92. physical host ID is assigned as the host ID of one of its virtual
  93. hosts.  A link to a neighbor net is associated with a special virtual
  94. host, called a gateway, which is assigned a unique host ID.
  95.  
  96.      The links connecting the various physical hosts together and to
  97. foreign nets can be distributed in arbitrary ways, so long as the net
  98. remains fully connected.  If full connectivity is lost, due to a link
  99. or host fault, the virtual hosts in each of the surviving segments can
  100. continue to operate with each other and, once connectivity is
  101. restored, with all of them.
  102.  
  103.      Datagram routing is determined entirely by internet address -
  104. there is no local leader as in the ARPANET.  Each physical host
  105. contains two tables, the Host Table, which is used to determine the
  106. outgoing link to each other local-net host, and the Net Table, which
  107. is used to determine the outgoing host (gateway) to each other net.
  108. The Host Table contains estimates of roundtrip delay and logical-clock
  109. offset for all virtual hosts in the net and is indexed by host ID.
  110. For the purpose of computing these estimates the delay and offset of
  111. each virtual host relative to the physical host in which it resides is
  112. assumed zero.  The single exception to this is a special virtual host
  113. associated with an NBS radio time-code receiver, where the offset is
  114. computed relative to the broadcast time.
  115.  
  116.      The Net Table contains an entry for every neighbor net that may
  117. be connected to the local net and, in addition, certain other nets
  118. that are not
  119.  
  120. DCN Local-Network Protocols                                         Page 3
  121. D.L. Mills
  122.  
  123. neighbors.  Each entry contains the net number, as well as the host ID
  124. of the local-net gateway to that net.  The routing function simply
  125. looks up the net number in the Net Table, finds the host ID of the
  126. gateway and retrieves the port ID of the net-output process from the
  127. Host Table.  Other information is included in the Host Table and Net
  128. Table as described below.
  129.  
  130.      The delay and offset estimates are updated by HELLO messages
  131. exchanged on the links connecting physical-host neighbors.  The HELLO
  132. messages are exchanged frequently, but not so as to materially degrade
  133. the throughput of the link for ordinary data messages.  A HELLO
  134. message contains a copy of the delay and offset information from the
  135. Host Table of the sender, as well as information to compute the
  136. roundtrip delay and logical-clock offset of the receiver relative to
  137. the sender.
  138.  
  139.      The routing algorithm is similar to that (formerly) used in the
  140. ARPANET and other places in that the roundtrip (biased) delay estimate
  141. calculated to a neighbor is added to each of the delay estimates given
  142. in its HELLO message and compared with the corresponding delay
  143. estimates in the Host Table.  If a delay computed in this way is less
  144. than the delay already in the Host Table, the routing to the
  145. corresponding virtual host is changed accordingly.  The detailed
  146. operation of this algorithm, which includes provisions for host
  147. up-down logic and loop suppression, is summarized in a later section.
  148.  
  149.      DCN local nets are self-configuring for all hosts and neighbor
  150. nets; that is, the routing algorithms will find minimum-delay paths
  151. between all hosts and gateways to neighbor nets.  In addition,
  152. timekeeping information can be exchanged using special HELLO messages
  153. between neighboring DCN local nets.  For routing beyond neighbor nets
  154. additional entries can be configured in the Net Tables as required.
  155. In addition, a special entry can be configured in the Net Tables which
  156. specifies the host ID of the gateway to all nets not explicitly
  157. included in the table.
  158.  
  159.      For routing via the ARPANET and its reachable nets a selected
  160. local-net host is equipped with an IMP interface and configured with a
  161. GGP/EGP Gateway process.  This process maintains the Net Table of the
  162. local host, including ARPANET leaders, dynamically as part of the
  163. GGP/EGP protocol interactions with other ARPANET gateways.  GGP/EGP
  164. protocol interactions are possibly with non-ARPANET gateways as well.
  165.  
  166.      The portable virtual-host structure used in the DCN encourages a
  167. rather loose interpretation of addressing.  In order to minimize
  168. confusion in the following, the term "host ID" will be applied only to
  169. virtual hosts, while "host number" will be applied to the physical
  170. host, called generically the DCN host.
  171.  
  172. 2.1.  Net and Host Tables
  173.  
  174.      There are two tables in every DCN host which control routing of
  175. Internet Protocol (IP) datagrams: the Net Table and the Host Table.
  176. The Net Table is used to determine the host ID of the gateway on the
  177. route to a foreign net,
  178.  
  179. DCN Local-Network Protocols                                         Page 4
  180. D.L. Mills
  181.  
  182.  
  183. while the Host Table is used to determine the link, with respect to
  184. the DCN host, on the route to a virtual host.  The Host Table is
  185. maintained dynamically using updates generated by periodic HELLO
  186. messages.  The Net Table is fixed at configuration time for all DCN
  187. hosts except those that support a GGP/EGP Gateway process.  In these
  188. cases the Net Table is updated as part of the gateway operations.  In
  189. addition, entries in either table can be changed by operator commands.
  190.  
  191.      The Net Table format is shown in Figure 1.
  192.  
  193.                         1                   0 
  194.               5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  195.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  196.              |           Net Name            |
  197.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  198.              |    Net(2)     |    Net(1)     |
  199.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  200.              |    Index      |    Net(3)     |
  201.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  202.              |     Hops      |  Gateway ID   |
  203.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  204.              |                               |
  205.              |        Gateway Leader         |
  206.              |                               |
  207.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  208.  
  209.                  Figure 1. Net Table Entry
  210.  
  211.      The "Net Name" field defines a short (RAD50) name for the net,
  212. while the "Net" fields define the class A/B/C net number.  The
  213. "Gateway ID" field contains the host ID of the first gateway to the
  214. net and the "Hops" field the number of hops to it.  The remaining
  215. fields are used only by the GGP/EGP Gateway process and include the
  216. "Index" field, which contains an index into the routing matrix.  and
  217. the "Gateway Leader" field, which contains the (byte-swapped)
  218. local-net leader for the gateway on a neighbor net.
  219.  
  220.      The Net Table contains an indefinite number of entries and is
  221. terminated by a special entry with all "Net" fields set to zero.  If
  222. the "Hops" field of this entry is less than 255, the "Gateway ID"
  223. field of this entry is used for all nets not in the table.  If the
  224. "Hops" field is 255 all nets not explicitly mentioned in the table
  225. appear unreachable.
  226.  
  227.      The Host Table format is shown in Figure 2.
  228.  
  229. DCN Local-Network Protocols                                         Page 5
  230. D.L. Mills
  231.  
  232.  
  233.                         1                   0 
  234.               5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  235.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  236.              |             Name              |
  237.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  238.              |      TTL      |    Port ID    |
  239.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  240.              |             Delay             |
  241.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  242.              |             Offset            |
  243.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  244.              |                               |
  245.              +                               +
  246.              |          Local Leader         |
  247.              +                               +
  248.              |                               |
  249.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  250.              |                               |
  251.              +        Update Timestamp       +
  252.              |                               |
  253.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  254.  
  255.                 Figure 2. Host Table Entry
  256.  
  257.      The ordinal position of each Host Table entry corresponds to its
  258. host ID.  The "Name" field contains a short (RAD50) name for
  259. convenient reference.  The "Port ID" field contains the port ID of the
  260. net-output process on the shortest path to this virtual host and the
  261. "Delay" field contains the measured roundtrip delay to it.  The
  262. "Offset" field contains the difference between the logical clock of
  263. this host and the logical clock of the local host.  The "Local Leader"
  264. field contains information used to construct the local leader of the
  265. outgoing packet, for those nets that require it.  The "Update
  266. Timestamp" field contains the logical clock value when the entry was
  267. last updated and the "TTL" field the time (in seconds) remaining until
  268. the virtual host is declared down.
  269.  
  270.      All fields except the "Name" field are filled in as part of the
  271. routing update process, which is initiated upon arrival of a HELLO
  272. message from a neighboring DCN host.  This message takes the form of
  273. an IP datagram carrying the reserved protocol number 63 and a data
  274. field as shown in Figure 3.
  275.  
  276. DCN Local-Network Protocols                                         Page 6
  277. D.L. Mills
  278.  
  279.  
  280.                         1                   0 
  281.               5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  282.          --- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  283. Fixed        |           Checksum            |
  284. Area         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  285.              |             Date              |
  286.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  287.              |                               |
  288.              +              Time             +
  289.              |                               |
  290.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  291.              |           Timestamp           |
  292.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  293.              |     Offset    |   Hosts (n)   |
  294.          --- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  295. Host         |          Delay Host 0         |
  296. Area         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  297.              |         Offset Host 0         |
  298.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  299.             ...                             ...
  300.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  301.              |         Delay Host n-1        |
  302.              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  303.              |         Offset Host n-1       |
  304.          --- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  305.  
  306.                Figure 3. HELLO Message Format
  307.  
  308.      There are two HELLO message formats, depending on the length of
  309. the message.  One format, sent by a DCN host to another host on the
  310. same local net, includes both the fixed and host areas shown above.
  311. The second format, sent in all other cases, includes only the fixed
  312. area.
  313.  
  314.      Note that all word fields shown are byte-swapped with respect to
  315. the ordinary PDP11 representation.  The "Checksum" field contains a
  316. checksum covering the fields indicated.  The "Date" and "Time" fields
  317. are filled in with the local date and time of origination.  The
  318. "Timestamp" field is used in the computation of the roundtrip delay
  319. (see below).  The "Offset" field contains the offset of the block af
  320. Internet addresses used by the local net.  The "Delay Host n" and
  321. "Offset Host n" fields represent a copy of the corresponding entries
  322. of the Host Table as they exist at the time of origination.  The
  323. "Hosts (n)" field contains the number of entries in this table.
  324.  
  325. 2.2.  Roundtrip Delay Calculations
  326.  
  327.      Periodically, each DCN physical host sends a HELLO message to its
  328. neighbor on each of the communication links common to both of them.
  329. For each of these links the sender keeps a set of state variables,
  330. including a copy of the source-address field of the last HELLO message
  331. received.  
  332.  
  333. DCN Local-Network Protocols                                         Page 7
  334. D.L. Mills
  335.  
  336.  
  337. When constructing a HELLO message the sender sets the
  338. destination-address field to this state variable and the
  339. source-address field to its own address.  It then fills in the "Date"
  340. and "Time" fields from its logical clock and the "Timestamp" field
  341. from another state variable.  It finally copies the "Delay" and
  342. "Offset" values from its Host Table into the message.
  343.  
  344.      A host receiving a HELLO message discards it if the format is bad
  345. or the checksum fails.  If valid, it initializes a link state variable
  346. to show that the link is up.  Each time a HELLO message is transmitted
  347. this state variable is decremented.  If it decrements to zero the link
  348. is declared down.
  349.  
  350.      The host then checks if the source-address field matches the
  351. state variable containing the last address stored.  If not, the link
  352. has been switched to a new host, so the state variables are flushed
  353. and the link forced into a recovery state.  The host then checks if
  354. the destination-address field matches its own address.  If so, the
  355. message has been looped (legal only in the case of a broadcast net)
  356. and the roundtrip delay information is corrected.  The host and net
  357. areas are ignored in this case.  If not, the host and net areas of the
  358. message are processed to update the Host and Net Tables.
  359.  
  360.      Roundtrip delay calculations are performed in the following way.
  361. The link input/output processes assigned each link maintain an
  362. internal state variable which is updated as each HELLO message is
  363. received and transmitted.  When a HELLO message is received this
  364. variable takes the value of the "Time" field minus the current
  365. time-of-day.  When the next HELLO message is transmitted, the value
  366. assigned the "Timestamp" field is computed as the low-order 16-bits of
  367. this variable plus the current time-of-day.  The value of this
  368. variable is forced to zero if either the link is down of the system
  369. logical clock has been reset since the last HELLO message was
  370. received.
  371.  
  372.      If a HELLO message is received with zero "Timestamp" field, no
  373. processing other than filling in the internal state variable.
  374. Otherwise, the roundtrip delay is computed as the low-order 16-bits of
  375. the current time-of-day minus the value of this field.  In order to
  376. assure the highest accuracy, the calculation is performed only if the
  377. length of the last transmitted HELLO message (in octets) matches the
  378. length of the received HELLO message.
  379.  
  380.      The above technique renders the calculation independent of the
  381. clock offsets and intervals between HELLO messages at either host,
  382. protects against errors that might occur due to lost HELLO messages
  383. and works even when a neighbor host simply forwards the HELLO message
  384. back to the originator without modifying it.  The latter behavior,
  385. typical of ARPANET IMPs and gateways, as well as broadcast nets, relies
  386. on the loop-detection mechanism so that correct calculations can be
  387. made and, furthermore, that spurious host updates can be avoided.
  388.  
  389.  
  390. DCN Local-Network Protocols                                         Page 8
  391. D.L. Mills
  392.  
  393.  
  394. 2.3.  Host Updates
  395.  
  396.      When a HELLO message arrives which results in a valid roundtrip
  397. delay calculation, a host update process is performed.  This consists
  398. of adding the roundtrip delay to each of the "Delay Host n" entries in
  399. the HELLO message in turn and comparing each of these calculated
  400. delays to the "Host Delay" field of the corresponding Host Table
  401. entry.  Each entry is then updated according to the following rules:
  402.  
  403. 1.  If the link connects to another DCN host on the same net and the
  404.     port ID (PID) of the link output process matches the "Port ID"
  405.     field of the entry, then update the entry.
  406.  
  407. 2.  If the link connects to another DCN host on the same net, the PID
  408.     of the link output process does not match the "Port ID" field and the
  409.     calculated delay is less than the "Host Delay" field by at least a
  410.     specified switching threshold (currently 100 milliseconds), then
  411.     update the entry. 
  412.  
  413. 3.  If the link connects to a foreign net and is assigned a host ID
  414.     corresponding to the entry, then update the entry.  In this case
  415.     only, use as the calculated delay the roundtrip delay.
  416.     
  417. 4.  If none of the above conditions are met, or if the virtual host
  418.     has been declared down and the "TTL" field contains a nonzero
  419.     value, then no update is performed.
  420.  
  421.      The update process consists of replacing the "Delay" field with
  422. the calculated delay, the "Port ID" field with the PID of the link
  423. output process, the "Update Timestamp" field with the current time of
  424. day and the "TTL" field by a specified value (currently 120) in
  425. seconds.  If the calculated delay exceeds a specified maximum interval
  426. (currently 30 seconds), the virtual host is declared down by setting
  427. the corresponding "Delay" field to the maximum and the remaining
  428. fields as before.  For the purposes of delay calculations values less
  429. than a specified minimum (currently 100 milliseconds) are rounded up
  430. to that minimum.
  431.  
  432.      The "Offset" field is also replaced during the update process.
  433. When the HELLO message arrives, The value of the current logical clock
  434. is subtracted from the "Time" field and the difference added to
  435. one-half the roundtrip delay.  The resulting sum, which represents the
  436. offset of the local clock to the clock of the sender, is added to the
  437. corresponding "Offset" field of the HELLO message and the sum replaces
  438. the "Offset" field of the Host Table.  Thus, the "Offset" field in the
  439. Host Table for a particular virtual host is replaced only if that host
  440. is up and on the minimum-delay path to the DCN host.
  441.  
  442.      The purpose of the switching threshold in (2) above and the
  443. minimum delay specification in the update process is to avoid
  444. unnecessary switching between links and transient loops which can
  445. occur due to normal variations in propagation delays.  The purpose of
  446. the "TTL" field test in (4) above is to ensure consistency by purging
  447. all paths to a virtual host when that virtual host goes down.
  448.  
  449. DCN Local-Network Protocols                                         Page 9
  450. D.L. Mills
  451.  
  452.  
  453.      In addition to the updates performed as HELLO messages arrive, each
  454. virtual host in a DCN host also performs a periodic update of its own
  455. Host Table entry.  The update procedure is identical to the above,
  456. except that the calculated delay and offset are taken as zero.  At
  457. least one of the virtual hosts in a DCN host must have the same host
  458. ID as the host number assigned the DCN host itself and all must be
  459. assigned the same net number.  Other than these, there are no
  460. restrictions on the number or addresses of internet processes resident
  461. in a single DCN host.
  462.  
  463.      It should be appreciated that virtual hosts are truly portable
  464. and can migrate about the net, should such a requirement arise.  The
  465. host update protocols described here insure that the routing
  466. procedures always converge to the minimum-delay paths via operational
  467. links and DCN hosts.  In the case of broadcast nets such as Ethernets,
  468. the procedures are modified slightly as described below.  In this case
  469. the HELLO messages are used to determine routing from the various
  470. Ethernet hosts to destinations off the cable, as well as to provide
  471. time synchronization.
  472.  
  473. 2.4.  Timeouts
  474.  
  475.      The "TTL" field in every Host Table entry is decremented once a
  476. second in normal operation.  Thus, if following a host update another
  477. update is not received within an interval corresponding to the value
  478. initialized in that field, it decrements to zero, at which point the
  479. virtual host is declared down and the Host Table entry set as
  480. described above.  The 120-second interval used currently provides for
  481. at least four HELLO messages to be generated by every neighbor on
  482. every link during that interval, since the maximum delay between HELLO
  483. messages is 30 seconds on the lowest-speed link (1200 bps).  Thus, if
  484. no HELLO messages are lost, the maximum number of links between any
  485. virtual host and any other is four.
  486.  
  487.      The "TTL" field is initialized at 120 seconds when an update
  488. occurs and when the virtual host is declared down.  During the
  489. interval this field decrements to zero immediately after being
  490. declared down, updates are ignored.  This provides a decent interval
  491. for the bad news to propagate throughout the net and for the Host
  492. Tables in all DCN hosts to reflect the fact.  Thus, the formation of
  493. routing loops is prevented.
  494.  
  495.      The IP datagram forwarding procedures call for decrementing the
  496. "time-to-live" field in the IP header once per second or at each point
  497. where it is forwarded, whichever comes first.  The value used
  498. currently for this purpose is 30, so that an IP datagram can live in
  499. the net no longer than that number of seconds.  This is thus the
  500. maximum delay allowed on any path between two virtual hosts.  If this
  501. maximum delay is exceeded in calculating the roundtrip delay for a
  502. Host Table entry, the corresponding virtual host will be declared
  503. down.
  504.  
  505.  
  506. DCN Local-Network Protocols                                        Page 10
  507. D.L. Mills
  508.  
  509.      The interval between HELLO messages on any link depends on the
  510. data rate supported by the link.  As a general rule, this interval is
  511. set at 16 times the expected roundtrip time for the longest packet to
  512. be sent on that link.  For 1200-bps asynchronous transmission and
  513. packet lengths to 256 octets, this corresponds to a maximum HELLO
  514. message interval of about 30 seconds. 
  515.  
  516.      Although the roundtrip delay calculation, upon which the routing
  517. process depends, is relatively insensitive to net traffic and
  518. congestion, stochastic variations in the calculated values ordinarily
  519. occur due to coding (bit or character stuffing) and medium
  520. perturbations.  In order to suppress loops and needless path changes a
  521. minimum switching threshold is incorporated into the routing mechanism
  522. (see above).  The interval used for this threshold, as well as for the
  523. minimum delay on any path, is 100 milliseconds.
  524.  
  525. 3.  Formal Specification
  526.  
  527.      The following sections provide a formal framework which describe
  528. the DCN HELLO protocol.  This protocol is run between neighboring DCN
  529. hosts that share a common point-to-point link and provides automatic
  530. connectivity determination, routing and timekeeping functions.
  531.  
  532.      The descriptions to follow are organized as follows: First a
  533. summary of data structures describes the global variables and packet
  534. formats.  Then three processes which implement the protocol are
  535. described: the CLOCK, HELLO and HOST processes.  The description of
  536. these processes is organized into sections that describe (1) the local
  537. variables used by that process, (2) the parameters and constants and
  538. (3) the events that initiate processing together with the procedures
  539. they evoke.  In the case of variables a distinction is made between
  540. state variables, which retain their contents between procedure calls,
  541. and temporaries, which have a lifetime extending only while the
  542. process is running.  Except as noted below, the initial contents of
  543. state variables are unimportant.
  544.  
  545. 3.1.  Data Structures
  546.  
  547. 3.1.1.  Global Variables
  548.  
  549. ADDRESS
  550.     This is a 32-bit bit-string temporary variable used to contain an
  551.     Internet address.
  552.     
  553.  
  554. CLOCK-HID
  555.     This is an eight-bit integer state variable used to contain the
  556.     host ID of the local-net host to be used as the master clock.  It
  557.     is initialized to the appropriate value depending upon the net
  558.     configuration. 
  559.     
  560. DATE
  561.     This is a 16-bit bit-string state variable used to contain the
  562.     date in RT-11 format.  Bits 0-4 contain the year, with zero
  563.     corresponding to 1972, bits 5-9 contain the day of the month and
  564.  
  565. DCN Local-Network Protocols                                        Page 11
  566. D.L. Mills
  567.  
  568.     bits 10-14 contain the month, starting with one for January.
  569.  
  570. DATE-VALID
  571.     This is a one-bit state variable used to indicate whether the
  572.     local date and time are synchronized with the master clock.  A
  573.     value of one indicates the local clock is not synchronized with
  574.     the master clock.  This variable is set to one initially and when
  575.     the local time-of-day rolls over past midnight.  It is set to zero
  576.     each time a valid date and time update has been received from the
  577.     master clock. 
  578.     
  579. DELAY
  580.     This is a 16-bit integer temporary variable which represents the
  581.     roundtrip delay in milliseconds to a host.
  582.     
  583. HID
  584.     This is an eight-bit integer temporary variable containing the
  585.     host ID of some host on the local net.
  586.     
  587.     There is a one-to-one correspondence between the Internet
  588.     addresses of local hosts and their HIDs.  The mapping between them
  589.     is selected on the basis of the octet number of the Internet
  590.     address.  For DCN hosts it is the fourth octet, while for hosts
  591.     directly connected to a class-A ARPANET IMP or gateway, it is the
  592.     third octet (logical-host field).  The contents of this octet are
  593.     to be added to ADDRESS-OFFSET to form the HID associated 
  594.     with the address.
  595.  
  596. HOLD
  597.     This is an eight-bit counter state variable indicating whether
  598.     timestamps are valid or not.  While HOLD is nonzero, timestamps
  599.     should be considered invalid.  When set to some nonzero value, the
  600.     counter decrements to zero at a 1-Hz rate.  Its initial value is
  601.     zero. 
  602.     
  603. HOST-TABLE
  604.     This is a table of NHOSTS entries indexed by host ID (HID).  There
  605.     is one entry for each host in the local net.  Each entry has the
  606.     following format:
  607.  
  608.     HOST-TABLE.DELAY
  609.         This is a 16-bit field containing the computed roundtrip delay
  610.         in milliseconds to host HID.
  611.         
  612.     HOST-TABLE.OFFSET
  613.         This is a 16-bit field containing the computed signed offset
  614.         in milliseconds which must be added to the local apparent
  615.         clock to agree with the apparent clock of host HID.
  616.         
  617.     HOST-TABLE.PID
  618.         This is an eight-bit field containing the PID of the net-output
  619.         process selected by the routing algorithm to forward packets
  620.         to host HID.
  621.         
  622.  
  623. DCN Local-Network Protocols                                        Page 12
  624. D.L. Mills
  625.  
  626.  
  627.  HOST-TABLE.TTL
  628.      This is an eight-bit field used as a time-to-live indicator.
  629.      It is decremented by the HOST process once each second and
  630.      initialized to a chosen value when a HELLO message is
  631.      received. The table is initialized with the HOST-TABLE.DELAY
  632.      field set to  MAXDELAY for all entries.  The contents of the
  633.      other fields are unimportant. 
  634.   
  635. LOCAL-ADDRESS
  636.     This is a 32-bit bit-string state variable used to contain the 
  637.     local host Internet address.
  638.  
  639. NET-TABLE
  640.     This is a table of NNETS entries with the following format:
  641.  
  642.     NET-TABLE.HID
  643.         This is an eight-bit field containing the host ID of the
  644.         pseudo-process to forward packets to the NET-TABLE.NET net.
  645.  
  646.     NET-TABLE.NET
  647.         This is a 24-bit field containing an Internet class-A (eight
  648.         bits), class-B (16 bits) or class-C (24 bits) net number.
  649.         Note that the actual field width for class-B net numbers is 24
  650.         bits in order to provide a subnet capability, in which the
  651.         high-order eight bits of the 16-bit host address is
  652.         interpreted as the subnet number. 
  653.         
  654.     The table is constructed at configuration time and must include an
  655.     entry for every net that is a potential neighbor.  A neighbor net
  656.     is defined as a net containing a host that can be directly
  657.     connected to a host on the local net.  The entry for such a net is
  658.     initialized with NET-TABLE.NET set to the neighbor net number and
  659.     NET-TABLE.HID set to an arbitrary vitual-host ID not assigned any
  660.     other local-net virtual host. 
  661.     
  662.     The remaining entries in NET-TABLE are initialized at initial-boot
  663.     time with the NET-TABLE.NET fields set to zero and the
  664.     NET-TABLE.HID fields set to a configuration-selected host ID to be
  665.     used to forward packets to all nets other than neighbor nets.  In
  666.     the case where a gateway module is included in the local host
  667.     configuration, the GGP and/or EGP protocols will be used to
  668.     maintain these entries;  while, in the case where no gateway
  669.     module is included, only one such entry is required. 
  670.     
  671. OFFSET
  672.     This is a 16-bit signed integer temporary variable which
  673.     represents the offset in milliseconds to be added to the apparent
  674.     clock time to yield the apparent clock time of the neighbor host. 
  675.     
  676. 3.1.2.  Parameters
  677.  
  678. ADDRESS-OFFSET
  679.     This is an integer which represents the value of the Internet 
  680.     address field corresponding to the first host in HOST-TABLE.
  681.  
  682. DCN Local-Network Protocols                                        Page 13
  683. D.L. Mills
  684.  
  685. NHOSTS
  686.     This is an integer which defines the number of entries in HOST-TABLE.
  687.  
  688. NNETS
  689.     This is an integer which defines the number of entries in MET-TABLE.
  690.  
  691. 3.1.3.  HELLO Packet Fields
  692.  
  693. PKT.ADDRESS-OFFSET
  694.     This eight-bit is copied from ADDRESS-OFFSET by the sender.
  695.  
  696. PKT.DATESTAMP
  697.     Bits 0-14 of this 16-bit field are copied from DATE by the sender, 
  698.     while bit 15 is copied from DATE-VALID.
  699.  
  700. PKT.DATE-VALID
  701.     This one-bit field is bit 15 of PKT.DATESTAMP.
  702.  
  703. PKT.DESTINATION
  704.     This 32-bit field is part of the IP header.  It is copied from
  705.     HLO.NEIGHBOR-ADDRESS by the sender.
  706.  
  707. PKT.HOST-TABLE
  708.     This is a table of PKT.NHOSTS entries, each entry of which
  709.     consists of two fields.  The entries are indexed by host ID and
  710.     have the following format: 
  711.  
  712.     PKT.HOST-TABLE.DELAY
  713.         This 16-bit field is copied from the corresponding HOST-TABLE.DELAY
  714.         field by the sender.
  715.  
  716.     PKT.HOST-TABLE.OFFSET
  717.         This 16-bit field is copied from the corresponding HOST-TABLE.OFFSET
  718.         field by the sender.
  719.  
  720. PKT.LENGTH
  721.     This 16-bit field is part of the IP header.  It is set by the sender to
  722.     the number of octets in the packet.
  723.  
  724. PKT.NHOSTS
  725.     This eight-bit field is copied from NHOST by the sender.
  726.  
  727. PKT.SOURCE
  728.     This 16-bit field is part of the IP header.  It is copied from
  729.     LOCAL-ADDRESS by the sender.
  730.  
  731. PKT.TIMESTAMP
  732.     This 32-bit field contains the apparent time the packet was transmitted 
  733.     in milliseconds past midnight UT.
  734.  
  735.  
  736. DCN Local-Network Protocols                                        Page 14
  737. D.L. Mills
  738.  
  739.  
  740. PKT.TSP
  741.     This 16-bit field contains a variable used in roundtrip delay
  742.     calculations.
  743.  
  744. 3.2 CLOCK Process (CLK)
  745.  
  746.      The timekeeping system maintains three clocks: (1) the physical
  747. clock, which is determined by a hardware oscillator/counter; (2) the
  748. apparent clock, which maintains the time-of-day used by client
  749. processes and (3) the actual clock, which represents the time-of-day
  750. provided by an outside reference.  The apparent and actual clocks are
  751. maintained as 48-bit quantities with 32 bits of significance available
  752. to client processes.  These clocks run at a rate of 1000 Hz and are
  753. reset at midnight UT.
  754.  
  755.      The CLOCK process consists of a set of state variables along with
  756. a set of procedures that are called as the result of hardware
  757. interrupts and client requests.  An interval timer is assumed
  758. logically separate from the local clock mechanism, although both could
  759. be derived from the same timing source.
  760.  
  761. 3.2.1.  Local Variables
  762.  
  763. CLK.CLOCK
  764.     This is a 48-bit fixed-point state variable used to represent the
  765.     apparent time-of-day.  The decimal point is to the right of bit 16
  766.     (numbering from the right at bit 0).  Bit 16 increments at a rate
  767.     equivalent to 1000 Hz independent of the hardware clock.  (In the
  768.     case of programmable-clock hardware the value of CLK.CLOCK must be
  769.     corrected as described below.) 
  770.     
  771. CLK.COUNT
  772.     This is a hardware register that increments at rate R.  It can be
  773.     represented by a simple line clock, which causes interrupts at the
  774.     line-frequency rate, or by a programmable clock, which contains a 16-bit
  775.     register that is programmed to count at a 1000-Hz rate and causes an
  776.     interrupt on overflow.  The register is considered a fixed-point variable
  777.     with decimal point to the right of bit 0.
  778.  
  779. CLK.DELTA
  780.     This is a 48-bit signed fixed-point state variable used to represent the
  781.     increment to be added to CLK.CLOCK to yield the actual time-of-day.  The
  782.     decimal point is to the right of bit 16.
  783.  
  784. 3.2.3.  Parameters
  785.  
  786. ADJUST-FRACTION
  787.     This is an integer which defines the shift count used to compute a
  788.     fraction that is used as a multiplier of CLK.DELTA to correct CLK.CLOCK
  789.     once each clock-adjust interval.  A value of seven is suggested.
  790.     
  791.  
  792. DCN Local-Network Protocols                                        Page 15
  793. D.L. Mills
  794.  
  795.  
  796. ADJUST-INTERVAL
  797.     This is an integer which defines the clock-adjust interval in
  798.     milliseconds.  A value of 500 (one-half second) is suggested for
  799.     the line clock and 4000 (four seconds) for the 1000-Hz clock.
  800.  
  801. CLOCK-TICK
  802.     This is a fixed-point integer which defines the increment in
  803.     milliseconds to be added to CLK.CLOCK as the result of a clock
  804.     tick.  The decimal point is to the right of bit 16.  In the case
  805.     of a line-clock interrupt, the value of CLOCK-TICK should be
  806.     16.66666 (60 Hz) or 20.00000 (50 Hz).  In the case of a 1000-Hz
  807.     programmable-clock overflow, the value should be 65536.00000.
  808.     
  809. HOLD-INTERVAL
  810.     This is an integer which defines the number of seconds that HOLD will
  811.     count down after CLK.CLOCK has been reset.  The resulting interval must be
  812.     at least as long as the maximum HELLO-INTERVAL used by any HELLO process.
  813.  
  814. 3.2.3.  Events and Procedures
  815.  
  816. INCREMENT-CLOCK Event
  817.     This event is evoked as the result of a tick interrupt, in the case of a
  818.     line clock, or a counter overflow, in the case of the 1000-Hz clock.  It
  819.     causes the logical clock to be incremented by the value of CLOCK-TICK.
  820.  
  821.     1.  Add the value of CLOCK-TICK to CLK.CLOCK.
  822.  
  823. ADJUST-CLOCK Event
  824.     This event is evoked once every ADJUST-INTERVAL milliseconds to slew the
  825.     apparent clock time to the actual clock time as set by the SET-CLOCK
  826.     procedure.  This is done by subtracting a fraction of the correction
  827.     factor CLK.DELTA from the value of CLK.DELTA and adding the same fraction
  828.     to CLK.CLOCK.  This continues until either the next SET-CLOCK call or
  829.     CLK.DELTA has been reduced to zero.
  830.  
  831.     The suggested values for ADJUST-INTERVAL and ADJUST-FRACTION
  832.     represent a maximum slew rate of less than +-2 milliseconds per
  833.     second, in the case of 1000-Hz clock.  The action is to smooth
  834.     noisy clock corrections received from neighboring systems to
  835.     obtain a high-quality local reference, while insuring the apparent
  836.     clock time is always monotonically increasing. 
  837.     
  838.     1.  Shift the 48-bit value of CLK.DELTA arithmetically ADJUST-FRACTION
  839.         bits to the right, discarding bits from the right and saving the
  840.         result in a temporary variable F.  Assuming the decimal point of F to
  841.         be positioned to the right of bit 16 and sign-extending as necessary,
  842.         subtract F from CLK.DELTA and add F to CLK.CLOCK.
  843.  
  844.  
  845. DCN Local-Network Protocols                                        Page 16
  846. D.L. Mills
  847.  
  848. DECREMENT-HOLD Event
  849.     This event is evoked once per second to decrement the value of HOLD.
  850.  
  851.     1.  If the value of HOLD is zero, do nothing;  otherwise, decrement its
  852.         value.
  853.  
  854. READ-CLOCK Procedure
  855.  
  856.     This procedure is called by a client process.  It returns the apparent
  857.     time-of-day computed as the integer part of the sum CLK.CLOCK plus
  858.     CLK.COUNT.  Note that the precision of the value returned is limited to
  859.     +-1 millisecond, so that client processes must expect the apparent
  860.     time to "run backward" occasionally due to drift corrections.  When
  861.     this happens the backward step will never be greater than one
  862.     millisecond and will never occur more often than twice per second.
  863.     
  864.     1.  In the case of line clocks CLK.COUNT is always zero, while in
  865.         the case of programmable clocks the hardware must be
  866.         interrogated to extract the value of CLK.COUNT.  If following
  867.         interrogation a counter-overflow condition is evident, add
  868.         CLOCK-TICK to CLK.CLOCK and interrogate the hardware again.
  869.         
  870.     2.  When the value of CLK.COUNT has been determined compute the sum
  871.         CLK.COUNT + CLK.CLOCK.  If this sum exceeds the number of
  872.         milliseconds in 24 hours (86,400,000), reduce CLK.CLOCK by
  873.         86,400,000, set HOLD-INTERVAL -> HOLD, set CLOCK-VALID (bit 15
  874.         of DATE) to one, roll over DATE to the next calendar day and
  875.         start over.  If not, return the integer part of the sum as the
  876.         apparent time-of-day. 
  877.         
  878.         The CLOCK-VALID bit is set to insure that a master-clock update is
  879.         received at least once per day.  Note that, in the case of
  880.         uncompensated crystal oscillators of the type commonly used as the
  881.         1000-Hz time base, a drift of several parts per million can be
  882.         expected, which would result in a time drift of several tenths of a
  883.         second per day, if not corrected.
  884.  
  885. SET-CLOCK Procedure
  886.     This procedure is called by a client process.  It sets a time-of-day
  887.     correction factor in milliseconds.  The argument represents a 32-bit
  888.     signed fixed-point quantity with decimal point to the right of bit
  889.     0 that is to be added to CLK.CLOCK so that READ-CLOCK subsequently
  890.     returns the actual time-of-day.  
  891.     
  892.     1.  If the correction factor is in the range -2**(16-ADJUST-FRACTION) to
  893.         +2**(16-ADJUST-FRACTION) - 1 (about +-128 milliseconds with the
  894.         suggested value of ADJUST-FRACTION), the value of the argument
  895.         replaces CLK.DELTA and the procedure is complete.  If not, add the
  896.         value of the sign-extended argument to CLK.CLOCK and set CLK.DELTA to
  897.         zero.  In addition, set HOLD-INTERVAL -> HOLD, since this
  898.         represents a relatively large step-change in apparent time.
  899.         The value of HOLD represents the remaining number of seconds
  900.         in which timestamps should be considered invalid and is used
  901.         by the HELLO process to suppress roundtrip delay calculations
  902.         which might involve invalid timestamps. 
  903.  
  904. DCN Local-Network Protocols                                        Page 17
  905. D.L. Mills
  906.  
  907.         
  908.  
  909. 3.3.  HELLO Process
  910.  
  911.      The HELLO process maintains clock synchronization with a neighbor
  912. HELLO process using the HELLO protocol.  It also participates in the
  913. routing algorithm.  There is one HELLO process and one set of local
  914. state variables for each link connecting the host to one of its
  915. neighbors.
  916.  
  917. 3.3.1.  Local variables
  918.  
  919. HLO.BROADCAST
  920.     This is a one-bit switch state variable.  When set to zero a
  921.     point-to-point link is assumed.  When set to one a broadcast (e.g.
  922.     Ethernet) link is assumed.
  923.  
  924. HLO.KEEP-ALIVE
  925.     This is an eight-bit counter state variable used to indicate whether the
  926.     link is up.  It is initialized with a value of zero.
  927.  
  928. HLO.LENGTH
  929.     This is a 16-bit integer state variable used to record the length in
  930.     octets of the last HELLO message sent.
  931.  
  932. HLO.NEIGHBOR-ADDRESS
  933.     This is a 32-bit integer state variable used to contain the neighbor host
  934.     Internet address.
  935.  
  936. HLO.PID
  937.     This is an eight-bit integer state variable used to identify the
  938.     net-output process associated with this HELLO process.  It is initialized
  939.     by the kernel when the process is created and remains unchanged
  940.     thereafter.
  941.  
  942. HLO.POLL
  943.     This is a one-bit switch state variable.  When set the HELLO process
  944.     spontaneously sends HELLO messages.  When not set the HELLO process
  945.     responds to HELLO messages, but does not send them spontaneously.
  946.  
  947. HLO.TIMESTAMP
  948.     This is a 32-bit integer temporary variable used to record the time of
  949.     arrival of a HELLO message.
  950.  
  951. HLO.TSP
  952.     This is a 16-bit signed integer state variable used in roundtrip delay
  953.     calculations.
  954.  
  955.  
  956. DCN Local-Network Protocols                                        Page 18
  957. D.L. Mills
  958.  
  959.  
  960. 3.3.2.  Parameters
  961.  
  962. HELLO-INTERVAL
  963.     This is an integer which defines the interval in seconds between HELLO
  964.     messages.  It ranges from about eight to a maximum of 30 seconds,
  965.     depending on line speed.
  966.  
  967. HOLD-DOWN-INTERVAL
  968.     This is an integer which defines the interval in seconds a host will be
  969.     considered up following receipt of a HELLO message indicating that
  970.     host is up.  A value of 120 is suggested.
  971.     
  972. KEEP-ALIVE-INTERVAL
  973.     This is an integer which defines the interval, in units of
  974.     HELLO-INTERVAL, that a HELLO process will consider the link up.  A
  975.     value of four is suggested.
  976.     
  977. MAXDELAY
  978.     This is an integer which defines the maximum roundtrip delay in
  979.     seconds on a path to any reachable host.  A value of 30 is suggested.
  980.     
  981. MINDELAY
  982.     This is an integer which defines the minimum switching threshold in
  983.     milliseconds below which routes will not be changed.  A value of 100 is
  984.     suggested.
  985.  
  986. 3.3.3.  Events and Procedures
  987.  
  988. INPUT-PACKET Event
  989.     When a packet arrives the net-input process first sets HLO.TIMESTAMP to
  990.     the value returned by the READ-CLOCK procedure, then checks the
  991.     packet for valid local leader, IP header format and checksum.  If
  992.     the protocol field in the IP header indicates a HELLO message, the
  993.     packet is passed to the HELLO process.  If any errors are found
  994.     the packet is dropped. 
  995.     
  996.     The HELLO process first checks the packet for valid HELLO header format
  997.     and checksum.  If any errors are found the packet is dropped.  Otherwise,
  998.     it proceeds as follows:
  999.  
  1000.     1.  If PKT.SOURCE is equal to LOCAL-ADDRESS, then the line to the
  1001.         neighbor host is looped.  If this is a broadcast link
  1002.         (HLO.BROADCAST is set to one), then ignore this nicety;  if
  1003.         not, this is considered an error and further processing is
  1004.         abandoned.  Note that, in special configurations involving
  1005.         other systems (e.g.  ARPANET IMPs and gateways) it may be
  1006.         useful to use looped HELLO to monitor connectivity.  The DCN
  1007.         implementation provides this feature, but is not described here.
  1008.         
  1009.     2.  Set KEEP-ALIVE-INTERVAL -> HLO.KEEP-ALIVE.  This indicates the
  1010.         maximum number of HELLO intervals the HLO.TSP field is
  1011.         considered valid. 
  1012.  
  1013.  
  1014. DCN Local-Network Protocols                                        Page 19
  1015. D.L. Mills
  1016.  
  1017.  
  1018.     3.  Set PKT.TIMESTAMP - HLO.TIMESTAMP -> HLO.TSP.  This is part of the
  1019.         roundtrip delay calculation.  The value of HLO.TSP will be
  1020.         updated and returned to the neighbor in the next HELLO message
  1021.         transmitted.  Next, compute the raw roundtrip delay and offset:
  1022.         HLO.TIMESTAMP - PKT.TSP -> DELAY and HLO.TSP + DELAY/2 -> OFFSET. 
  1023.         Note:  in the case of a broadcast link (HLO.BROADCAST set to one) set
  1024.         DELAY to zero.
  1025.  
  1026.     4.  Perform this step only in the case of non-broadcast links
  1027.         (HLO.BROADCAST set to zero).  If PKT.SOURCE is not equal to
  1028.         HLO.NEIGHBOR-ADDRESS, then a new neighbor has appeared on this
  1029.         link. Set PKT.SOURCE -> HLO.NEIGHBOR ADDRESS, MAXDELAY ->
  1030.         DELAY and proceed to the next step.  This will force the line
  1031.         to be declared down and result in a hold-down cycle.
  1032.         Otherwise, if either PKT.TSP is zero or HOLD is nonzero, then
  1033.         the DELAY calculation is invalid and further processing is
  1034.         abandoned.  Note that a hold-down cycle is forced in any 
  1035.         case if a new neighbor is recognized.
  1036.  
  1037.     5.  If processing reaches this point the DELAY and OFFSET
  1038.         variables can be assumed valid as well as the remaining data
  1039.         in the packet.  First, if DELAY < MINDELAY, set MINDELAY ->
  1040.         DELAY.  This avoids needless path switching when the
  1041.         difference in delays is not significant and has the effect
  1042.         that on low-delay links the routing algorithm degenerates to 
  1043.         min-hop rather than min-delay.  Then set HLO.PID -> PID.  There are
  1044.         two cases:
  1045.  
  1046.         Case 1:  PKT.NHOSTS is zero.
  1047.             This will be the case when the neighbor host has just come up or
  1048.             is on a different net or subnet.  Set NEIGHBOR-ADDRESS -> ADDRESS
  1049.             and call the ROUTE procedure, which will return the host
  1050.             ID.  Then call the UPDATE procedure.  In the case of
  1051.             errors, do nothing but return.
  1052.             
  1053.         Case 2:  PKT.NHOSTS is nonzero.
  1054.             This is the case when the neighbor host is on the same net or
  1055.             subnet.  First, save the values of DELAY and OFFSET in temporary
  1056.             variables F and G.  Then, for each value of HID from zero to
  1057.             NHOSTS-1 consider the corresponding PKT.HOSTS-TABLE entry and do
  1058.             the following:  Set F + PKT.HOST-TABLE.DELAY -> DELAY and
  1059.             G + PKT.HOST-TABLE.OFFSET -> OFFSET and call the UPDATE procedure.
  1060.             This completes processing.
  1061.  
  1062.         ROUTE Procedure
  1063.             This procedure returns the host ID in HID of the host represented
  1064.             by the global variable ADDRESS.
  1065.  
  1066.     1.  First, determine if the host represented by ADDRESS is on the same
  1067.         local net as LOCAL-ADDRESS.  For the purposes of this
  1068.         comparison bits 0-7 and 16-31 are compared for class-A nets
  1069.         and bits 8-31 are compared for class-B and class-C nets.  This
  1070.         provides for a subnet capability, where the bits 0-7 and 16-23
  1071.         (class-A) or 8-15 (class-B) are used as a subnet number.
  1072.  
  1073. DCN Local-Network Protocols                                        Page 20
  1074. D.L. Mills
  1075.  
  1076.         
  1077.         Case 1:  The host is on the same net or subnet.
  1078.             Extract the address field of ADDRESS, subtract ADDRESS-OFFSET and
  1079.             store the result in HID.  If 0 <= HID < NHOSTS, the procedure
  1080.             completes normally;  otherwise it terminates in an error
  1081.             condition.
  1082.  
  1083.         Case 2:  The host is not on the same net or subnet.
  1084.             Search the NET-TABLE for a match of the net fields of
  1085.             LOCAL-ADDRESS and NET-TABLE.NET.  If found set
  1086.             NET-TABLE.HID -> HID and return normally.  If the NET-TABLE.NET
  1087.             field is zero, indicating the last entry in the table, set
  1088.             HET-TABLE.HID -> HID and return normally.  Note that, in the case
  1089.             of hosts including GGP/EGP gateway modules, if no match is found
  1090.             the procedure terminates in an error condition.
  1091.  
  1092. UPDATE Procedure
  1093.     This procedure updates the entry of HOST-TABLE indicated by HID using
  1094.     three global variables:  DELAY, OFFSET and PID.  Its purpose is to update
  1095.     the HOST-TABLE entry corresponding to host ID HID.  In the following all
  1096.     references are to this entry.
  1097.  
  1098.     1.  If PID is not equal to HOST-TABLE.PID, the route to host HID is not
  1099.         via the net-output process associated with this HELLO process.  In
  1100.         this case, if DELAY + MINDELAY > HOST-TABLE.DELAY, the path is longer
  1101.         than one already in HOST-TABLE, so the procedure does nothing.
  1102.  
  1103.     2.  This step is reached only if either the route to host HID is via the
  1104.         net-output process associated with this HELLO process or the newly
  1105.         reported path to this host is shorter by at least MINDELAY.  
  1106.         There are two cases:
  1107.  
  1108.         Case 1:  HOST-TABLE.DELAY < MAXDELAY.
  1109.             The existing path to host HID is up and this is a point-to-point
  1110.             link (HLO.BROADCAST is set to zero).  If DELAY < MAXDELAY the
  1111.             newly reported path is also up.  Proceed to the next step.
  1112.             Otherwise, initiate a hold-down cycle by setting
  1113.             MAXDELAY -> HOST-TABLE.DELAY and
  1114.             HOLD-DOWN-INTERVAL -> HOST-TABLE.TTL and return.
  1115.  
  1116.         Case 2:  HOST-TABLE.DELAY >= MAXDELAY.
  1117.             The existing path to host HID is down.  If DELAY < MAXDELAY and
  1118.             HOST-TABLE.TTL is zero, the hold-down period has expired and the
  1119.             newly reported path has just come up.  Proceed to the next step.
  1120.             Otherwise simply return.
  1121.  
  1122.     3.  In this step the HOST-DELAY entry is updated.  Set
  1123.         DELAY -> HOST-TABLE.DELAY, HOLD-DOWN-INTERVAL -> HOST-TABLE.TTL and
  1124.         HLO.PID -> HOST-TABLE.PID.
  1125.  
  1126.  
  1127. DCN Local-Network Protocols                                        Page 21
  1128. D.L. Mills
  1129.  
  1130.  
  1131.     4.  For precise timekeeping, the offset can be considered valid only if
  1132.         the length of the last HELLO packet transmitted is equal to
  1133.         the length of the last one received.  Thus, if HLO.LENGTH
  1134.         equal to PKT.LENGTH, set OFFSET -> HOST-TABLE.OFFSET;
  1135.         otherwise, leave this field alone. Finally, if HID is equal to
  1136.         CLOCK-HID and bit 15 (the DATE-VALID bit) 
  1137.         of DATE is zero, set PKT.DATESTAMP -> DATE and call the SET-CLOCK
  1138.         procedure of the CLOCK process with argument HLO.TIMESTAMP.
  1139.  
  1140. OUTPUT-PACKET Event
  1141.     This event is evoked once every HELLO-INTERVAL seconds.  It determines if
  1142.     a HELLO message is to be transmitted, transmits it and updates state
  1143.     variables.
  1144.  
  1145.     1.  If HLO.KEEP-ALIVE is nonzero decrement its value.
  1146.  
  1147.     2.  If HLO.POLL is zero and HLO.KEEP-ALIVE is zero, do not send a HELLO
  1148.         message.  If either is nonzero initialize the packet fields as
  1149.         follows:  LOCAL-ADDRESS -> PKT.SOURCE,
  1150.         HLO.NEIGHBOR-ADDRESS -> PKT.DESTINATION and DATE -> PKT.DATESTAMP.
  1151.         Note:  PKT.DESTINATION is set to zero if this is a broadcast link
  1152.         (HLO.BROADCAST set to one).  Also, note that bit 15 of DATE is the
  1153.         DATE-VALID bit.  If this bit is one the receiver will not update its
  1154.         master clock from the information in the transmitted packet.
  1155.         This is significant only if the sending host is on the
  1156.         least-delay path to the master clock.  Set PKT.TIMESTAMP to
  1157.         the value returned from the READ-CLOCK procedure.  If
  1158.         HLO.KEEP-ALIVE is zero or HOLD is nonzero, set PKT.TSP to
  1159.         zero;  otherwise, set PKT.TIMESTAMP + HLO.TSP -> PKT.TSP.
  1160.         
  1161.     3.  Determine if the neighbor is on the same net or subnet.  If the
  1162.         neighbor is on a different net set PKT.NHOSTS to zero and
  1163.         proceed with the next step.  Otherwise, set NHOSTS ->
  1164.         PKT.NHOSTS and for each value of HID from zero to PKT.HOSTS-1
  1165.         copy the HOST-TABLE.DELAY and HOST-TABLE.OFFSET fields of the
  1166.         corresponding HOST-TABLE entry in order into the packet.  For
  1167.         each entry copied test if the HOST-TABLE.PID field matches the
  1168.         HLO.PID of the HELLO process.  If so, a potential routing loop
  1169.         is possible.  In this case use MAXDELAY for the delay field in
  1170.         the packet instead. 
  1171.         
  1172.     4.  Finally, set HLO.LENGTH to the number of octets in the packet 
  1173.         and send the packet.
  1174.  
  1175. 3.4.  HOST Process (HOS)
  1176.  
  1177.      This process maintains the routing tables.  It is activated once per
  1178. second to scan HOST-TABLE and decrement the HOST-TABLE.TTL field of each
  1179. entry.  It also performs housekeeping functions.
  1180.  
  1181.  
  1182. DCN Local-Network Protocols                                        Page 22
  1183. D.L. Mills
  1184.  
  1185.  
  1186. 3.4.1.  Local variables
  1187.  
  1188. HOS.PID
  1189.     This is an eight-bit integer used to identify the HOST process.  It is
  1190.     initialized by the kernel when the process is created and remains
  1191.     unchanged thereafter.
  1192.  
  1193. HOS.HID
  1194.     This is an eight-bit temporary variable.
  1195.  
  1196. 3.4.2.  Events and Procedures
  1197.  
  1198. SCAN Event
  1199.     This event is evoked once each second to scan the HOST-TABLE and perform
  1200.     housekeeping functions.
  1201.  
  1202.     1.  For each value of a temporary variable F from zero to NHOSTS-1 do the
  1203.         following:  Set LOCAL-ADDRESS -> ADDRESS and call the ROUTE
  1204.         procedure, which will return the host ID HID.  If F is equal
  1205.         to HID, then set both DELAY and OFFSET to zero, HOS.PID -> PID
  1206.         and call the UPDATE procedure.  This will cause all packets
  1207.         received with the local address to be routed to this process.
  1208.         
  1209.         If HOST-TABLE.TTL is zero skip this step.  Otherwise, decrement
  1210.         HOST-TABLE.TTL by one.  If the result is nonzero skip the
  1211.         remainder of this step.  Otherwise, If HOST-TABLE.DELAY <MAXDELAY set
  1212.         HOLDOFF-INTERVAL -> HOST-TABLE.TTL and MAXDELAY -> HOST-TABLE.DELAY.
  1213.         The effect of this step is to declare a hold-down cycle when a host
  1214.         goes down.
  1215.  
  1216. 4.  References
  1217.  
  1218. 1.  Mills, D.L.  Final Report on Internet Research, ARPA Packet Switching
  1219.     Program.  Technical Report TSLAB 82-7, COMSAT Laboratories, 
  1220.     December 1982.
  1221.  
  1222. DCN Local-Network Protocols                                        Page 23
  1223. D.L. Mills
  1224.  
  1225.  
  1226. Appendix A.  Link-Level Packet Formats
  1227.  
  1228. A.1.  Serial Links Using Program-Interrupt Interfaces
  1229.  
  1230.      Following is a description of the frame format used on
  1231. asynchronous and synchronous serial links with program-interrupt
  1232. interfaces such as the DEC DLV11 and DPV11.  This format provides
  1233. transparency coding for all messages, including HELLO messages, but
  1234. does not provide error detection or retransmission functions.  It is
  1235. designed to be easily implemented and compatible as far as possible
  1236. with standard industry protocols.
  1237.  
  1238.      The protocol is serial-by-bit, with the same interpretation on
  1239. the order of transmission as standard asynchronous and synchronous
  1240. interface devices; that is, the low-order bit of each octet is
  1241. transmitted first.  The data portion of the frame consists of one
  1242. Internet datagram encoded according to a "character-stuffing"
  1243. transparency convention:
  1244.  
  1245. 1.  The frame begins with the two-octet sequence DLE-STX, in the case of
  1246.     asynchronous links, or the four-octet sequence SYN-SYN-DLE-STX, in the
  1247.     case of synchronous links.  The data portion is transmitted next,
  1248.     encoded as described below, followed by the two-octet sequence
  1249.     DLE-ETX.  No checksum is transmitted or expected.  If it is
  1250.     necessary for any reason to transmit time-fill other than in the
  1251.     data portion, the DEL (all ones) is used.
  1252.     
  1253. 2.  Within the data portion of the frame the transmit buffer is
  1254.     scanned for a DLE.  Each DLE found causes the sequence DLE-DLE to
  1255.     be transmitted.  If it is necessary for some reason for the
  1256.     transmitter to insert time-fill within the data portion, the
  1257.     sequence DLE-DEL is used. 
  1258.     
  1259. 3.  While scanning the data stream within the data portion of the
  1260.     frame the sequence DLE-DLE is found, a single DLE is inserted in
  1261.     the receive buffer.  If the sequence DLE-ETX is found, the buffer
  1262.     is passed on for processing. The sequence DLE-DEL is discarded.
  1263.     Any other two-octet sequence beginning with DLE and ending with
  1264.     other than DLE, ETX or DEL is considered a protocol error 
  1265.     (see note below). 
  1266.     
  1267.      Note: In the case of synchronous links using program-interrupt
  1268. interfaces such as the DPV11, for example, a slightly modified
  1269. protocol is suggested when both ends of the link concur.  These
  1270. interfaces typically provide a parameter register which can be loaded
  1271. with a code used both to detect the receiver synchronizing pattern and
  1272. for time-fill when the transmit buffer register cannot be serviced in
  1273. time for the next character.
  1274.  
  1275.      The parameter register must be loaded with the SYN code for this
  1276. protocol to work properly.  However, should it be necessary to
  1277. transmit time-fill, a single SYN will be transmitted, rather than the
  1278. DLE-DEL sequence specified.  Disruptions due to these events can be
  1279. minimized by use of the following rules:
  1280.  
  1281. DCN Local-Network Protocols                                        Page 24
  1282. D.L. Mills
  1283.  
  1284.  
  1285. 1.  If the transmitter senses a time-fill condition (usually by a
  1286.     control bit assigned for this purpose) between frames or
  1287.     immediately following transmission of a DLE, the condition is ignored.
  1288.     
  1289. 2.  If the transmitter senses a time-fill condition at other times it sends
  1290.     the sequence DLE-CAN.
  1291.  
  1292. 3.  If the receiver finds a SYN either between frames or immediately
  1293.     following DLE, the SYN is discarded without affecting sequence
  1294.     decoding. 
  1295.  
  1296. 4.  If the receiver finds the sequence DLE-CAN in the data portion, it
  1297.     discards the sequence and the immediately preceding octet.
  1298.  
  1299.      These rules will work in cases where a single SYN has been
  1300. inserted by the transmitter and even when a SYN has been inserted in
  1301. the DLE-CAN sequence.  If an overrun (lost data) condition is sensed
  1302. at the receiver, the appropriate action is to return to the
  1303. initial-synchronization state.  This should also be the action if any
  1304. code other than STX is found following the initial DLE.  or if any
  1305. code other than DLE, ETX, DEL or CAN is found following a DLE in the
  1306. data portion.
  1307.  
  1308. A.2.  Serial Links Using DDCMP Devices
  1309.  
  1310.      Following is a description of the frame format used on DEC DDCMP links
  1311. with DMA interfaces such as the DEC DMV11 and DMR11.  These interfaces
  1312. implement the DEC DDCMP protocol, which includes error detection and
  1313. retransmission capabilities.  The DDCMP frame format is as follows:
  1314.  
  1315. +-------------+-----+-----+-----+-----+-----+------+------+------+
  1316. | SYN SYN SOH |Count|Flag |Resp | Seq | Adr | CRC1 | Data | CRC2 |
  1317. +-------------+-----+-----+-----+-----+-----+------+------+------+
  1318. bits   24       14     2     8     8     8     16     ...    16
  1319.  
  1320. With respect to this diagram, each octet is transmitted starting from the
  1321. leftmost octet, with the bits of each octet transmitted low-order bit first.
  1322. The contents of all fields except the "Data" field are managed by the
  1323. interface.  The Internet datagram is placed in this field as-is, with no
  1324. character or bit stuffing (the extent of this field is indicated by the
  1325. interface in the "Count" field.
  1326.  
  1327. A.3.  Serial Links Using HDLC Devices
  1328.  
  1329.      Following is a description of the frame format used on HDLC links with
  1330. program-interrupt interfaces such as the DEC DPV11.
  1331.  
  1332.         +--------+--------+--------+--------+--------+--------+
  1333.         |  Flag  |  Addr  |  Ctrl  |  Data  |  CRC   |  Flag  |
  1334.         +--------+--------+--------+--------+--------+--------+
  1335. coding   01111110 00000000 00000000 xxxxxxxx cccccccc 01111110
  1336.  
  1337.  
  1338. DCN Local-Network Protocols                                        Page 25
  1339. D.L. Mills
  1340.  
  1341.  
  1342. With respect to this diagram, each octet is transmitted starting from
  1343. the leftmost octet, with the bits of each octet transmitted low-order
  1344. bit first.  The code xxxxxxxx represents the data portion and cccccccc
  1345. represents the checksum.  The bits between the "Flag" fields are
  1346. encoded with a bit-stuffing convention in which a zero bit is stuffed
  1347. following a string of five one bits.  The "Addr" and "Ctrl" fields are
  1348. not used and the checksum is ignored.  The Internet datagram is placed
  1349. in the "Data" field, which must be a multiple of eight bits in length.
  1350.  
  1351. A.4.  ARPANET 1822 Links Using Local or Distant Host Interfaces
  1352.  
  1353.      Following is a description of the frame format used with ARPANET
  1354. 1822 Local or Distant Host interfaces.  These interfaces can be used
  1355. to connect a DCN host to an ARPANET IMP, Gateway or Port Expander or
  1356. to connect two DCN hosts together.  When used to connect a DCN host to
  1357. an ARPANET IMP, Gateway or Port Expander, a 96-bit 1822 leader is
  1358. prepended ahead of the Internet datagram.  The coding of this leader
  1359. is as described in BBN Report 1822.  When used to connect two DCN
  1360. hosts together, no leader is used and the frame contains only the
  1361. Internet datagram.
  1362.  
  1363. A.5.  ARPANET 1822 Links Using HDH Interfaces
  1364.  
  1365.      Following is a description of the frame format used with ARPANET
  1366. 1822 HDH interfaces.  These interfaces can be used to connect a DCN
  1367. host to an ARPANET IMP or Gateway or to connect two DCN hosts
  1368. together.  In either case, the frame format is as described in
  1369. Appendix J of BBN Report 1822.
  1370.  
  1371. A.6.  X.25 LAPB Links Using RSRE Interfaces
  1372.  
  1373.      Following is a description of the frame format used on X.25 LAPB
  1374. links with the Royal Signals and Radar Establishment interfaces.
  1375. These interfaces implement the X.25 Link Access Protocol - Balanced
  1376. (LAPB), also known as the frame-level protocol, using a frame format
  1377. similar to that described under A.3 above.  Internet datagrams are
  1378. placed in the data portion of I frames and encoded with the
  1379. bit-stuffing procedure described in A.3.  There is no packet-level
  1380. format used with these interfaces.
  1381.  
  1382. A.7.  Ethernet Links
  1383.  
  1384.      Following is a description of the frame format used on Ethernet links.
  1385.  
  1386.         +-----------+-----------+------+------+-----+
  1387.         | Dest Addr | Srce Addr | Type | Data | CRC |
  1388.         +-----------+-----------+------+------+-----+
  1389. bits          48          48       16     ...   32
  1390.  
  1391. With respect to this diagram, each field is transmitted starting from
  1392. the leftmost field, with the bits of each field transmitted low-order
  1393. bit first.  The "Dest Addr" and "Srce Addr" contain 48-bit Ethernet
  1394. addresses, while the "Type" field contains the assigned value for IP
  1395. datagrams (0800 hex) or for
  1396.  
  1397. DCN Local-Network Protocols                                        Page 26
  1398. D.L. Mills
  1399.  
  1400.  
  1401. ARP datagrams (0806 hex).  The Internet datagram is placed in the
  1402. "Data" field and followed by the 32-bit checksum.  The Address
  1403. Resolution Protocol (ARP) is used to establish the mapping between
  1404. Ethernet address and Internet addresses.
  1405.