sp-udp-mapping-01.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <?xml version="1.0" encoding="US-ASCII"?>
  2. <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
  3. <rfc category="info" docName="sp-udp-mapping-01">
  4. <front>
  5. <title abbrev="UDP mapping for SPs">
  6. UDP Mapping for Scalability Protocols
  7. </title>
  8. <author fullname="Garrett D'Amore" initials="G." role="editor"
  9. surname="D'Amore">
  10. <address>
  11. <email>garrett@damore.org</email>
  12. </address>
  13. </author>
  14. <author fullname="Martin Sustrik" initials="M."
  15. surname="Sustrik">
  16. <address>
  17. <email>sustrik@250bpm.com</email>
  18. </address>
  19. </author>
  20. <date month="October" year="2016" />
  21. <area>Applications</area>
  22. <workgroup>Internet Engineering Task Force</workgroup>
  23. <keyword>UDP</keyword>
  24. <keyword>SP</keyword>
  25. <abstract>
  26. <t>This document defines the UDP mapping for scalability protocols.</t>
  27. </abstract>
  28. </front>
  29. <middle>
  30. <section title = "Underlying protocol">
  31. <t>This mapping should be layered directly on the top of UDP.</t>
  32. <t>There's no fixed UDP port to use for the communication. Instead, port
  33. numbers are assigned to individual services by the user.</t>
  34. </section>
  35. <section title = "Message delimitation">
  36. <t>Each UDP packet maps to exactly one SP message.</t>
  37. <t>There is no way to split one SP message into multiple UDP packets
  38. and therefore SP messages larger than existing path MTU will be
  39. dropped silently.</t>
  40. <t>There is also no way to pack multiple SP messages into a single
  41. UDP packet.</t>
  42. </section>
  43. <section title = "Packet layout">
  44. <t>Each packet consists of an 8-byte header followed by the opaque
  45. message payload:</t>
  46. <figure>
  47. <artwork>
  48. 0 1 2 3
  49. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  50. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  51. | 0x00 | 0x53 | 0x50 | opcode |
  52. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  53. | type | reserved |
  54. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  55. | payload ...
  56. +-+-+-+-+-+-+-+-+-+-+-+-+-
  57. </artwork>
  58. </figure>
  59. <t>The first three bytes of the protocol header are used to make sure that
  60. the peer's protocol is compatible with the protocol used by the local
  61. endpoint. Keep in mind that this protocol is designed to run on an
  62. arbitrary UDP port, thus the standard compatibility check -- if it runs
  63. on port X and protocol Y is assigned to X by IANA, it speaks protocol Y
  64. -- does not apply. We have to use an alternative mechanism.</t>
  65. <t>The first three bytes of the protocol header MUST be set to 0x00,
  66. 0x53 and 0x50. If the protocol header received from the peer
  67. differs, the UDP packet MUST be ignored.</t>
  68. <t>The fact that the first byte of the protocol header is binary zero
  69. eliminates any text-based protocols that were accidentally sending
  70. to the endpoint. Subsequent two bytes make the check even more
  71. rigorous. At the same time they can be used as a debugging hint to
  72. indicate that the connection is supposed to use one of the scalability
  73. protocols -- ASCII representation of these bytes is 'SP' that can
  74. be easily spotted in when capturing the network traffic.</t>
  75. <section title="Opcode">
  76. <t>The fourth byte is an operation code (opcode), which
  77. is used to indicate a transport-specific type of operation. The
  78. following operations are defined:
  79. <list>
  80. <t>0x00 -- DATA: The packet carries SP payload data.</t>
  81. <t>0x01 -- CREQ: The packet requests (initiates) a logical connection.</t>
  82. <t>0x02 -- CACK: The packet confirms creation of a logical connection.</t>
  83. <t>0x03 -- DISC: The packet terminates a logical connection.</t>
  84. </list>
  85. </t>
  86. <t>It is intended that if the protocol must be revised, that
  87. additional op codes can be assigned, obviating the need for an
  88. explicit version field.</t>
  89. <t>These operation codes are used in the mangement of logical connections,
  90. and are described in more detail in the Logical Connections section
  91. below.</t>
  92. </section>
  93. <section title="SP Type">
  94. <t>The fifth and sixth bytes of the header
  95. form a 16-bit unsigned integer
  96. in network byte order representing the type of SP endpoint on the layer
  97. above. The value SHOULD NOT be interpreted by the mapping, rather
  98. the interpretation should be delegated to the scalability protocol
  99. above the mapping. For informational purposes, it should be noted that
  100. the field encodes information such as SP protocol ID, protocol version
  101. and the role of endpoint within the protocol. Individual values are
  102. assigned by IANA.</t>
  103. </section>
  104. <section title="Reserved Field">
  105. <t>Finally, the last two bytes of the protocol header are reserved for
  106. future use and must be set to binary zeroes. If the protocol header
  107. from the peer contains anything else than zeroes in this field, the
  108. implementation MUST ignore the UDP packet.</t>
  109. </section>
  110. <section title="Payload">
  111. <t>The packet header is followed by the opaque message payload
  112. which spans all the way to the end of the packet. The payload contents
  113. are the SP message content itself, except in the case of DISC
  114. messages.</t>
  115. </section>
  116. </section>
  117. <section title="Unicast Only">
  118. <t>This mapping operates only over Unicast UDP. Messages with
  119. source or destination addresses that are not unicast MUST be
  120. discarded.</t>
  121. <t>Furthermore, there is an assumption that bidirectional
  122. communication is possible. Various SP protocols have this
  123. requirement anyway.</t>
  124. </section>
  125. <section title="Logical Connections">
  126. <t>This mapping of the SP protocols is layered on top of a
  127. connectionless transport layer. However the SP protocols require
  128. use of logical connections in order to pass "connection IDs" in some
  129. of the fields (such as the backtrace information used for the
  130. Request/Reply Scalability Protocol.</t>
  131. <t>Hence it is desirable to create logical connections, and to be able
  132. to ensure that the connections are kept active either by monitoring
  133. activity passively, or by active probing. It is also desirable for
  134. a peer to be able to indicate that it's partner may release resources
  135. used for tracking the connection.</t>
  136. <t>The logical connection itself is still best-effort only,
  137. and packets may be corrupted, lost, or reordered. The packets are
  138. also subject to inspecion, modification, and replay, if the
  139. underlying IP transport is not secured.</t>
  140. <section title="Connection roles">
  141. <t>As with other transports like TCP, we intentionally create the
  142. notion of a connection initiator, and a connection accepter.
  143. The initator is always the party who initiates the connection,
  144. and is the party responsible for sending CREQ messages. The
  145. accepter is the party that receives the CREQ messages, and
  146. replies with CACK (or possibly DISC).</t>
  147. <t>The role of initiator and accepter do not change during the
  148. course of a single logical connection.</t>
  149. </section>
  150. <section title="Keeping the Connection Alive">
  151. <t>In order to keep session state, implementations will generally
  152. store data for each session. In order to prevent a stale session
  153. from consuming these resources forever, and in order to keep
  154. any intervening state active (e.g. NAT rules), a CACK message may be
  155. sent at any time by the initator.</t>
  156. <t>In the event of an error, the accepter MAY reply with an
  157. DISC message. Otherwise it MUST reply with a CREQ message.</t>
  158. <t>An accepter MUST NOT send a CACK message.</t>
  159. <t>The initiator MUST send CREQ messages every T1 seconds.</t>
  160. <t>An accepter that has not received a CREQ message for at least T2
  161. seconds, or an initiator that has not received a CACK message for
  162. at least T2 seconds, SHOULD assume the connection has failed, and
  163. and may discard any state associated with the logical connection.</t>
  164. <t>It is recommended that T1 and T2 be configurable, with
  165. recommended default values of 30 and 300. This means that sessions
  166. that go inexplicably silent for 5 minutes will be closed, and their
  167. resources reclaimed.</t>
  168. <t>Note that values for T1 and T2 must match on both initiator
  169. and accepter for correct operation. Failure to do so will likely
  170. result in permature connection termination.</t>
  171. </section>
  172. </section>
  173. <section title="Message Types">
  174. <section title="DATA messages">
  175. <t>DATA messages (opcode 0x00) are used on an established logical,
  176. connection and, and carry SP messages. The payload part of the
  177. message is the SP payload. Data messages are unacknowledged.</t>
  178. <t>A DATA message that is received by a party which does not have
  179. a corresponding logical connection set up SHOULD be replied to
  180. with a DISC message, using error code 0x04 (not connected).</t>
  181. <t>DATA messages may only be sent on an active connection, and
  182. may be sent at any time by either party.</t>
  183. </section>
  184. <section title="CREQ messages">
  185. <t>CREQ messages are used to establish a logical connection. The
  186. initiator sends a CREQ message to the listener. On success, the
  187. accepter will record the full UDP source and destination addresses
  188. (including IP addresses and port numbers),
  189. creating a local entry in a list of logical connections.
  190. </t>
  191. <t>If this
  192. is successful, the accepter MUST respond with an CACK message.
  193. Otherwise it SHOULD respond with an appropriately formed DISC
  194. message. CREQ messages have no payload. A CREQ message may be
  195. sent at any time, and is idempotent. (If the receiver of a CREQ
  196. already has the logical connection established, it need simply
  197. reply with the CACK.</t>
  198. </section>
  199. <section title="CACK messages">
  200. <t>CACK messages are sent in response to a CREQ, when the connection
  201. is either already established, or after a new connection is
  202. established. As noted above, CREQ is meant to be idempotent, and
  203. indeed may be sent periodically to keep a connection from idling
  204. out, and so a CACK message is also expected to be sent over the
  205. network periodically.</t>
  206. </section>
  207. <section title="DISC messages">
  208. <t>DISC messages are sent by one side of a logical connection
  209. to terminate the logical connection. This notification
  210. allows the remote partner to either terminate an existing connection,
  211. such as when it is shutting down, or to reject a connection attempt
  212. made with CREQ.</t>
  213. <t>DISC messages carry in their payload, a single byte indicating
  214. a reason for the disconnect, along with a human readable reason
  215. as an ASCII byte array. (This MAY not be present, and SHOULD NOT
  216. be zero terminated.)</t>
  217. <t>The following reasons for DISC are defined:
  218. <list>
  219. <t>0x00 - normal close of a socket or endpoint</t>
  220. <t>0x01 - connection rejected</t>
  221. <t>0x02 - SP protocol invalid</t>
  222. <t>0x03 - invalid address (such as multicast)</t>
  223. <t>0x04 - not connected</t>
  224. <t>0xff - Other error</t>
  225. </list>
  226. </t>
  227. </section>
  228. </section>
  229. <section title="Latency Considerations">
  230. <t>A full round trip is required to establish a logical connection.</t>
  231. <t>However, a particularly optimistic initiator could send a CREQ and
  232. a DATA message in rapid succession, and hope that the DATA was received.
  233. Since these protocols are best effort only, this might not be a terrible
  234. thing to do.</t>
  235. <t>A future extension might be to offer a new opcode, allowing DATA
  236. to be combined with a CREQ or CACK. However, given that typical uses
  237. of these protocols are for long-lived use cases, there does not seem
  238. to be any particular urgency in doing this.</t>
  239. </section>
  240. <section anchor="IANA" title="IANA Considerations">
  241. <t>This memo includes no request to IANA.</t>
  242. </section>
  243. <section anchor="Security" title="Security Considerations">
  244. <t>The mapping isn't intended to provide any additional security in
  245. addition to UDP. If this is a concern, it is recommended that
  246. IPsec or similar approaches be used to secure the underlying
  247. transport.</t>
  248. </section>
  249. </middle>
  250. </rfc>