idnits 2.17.1 draft-ietf-p2psip-base-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1821 has weird spacing: '...Options optio...' == Line 2079 has weird spacing: '...hReqAns con...' == Line 2116 has weird spacing: '...ionType type;...' == Line 2258 has weird spacing: '...te_type typ...' == Line 2318 has weird spacing: '...tyValue ide...' == (5 more instances...) -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (Aug 3, 2010) is 5015 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'NodeIdLength' is mentioned on line 1717, but not defined -- Looks like a reference, but probably isn't: '0' on line 4527 == Missing Reference: 'RFC-AAAA' is mentioned on line 6118, but not defined ** Obsolete normative reference: RFC 5245 (Obsoleted by RFC 8445, RFC 8839) ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) ** Obsolete normative reference: RFC 5766 (Obsoleted by RFC 8656) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) ** Obsolete normative reference: RFC 2988 (Obsoleted by RFC 6298) ** Obsolete normative reference: RFC 4395 (Obsoleted by RFC 7595) == Outdated reference: A later version (-16) exists of draft-ietf-mmusic-ice-tcp-07 -- Obsolete informational reference (is this intentional?): RFC 5201 (Obsoleted by RFC 7401) == Outdated reference: A later version (-09) exists of draft-ietf-p2psip-concepts-02 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-01 Summary: 7 errors (**), 0 flaws (~~), 12 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: February 4, 2011 Skype 6 E. Rescorla 7 Network Resonance 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 Aug 3, 2010 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-10 16 Abstract 18 In this document the term BCP 78 and BCP 79 refer to RFC 3978 and RFC 19 3979 respectively. They refer only to those RFCs and not to any 20 documents that update or supersede them. 22 This specification defines REsource LOcation And Discovery (RELOAD), 23 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 24 P2P signaling protocol provides its clients with an abstract storage 25 and messaging service between a set of cooperating peers that form 26 the overlay network. RELOAD is designed to support a P2P Session 27 Initiation Protocol (P2PSIP) network, but can be utilized by other 28 applications with similar requirements by defining new usages that 29 specify the kinds of data that must be stored for a particular 30 application. RELOAD defines a security model based on a certificate 31 enrollment service that provides unique identities. NAT traversal is 32 a fundamental service of the protocol. RELOAD also allows access 33 from "client" nodes that do not need to route traffic or store data 34 for others. 36 Legal 38 This documents and the information contained therein are provided on 39 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 40 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 41 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 42 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 43 WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE 44 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 45 FOR A PARTICULAR PURPOSE. 47 Status of this Memo 48 This Internet-Draft is submitted in full conformance with the 49 provisions of BCP 78 and BCP 79. 51 Internet-Drafts are working documents of the Internet Engineering 52 Task Force (IETF). Note that other groups may also distribute 53 working documents as Internet-Drafts. The list of current Internet- 54 Drafts is at http://datatracker.ietf.org/drafts/current/. 56 Internet-Drafts are draft documents valid for a maximum of six months 57 and may be updated, replaced, or obsoleted by other documents at any 58 time. It is inappropriate to use Internet-Drafts as reference 59 material or to cite them other than as "work in progress." 61 This Internet-Draft will expire on February 4, 2011. 63 Copyright Notice 65 Copyright (c) 2010 IETF Trust and the persons identified as the 66 document authors. All rights reserved. 68 This document is subject to BCP 78 and the IETF Trust's Legal 69 Provisions Relating to IETF Documents 70 (http://trustee.ietf.org/license-info) in effect on the date of 71 publication of this document. Please review these documents 72 carefully, as they describe your rights and restrictions with respect 73 to this document. Code Components extracted from this document must 74 include Simplified BSD License text as described in Section 4.e of 75 the Trust Legal Provisions and are provided without warranty as 76 described in the Simplified BSD License. 78 This document may contain material from IETF Documents or IETF 79 Contributions published or made publicly available before November 80 10, 2008. The person(s) controlling the copyright in some of this 81 material may not have granted the IETF Trust the right to allow 82 modifications of such material outside the IETF Standards Process. 83 Without obtaining an adequate license from the person(s) controlling 84 the copyright in such materials, this document may not be modified 85 outside the IETF Standards Process, and derivative works of it may 86 not be created outside the IETF Standards Process, except to format 87 it for publication as an RFC or to translate it into languages other 88 than English. 90 Table of Contents 92 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 93 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 94 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 95 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 96 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 97 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 14 98 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 99 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 100 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 16 101 1.4. Structure of This Document . . . . . . . . . . . . . . . 17 102 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 103 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 20 104 3.1. Security and Identification . . . . . . . . . . . . . . 20 105 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 21 106 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 21 107 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 22 108 3.2.2. Minimum Functionality Requirements for Clients . . . 22 109 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 23 110 3.4. Connectivity Management . . . . . . . . . . . . . . . . 25 111 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 26 112 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 26 113 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 26 114 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 28 115 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 28 116 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 28 117 4. Application Support Overview . . . . . . . . . . . . . . . . 29 118 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 29 119 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 30 120 4.1.2. Usages . . . . . . . . . . . . . . . . . . . . . . . 31 121 4.1.3. Replication . . . . . . . . . . . . . . . . . . . . 31 122 4.2. Service Discovery . . . . . . . . . . . . . . . . . . . 32 123 4.3. Application Connectivity . . . . . . . . . . . . . . . . 32 124 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 33 125 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 33 126 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 33 127 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 34 128 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 35 129 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 35 130 5.2.1. Request Origination . . . . . . . . . . . . . . . . 36 131 5.2.2. Response Origination . . . . . . . . . . . . . . . . 36 132 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 37 133 5.3.1. Presentation Language . . . . . . . . . . . . . . . 38 134 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 38 135 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 41 136 5.3.2.1. Processing Configuration Sequence Numbers . . . . 43 137 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 44 138 5.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 46 139 5.3.2.4. Direct Return Response Forwarding Options . . . . 47 140 5.3.3. Message Contents Format . . . . . . . . . . . . . . 48 141 5.3.3.1. Response Codes and Response Errors . . . . . . . 49 142 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 51 143 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 54 144 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 54 145 5.4.2. Methods and types for use by topology plugins . . . 54 146 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 54 147 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 55 148 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 56 149 5.4.2.4. Route_Query . . . . . . . . . . . . . . . . . . . 56 150 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 57 151 5.5. Forwarding and Link Management Layer . . . . . . . . . . 59 152 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 60 153 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 60 154 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 63 155 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 63 156 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 63 157 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 64 158 5.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 65 159 5.5.1.7. Encoding the Attach Message . . . . . . . . . . . 65 160 5.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 66 161 5.5.1.9. Role Determination . . . . . . . . . . . . . . . 66 162 5.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 66 163 5.5.1.11. No-ICE . . . . . . . . . . . . . . . . . . . . . 67 164 5.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 67 165 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 67 166 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 68 167 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 68 168 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 68 169 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 69 170 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 69 171 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 69 172 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 70 173 5.5.4. Config_Update . . . . . . . . . . . . . . . . . . . 70 174 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 71 175 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 71 176 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 72 177 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 73 178 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 74 179 5.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 74 180 5.6.1.3. Message-oriented Transports . . . . . . . . . . . 74 181 5.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 74 182 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 75 183 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 76 184 5.6.3.1. Retransmission and Flow Control . . . . . . . . . 77 185 5.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 78 186 5.6.5. TLS/TCP with FH, No-ICE . . . . . . . . . . . . . . 78 187 5.6.6. DTLS/UDP with SR, No-ICE . . . . . . . . . . . . . . 79 188 5.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 79 189 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 80 190 6.1. Data Signature Computation . . . . . . . . . . . . . . . 81 191 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 82 192 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 83 193 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 84 194 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 84 195 6.3. Access Control Policies . . . . . . . . . . . . . . . . 85 196 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 85 197 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 85 198 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 85 199 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 85 200 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 86 201 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 86 202 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 86 203 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 90 204 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 91 205 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 92 206 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 93 207 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 95 208 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 95 209 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 96 210 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 96 211 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 98 212 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 98 213 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 98 214 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 99 215 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 100 216 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 101 217 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 102 218 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 103 219 9.2. Routing . . . . . . . . . . . . . . . . . . . . . . . . 104 220 9.3. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 104 221 9.4. Joining . . . . . . . . . . . . . . . . . . . . . . . . 105 222 9.5. Routing Attaches . . . . . . . . . . . . . . . . . . . . 105 223 9.6. Updates . . . . . . . . . . . . . . . . . . . . . . . . 106 224 9.6.1. Handling Neighbor Failures . . . . . . . . . . . . . 107 225 9.6.2. Handling Finger Table Entry Failure . . . . . . . . 108 226 9.6.3. Receiving Updates . . . . . . . . . . . . . . . . . 108 227 9.6.4. Stabilization . . . . . . . . . . . . . . . . . . . 109 228 9.6.4.1. Updating neighbor table . . . . . . . . . . . . . 109 229 9.6.4.2. Refreshing finger table . . . . . . . . . . . . . 109 230 9.6.4.3. Adjusting finger table size . . . . . . . . . . . 110 231 9.6.4.4. Detecting partitioning . . . . . . . . . . . . . 111 232 9.7. Route Query . . . . . . . . . . . . . . . . . . . . . . 111 233 9.8. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 112 235 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 113 236 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 113 237 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 118 238 10.2. Discovery Through Enrollment Server . . . . . . . . . . 120 239 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 121 240 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 122 241 10.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 122 242 10.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 123 243 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 123 244 12. Security Considerations . . . . . . . . . . . . . . . . . . . 129 245 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 129 246 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 130 247 12.3. Certificate-based Security . . . . . . . . . . . . . . . 130 248 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 131 249 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 132 250 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 132 251 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 133 252 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 133 253 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 133 254 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 134 255 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 134 256 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 135 257 12.6.3. Peer Identification and Authentication . . . . . . . 135 258 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 136 259 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 136 260 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 137 261 13.1. Port Registrations . . . . . . . . . . . . . . . . . . . 137 262 13.2. Overlay Algorithm Types . . . . . . . . . . . . . . . . 137 263 13.3. Access Control Policies . . . . . . . . . . . . . . . . 137 264 13.4. Application-ID . . . . . . . . . . . . . . . . . . . . . 138 265 13.5. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 138 266 13.6. Data Model . . . . . . . . . . . . . . . . . . . . . . . 139 267 13.7. Message Codes . . . . . . . . . . . . . . . . . . . . . 139 268 13.8. Error Codes . . . . . . . . . . . . . . . . . . . . . . 140 269 13.9. Overlay Link Types . . . . . . . . . . . . . . . . . . . 141 270 13.10. Overlay Link Protocols . . . . . . . . . . . . . . . . . 141 271 13.11. Forwarding Options . . . . . . . . . . . . . . . . . . . 141 272 13.12. Probe Information Types . . . . . . . . . . . . . . . . 142 273 13.13. Message Extensions . . . . . . . . . . . . . . . . . . . 142 274 13.14. reload URI Scheme . . . . . . . . . . . . . . . . . . . 142 275 13.14.1. URI Registration . . . . . . . . . . . . . . . . . . 143 276 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 144 277 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 144 278 15.1. Normative References . . . . . . . . . . . . . . . . . . 144 279 15.2. Informative References . . . . . . . . . . . . . . . . . 145 280 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 149 281 A.1. Changes since draft-ietf-p2psip-reload-09 . . . . . . . 149 282 Appendix B. Routing Alternatives . . . . . . . . . . . . . . . . 149 283 B.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 149 284 B.2. Symmetric vs Forward response . . . . . . . . . . . . . 149 285 B.3. Direct Response . . . . . . . . . . . . . . . . . . . . 150 286 B.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 151 287 B.5. Symmetric Route Stability . . . . . . . . . . . . . . . 152 288 Appendix C. Why Clients? . . . . . . . . . . . . . . . . . . . . 152 289 C.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 152 290 C.2. Clients as Application-Level Agents . . . . . . . . . . 153 291 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 153 293 1. Introduction 295 This document defines REsource LOcation And Discovery (RELOAD), a 296 peer-to-peer (P2P) signaling protocol for use on the Internet. It 297 provides a generic, self-organizing overlay network service, allowing 298 nodes to efficiently route messages to other nodes and to efficiently 299 store and retrieve data in the overlay. RELOAD provides several 300 features that are critical for a successful P2P protocol for the 301 Internet: 303 Security Framework: A P2P network will often be established among a 304 set of peers that do not trust each other. RELOAD leverages a 305 central enrollment server to provide credentials for each peer 306 which can then be used to authenticate each operation. This 307 greatly reduces the possible attack surface. 309 Usage Model: RELOAD is designed to support a variety of 310 applications, including P2P multimedia communications with the 311 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 312 the definition of new application usages, each of which can define 313 its own data types, along with the rules for their use. This 314 allows RELOAD to be used with new applications through a simple 315 documentation process that supplies the details for each 316 application. 318 NAT Traversal: RELOAD is designed to function in environments where 319 many if not most of the nodes are behind NATs or firewalls. 320 Operations for NAT traversal are part of the base design, 321 including using ICE to establish new RELOAD or application 322 protocol connections. 324 High Performance Routing: The very nature of overlay algorithms 325 introduces a requirement that peers participating in the P2P 326 network route requests on behalf of other peers in the network. 327 This introduces a load on those other peers, in the form of 328 bandwidth and processing power. RELOAD has been defined with a 329 simple, lightweight forwarding header, thus minimizing the amount 330 of effort required by intermediate peers. 332 Pluggable Overlay Algorithms: RELOAD has been designed with an 333 abstract interface to the overlay layer to simplify implementing a 334 variety of structured (DHT) and unstructured overlay algorithms. 335 This specification also defines how RELOAD is used with Chord, 336 which is mandatory to implement. Specifying a default "must 337 implement" overlay algorithm promotes interoperability, while 338 extensibility allows selection of overlay algorithms optimized for 339 a particular application. 341 These properties were designed specifically to meet the requirements 342 for a P2P protocol to support SIP. This document defines the base 343 protocol for the distributed storage and location service, as well as 344 critical usages for NAT traversal and security. The SIP Usage itself 345 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 346 limited to usage by SIP and could serve as a tool for supporting 347 other P2P applications with similar needs. RELOAD is also based on 348 the concepts introduced in [I-D.ietf-p2psip-concepts]. 350 1.1. Basic Setting 352 In this section, we provide a brief overview of the operational 353 setting for RELOAD. See the concepts document for more details. A 354 RELOAD Overlay Instance consists of a set of nodes arranged in a 355 connected graph. Each node in the overlay is assigned a numeric 356 Node-ID which, together with the specific overlay algorithm in use, 357 determines its position in the graph and the set of nodes it connects 358 to. The figure below shows a trivial example which isn't drawn from 359 any particular overlay algorithm, but was chosen for convenience of 360 representation. 362 +--------+ +--------+ +--------+ 363 | Node 10|--------------| Node 20|--------------| Node 30| 364 +--------+ +--------+ +--------+ 365 | | | 366 | | | 367 +--------+ +--------+ +--------+ 368 | Node 40|--------------| Node 50|--------------| Node 60| 369 +--------+ +--------+ +--------+ 370 | | | 371 | | | 372 +--------+ +--------+ +--------+ 373 | Node 70|--------------| Node 80|--------------| Node 90| 374 +--------+ +--------+ +--------+ 375 | 376 | 377 +--------+ 378 | Node 85| 379 |(Client)| 380 +--------+ 382 Because the graph is not fully connected, when a node wants to send a 383 message to another node, it may need to route it through the network. 384 For instance, Node 10 can talk directly to nodes 20 and 40, but not 385 to Node 70. In order to send a message to Node 70, it would first 386 send it to Node 40 with instructions to pass it along to Node 70. 387 Different overlay algorithms will have different connectivity graphs, 388 but the general idea behind all of them is to allow any node in the 389 graph to efficiently reach every other node within a small number of 390 hops. 392 The RELOAD network is not only a messaging network. It is also a 393 storage network. Records are stored under numeric addresses which 394 occupy the same space as node identifiers. Peers are responsible for 395 storing the data associated with some set of addresses as determined 396 by their Node-ID. For instance, we might say that every peer is 397 responsible for storing any data value which has an address less than 398 or equal to its own Node-ID, but greater than the next lowest 399 Node-ID. Thus, Node-20 would be responsible for storing values 400 11-20. 402 RELOAD also supports clients. These are nodes which have Node-IDs 403 but do not participate in routing or storage. For instance, in the 404 figure above Node 85 is a client. It can route to the rest of the 405 RELOAD network via Node 80, but no other node will route through it 406 and Node 90 is still responsible for all addresses between 81-90. We 407 refer to non-client nodes as peers. 409 Other applications (for instance, SIP) can be defined on top of 410 RELOAD and use these two basic RELOAD services to provide their own 411 services. 413 1.2. Architecture 415 RELOAD is fundamentally an overlay network. Therefore, it can be 416 divided into components that mimic the layering of the Internet 417 model[RFC1122]. 419 Application 421 +-------+ +-------+ 422 | SIP | | XMPP | ... 423 | Usage | | Usage | 424 +-------+ +-------+ 425 -------------------------------------- Messaging API 426 +------------------+ +---------+ 427 | Message |<--->| Storage | 428 | Transport | +---------+ 429 +------------------+ ^ 430 ^ ^ | 431 | v v 432 | +-------------------+ 433 | | Topology | 434 | | Plugin | 435 | +-------------------+ 436 | ^ 437 v v 438 +------------------+ 439 | Forwarding & | 440 | Link Management | 441 +------------------+ 442 -------------------------------------- Overlay Link API 443 +-------+ +------+ 444 |TLS | |DTLS | ... 445 +-------+ +------+ 447 The major components of RELOAD are: 449 Usage Layer: Each application defines a RELOAD usage; a set of data 450 kinds and behaviors which describe how to use the services 451 provided by RELOAD. These usages all talk to RELOAD through a 452 common Message Transport API. 454 Message Transport: Handles end-to-end reliability, manages request 455 state for the usages, and forwards Store and Fetch operations to 456 the Storage component. Delivers message responses to the 457 component initiating the request. 459 Storage: The Storage component is responsible for processing 460 messages relating to the storage and retrieval of data. It talks 461 directly to the Topology Plugin to manage data replication and 462 migration, and it talks to the Message Transport component to send 463 and receive messages. 465 Topology Plugin: The Topology Plugin is responsible for implementing 466 the specific overlay algorithm being used. It uses the Message 467 Transport component to send and receive overlay management 468 messages, to the Storage component to manage data replication, and 469 directly to the Forwarding Layer to control hop-by-hop message 470 forwarding. This component closely parallels conventional routing 471 algorithms, but is more tightly coupled to the Forwarding Layer 472 because there is no single "routing table" equivalent used by all 473 overlay algorithms. 475 Forwarding and Link Management Layer: Stores and implements the 476 routing table by providing packet forwarding services between 477 nodes. It also handles establishing new links between nodes, 478 including setting up connections across NATs using ICE. 480 Overlay Link Layer: Responsible for actually transporting traffic 481 directly between nodes. Each such protocol includes the 482 appropriate provisions for per-hop framing or hop-by-hop ACKs 483 required by unreliable transports. TLS [RFC5246] and DTLS 484 [RFC4347] are the currently defined "link layer" protocols used by 485 RELOAD for hop-by-hop communication. New protocols MAY be 486 defined, as described in Section 5.6.1 and Section 10.1. As this 487 document defines only TLS and DTLS, we use those terms throughout 488 the remainder of the document with the understanding that some 489 future document may add new overlay link layers. 491 To further clarify the roles of the various layers, this figure 492 parallels the architecture with each layer's role from an overlay 493 perspective and implementation layer in the internet: 495 | Internet Model | 496 Real | Equivalent | Reload 497 Internet | in Overlay | Architecture 498 -------------+-----------------+------------------------------------ 499 | | +-------+ +-------+ 500 | Application | | SIP | | XMPP | ... 501 | | | Usage | | Usage | 502 | | +-------+ +-------+ 503 | | ---------------------------------- 504 | |+------------------+ +---------+ 505 | Transport || Message |<--->| Storage | 506 | || Transport | +---------+ 507 | |+------------------+ ^ 508 | | ^ ^ | 509 | | | v v 510 Application | | | +-------------------+ 511 | (Routing) | | | Topology | 512 | | | | Plugin | 513 | | | +-------------------+ 514 | | | ^ 515 | | v v 516 | Network | +------------------+ 517 | | | Forwarding & | 518 | | | Link Management | 519 | | +------------------+ 520 | | ---------------------------------- 521 Transport | Link | +-------+ +------+ 522 | | |TLS | |DTLS | ... 523 | | +-------+ +------+ 524 -------------+-----------------+------------------------------------ 525 Network | 526 | 527 Link | 529 1.2.1. Usage Layer 531 The top layer, called the Usage Layer, has application usages, such 532 as the SIP Location Usage, that use the abstract Message Transport 533 API provided by RELOAD. The goal of this layer is to implement 534 application-specific usages of the generic overlay services provided 535 by RELOAD. The usage defines how a specific application maps its 536 data into something that can be stored in the overlay, where to store 537 the data, how to secure the data, and finally how applications can 538 retrieve and use the data. 540 The architecture diagram shows both a SIP usage and an XMPP usage. A 541 single application may require multiple usages; for example a SIP 542 application may also require a voicemail usage. A usage may define 543 multiple kinds of data that are stored in the overlay and may also 544 rely on kinds originally defined by other usages. 546 Because the security and storage policies for each kind are dictated 547 by the usage defining the kind, the usages may be coupled with the 548 Storage component to provide security policy enforcement and to 549 implement appropriate storage strategies according to the needs of 550 the usage. The exact implementation of such an interface is outside 551 the scope of this specification. 553 1.2.2. Message Transport 555 The Message Transport component provides a generic message routing 556 service for the overlay. The Message Transport layer is responsible 557 for end-to-end message transactions, including retransmissions. Each 558 peer is identified by its location in the overlay as determined by 559 its Node-ID. A component that is a client of the Message Transport 560 can perform two basic functions: 562 o Send a message to a given peer specified by Node-ID or to the peer 563 responsible for a particular Resource-ID. 564 o Receive messages that other peers send to a Node-ID or Resource-ID 565 for which the receiving peer is responsible. 567 All usages rely on the Message Transport component to send and 568 receive messages from peers. For instance, when a usage wants to 569 store data, it does so by sending Store requests. Note that the 570 Storage component and the Topology Plugin are themselves clients of 571 the Message Transport, because they need to send and receive messages 572 from other peers. 574 The Message Transport API is similar to those described as providing 575 "Key based routing" (KBR), although as RELOAD supports different 576 overlay algorithms (including non-DHT overlay algorithms) that 577 calculate keys in different ways, the actual interface must accept 578 Resource Names rather than actual keys. 580 1.2.3. Storage 582 One of the major functions of RELOAD is to allow nodes to store data 583 in the overlay and to retrieve data stored by other nodes or by 584 themselves. The Storage component is responsible for processing data 585 storage and retrieval messages. For instance, the Storage component 586 might receive a Store request for a given resource from the Message 587 Transport. It would then query the appropriate usage before storing 588 the data value(s) in its local data store and sending a response to 589 the Message Transport for delivery to the requesting node. 590 Typically, these messages will come from other nodes, but depending 591 on the overlay topology, a node might be responsible for storing data 592 for itself as well, especially if the overlay is small. 594 A peer's Node-ID determines the set of resources that it will be 595 responsible for storing. However, the exact mapping between these is 596 determined by the overlay algorithm in use. The Storage component 597 will only receive a Store request from the Message Transport if this 598 peer is responsible for that Resource-ID. The Storage component is 599 notified by the Topology Plugin when the Resource-IDs for which it is 600 responsible change, and the Storage component is then responsible for 601 migrating resources to other peers, as required. 603 1.2.4. Topology Plugin 605 RELOAD is explicitly designed to work with a variety of overlay 606 algorithms. In order to facilitate this, the overlay algorithm 607 implementation is provided by a Topology Plugin so that each overlay 608 can select an appropriate overlay algorithm that relies on the common 609 RELOAD core protocols and code. 611 The Topology Plugin is responsible for maintaining the overlay 612 algorithm Routing Table, which is consulted by the Forwarding and 613 Link Management Layer before routing a message. When connections are 614 made or broken, the Forwarding and Link Management Layer notifies the 615 Topology Plugin, which adjusts the routing table as appropriate. The 616 Topology Plugin will also instruct the Forwarding and Link Management 617 Layer to form new connections as dictated by the requirements of the 618 overlay algorithm Topology. The Topology Plugin issues periodic 619 update requests through Message Transport to maintain and update its 620 Routing Table. 622 As peers enter and leave, resources may be stored on different peers, 623 so the Topology Plugin also keeps track of which peers are 624 responsible for which resources. As peers join and leave, the 625 Topology Plugin instructs the Storage component to issue resource 626 migration requests as appropriate, in order to ensure that other 627 peers have whatever resources they are now responsible for. The 628 Topology Plugin is also responsible for providing for redundant data 629 storage to protect against loss of information in the event of a peer 630 failure and to protect against compromised or subversive peers. 632 1.2.5. Forwarding and Link Management Layer 634 The Forwarding and Link Management Layer is responsible for getting a 635 message to the next peer, as determined by the Topology Plugin. This 636 Layer establishes and maintains the network connections as required 637 by the Topology Plugin. This layer is also responsible for setting 638 up connections to other peers through NATs and firewalls using ICE, 639 and it can elect to forward traffic using relays for NAT and firewall 640 traversal. 642 This layer provides a generic interface that allows the topology 643 plugin to control the overlay and resource operations and messages. 644 Since each overlay algorithm is defined and functions differently, we 645 generically refer to the table of other peers that the overlay 646 algorithm maintains and uses to route requests (neighbors) as a 647 Routing Table. The Topology Plugin actually owns the Routing Table, 648 and forwarding decisions are made by querying the Topology Plugin for 649 the next hop for a particular Node-ID or Resource-ID. If this node 650 is the destination of the message, the message is delivered to the 651 Message Transport. 653 This layer may also utilize a framing header to encapsulate messages 654 as they are forwarding along each hop. Such a header may be used to 655 aid reliability, congestion control, flow control, etc. Any such 656 header has meaning only in the context of that individual link. 658 The Forwarding and Link Management Layer sits on top of the Overlay 659 Link Layer protocols that carry the actual traffic. This 660 specification defines how to use DTLS and TLS protocols to carry 661 RELOAD messages. 663 1.3. Security 665 RELOAD's security model is based on each node having one or more 666 public key certificates. In general, these certificates will be 667 assigned by a central server which also assigns Node-IDs, although 668 self-signed certificates can be used in closed networks. These 669 credentials can be leveraged to provide communications security for 670 RELOAD messages. RELOAD provides communications security at three 671 levels: 673 Connection Level: Connections between peers are secured with TLS, 674 DTLS, or potentially some to-be-defined future protocol. 675 Message Level: Each RELOAD message must be signed. 676 Object Level: Stored objects must be signed by the storing peer. 678 These three levels of security work together to allow peers to verify 679 the origin and correctness of data they receive from other peers, 680 even in the face of malicious activity by other peers in the overlay. 681 RELOAD also provides access control built on top of these 682 communications security features. Because the peer responsible for 683 storing a piece of data can validate the signature on the data being 684 stored, the responsible peer can determine whether a given operation 685 is permitted or not. 687 RELOAD also provides an optional shared secret based admission 688 control feature using shared secrets and TLS-PSK. This mode is 689 typically used when self-signed certificates are being used but would 690 generally not be used when the certificates were all signed by an 691 enrollment server. In order to form a TLS connection to any node in 692 the overlay, a new node needs to know the shared overlay key, thus 693 restricting access to authorized users only. This feature is used 694 together with certificate-based access control, not as a replacement 695 for it. 697 1.4. Structure of This Document 699 The remainder of this document is structured as follows. 701 o Section 2 provides definitions of terms used in this document. 702 o Section 3 provides an overview of the mechanisms used to establish 703 and maintain the overlay. 704 o Section 4 provides an overview of the mechanism RELOAD provides to 705 support other applications. 706 o Section 5 defines the protocol messages that RELOAD uses to 707 establish and maintain the overlay. 708 o Section 6 defines the protocol messages that are used to store and 709 retrieve data using RELOAD. 710 o Section 7 defines the Certificate Store Usage that is fundamental 711 to RELOAD security. 712 o Section 8 defines the TURN Server Usage needed to locate TURN 713 servers for NAT traversal. 714 o Section 9 defines a specific Topology Plugin using Chord. 715 o Section 10 defines the mechanisms that new RELOAD nodes use to 716 join the overlay for the first time. 717 o Section 11 provides an extended example. 719 2. Terminology 721 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 722 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 723 document are to be interpreted as described in RFC 2119 [RFC2119]. 725 We use the terminology and definitions from the Concepts and 726 Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft 727 extensively in this document. Other terms used in this document are 728 defined inline when used and are also defined below for reference. 730 DHT: A distributed hash table. A DHT is an abstract hash table 731 service realized by storing the contents of the hash table across 732 a set of peers. 734 Overlay Algorithm: An overlay algorithm defines the rules for 735 determining which peers in an overlay store a particular piece of 736 data and for determining a topology of interconnections amongst 737 peers in order to find a piece of data. 739 Overlay Instance: A specific overlay algorithm and the collection of 740 peers that are collaborating to provide read and write access to 741 it. There can be any number of overlay instances running in an IP 742 network at a time, and each operates in isolation of the others. 744 Peer: A host that is participating in the overlay. Peers are 745 responsible for holding some portion of the data that has been 746 stored in the overlay and also route messages on behalf of other 747 hosts as required by the Overlay Algorithm. 749 Client: A host that is able to store data in and retrieve data from 750 the overlay but which is not participating in routing or data 751 storage for the overlay. 753 Kind: A kind defined a particular type of data that can be stored in 754 the overlay. Applications define new Kinds to story the data they 755 use. Each Kind is identied iwht a unique IANA assinged intereger 756 called a Kind-ID . 758 Node: We use the term "Node" to refer to a host that may be either a 759 Peer or a Client. Because RELOAD uses the same protocol for both 760 clients and peers, much of the text applies equally to both. 761 Therefore we use "Node" when the text applies to both Clients and 762 Peers and the more specific term (i.e. client or peer) when the 763 text applies only to Clients or only to Peers. 765 Node-ID: A 128-bit value that uniquely identifies a node. Node-IDs 766 0 and 2^128 - 1 are reserved and are invalid Node-IDs. A value of 767 zero is not used in the wire protocol but can be used to indicate 768 an invalid node in implementations and APIs. The Node-ID of 769 2^128-1 is used on the wire protocol as a wildcard. 771 Resource: An object or group of objects associated with a string 772 identifier. See "Resource Name" below. 774 Resource Name: The potentially human readable name by which a 775 resource is identified. In unstructured P2P networks, the 776 resource name is sometimes used directly as a Resource-ID. In 777 structured P2P networks the resource name is typically mapped into 778 a Resource-ID by using the string as the input to hash function. 779 A SIP resource, for example, is often identified by its AOR which 780 is an example of a Resource Name. 782 Resource-ID: A value that identifies some resources and which is 783 used as a key for storing and retrieving the resource. Often this 784 is not human friendly/readable. One way to generate a Resource-ID 785 is by applying a mapping function to some other unique name (e.g., 786 user name or service name) for the resource. The Resource-ID is 787 used by the distributed database algorithm to determine the peer 788 or peers that are responsible for storing the data for the 789 overlay. In structured P2P networks, Resource-IDs are generally 790 fixed length and are formed by hashing the resource name. In 791 unstructured networks, resource names may be used directly as 792 Resource-IDs and may be variable lengths. 794 Connection Table: The set of nodes to which a node is directly 795 connected. This includes nodes with which Attach handshakes have 796 been done but which have not sent any Updates. 798 Routing Table: The set of peers which a node can use to route 799 overlay messages. In general, these peers will all be on the 800 connection table but not vice versa, because some peers will have 801 Attached but not sent updates. Peers may send messages directly 802 to peers that are in the connection table but may only route 803 messages to other peers through peers that are in the routing 804 table. 806 Destination List: A list of IDs through which a message is to be 807 routed. A single Node-ID is a trivial form of destination list. 809 Usage: A usage is an application that wishes to use the overlay for 810 some purpose. Each application wishing to use the overlay defines 811 a set of data kinds that it wishes to use. The SIP usage defines 812 the location data kind. 814 The term "maximum request lifetime" is the maximum time a request 815 will wait for a response; it defaults to 15 seconds. The term 816 "successor replacement hold-down time" is the amount of time to wait 817 before starting replication when a new successor is found; it 818 defaults to 30 seconds. 820 3. Overlay Management Overview 822 The most basic function of RELOAD is as a generic overlay network. 823 Nodes need to be able to join the overlay, form connections to other 824 nodes, and route messages through the overlay to nodes to which they 825 are not directly connected. This section provides an overview of the 826 mechanisms that perform these functions. 828 3.1. Security and Identification 830 Every node in the RELOAD overlay is identified by a Node-ID. The 831 Node-ID is used for three major purposes: 833 o To address the node itself. 834 o To determine its position in the overlay topology when the overlay 835 is structured. 836 o To determine the set of resources for which the node is 837 responsible. 839 Each node has a certificate [RFC5280] containing a Node-ID, which is 840 globally unique. 842 The certificate serves multiple purposes: 844 o It entitles the user to store data at specific locations in the 845 Overlay Instance. Each data kind defines the specific rules for 846 determining which certificates can access each Resource-ID/Kind-ID 847 pair. For instance, some kinds might allow anyone to write at a 848 given location, whereas others might restrict writes to the owner 849 of a single certificate. 850 o It entitles the user to operate a node that has a Node-ID found in 851 the certificate. When the node forms a connection to another 852 peer, it uses this certificate so that a node connecting to it 853 knows it is connected to the correct node (technically: a (D)TLS 854 association with client authentication is formed.) In addition, 855 the node can sign messages, thus providing integrity and 856 authentication for messages which are sent from the node. 857 o It entitles the user to use the user name found in the 858 certificate. 860 If a user has more than one device, typically they would get one 861 certificate for each device. This allows each device to act as a 862 separate peer. 864 RELOAD supports multiple certificate issuance models. The first is 865 based on a central enrollment process which allocates a unique name 866 and Node-ID and puts them in a certificate for the user. All peers 867 in a particular Overlay Instance have the enrollment server as a 868 trust anchor and so can verify any other peer's certificate. 870 In some settings, a group of users want to set up an overlay network 871 but are not concerned about attack by other users in the network. 872 For instance, users on a LAN might want to set up a short term ad hoc 873 network without going to the trouble of setting up an enrollment 874 server. RELOAD supports the use of self-generated and self-signed 875 certificates. When self-signed certificates are used, the node also 876 generates its own Node-ID and username. The Node-ID is computed as a 877 digest of the public key, to prevent Node-ID theft; however this 878 model is still subject to a number of known attacks (most notably 879 Sybil attacks [Sybil]) and can only be safely used in closed networks 880 where users are mutually trusting. 882 The general principle here is that the security mechanisms (TLS and 883 message signatures) are always used, even if the certificates are 884 self-signed. This allows for a single set of code paths in the 885 systems with the only difference being whether certificate 886 verification is required to chain to a single root of trust. 888 3.1.1. Shared-Key Security 890 RELOAD also provides an admission control system based on shared 891 keys. In this model, the peers all share a single key which is used 892 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 894 3.2. Clients 896 RELOAD defines a single protocol that is used both as the peer 897 protocol and as the client protocol for the overlay. This simplifies 898 implementation, particularly for devices that may act in either role, 899 and allows clients to inject messages directly into the overlay. 901 We use the term "peer" to identify a node in the overlay that routes 902 messages for nodes other than those to which it is directly 903 connected. Peers typically also have storage responsibilities. We 904 use the term "client" to refer to nodes that do not have routing or 905 storage responsibilities. When text applies to both peers and 906 clients, we will simply refer such devices as "nodes." 908 RELOAD's client support allows nodes that are not participating in 909 the overlay as peers to utilize the same implementation and to 910 benefit from the same security mechanisms as the peers. Clients 911 possess and use certificates that authorize the user to store data at 912 certain locations in the overlay. The Node-ID in the certificate is 913 used to identify the particular client as a member of the overlay and 914 to authenticate its messages. 916 In RELOAD, unlike some other designs, clients are not a first-class 917 concept. From the perspective of a peer, a client is simply a node 918 which has not yet sent any Updates or Joins. It might never do so 919 (if it's a client) or it might eventually do so (if it's just a node 920 that's taking a long time to join). The routing and storage rules 921 for RELOAD provide for correct behavior by peers regardless of 922 whether other nodes attached to them are clients or peers. Of 923 course, a client implementation must know that it intends to be a 924 client, but this localizes complexity only to that node. 926 For more discussion of the motivation for RELOAD's client support, 927 see Appendix C. 929 3.2.1. Client Routing 931 There are two routing options by which a client may be located in an 932 overlay. 934 o Establish a connection to the peer responsible for the client's 935 Node-ID in the overlay. Then requests may be sent from/to the 936 client using its Node-ID in the same manner as if it were a peer, 937 because the responsible peer in the overlay will handle the final 938 step of routing to the client. This may require a TURN relay in 939 cases where NATs or firewalls prevent a client from forming a 940 direct connections with its responsible peer. Note that clients 941 that choose this option MUST process Update messages from the 942 peer. Those updates can indicate that the peer no longer owns the 943 Client's Node-ID. The client then forms a connection to the 944 appropriate peer. Failure to do so will result in the client no 945 longer receiving messages. 946 o Establish a connection with an arbitrary peer in the overlay 947 (perhaps based on network proximity or an inability to establish a 948 direct connection with the responsible peer). In this case, the 949 client will rely on RELOAD's Destination List feature to ensure 950 reachability. The client can initiate requests, and any node in 951 the overlay that knows the Destination List to its current 952 location can reach it, but the client is not directly reachable 953 using only its Node-ID. The Destination List required to reach it 954 must be learnable via other mechanisms, such as being stored in 955 the overlay by a usage, if the client is to receive incoming 956 requests from other members of the overlay. 958 3.2.2. Minimum Functionality Requirements for Clients 960 A node may act as a client simply because it does not have the 961 resources or even an implementation of the topology plugin required 962 to act as a peer in the overlay. In order to exchange RELOAD 963 messages with a peer, a client must meet a minimum level of 964 functionality. Such a client must: 966 o Implement RELOAD's connection-management operations that are used 967 to establish the connection with the peer. 968 o Implement RELOAD's data retrieval methods (with client 969 functionality). 970 o Be able to calculate Resource-IDs used by the overlay. 971 o Possess security credentials required by the overlay it is 972 implementing. 974 A client speaks the same protocol as the peers, knows how to 975 calculate Resource-IDs, and signs its requests in the same manner as 976 peers. While a client does not necessarily require a full 977 implementation of the overlay algorithm, calculating the Resource-ID 978 requires an implementation of the appropriate algorithm for the 979 overlay. 981 3.3. Routing 983 This section will discuss the requirements RELOAD's routing 984 capabilities must meet, then describe the routing features in the 985 protocol, and then provide a brief overview of how they are used. 986 Appendix B discusses some alternative designs and the tradeoffs that 987 would be necessary to support them. 989 RELOAD's routing capabilities must meet the following requirements: 991 NAT Traversal: RELOAD must support establishing and using 992 connections between nodes separated by one or more NATs, including 993 locating peers behind NATs for those overlays allowing/requiring 994 it. 995 Clients: RELOAD must support requests from and to clients that do 996 not participate in overlay routing. 997 Client promotion: RELOAD must support clients that become peers at a 998 later point as determined by the overlay algorithm and deployment. 999 Low state: RELOAD's routing algorithms must not require 1000 significant state to be stored on intermediate peers. 1001 Return routability in unstable topologies: At some points in 1002 times, different nodes may have inconsistent information about the 1003 connectivity of the routing graph. In all cases, the response to 1004 a request needs to delivered to the node that sent the request and 1005 not to some other node. 1007 To meet these requirements, RELOAD's routing relies on two basic 1008 mechanisms: 1010 Via Lists: The forwarding header used by all RELOAD messages 1011 contains both a Via List (built hop-by-hop as the message is 1012 routed through the overlay) and a Destination List (providing 1013 source-routing capabilities for requests and return-path routing 1014 for responses). 1015 Route_Query: The Route_Query method allows a node to query a peer 1016 for the next hop it will use to route a message. This method is 1017 useful for diagnostics and for iterative routing. 1019 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1020 We will first describe symmetric routing and then discuss its 1021 advantages in terms of the requirements discussed above. 1023 Symmetric recursive routing requires that a message follow the path 1024 through the overlay to the destination without returning to the 1025 originating node: each peer forwards the message closer to its 1026 destination. The return path of the response is then the same path 1027 followed in reverse. For example, a message following a route from A 1028 to Z through B and X: 1030 A B X Z 1031 ------------------------------- 1033 ----------> 1034 Dest=Z 1035 ----------> 1036 Via=A 1037 Dest=Z 1038 ----------> 1039 Via=A, B 1040 Dest=Z 1042 <---------- 1043 Dest=X, B, A 1044 <---------- 1045 Dest=B, A 1046 <---------- 1047 Dest=A 1049 Note that the preceding Figure does not indicate whether A is a 1050 client or peer: A forwards its request to B and the response is 1051 returned to A in the same manner regardless of A's role in the 1052 overlay. 1054 This figure shows use of full via-lists by intermediate peers B and 1055 X. However, if B and/or X are willing to store state, then they may 1056 elect to truncate the lists, save that information internally (keyed 1057 by the transaction id), and return the response message along the 1058 path from which it was received when the response is received. This 1059 option requires greater state to be stored on intermediate peers but 1060 saves a small amount of bandwidth and reduces the need for modifying 1061 the message en route. Selection of this mode of operation is a 1062 choice for the individual peer; the techniques are interoperable even 1063 on a single message. The figure below shows B using full via lists 1064 but X truncating them and saving the state internally. 1066 A B X Z 1067 ------------------------------- 1069 ----------> 1070 Dest=Z 1071 ----------> 1072 Via=A 1073 Dest=Z 1074 ----------> 1075 Dest=Z 1077 <---------- 1078 Dest=X 1079 <---------- 1080 Dest=B, A 1081 <---------- 1082 Dest=A 1084 RELOAD also supports a basic Iterative routing mode (where the 1085 intermediate peers merely return a response indicating the next hop, 1086 but do not actually forward the message to that next hop themselves). 1087 Iterative routing is implemented using the Route_Query method, which 1088 requests this behavior. Note that iterative routing is selected only 1089 by the initiating node. 1091 3.4. Connectivity Management 1093 In order to provide efficient routing, a peer needs to maintain a set 1094 of direct connections to other peers in the Overlay Instance. Due to 1095 the presence of NATs, these connections often cannot be formed 1096 directly. Instead, we use the Attach request to establish a 1097 connection. Attach uses ICE [RFC5245] to establish the connection. 1098 It is assumed that the reader is familiar with ICE. 1100 Say that peer A wishes to form a direct connection to peer B. It 1101 gathers ICE candidates and packages them up in an Attach request 1102 which it sends to B through usual overlay routing procedures. B does 1103 its own candidate gathering and sends back a response with its 1104 candidates. A and B then do ICE connectivity checks on the candidate 1105 pairs. The result is a connection between A and B. At this point, A 1106 and B can add each other to their routing tables and send messages 1107 directly between themselves without going through other overlay 1108 peers. 1110 There is one special case in which Attach cannot be used: when a 1111 peer is joining the overlay and is not connected to any peers. In 1112 order to support this case, some small number of "bootstrap nodes" 1113 typically need to be publicly accessible so that new peers can 1114 directly connect to them. Section 10 contains more detail on this. 1116 In general, a peer needs to maintain connections to all of the peers 1117 near it in the Overlay Instance and to enough other peers to have 1118 efficient routing (the details depend on the specific overlay). If a 1119 peer cannot form a connection to some other peer, this isn't 1120 necessarily a disaster; overlays can route correctly even without 1121 fully connected links. However, a peer should try to maintain the 1122 specified link set and if it detects that it has fewer direct 1123 connections, should form more as required. This also implies that 1124 peers need to periodically verify that the connected peers are still 1125 alive and if not try to reform the connection or form an alternate 1126 one. 1128 3.5. Overlay Algorithm Support 1130 The Topology Plugin allows RELOAD to support a variety of overlay 1131 algorithms. This specification defines a DHT based on Chord [Chord], 1132 which is mandatory to implement, but the base RELOAD protocol is 1133 designed to support a variety of overlay algorithms. 1135 3.5.1. Support for Pluggable Overlay Algorithms 1137 RELOAD defines three methods for overlay maintenance: Join, Update, 1138 and Leave. However, the contents of those messages, when they are 1139 sent, and their precise semantics are specified by the actual overlay 1140 algorithm; RELOAD merely provides a framework of commonly-needed 1141 methods that provides uniformity of notation (and ease of debugging) 1142 for a variety of overlay algorithms. 1144 3.5.2. Joining, Leaving, and Maintenance Overview 1146 When a new peer wishes to join the Overlay Instance, it must have a 1147 Node-ID that it is allowed to use. When an enrollment server is used 1148 that Node-ID will be in the certificate the node received from the 1149 enrollment server. The details of the joining procedure are defined 1150 by the overlay algorithm, but the general steps for joining an 1151 Overlay Instance are: 1153 o Forming connections to some other peers. 1154 o Acquiring the data values this peer is responsible for storing. 1155 o Informing the other peers which were previously responsible for 1156 that data that this peer has taken over responsibility. 1158 The first thing the peer needs to do is to form a connection to some 1159 "bootstrap node". Because this is the first connection the peer 1160 makes, these nodes must have public IP addresses so that they can be 1161 connected to directly. Once a peer has connected to one or more 1162 bootstrap nodes, it can form connections in the usual way by routing 1163 Attach messages through the overlay to other nodes. Once a peer has 1164 connected to the overlay for the first time, it can cache the set of 1165 nodes it has connected to with public IP addresses for use as future 1166 bootstrap nodes. 1168 Once a peer has connected to a bootstrap node, it then needs to take 1169 up its appropriate place in the overlay. This requires two major 1170 operations: 1172 o Forming connections to other peers in the overlay to populate its 1173 Routing Table. 1174 o Getting a copy of the data it is now responsible for storing and 1175 assuming responsibility for that data. 1177 The second operation is performed by contacting the Admitting Peer 1178 (AP), the node which is currently responsible for that section of the 1179 overlay. 1181 The details of this operation depend mostly on the overlay algorithm 1182 involved, but a typical case would be: 1184 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1185 announcing its intention to join. 1186 2. AP sends a Join response. 1187 3. AP does a sequence of Stores to JP to give it the data it will 1188 need. 1189 4. AP does Updates to JP and to other peers to tell it about its own 1190 routing table. At this point, both JP and AP consider JP 1191 responsible for some section of the Overlay Instance. 1192 5. JP makes its own connections to the appropriate peers in the 1193 Overlay Instance. 1195 After this process is completed, JP is a full member of the Overlay 1196 Instance and can process Store/Fetch requests. 1198 Note that the first node is a special case. When ordinary nodes 1199 cannot form connections to the bootstrap nodes, then they are not 1200 part of the overlay. However, the first node in the overlay can 1201 obviously not connect to others nodes. In order to support this 1202 case, potential first nodes (which must also serve as bootstrap nodes 1203 initially) must somehow be instructed (perhaps by configuration 1204 settings) that they are the entire overlay, rather than not part of 1205 it. 1207 Note that clients do not perfom either of these operations. 1209 3.6. First-Time Setup 1211 Previous sections addressed how RELOAD works once a node has 1212 connected. This section provides an overview of how users get 1213 connected to the overlay for the first time. RELOAD is designed so 1214 that users can start with the name of the overlay they wish to join 1215 and perhaps a username and password, and leverage that into having a 1216 working peer with minimal user intervention. This helps avoid the 1217 problems that have been experienced with conventional SIP clients 1218 where users are required to manually configure a large number of 1219 settings. 1221 3.6.1. Initial Configuration 1223 In the first phase of the process, the user starts out with the name 1224 of the overlay and uses this to download an initial set of overlay 1225 configuration parameters. The node does a DNS SRV lookup on the 1226 overlay name to get the address of a configuration server. It can 1227 then connect to this server with HTTPS to download a configuration 1228 document which contains the basic overlay configuration parameters as 1229 well as a set of bootstrap nodes which can be used to join the 1230 overlay. 1232 If a node already has the valid configuration document that it 1233 received by some out of band method, this step can be skipped. 1235 3.6.2. Enrollment 1237 If the overlay is using centralized enrollment, then a user needs to 1238 acquire a certificate before joining the overlay. The certificate 1239 attests both to the user's name within the overlay and to the Node- 1240 IDs which they are permitted to operate. In that case, the 1241 configuration document will contain the address of an enrollment 1242 server which can be used to obtain such a certificate. The 1243 enrollment server may (and probably will) require some sort of 1244 username and password before issuing the certificate. The enrollment 1245 server's ability to restrict attackers' access to certificates in the 1246 overlay is one of the cornerstones of RELOAD's security. 1248 4. Application Support Overview 1250 RELOAD is not intended to be used alone, but rather as a substrate 1251 for other applications. These applications can use RELOAD for a 1252 variety of purposes: 1254 o To store data in the overlay and retrieve data stored by other 1255 nodes. 1256 o As a discovery mechanism for services such as TURN. 1257 o To form direct connections which can be used to transmit 1258 application-level messages without using the overlay. 1260 This section provides an overview of these services. 1262 4.1. Data Storage 1264 RELOAD provides operations to Store and Fetch data. Each location in 1265 the Overlay Instance is referenced by a Resource-ID. However, each 1266 location may contain data elements corresponding to multiple kinds 1267 (e.g., certificate, SIP registration). Similarly, there may be 1268 multiple elements of a given kind, as shown below: 1270 +--------------------------------+ 1271 | Resource-ID | 1272 | | 1273 | +------------+ +------------+ | 1274 | | Kind 1 | | Kind 2 | | 1275 | | | | | | 1276 | | +--------+ | | +--------+ | | 1277 | | | Value | | | | Value | | | 1278 | | +--------+ | | +--------+ | | 1279 | | | | | | 1280 | | +--------+ | | +--------+ | | 1281 | | | Value | | | | Value | | | 1282 | | +--------+ | | +--------+ | | 1283 | | | +------------+ | 1284 | | +--------+ | | 1285 | | | Value | | | 1286 | | +--------+ | | 1287 | +------------+ | 1288 +--------------------------------+ 1290 Each kind is identified by a Kind-ID, which is a code point assigned 1291 by IANA. As part of the kind definition, protocol designers may 1292 define constraints, such as limits on size, on the values which may 1293 be stored. For many kinds, the set may be restricted to a single 1294 value; some sets may be allowed to contain multiple identical items 1295 while others may only have unique items. Note that a kind may be 1296 employed by multiple usages and new usages are encouraged to use 1297 previously defined kinds where possible. We define the following 1298 data models in this document, though other usages can define their 1299 own structures: 1301 single value: There can be at most one item in the set and any value 1302 overwrites the previous item. 1304 array: Many values can be stored and addressed by a numeric index. 1306 dictionary: The values stored are indexed by a key. Often this key 1307 is one of the values from the certificate of the peer sending the 1308 Store request. 1310 In order to protect stored data from tampering, by other nodes, each 1311 stored value is digitally signed by the node which created it. When 1312 a value is retrieved, the digital signature can be verified to detect 1313 tampering. 1315 4.1.1. Storage Permissions 1317 A major issue in peer-to-peer storage networks is minimizing the 1318 burden of becoming a peer, and in particular minimizing the amount of 1319 data which any peer is required to store for other nodes. RELOAD 1320 addresses this issue by only allowing any given node to store data at 1321 a small number of locations in the overlay, with those locations 1322 being determined by the node's certificate. When a peer uses a Store 1323 request to place data at a location authorized by its certificate, it 1324 signs that data with the private key that corresponds to its 1325 certificate. Then the peer responsible for storing the data is able 1326 to verify that the peer issuing the request is authorized to make 1327 that request. Each data kind defines the exact rules for determining 1328 what certificate is appropriate. 1330 The most natural rule is that a certificate authorizes a user to 1331 store data keyed with their user name X. This rule is used for all 1332 the kinds defined in this specification. Thus, only a user with a 1333 certificate for "alice@example.org" could write to that location in 1334 the overlay. However, other usages can define any rules they choose, 1335 including publicly writable values. 1337 The digital signature over the data serves two purposes. First, it 1338 allows the peer responsible for storing the data to verify that this 1339 Store is authorized. Second, it provides integrity for the data. 1340 The signature is saved along with the data value (or values) so that 1341 any reader can verify the integrity of the data. Of course, the 1342 responsible peer can "lose" the value but it cannot undetectably 1343 modify it. 1345 The size requirements of the data being stored in the overlay are 1346 variable. For instance, a SIP AoR and voicemail differ widely in the 1347 storage size. RELOAD leaves it to the Usage and overlay 1348 configuration to limit size imbalance of various kinds. 1350 4.1.2. Usages 1352 By itself, the distributed storage layer just provides infrastructure 1353 on which applications are built. In order to do anything useful, a 1354 usage must be defined. Each Usage specifies several things: 1356 o Registers Kind-ID code points for any kinds that the Usage 1357 defines. 1358 o Defines the data structure for each of the kinds. 1359 o Defines access control rules for each of the kinds. 1360 o Defines how the Resource Name is formed that is hashed to form the 1361 Resource-ID where each kind is stored. 1362 o Describes how values will be merged after a network partition. 1363 Unless otherwise specified, the default merging rule is to act as 1364 if all the values that need to be merged were stored and as if the 1365 order they were stored in corresponds to the stored time values 1366 associated with (and carried in) their values. Because the stored 1367 time values are those associated with the peer which did the 1368 writing, clock skew is generally not an issue. If two nodes are 1369 on different partitions, write to the same location, and have 1370 clock skew, this can create merge conflicts. However because 1371 RELOAD deliberately segregates storage so that data from different 1372 users and peers is stored in different locations, and a single 1373 peer will typically only be in a single network partition, this 1374 case will generally not arise. 1375 o Defines the types of connections that can be initiated using 1376 AppAttach. 1378 The kinds defined by a usage may also be applied to other usages. 1379 However, a need for different parameters, such as different size 1380 limits, would imply the need to create a new kind. 1382 4.1.3. Replication 1384 Replication in P2P overlays can be used to provide: 1386 persistence: if the responsible peer crashes and/or if the storing 1387 peer leaves the overlay 1389 security: to guard against DoS attacks by the responsible peer or 1390 routing attacks to that responsible peer 1391 load balancing: to balance the load of queries for popular 1392 resources. 1394 A variety of schemes are used in P2P overlays to achieve some of 1395 these goals. Common techniques include replicating on neighbors of 1396 the responsible peer, randomly locating replicas around the overlay, 1397 or replicating along the path to the responsible peer. 1399 The core RELOAD specification does not specify a particular 1400 replication strategy. Instead, the first level of replication 1401 strategies are determined by the overlay algorithm, which can base 1402 the replication strategy on its particular topology. For example, 1403 Chord places replicas on successor peers, which will take over 1404 responsibility should the responsible peer fail [Chord]. 1406 If additional replication is needed, for example if data persistence 1407 is particularly important for a particular usage, then that usage may 1408 specify additional replication, such as implementing random 1409 replications by inserting a different well known constant into the 1410 Resource Name used to store each replicated copy of the resource. 1411 Such replication strategies can be added independent of the 1412 underlying algorithm, and their usage can be determined based on the 1413 needs of the particular usage. 1415 4.2. Service Discovery 1417 RELOAD does not currently define a generic service discovery 1418 algorithm as part of the base protocol, although a simplistic TURN- 1419 specific discovery mechanism is provided. A variety of service 1420 discovery algorithms can be implemented as extensions to the base 1421 protocol, such as the service discovery algorithm ReDIR 1422 [opendht-sigcomm05] . 1424 4.3. Application Connectivity 1426 There is no requirement that a RELOAD usage must use RELOAD's 1427 primitives for establishing its own communication if it already 1428 possesses its own means of establishing connections. For example, 1429 one could design a RELOAD-based resource discovery protocol which 1430 used HTTP to retrieve the actual data. 1432 For more common situations, however, it is the overlay itself - 1433 rather than an external authority such as DNS - which is used to 1434 establish a connection. RELOAD provides connectivity to applications 1435 using the AppAttach method. For example, if a P2PSIP node wishes to 1436 establish a SIP dialog with another P2PSIP node, it will use 1437 AppAttach to establish a direct connection with the other node. This 1438 new connection is separate from the peer protocol connection. It is 1439 a dedicated UDP or TCP flow used only for the SIP dialog. Each usage 1440 specifies which types of connections can be initiated using 1441 AppAttach. 1443 5. Overlay Management Protocol 1445 This section defines the basic protocols used to create, maintain, 1446 and use the RELOAD overlay network. We start by defining the basic 1447 concept of how message destinations are interpreted when routing 1448 messages. We then describe the symmetric recursive routing model, 1449 which is RELOAD's default routing algorithm. We then define the 1450 message structure and then finally define the messages used to join 1451 and maintain the overlay. 1453 5.1. Message Receipt and Forwarding 1455 When a peer receives a message, it first examines the overlay, 1456 version, and other header fields to determine whether the message is 1457 one it can process. If any of these are incorrect (e.g., the message 1458 is for an overlay in which the peer does not participate) it is an 1459 error. The peer SHOULD generate an appropriate error but local 1460 policy can override this and cause the messages to be silently 1461 dropped. 1463 Once the peer has determined that the message is correctly formatted, 1464 it examines the first entry on the destination list. There are three 1465 possible cases here: 1467 o The first entry on the destination list is an ID for which the 1468 peer is responsible. 1469 o The first entry on the destination list is an ID for which another 1470 peer is responsible. 1471 o The first entry on the destination list is a private ID that is 1472 being used for destination list compression. This is described 1473 later. 1475 These cases are handled as discussed below. 1477 5.1.1. Responsible ID 1479 If the first entry on the destination list is an ID for which the 1480 node is responsible, there are several sub-cases. 1481 o If the entry is a Resource-ID, then it MUST be the only entry on 1482 the destination list. If there are other entries, the message 1483 MUST be silently dropped. Otherwise, the message is destined for 1484 this node and it passes it up to the upper layers. 1485 o If the entry is a Node-ID which equals this node's Node-ID, then 1486 the message is destined for this node. If this is the only entry 1487 on the destination list, the message is destined for this node and 1488 is passed up to the upper layers. Otherwise the entry is removed 1489 from the destination list and the message is passed to the Message 1490 Transport. If the message is a response and there is state for 1491 the transaction ID, the state is reinserted into the destination 1492 list before the message is further processed. 1493 o If the entry is a Node-ID which is not equal to this node, then 1494 the node MUST drop the message silently unless the Node-ID 1495 corresponds to a node which is directly connected to this node 1496 (i.e., a client). In that case, it MUST forward the message to 1497 the destination node as described in the next section. 1499 Note that this implies that in order to address a message to "the 1500 peer that controls region X", a sender sends to Resource-ID X, not 1501 Node-ID X. 1503 5.1.2. Other ID 1505 If neither of the other three cases applies, then the peer MUST 1506 forward the message towards the first entry on the destination list. 1507 This means that it MUST select one of the peers to which it is 1508 connected and which is likely to be responsible for the first entry 1509 on the destination list. If the first entry on the destination list 1510 is in the peer's connection table, then it SHOULD forward the message 1511 to that peer directly. Otherwise, the peer consults the routing 1512 table to forward the message. 1514 Any intermediate peer which forwards a RELOAD message MUST arrange 1515 that if it receives a response to that message the response can be 1516 routed back through the set of nodes through which the request 1517 passed. This may be arranged in one of two ways: 1519 o The peer MAY add an entry to the via list in the forwarding header 1520 that will enable it to determine the correct node. 1521 o The peer MAY keep per-transaction state which will allow it to 1522 determine the correct node. 1524 As an example of the first strategy, if node D receives a message 1525 from node C with via list (A, B), then D would forward to the next 1526 node (E) with via list (A, B, C). Now, if E wants to respond to the 1527 message, it reverses the via list to produce the destination list, 1528 resulting in (D, C, B, A). When D forwards the response to C, the 1529 destination list will contain (C, B, A). 1531 As an example of the second strategy, if node D receives a message 1532 from node C with transaction ID X and via list (A, B), it could store 1533 (X, C) in its state database and forward the message with the via 1534 list unchanged. When D receives the response, it consults its state 1535 database for transaction id X, determines that the request came from 1536 C, and forwards the response to C. 1538 Intermediate peers which modify the via list are not required to 1539 simply add entries. The only requirement is that the peer be able to 1540 reconstruct the correct destination list on the return route. RELOAD 1541 provides explicit support for this functionality in the form of 1542 private IDs, which can replace any number of via list entries. For 1543 instance, in the above example, Node D might send E a via list 1544 containing only the private ID (I). E would then use the destination 1545 list (D, I) to send its return message. When D processes this 1546 destination list, it would detect that I is a private ID, recover the 1547 via list (A, B, C), and reverse that to produce the correct 1548 destination list (C, B, A) before sending it to C. This feature is 1549 called List Compression. It MAY either be a compressed version of 1550 the original via list or an index into a state database containing 1551 the original via list. 1553 Note that if an intermediate peer exits the overlay, then on the 1554 return trip the message cannot be forwarded and will be dropped. The 1555 ordinary timeout and retransmission mechanisms provide stability over 1556 this type of failure. 1558 Note that if an intermediate peer retains per-transaction state 1559 instead of modifying the via list, it needs some mechanism for timing 1560 out that state, otherwise its state database will grow without bound. 1561 Whatever algorithm is used, state MUST be maintained for at least the 1562 value of the overlay reliability timer (3 seconds) and MAY keep it 1563 longer. 1565 5.1.3. Private ID 1567 If the first entry in the destination list is a private id (e.g., a 1568 compressed via list), the peer MUST replace that entry with the 1569 original via list that it replaced and then re-examine the 1570 destination list to determine which of the above cases now applies. 1572 5.2. Symmetric Recursive Routing 1574 This Section defines RELOAD's symmetric recursive routing algorithm, 1575 which is the default algorithm used by nodes to route messages 1576 through the overlay. All implementations MUST implement this routing 1577 algorithm. An overlay may be configured to use alternative routing 1578 algorithms, and alternative routing algorithms may be selected on a 1579 per-message basis. 1581 5.2.1. Request Origination 1583 In order to originate a message to a given Node-ID or Resource-ID, a 1584 node constructs an appropriate destination list. The simplest such 1585 destination list is a single entry containing the Node-ID or 1586 Resource-ID. The resulting message will use the normal overlay 1587 routing mechanisms to forward the message to that destination. The 1588 node can also construct a more complicated destination list for 1589 source routing. 1591 Once the message is constructed, the node sends the message to some 1592 adjacent peer. If the first entry on the destination list is 1593 directly connected, then the message MUST be routed down that 1594 connection. Otherwise, the topology plugin MUST be consulted to 1595 determine the appropriate next hop. 1597 Parallel searches for the resource are a common solution to improve 1598 reliability in the face of churn or of subversive peers. Parallel 1599 searches for usage-specified replicas are managed by the usage layer. 1600 However, a single request can also be routed through multiple 1601 adjacent peers, even when known to be sub-optimal, to improve 1602 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1603 specified by the topology plugin. 1605 Because messages may be lost in transit through the overlay, RELOAD 1606 incorporates an end-to-end reliability mechanism. When an 1607 originating node transmits a request it MUST set a 3 second timer. 1608 If a response has not been received when the timer fires, the request 1609 is retransmitted with the same transaction identifier. The request 1610 MAY be retransmitted up to 4 times (for a total of 5 messages). 1611 After the timer for the fifth transmission fires, the message SHALL 1612 be considered to have failed. Note that this retransmission 1613 procedure is not followed by intermediate nodes. They follow the 1614 hop-by-hop reliability procedure described in Section 5.6.3. 1616 The above algorithm can result in multiple requests being delivered 1617 to a node. Receiving nodes MUST generate semantically equivalent 1618 responses to retransmissions of the same request (this can be 1619 determined by transaction id) if the request is received within the 1620 maximum request lifetime (15 seconds). For some requests (e.g., 1621 Fetch) this can be accomplished merely by processing the request 1622 again. For other requests, (e.g., Store) it may be necessary to 1623 maintain state for the duration of the request lifetime. 1625 5.2.2. Response Origination 1627 When a peer sends a response to a request using this routing 1628 algorithm, it MUST construct the destination list by reversing the 1629 order of the entries on the via list. This has the result that the 1630 response traverses the same peers as the request traversed, except in 1631 reverse order (symmetric routing). 1633 5.3. Message Structure 1635 RELOAD is a message-oriented request/response protocol. The messages 1636 are encoded using binary fields. All integers are represented in 1637 network byte order. The general philosophy behind the design was to 1638 use Type, Length, Value fields to allow for extensibility. However, 1639 for the parts of a structure that were required in all messages, we 1640 just define these in a fixed position, as adding a type and length 1641 for them is unnecessary and would simply increase bandwidth and 1642 introduces new potential for interoperability issues. 1644 Each message has three parts, concatenated as shown below: 1646 +-------------------------+ 1647 | Forwarding Header | 1648 +-------------------------+ 1649 | Message Contents | 1650 +-------------------------+ 1651 | Security Block | 1652 +-------------------------+ 1654 The contents of these parts are as follows: 1656 Forwarding Header: Each message has a generic header which is used 1657 to forward the message between peers and to its final destination. 1658 This header is the only information that an intermediate peer 1659 (i.e., one that is not the target of a message) needs to examine. 1661 Message Contents: The message being delivered between the peers. 1662 From the perspective of the forwarding layer, the contents are 1663 opaque, however, they are interpreted by the higher layers. 1665 Security Block: A security block containing certificates and a 1666 digital signature over the message. Note that this signature can 1667 be computed without parsing the message contents. All messages 1668 MUST be signed by their originator. 1670 The following sections describe the format of each part of the 1671 message. 1673 5.3.1. Presentation Language 1675 The structures defined in this document are defined using a C-like 1676 syntax based on the presentation language used to define TLS. 1677 Advantages of this style include: 1679 o It is easy to write and familiar enough looking that most readers 1680 can grasp it quickly. 1681 o The ability to define nested structures allows a separation 1682 between high-level and low-level message structures. 1683 o It has a straightforward wire encoding that allows quick 1684 implementation, but the structures can be comprehended without 1685 knowing the encoding. 1686 o The ability to mechanically compile encoders and decoders. 1688 Several idiosyncrasies of this language are worth noting. 1690 o All lengths are denoted in bytes, not objects. 1691 o Variable length values are denoted like arrays with angle 1692 brackets. 1693 o "select" is used to indicate variant structures. 1695 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1696 but only up to 127 values of two bytes (16 bits) each. 1698 5.3.1.1. Common Definitions 1700 The following definitions are used throughout RELOAD and so are 1701 defined here. They also provide a convenient introduction to how to 1702 read the presentation language. 1704 An enum represents an enumerated type. The values associated with 1705 each possibility are represented in parentheses and the maximum value 1706 is represented as a nameless value, for purposes of describing the 1707 width of the containing integral type. For instance, Boolean 1708 represents a true or false: 1710 enum { false (0), true(1), (255)} Boolean; 1712 A boolean value is either a 1 or a 0 and is represented as a single 1713 byte on the wire. 1715 The NodeId, shown below, represents a single Node-ID. 1717 typedef opaque NodeId[NodeIdLength]; 1719 A NodeId is a fixed-length structure represented as a series of 1720 bytes, with the most significant byte first. The length is set on a 1721 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1722 (See Section 10.1 for how NodeIdLength is set.) Note: the use of 1723 "typedef" here is an extension to the TLS language, but its meaning 1724 should be relatively obvious. Note the [ size ] syntax defines a 1725 fixed length element that does not include the length of the element 1726 in the on the wire encoding. 1728 A ResourceId, shown below, represents a single Resource-ID. 1730 typedef opaque ResourceId<0..2^8-1>; 1732 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1733 NodeIds, ResourceIds are variable length, up to 255 bytes (2048 bits) 1734 in length. On the wire, each ResourceId is preceded by a single 1735 length byte (allowing lengths up to 255). Thus, the 3-byte value 1736 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1737 defines a variable length element that does include the length of the 1738 element in the on the wire encoding. The number of bytes to encode 1739 the length on the wire is derived by range. 1741 A more complicated example is IpAddressPort, which represents a 1742 network address and can be used to carry either an IPv6 or IPv4 1743 address: 1745 enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 1746 (255)} AddressType; 1748 struct { 1749 uint32 addr; 1750 uint16 port; 1751 } IPv4AddrPort; 1753 struct { 1754 uint128 addr; 1755 uint16 port; 1756 } IPv6AddrPort; 1758 struct { 1759 AddressType type; 1760 uint8 length; 1762 select (type) { 1763 case ipv4_address: 1764 IPv4AddrPort v4addr_port; 1766 case ipv6_address: 1767 IPv6AddrPort v6addr_port; 1769 /* This structure can be extended */ 1771 } IpAddressPort; 1773 The first two fields in the structure are the same no matter what 1774 kind of address is being represented: 1776 type: the type of address (v4 or v6). 1777 length: the length of the rest of the structure. 1779 By having the type and the length appear at the beginning of the 1780 structure regardless of the kind of address being represented, an 1781 implementation which does not understand new address type X can still 1782 parse the IpAddressPort field and then discard it if it is not 1783 needed. 1785 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1786 an IPv6AddrPort. Both of these simply consist of an address 1787 represented as an integer and a 16-bit port. As an example, here is 1788 the wire representation of the IPv4 address "192.0.2.1" with port 1789 "6100". 1791 01 ; type = IPv4 1792 06 ; length = 6 1793 c0 00 02 01 ; address = 192.0.2.1 1794 17 d4 ; port = 6100 1796 Unless a given structure that uses a select explicitly allows for 1797 unknown types in the select, any unknown type SHOULD be treated as an 1798 parsing error and the whole message discarded with no response. 1800 5.3.2. Forwarding Header 1802 The forwarding header is defined as a ForwardingHeader structure, as 1803 shown below. 1805 struct { 1806 uint32 relo_token; 1807 uint32 overlay; 1808 uint16 configuration_sequence; 1809 uint8 version; 1810 uint8 ttl; 1811 uint32 fragment; 1812 uint32 length; 1813 uint64 transaction_id; 1814 uint32 max_response_length; 1815 uint16 via_list_length; 1816 uint16 destination_list_length; 1817 uint16 options_length; 1818 Destination via_list[via_list_length]; 1819 Destination destination_list 1820 [destination_list_length]; 1821 ForwardingOptions options[options_length]; 1822 } ForwardingHeader; 1824 The contents of the structure are: 1826 relo_token: The first four bytes identify this message as a RELOAD 1827 message. The message is easy to demultiplex from STUN messages by 1828 looking at the first bit. This field MUST contain the value 1829 0xd2454c4f (the string 'RELO' with the high bit of the first byte 1830 set.). 1832 overlay: The 32 bit checksum/hash of the overlay being used. The 1833 variable length string representing the overlay name is hashed 1834 with SHA-1 and the low order 32 bits are used. The purpose of 1835 this field is to allow nodes to participate in multiple overlays 1836 and to detect accidental misconfiguration. This is not a security 1837 critical function. 1839 configuration_sequence: The sequence number of the configuration 1840 file. 1842 version: The version of the RELOAD protocol being used. This is a 1843 fixed point interger between 0.1 and 25.4. This document 1844 describes version 0.1, with a value of 0x01. [[ Note to RFC 1845 Editor: Please update this to version 1.0 with value of 0x0a and 1846 remove this note. ]] 1848 ttl: An 8 bit field indicating the number of iterations, or hops, a 1849 message can experience before it is discarded. The TTL value MUST 1850 be decremented by one at every hop along the route the message 1851 traverses. If the TTL is 0, the message MUST NOT be propagated 1852 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1853 should be generated. The initial value of the TTL SHOULD be 100 1854 unless defined otherwise by the overlay configuration. 1856 fragment: This field is used to handle fragmentation. The high 1857 order two bits are used to indicate the fragmentation status: If 1858 the high bit (0x80000000) is set, it indicates that the message is 1859 a fragment. If the next bit (0x40000000) is set, it indicates 1860 that this is the last fragment. The next six bits (0x20000000 to 1861 0x01000000) are reserved and SHOULD be set to zero. The remainder 1862 of the field is used to indicate the fragment offset; see 1863 Section 5.7 1865 length: The count in bytes of the size of the message, including the 1866 header. 1868 transaction_id: A unique 64 bit number that identifies this 1869 transaction and also allows receivers to disambiguate transactions 1870 which are otherwise identical. Responses use the same Transaction 1871 ID as the request they correspond to. Transaction IDs are also 1872 used for fragment reassembly. 1874 max_response_length: The maximum size in bytes of a response. Used 1875 by requesting nodes to avoid receiving (unexpected) very large 1876 responses. If this value is non-zero, responding peers MUST check 1877 that any response would not exceed it and if so generate an 1878 Error_Response_Too_Large value. This value SHOULD be set to zero 1879 for responses. 1881 via_list_length: The length of the via list in bytes. Note that in 1882 this field and the following two length fields we depart from the 1883 usual variable-length convention of having the length immediately 1884 precede the value in order to make it easier for hardware decoding 1885 engines to quickly determine the length of the header. 1887 destination_list_length: The length of the destination list in 1888 bytes. 1890 options_length: The length of the header options in bytes. 1892 via_list: The via_list contains the sequence of destinations through 1893 which the message has passed. The via_list starts out empty and 1894 grows as the message traverses each peer. 1896 destination_list: The destination_list contains a sequence of 1897 destinations which the message should pass through. The 1898 destination list is constructed by the message originator. The 1899 first element in the destination list is where the message goes 1900 next. The list shrinks as the message traverses each listed peer. 1902 options: Contains a series of ForwardingOptions entries. See 1903 Section 5.3.2.3. 1905 5.3.2.1. Processing Configuration Sequence Numbers 1907 In order to be part of the overlay, a node MUST have a copy of the 1908 overlay configuration document. In order to allow for configuration 1909 document changes, each version of the configuration document has a 1910 sequence number which is monotonically increasing mod 65536. Because 1911 the sequence number may in principle wrap, greater than or less than 1912 are interpreted by modulo arithmetic as in TCP. 1914 When a destination node receives a request, it MUST check that the 1915 configuration_sequence field is equal to its own configuration 1916 sequence number. If they do not match, it MUST generate an error, 1917 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1918 the configuration file in the request is too old, it MUST generate a 1919 Config_Update message to update the requesting node. This allows new 1920 configuration documents to propagate quickly throughout the system. 1921 The one exception to this rule is that if the configuration_sequence 1922 field is equal to 0xffff, and the message type is Config_Update, then 1923 the message MUST be accepted regardless of the receiving node's 1924 configuration sequence number. 1926 5.3.2.2. Destination and Via Lists 1928 The destination list and via lists are sequences of Destination 1929 values: 1931 enum {reserved(0), node(1), resource(2), compressed(3), 1932 /* 128-255 not allowed */ (255) } 1933 DestinationType; 1935 select (destination_type) { 1936 case node: 1937 NodeId node_id; 1939 case resource: 1940 ResourceId resource_id; 1942 case compressed: 1943 opaque compressed_id<0..2^8-1>; 1945 /* This structure may be extended with new types */ 1947 } DestinationData; 1949 struct { 1950 DestinationType type; 1951 uint8 length; 1952 DestinationData destination_data; 1953 } Destination; 1955 struct { 1956 uint16 compressed_id; /* top bit MUST be 1 */ 1957 } Destination; 1959 If destination structure has its first bit set to 1, then it is a 16 1960 bit integer. If the first bit is not set, then it is a structure 1961 starting with DestinationType. If it is a 16 bit integer, it is 1962 treated as if it were a full structure with a DestinationType of 1963 compressed and a compressed_id that was 2 bytes long with the value 1964 of the 16 bit integer. When the destination structure is not a 16 1965 bit integer, it is the TLV structure with the following contents: 1967 type 1968 The type of the DestinationData Payload Data Unit (PDU). This may 1969 be one of "node", "resource", or "compressed". 1971 length 1972 The length of the destination_data. 1974 destination_value 1975 The destination value itself, which is an encoded DestinationData 1976 structure, depending on the value of "type". 1978 Note: This structure encodes a type, length, value. The length 1979 field specifies the length of the DestinationData values, which 1980 allows the addition of new DestinationTypes. This allows an 1981 implementation which does not understand a given DestinationType 1982 to skip over it. 1984 A DestinationData can be one of three types: 1986 node 1987 A Node-ID. 1989 compressed 1990 A compressed list of Node-IDs and/or resources. Because this 1991 value was compressed by one of the peers, it is only meaningful to 1992 that peer and cannot be decoded by other peers. Thus, it is 1993 represented as an opaque string. 1995 resource 1996 The Resource-ID of the resource which is desired. This type MUST 1997 only appear in the final location of a destination list and MUST 1998 NOT appear in a via list. It is meaningless to try to route 1999 through a resource. 2001 One possible encoding of the 16 bit integer version as an opaque 2002 identifier is to encode an index into a connection table. To avoid 2003 misrouting responses in the event a response is delayed and the 2004 connection table entry has changed, the identifier should be split 2005 between an index and a generation counter for that index. At 2006 startup, the generation counters should be initialized to random 2007 values. An implementation could use 12 bits for the connection table 2008 index and 3 bits for the generation counter. (Note that this does 2009 not suggest a 4096 entry connection table for every node, only the 2010 ability to encode for a larger connection table.) When a connection 2011 table slot is used for a new connection, the generation counter is 2012 incremented (with wrapping). Connection table slots are used on a 2013 rotating basis to maximize the time interval between uses of the same 2014 slot for different connections. When routing a message to an entry 2015 in the destination list encoding a connection table entry, the node 2016 confirms that the generation counter matches the current generation 2017 counter of that index before forwarding the message. If it does not 2018 match, the message is silently dropped. 2020 Regardless of how the 16 bit integer field or opaque DestinationType 2021 is used, the encoding MUST include a generation counter designed to 2022 prevent misrouting of responses due to the connection table entry 2023 having changed since the request message was originally forwarded. 2025 5.3.2.3. Forwarding Options 2027 The Forwarding header can be extended with forwarding header options, 2028 which are a series of ForwardingOptions structures: 2030 enum { directResponseForwarding(1), (255) } ForwardingOptionsType; 2032 struct { 2033 ForwardingOptionsType type; 2034 uint8 flags; 2035 uint16 length; 2036 select (type) { 2037 case directResponseForwarding: 2038 DirectResponseForwardingOption directResponseForwardingOption; 2039 /* This type may be extended */ 2040 } option; 2041 } ForwardingOption; 2043 Each ForwardingOption consists of the following values: 2045 type 2046 The type of the option. This structure allows for unknown options 2047 types. 2049 length 2050 The length of the rest of the structure. 2052 flags 2053 Three flags are defined FORWARD_CRITICAL(0x01), 2054 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2055 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2056 set, any node that would forward the message but does not 2057 understand this options MUST reject the request with an 2058 Error_Unsupported_Forwarding_Option error response. If the 2059 DESTINATION_CRITICAL flag is set, any node that generates a 2060 response to the message but does not understand the forwarding 2061 option MUST reject the request with an 2062 Error_Unsupported_Forwarding_Option error response. If the 2063 RESPONSE_COPY flag is set, any node generating a response MUST 2064 copy the option from the request to the response and clear the 2065 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags. 2067 option 2068 The option value. 2070 5.3.2.4. Direct Return Response Forwarding Options 2072 This section defines an OPTIONAL forwarding option that allows the 2073 originator of a request to signal that the node responsindg to the 2074 request should try to route the response directly to the node that 2075 made the request instead of having the responses traverse the 2076 overlay. : 2078 struct { 2079 AttachReqAns connection_information; 2080 NodeID requesting_node; 2081 } DirectResponseForwardingOption; 2083 Each ForwardingOption consists of the following values: 2085 connection_information 2086 All of the information needed to initiate a new connection to the 2087 requesting node. 2089 requesting_node 2090 The NodeID of the node that originated the request. This is used 2091 to match the TLS certificate. 2093 This option can only be used if the direct-return-response-permitted 2094 flag in the configuration for the overlay is set to TRUE. The 2095 RESPONSE_COPY flag SHOULD be set to false while the FORWARD_CRITICAL 2096 and DESTINATION_CRITICAL SHOULD be set to true. When a node that 2097 supports this forwarding options receives a request with it, it acts 2098 as if it had send an Attache request to the the requesting_node and 2099 it had received the connection_information in the answer. This cases 2100 it to form a new connection directly to that node. Once that is 2101 complete the response to this request is sent over that connection. 2102 If a connection already exists directly to that node, it is used 2103 instead of a a new connection being formed. The connection MAY be 2104 closed at any point but is typically kept open until until it has 2105 noot been used for a signicant period of time or one of the nodes 2106 needs to reclaim resources. 2108 5.3.3. Message Contents Format 2110 The second major part of a RELOAD message is the contents part, which 2111 is defined by MessageContents: 2113 enum { (2^16-1) } MessageExtensionType; 2115 struct { 2116 MessageExtensionType type; 2117 Boolean critical; 2118 opaque extension_contents<0..2^32-1>; 2119 } MessageExtension; 2121 struct { 2122 uint16 message_code; 2123 opaque message_body<0..2^32-1>; 2124 MessageExtensions extensions<0..2^32-1>; 2125 } MessageContents; 2127 The contents of this structure are as follows: 2129 message_code 2130 This indicates the message that is being sent. The code space is 2131 broken up as follows. 2133 0 Reserved 2135 1 .. 0x7fff Requests and responses. These code points are always 2136 paired, with requests being odd and the corresponding response 2137 being the request code plus 1. Thus, "probe_request" (the 2138 Probe request) has value 1 and "probe_answer" (the Probe 2139 response) has value 2 2141 0xffff Error 2143 message_body 2144 The message body itself, represented as a variable-length string 2145 of bytes. The bytes themselves are dependent on the code value. 2146 See the sections describing the various RELOAD methods (Join, 2147 Update, Attach, Store, Fetch, etc.) for the definitions of the 2148 payload contents. 2150 extensions 2151 Extensions to the message. Currently no extensions are defined, 2152 but new extensions can be defined by the process described in 2153 Section 13.13. 2155 All extensions have the following form: 2157 type 2158 The extension type. 2160 critical 2161 Whether this extension must be understood in order to process the 2162 message. If critical = True and the recipient does not understand 2163 the message, it MUST generate an Error_Unknown_Extension error. 2164 If critical = False, the recipient SHOULD choose to process the 2165 message even if it does not understand the extension. 2167 extension_contents 2168 The contents of the extension (extension-dependent). 2170 5.3.3.1. Response Codes and Response Errors 2172 A peer processing a request returns its status in the message_code 2173 field. If the request was a success, then the message code is the 2174 response code that matches the request (i.e., the next code up). The 2175 response payload is then as defined in the request/response 2176 descriptions. 2178 If the request has failed, then the message code is set to 0xffff 2179 (error) and the payload MUST be an error_response PDU, as shown 2180 below. 2182 When the message code is 0xffff, the payload MUST be an 2183 ErrorResponse. 2185 public struct { 2186 uint16 error_code; 2187 opaque error_info<0..2^16-1>; 2188 } ErrorResponse; 2190 The contents of this structure are as follows: 2192 error_code 2193 A numeric error code indicating the error that occurred. 2195 error_info 2196 An optional arbitrary byte string. Unless otherwise specified, 2197 this will be a UTF-8 text string providing further information 2198 about what went wrong. 2200 The following error code values are defined. The numeric values for 2201 these are defined in Section 13.8. 2203 Error_Forbidden: The requesting node does not have permission to 2204 make this request. 2206 Error_Not_Found: The resource or peer cannot be found or does not 2207 exist. 2209 Error_Request_Timeout: A response to the request has not been 2210 received in a suitable amount of time. The requesting node MAY 2211 resend the request at a later time. 2213 Error_Data_Too_Old: A store cannot be completed because the 2214 storage_time precedes the existing value. 2216 Error_Generation_Counter_Too_Low: A store cannot be completed 2217 because the generation counter precedes the existing value. 2219 Error_Incompatible_with_Overlay: A peer receiving the request is 2220 using a different overlay, overlayalgorithm, or hash algorithm. 2222 Error_Unsupported_Forwarding_Option: A peer receiving the request 2223 with a forwarding options flagged as critical but the peer does 2224 not support this option. See section Section 5.3.2.3. 2226 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2227 decremented to zero. See section Section 5.3.2. 2229 Error_Message_Too_Large: A peer receiving the request that was too 2230 large. See section Section 5.6. 2232 Error_Response_Too_Large: A peer would have generated a response 2233 that is too large per the max_response_length field. 2235 Error_Config_Too_Old: A destination peer received a request with a 2236 configuration sequence that's too old. 2238 Error_Config_Too_New: A destination node received a request with a 2239 configuration sequence that's too new. A node which receives this 2240 error MUST generate a Config_Update message to send a new copy of 2241 the configuration document to the node which generated the error. 2243 Error_Unknown_Kind: A destination node received a request with an 2244 unknown kind-id. A node which receives this error MUST generate a 2245 Config_Update message which contains the appropriate kind 2246 definition. 2247 Error_Unknown_Extension: A destination node received a request with 2248 an unknown extension. 2250 5.3.4. Security Block 2252 The third part of a RELOAD message is the security block. The 2253 security block is represented by a SecurityBlock structure: 2255 enum { x509(0), (255) } certificate_type; 2257 struct { 2258 certificate_type type; 2259 opaque certificate<0..2^16-1>; 2260 } GenericCertificate; 2262 struct { 2263 GenericCertificate certificates<0..2^16-1>; 2264 Signature signature; 2265 } SecurityBlock; 2267 The contents of this structure are: 2269 certificates 2270 A bucket of certificates. 2272 signature 2273 A signature over the message contents. 2275 The certificates bucket SHOULD contain all the certificates necessary 2276 to verify every signature in both the message and the internal 2277 message objects. This is the only location in the message which 2278 contains certificates, thus allowing for only a single copy of each 2279 certificate to be sent. In systems which have some alternate 2280 certificate distribution mechanism, some certificates MAY be omitted. 2282 However, implementors should note that this creates the possibility 2283 that messages may not be immediately verifiable because certificates 2284 must first be retrieved. 2286 Each certificate is represented by a GenericCertificate structure, 2287 which has the following contents: 2289 type 2290 The type of the certificate. Only one type is defined: x509 2291 representing an X.509 certificate. 2293 certificate 2294 The encoded version of the certificate. For X.509 certificates, 2295 it is the DER form. 2297 The signature is computed over the payload and parts of the 2298 forwarding header. The payload, in case of a Store, may contain an 2299 additional signature computed over a StoreReq structure. All 2300 signatures are formatted using the Signature element. This element 2301 is also used in other contexts where signatures are needed. The 2302 input structure to the signature computation varies depending on the 2303 data element being signed. 2305 enum {reserved(0), cert_hash(1), (255)} SignerIdentityType; 2307 select (identity_type) { 2308 case cert_hash; 2309 HashAlgorithm hash_alg; 2310 opaque certificate_hash<0..2^8-1>; 2312 /* This structure may be extended with new types if necessary*/ 2313 } SignerIdentityValue; 2315 struct { 2316 SignerIdentityType identity_type; 2317 uint16 length; 2318 SignerIdentityValue identity[SignerIdentity.length]; 2319 } SignerIdentity; 2321 struct { 2322 SignatureAndHashAlgorithm algorithm; 2323 SignerIdentity identity; 2324 opaque signature_value<0..2^16-1>; 2325 } Signature; 2327 The signature construct contains the following values: 2329 algorithm 2330 The signature algorithm in use. The algorithm definitions are 2331 found in the IANA TLS SignatureAlgorithm Registry. 2333 identity 2334 The identity used to form the signature. 2336 signature_value 2337 The value of the signature. 2339 The only currently permitted identity format is a hash of the 2340 signer's certificate. The hash_alg field is used to indicate the 2341 algorithm used to produce the hash. The certificate_hash contains 2342 the hash of the certificate object. The SignerIdentity structure is 2343 typed purely to allow for future (unanticipated) extensibility. 2345 For signatures over messages the input to the signature is computed 2346 over: 2348 overlay + transaction_id + MessageContents + SignerIdentity 2350 where overlay and transaction_id come from the forwarding header and 2351 + indicates concatenation. 2353 The input to signatures over data values is different, and is 2354 described in Section 6.1. 2356 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2357 MUST verify the signature and the authorizing certificate. This 2358 check provides a minimal level of assurance that the sending node is 2359 a valid part of the overlay as well as cryptographic authentication 2360 of the sending node. In addition, responses MUST be checked as 2361 follows: 2363 1. The response to a message sent to a specific Node-ID MUST have 2364 been sent by that Node-ID. 2365 2. The response to a message sent to a Resource-Id MUST have been 2366 sent by a Node-ID which is as close to or closer to the target 2367 Resource-Id than any node in the requesting node's neighbor 2368 table. 2370 The second condition serves as a primitive check for responses from 2371 wildly wrong nodes but is not a complete check. Note that in periods 2372 of churn, it is possible for the requesting node to obtain a closer 2373 neighbor while the request is outstanding. This will cause the 2374 response to be rejected and the request to be retransmitted. 2376 In addition, some methods (especially Store) have additional 2377 authentication requirements, which are described in the sections 2378 covering those methods. 2380 5.4. Overlay Topology 2382 As discussed in previous sections, RELOAD does not itself implement 2383 any overlay topology. Rather, it relies on Topology Plugins, which 2384 allow a variety of overlay algorithms to be used while maintaining 2385 the same RELOAD core. This section describes the requirements for 2386 new topology plugins and the methods that RELOAD provides for overlay 2387 topology maintenance. 2389 5.4.1. Topology Plugin Requirements 2391 When specifying a new overlay algorithm, at least the following need 2392 to be described: 2394 o Joining procedures, including the contents of the Join message. 2395 o Stabilization procedures, including the contents of the Update 2396 message, the frequency of topology probes and keepalives, and the 2397 mechanism used to detect when peers have disconnected. 2398 o Exit procedures, including the contents of the Leave message. 2399 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2400 compute the hash of an identifier. 2401 o The procedures that peers use to route messages. 2402 o The replication strategy used to ensure data redundancy. 2404 All overlay algorithms MUST specify maintenance procedures that send 2405 Updates to clients and peers that have established connections to the 2406 peer responsible for a particular ID when the responsibility for that 2407 ID changes. Because tracking this information is difficult, overlay 2408 algorithms MAY simply specify that an Update is sent to all members 2409 of the Connection Table whenever the range of IDs for which the peer 2410 is responsible changes. 2412 5.4.2. Methods and types for use by topology plugins 2414 This section describes the methods that topology plugins use to join, 2415 leave, and maintain the overlay. 2417 5.4.2.1. Join 2419 A new peer (but one that already has credentials) uses the JoinReq 2420 message to join the overlay. The JoinReq is sent to the responsible 2421 peer depending on the routing mechanism described in the topology 2422 plugin. This notifies the responsible peer that the new peer is 2423 taking over some of the overlay and it needs to synchronize its 2424 state. 2426 struct { 2427 NodeId joining_peer_id; 2428 opaque overlay_specific_data<0..2^16-1>; 2429 } JoinReq; 2431 The minimal JoinReq contains only the Node-ID which the sending peer 2432 wishes to assume. Overlay algorithms MAY specify other data to 2433 appear in this request. 2435 If the request succeeds, the responding peer responds with a JoinAns 2436 message, as defined below: 2438 struct { 2439 opaque overlay_specific_data<0..2^16-1>; 2440 } JoinAns; 2442 If the request succeeds, the responding peer MUST follow up by 2443 executing the right sequence of Stores and Updates to transfer the 2444 appropriate section of the overlay space to the joining peer. In 2445 addition, overlay algorithms MAY define data to appear in the 2446 response payload that provides additional info. 2448 In general, nodes which cannot form connections SHOULD report an 2449 error. However, implementations MUST provide some mechanism whereby 2450 nodes can determine that they are potentially the first node and take 2451 responsibility for the overlay. This specification does not mandate 2452 any particular mechanism, but a configuration flag or setting seems 2453 appropriate. 2455 5.4.2.2. Leave 2457 The LeaveReq message is used to indicate that a node is exiting the 2458 overlay. A node SHOULD send this message to each peer with which it 2459 is directly connected prior to exiting the overlay. 2461 public struct { 2462 NodeId leaving_peer_id; 2463 opaque overlay_specific_data<0..2^16-1>; 2464 } LeaveReq; 2466 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2467 algorithms MAY specify other data to appear in this request. 2469 Upon receiving a Leave request, a peer MUST update its own routing 2470 table, and send the appropriate Store/Update sequences to re- 2471 stabilize the overlay. 2473 5.4.2.3. Update 2475 Update is the primary overlay-specific maintenance message. It is 2476 used by the sender to notify the recipient of the sender's view of 2477 the current state of the overlay (its routing state), and it is up to 2478 the recipient to take whatever actions are appropriate to deal with 2479 the state change. In general, peers send Update messages to all 2480 their adjacencies whenever they detect a topology shift. 2482 When a peer detects through an Update that it is no longer 2483 responsible for any data value it is storing, it MUST attempt to 2484 Store a copy to the correct node unless it knows the the newly 2485 responsible node already has a copy of the data. This prevents data 2486 loss during large-scale topology shifts such as the merging of 2487 partitioned overlays. 2489 The contents of the UpdateReq message are completely overlay- 2490 specific. The UpdateAns response is expected to be either success or 2491 an error. 2493 5.4.2.4. Route_Query 2495 The Route_Query request allows the sender to ask a peer where they 2496 would route a message directed to a given destination. In other 2497 words, a RouteQuery for a destination X requests the Node-ID for the 2498 node that the receiving peer would next route to in order to get to 2499 X. A RouteQuery can also request that the receiving peer initiate an 2500 Update request to transfer the receiving peer's routing table. 2502 One important use of the RouteQuery request is to support iterative 2503 routing. The sender selects one of the peers in its routing table 2504 and sends it a RouteQuery message with the destination_object set to 2505 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2506 responds with information about the peers to which the request would 2507 be routed. The sending peer MAY then use the Attach method to attach 2508 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2509 gets a response from a peer that is closest to the identifier in the 2510 destination_object as determined by the topology plugin. At that 2511 point, the sender can send messages directly to that peer. 2513 5.4.2.4.1. Request Definition 2515 A RouteQueryReq message indicates the peer or resource that the 2516 requesting node is interested in. It also contains a "send_update" 2517 option allowing the requesting node to request a full copy of the 2518 other peer's routing table. 2520 struct { 2521 Boolean send_update; 2522 Destination destination; 2523 opaque overlay_specific_data<0..2^16-1>; 2524 } RouteQueryReq; 2526 The contents of the RouteQueryReq message are as follows: 2528 send_update 2529 A single byte. This may be set to "true" to indicate that the 2530 requester wishes the responder to initiate an Update request 2531 immediately. Otherwise, this value MUST be set to "false". 2533 destination 2534 The destination which the requester is interested in. This may be 2535 any valid destination object, including a Node-ID, compressed ids, 2536 or Resource-ID. 2538 overlay_specific_data 2539 Other data as appropriate for the overlay. 2541 5.4.2.4.2. Response Definition 2543 A response to a successful RouteQueryReq request is a RouteQueryAns 2544 message. This is completely overlay specific. 2546 5.4.2.5. Probe 2548 Probe provides primitive "exploration" services: it allows node to 2549 determine which resources another node is responsible for; and it 2550 allows some discovery services using multicast, anycast, or 2551 broadcast. A probe can be addressed to a specific Node-ID, or the 2552 peer controlling a given location (by using a resource ID). In 2553 either case, the target Node-IDs respond with a simple response 2554 containing some status information. 2556 5.4.2.5.1. Request Definition 2558 The ProbeReq message contains a list (potentially empty) of the 2559 pieces of status information that the requester would like the 2560 responder to provide. 2562 enum { responsible_set(1), num_resources(2), uptime(3), (255)} 2563 ProbeInformationType; 2565 struct { 2566 ProbeInformationType requested_info<0..2^8-1>; 2567 } ProbeReq 2569 The currently defined values for ProbeInformation are: 2571 responsible_set 2572 indicates that the peer should Respond with the fraction of the 2573 overlay for which the responding peer is responsible. 2575 num_resources 2576 indicates that the peer should Respond with the number of 2577 resources currently being stored by the peer. 2579 uptime 2580 indicates that the peer should Respond with how long the peer has 2581 been up in seconds. 2583 5.4.2.5.2. Response Definition 2585 A successful ProbeAns response contains the information elements 2586 requested by the peer. 2588 struct { 2589 select (type) { 2590 case responsible_set: 2591 uint32 responsible_ppb; 2593 case num_resources: 2594 uint32 num_resources; 2596 case uptime: 2597 uint32 uptime; 2598 /* This type may be extended */ 2600 }; 2601 } ProbeInformationData; 2603 struct { 2604 ProbeInformationType type; 2605 uint8 length; 2606 ProbeInformationData value; 2607 } ProbeInformation; 2609 struct { 2610 ProbeInformation probe_info<0..2^16-1>; 2611 } ProbeAns; 2613 A ProbeAns message contains a sequence of ProbeInformation 2614 structures. Each has a "length" indicating the length of the 2615 following value field. This structure allows for unknown options 2616 types. 2618 Each of the current possible Probe information types is a 32-bit 2619 unsigned integer. For type "responsible_ppb", it is the fraction of 2620 the overlay for which the peer is responsible in parts per billion. 2621 For type "num_resources", it is the number of resources the peer is 2622 storing. For the type "uptime" it is the number of seconds the peer 2623 has been up. 2625 The responding peer SHOULD include any values that the requesting 2626 node requested and that it recognizes. They SHOULD be returned in 2627 the requested order. Any other values MUST NOT be returned. 2629 5.5. Forwarding and Link Management Layer 2631 Each node maintains connections to a set of other nodes defined by 2632 the topology plugin. This section defines the methods RELOAD uses to 2633 form and maintain connections between nodes in the overlay. Three 2634 methods are defined: 2636 Attach: used to form RELOAD connections between nodes. When node 2637 A wants to connect to node B, it sends an Attach message to node B 2638 through the overlay. The Attach contains A's ICE parameters. B 2639 responds with its ICE parameters and the two nodes perform ICE to 2640 form connection. Attach also allows two nodes to connect via No- 2641 ICE instead of full ICE. 2642 AppAttach: used to form application layer connections between 2643 nodes. 2644 Ping: is a simple request/response which is used to verify 2645 connectivity of the target peer. 2647 5.5.1. Attach 2649 A node sends an Attach request when it wishes to establish a direct 2650 TCP or UDP connection to another node for the purpose of sending 2651 RELOAD messages. 2653 As described in Section 5.1, an Attach may be routed to either a 2654 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2655 will fail if that node is not reached. An Attach routed to a 2656 Resource-ID will establish a connection with the peer currently 2657 responsible for that Resource-ID, which may be useful in establishing 2658 a direct connection to the responsible peer for use with frequent or 2659 large resource updates. 2661 An Attach in and of itself does not result in updating the routing 2662 table of either node. That function is performed by Updates. If 2663 node A has Attached to node B, but not received any Updates from B, 2664 it MAY route messages which are directly addressed to B through that 2665 channel but MUST NOT route messages through B to other peers via that 2666 channel. The process of Attaching is separate from the process of 2667 becoming a peer (using Join and Update), to prevent half-open states 2668 where a node has started to form connections but is not really ready 2669 to act as a peer. Thus, clients (unlike peers) can simply Attach 2670 without sending Join or Update. 2672 5.5.1.1. Request Definition 2674 An Attach request message contains the requesting node ICE connection 2675 parameters formatted into a binary structure. 2677 enum { reserved(0), DTLS-UDP-SR(1), 2678 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2679 (255) } OverlayLinkType; 2681 enum { reserved(0), host(1), srflx(2), prflx(3), relay(4), 2682 (255) } CandType; 2684 struct { 2685 opaque name<2^16-1>; 2686 opaque value<2^16-1>; 2687 } IceExtension; 2689 struct { 2690 IpAddressPort addr_port; 2691 OverlayLinkType overlay_link; 2692 opaque foundation<0..255>; 2693 uint32 priority; 2694 CandType type; 2695 select (type){ 2696 case host: 2697 ; /* Nothing */ 2698 case srflx: 2699 case prflx: 2700 case relay: 2701 IpAddressPort rel_addr_port; 2702 } 2703 IceExtension extensions<0..2^16-1>; 2704 } IceCandidate; 2706 struct { 2707 opaque ufrag<0..2^8-1>; 2708 opaque password<0..2^8-1>; 2709 opaque role<0..2^8-1>; 2710 IceCandidate candidates<0..2^16-1>; 2711 Boolean send_update; 2712 } AttachReqAns; 2714 The values contained in AttachReqAns are: 2716 ufrag 2717 The username fragment (from ICE). 2719 password 2720 The ICE password. 2722 role 2723 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2724 value MUST be 'passive' for the offerer (the peer sending the 2725 Attach request) and 'active' for the answerer (the peer sending 2726 the Attach response). 2728 candidates 2729 One or more ICE candidate values, as described below. 2730 send_update 2731 Has the same meaning as the send_update field in RouteQueryReq. 2733 Each ICE candidate is represented as an IceCandidate structure, which 2734 is a direct translation of the information from the ICE string 2735 structures, with the exception of the component ID. Since there is 2736 only one component, it is always 1, and thus left out of the PDU. 2737 The remaining values are specified as follows: 2739 addr_port 2740 corresponds to the connection-address and port productions. 2742 overlay_link 2743 corresponds to the OverlayLinkType production, Overlay Link 2744 protocols used with No-ICE MUST specify "No-ICE" in their 2745 description. Future overlay link values can be added be defining 2746 new OverlayLinkType values in the IANA registry in Section 13.9. 2747 Future extensions to the encapsulation or framing that provide for 2748 backward compatibility with that specified by a previously defined 2749 OverlayLinkType values MUST use that previous value. 2750 OverlayLinkType protocols are defined in Section 5.6 2751 A single AttachReqAns MUST NOT include both candidates whose 2752 OverlayLinkType protocols use ICE (the default) and candidates 2753 that specify "No-ICE". 2755 foundation 2756 corresponds to the foundation production. 2758 priority 2759 corresponds to the priority production. 2761 type 2762 corresponds to the cand-type production. 2764 rel_addr_port 2765 corresponds to the rel-addr and rel-port productions. Only 2766 present for type "relay". 2768 extensions 2769 ICE extensions. The name and value fields correspond to binary 2770 translations of the equivalent fields in the ICE extensions. 2772 These values should be generated using the procedures described in 2773 Section 5.5.1.3. 2775 5.5.1.2. Response Definition 2777 If a peer receives an Attach request, it SHOULD process the request 2778 and generate its own response with a AttachReqAns. It should then 2779 begin ICE checks. When a peer receives an Attach response, it SHOULD 2780 parse the response and begin its own ICE checks. 2782 5.5.1.3. Using ICE With RELOAD 2784 This section describes the profile of ICE that is used with RELOAD. 2785 RELOAD implementations MUST implement full ICE. 2787 In ICE as defined by [RFC5245], SDP is used to carry the ICE 2788 parameters. In RELOAD, this function is performed by a binary 2789 encoding in the Attach method. This encoding is more restricted than 2790 the SDP encoding because the RELOAD environment is simpler: 2792 o Only a single media stream is supported. 2793 o In this case, the "stream" refers not to RTP or other types of 2794 media, but rather to a connection for RELOAD itself or for SIP 2795 signaling. 2796 o RELOAD only allows for a single offer/answer exchange. Unlike the 2797 usage of ICE within SIP, there is never a need to send a 2798 subsequent offer to update the default candidates to match the 2799 ones selected by ICE. 2801 An agent follows the ICE specification as described in [RFC5245] with 2802 the changes and additional procedures described in the subsections 2803 below. 2805 5.5.1.4. Collecting STUN Servers 2807 ICE relies on the node having one or more STUN servers to use. In 2808 conventional ICE, it is assumed that nodes are configured with one or 2809 more STUN servers through some out-of-band mechanism. This is still 2810 possible in RELOAD but RELOAD also learns STUN servers as it connects 2811 to other peers. Because all RELOAD peers implement ICE and use STUN 2812 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2813 peer a node knows will be willing to be a STUN server -- though of 2814 course it may be behind a NAT. 2816 A peer on a well-provisioned wide-area overlay will be configured 2817 with one or more bootstrap nodes. These nodes make an initial list 2818 of STUN servers. However, as the peer forms connections with 2819 additional peers, it builds more peers it can use as STUN servers. 2821 Because complicated NAT topologies are possible, a peer may need more 2822 than one STUN server. Specifically, a peer that is behind a single 2823 NAT will typically observe only two IP addresses in its STUN checks: 2824 its local address and its server reflexive address from a STUN server 2825 outside its NAT. However, if there are more NATs involved, it may 2826 learn additional server reflexive addresses (which vary based on 2827 where in the topology the STUN server is). To maximize the chance of 2828 achieving a direct connection, a peer SHOULD group other peers by the 2829 peer-reflexive addresses it discovers through them. It SHOULD then 2830 select one peer from each group to use as a STUN server for future 2831 connections. 2833 Only peers to which the peer currently has connections may be used. 2834 If the connection to that host is lost, it MUST be removed from the 2835 list of stun servers and a new server from the same group SHOULD be 2836 selected. 2838 5.5.1.5. Gathering Candidates 2840 When a node wishes to establish a connection for the purposes of 2841 RELOAD signaling or application signaling, it follows the process of 2842 gathering candidates as described in Section 4 of ICE [RFC5245]. 2843 RELOAD utilizes a single component. Consequently, gathering for 2844 these "streams" requires a single component. In the case where a 2845 node has not yet found a TURN server, the agent would not include a 2846 relayed candidate. 2848 The ICE specification assumes that an ICE agent is configured with, 2849 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2850 for an agent to learn these by querying the overlay, as described in 2851 Section 5.5.1.4 and Section 8. 2853 The default candidate selection described in Section 4.1.4 of ICE is 2854 ignored; defaults are not signaled or utilized by RELOAD. 2856 An alternative to using the full ICE supported by the Attach request 2857 is to use No-ICE mechanism by providing candidates with "No-ICE" 2858 Overlay Link protocols. Configuration for the overlay indicates 2859 whether or not these Overlay Link protocols can be used. A node MUST 2860 only use ICE or No-ICE candidates within one overlay instance. No- 2861 ICE will not work in all of the scenarios where ICE would work, but 2862 in some cases, particularly those with no NATs or firewalls, it will 2863 work. It is RECOMMENDED that full ICE be used even for a node that 2864 has a public, unfiltered IP address, to take advantage of STUN 2865 connectivity checks, etc. 2867 5.5.1.6. Prioritizing Candidates 2869 At the time of writing, UDP is the only transport protocol specified 2870 to work with ICE. However, standardization of additional protocols 2871 for use with ICE is expected, including TCP and datagram-oriented 2872 protocols such as SCTP and DCCP. In particular, UDP encapsulations 2873 for SCTP and DCCP are expected to be standardized in the near future, 2874 greatly expanding the available Overlay Link protocols available for 2875 RELOAD. When additional protocols are available, the following 2876 prioritization is RECOMMENDED: 2878 o Highest priority is assigned to message-oriented protocols that 2879 offer well-understood congestion and flow control without head-of- 2880 line blocking. For example, SCTP without message ordering, DCCP, 2881 or those protocols encapsulated using UDP. 2882 o Second highest priority is assigned to stream-oriented protocols, 2883 e.g. TCP. 2884 o Lowest priority is assigned to protocols encapsulated over UDP 2885 that do not implement well-established congestion control 2886 algorithms. For example, the DTLS/UDP with SR overlay link 2887 protocol. 2889 5.5.1.7. Encoding the Attach Message 2891 Section 4.3 of ICE describes procedures for encoding the SDP for 2892 conveying RELOAD candidates. Instead of actually encoding an SDP, 2893 the candidate information (IP address and port and transport 2894 protocol, priority, foundation, type and related address) is carried 2895 within the attributes of the Attach request or its response. 2896 Similarly, the username fragment and password are carried in the 2897 Attach message or its response. Section 5.5.1 describes the detailed 2898 attribute encoding for Attach. The Attach request and its response 2899 do not contain any default candidates or the ice-lite attribute, as 2900 these features of ICE are not used by RELOAD. 2902 Since the Attach request contains the candidate information and short 2903 term credentials, it is considered as an offer for a single media 2904 stream that happens to be encoded in a format different than SDP, but 2905 is otherwise considered a valid offer for the purposes of following 2906 the ICE specification. Similarly, the Attach response is considered 2907 a valid answer for the purposes of following the ICE specification. 2909 5.5.1.8. Verifying ICE Support 2911 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2912 of ICE. Since RELOAD requires full ICE from all agents, this check 2913 is not required. 2915 5.5.1.9. Role Determination 2917 The roles of controlling and controlled as described in Section 5.2 2918 of ICE are still utilized with RELOAD. However, the offerer (the 2919 entity sending the Attach request) will always be controlling, and 2920 the answerer (the entity sending the Attach response) will always be 2921 controlled. The connectivity checks MUST still contain the ICE- 2922 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2923 role reversal capability for which they are defined will never be 2924 needed with RELOAD. This is to allow for a common codebase between 2925 ICE for RELOAD and ICE for SDP. 2927 5.5.1.10. Full ICE 2929 When neither side has provided an No-ICE candidate, connectivity 2930 checks and nominations are used as in regular ICE. 2932 5.5.1.10.1. Connectivity Checks 2934 The processes of forming check lists in Section 5.7 of ICE, 2935 scheduling checks in Section 5.8, and checking connectivity checks in 2936 Section 7 are used with RELOAD without change. 2938 5.5.1.10.2. Concluding ICE 2940 The controlling agent MUST utilize regular nomination. This is to 2941 ensure consistent state on the final selected pairs without the need 2942 for an updated offer, as RELOAD does not generate additional offer/ 2943 answer exchanges. 2945 The procedures in Section 8 of ICE are followed to conclude ICE, with 2946 the following exceptions: 2948 o The controlling agent MUST NOT attempt to send an updated offer 2949 once the state of its single media stream reaches Completed. 2950 o Once the state of ICE reaches Completed, the agent can immediately 2951 free all unused candidates. This is because RELOAD does not have 2952 the concept of forking, and thus the three second delay in Section 2953 8.3 of ICE does not apply. 2955 5.5.1.10.3. Media Keepalives 2957 STUN MUST be utilized for the keepalives described in Section 10 of 2958 ICE. 2960 5.5.1.11. No-ICE 2962 No-ICE is selected when either side has provided "no ICE" Overlay 2963 Link candidates. STUN is not used for connectivity checks when doing 2964 No-ICE; instead the DTLS or TLS handshake (or similar security layer 2965 of future overlay link protocols) forms the connectivity check. The 2966 certificate exchanged during the (D)TLS handshake must match the node 2967 that sent the AttachReqAns and if it does not, the connection MUST be 2968 closed. 2970 5.5.1.11.1. Implementation Notes for No-ICE 2972 This is a non-normative section to help implementors. 2974 At times ICE can seem a bit daunting to get one's head around. For a 2975 simple IPv4 only peer, a simple implementation of No-ICE could be 2976 done by doing the following: 2977 o When sending an AttachReqAns, form one candidate with a priority 2978 value of (2^24)*(126)+(2^8)*(65535)+(2^0)*(256-1) that specifies 2979 the UDP port being listened to and another one with the TCP port. 2980 o Check the certificate received in the TLS handshake has the same 2981 Node-ID as the node that has sent the AttachReqAns. If multiple 2982 connections succeed, close all but the one with highest priority. 2983 o Do normal TLS and DTLS with no need for any special framing or 2984 STUN processing. 2986 5.5.1.12. Subsequent Offers and Answers 2988 An agent MUST NOT send a subsequent offer or answer. Thus, the 2989 procedures in Section 9 of ICE MUST be ignored. 2991 5.5.1.13. Sending Media 2993 The procedures of Section 11 apply to RELOAD as well. However, in 2994 this case, the "media" takes the form of application layer protocols 2995 (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE 2996 processing completes, the agent will begin TLS or DTLS procedures to 2997 establish a secure connection. The node which sent the Attach 2998 request MUST be the TLS server. The other node MUST be the TLS 2999 client. The server MUST request TLS client authentication. The 3000 nodes MUST verify that the certificate presented in the handshake 3001 matches the identity of the other peer as found in the Attach 3002 message. Once the TLS or DTLS signaling is complete, the application 3003 protocol is free to use the connection. 3005 The concept of a previous selected pair for a component does not 3006 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3008 5.5.1.14. Receiving Media 3010 An agent MUST be prepared to receive packets for the application 3011 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3012 time. The jitter and RTP considerations in Section 11 of ICE do not 3013 apply to RELOAD. 3015 5.5.2. AppAttach 3017 A node sends an AppAttach request when it wishes to establish a 3018 direct connection to another node for the purposes of sending 3019 application layer messages. AppAttach is basically like Attach, 3020 except for the purpose of the connection. A separate request is used 3021 to avoid implementor confusion between the two methods (this was 3022 found to be a real problem with initial implementations). The 3023 AppAttach request and its response contain an application attribute, 3024 which indicates what protocol is to be run over the connection. 3026 5.5.2.1. Request Definition 3028 An AppAttachReq message contains the requesting node's ICE connection 3029 parameters formatted into a binary structure. 3031 struct { 3032 opaque ufrag<0..2^8-1>; 3033 opaque password<0..2^8-1>; 3034 uint16 application; 3035 opaque role<0..2^8-1>; 3036 IceCandidate candidates<0..2^16-1>; 3037 } AppAttachReq; 3039 The values contained in AppAttachReq and AppAttachAns are: 3041 ufrag 3042 The username fragment (from ICE) 3044 password 3045 The ICE password. 3047 application 3048 A 16-bit application-id as defined in the Section 13.4. This 3049 number represents the IANA registered applications that is going 3050 to be sent data on this connection. For SIP, this is 5060 or 3051 5061. 3053 role 3054 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3056 candidates 3057 One or more ICE candidate values 3059 5.5.2.2. Response Definition 3061 If a peer receives an AppAttach request, it SHOULD process the 3062 request and generate its own response with a AppAttachAns. It should 3063 then begin ICE checks. When a peer receives an AppAttach response, 3064 it SHOULD parse the response and begin its own ICE checks. 3066 struct { 3067 opaque ufrag<0..2^8-1>; 3068 opaque password<0..2^8-1>; 3069 uint16 application; 3070 opaque role<0..2^8-1>; 3071 IceCandidate candidates<0..2^16-1>; 3072 } AppAttachAns; 3074 The meaning of the fields is the same as in the AppAttachReq. 3076 5.5.3. Ping 3078 Ping is used to test connectivity along a path. A ping can be 3079 addressed to a specific Node-ID, to the peer controlling a given 3080 location (by using a resource ID), or to the broadcast Node-ID 3081 (2^128-1). 3083 5.5.3.1. Request Definition 3085 struct { 3086 } PingReq 3088 5.5.3.2. Response Definition 3090 A successful PingAns response contains the information elements 3091 requested by the peer. 3093 struct { 3094 uint64 response_id; 3095 uint64 time; 3096 } PingAns; 3098 A PingAns message contains the following elements: 3100 response_id 3101 A randomly generated 64-bit response ID. This is used to 3102 distinguish Ping responses. 3104 time 3105 The time when the ping responses was created in absolute time, 3106 represented in milliseconds since midnight Jan 1, 1970 which is 3107 the UNIX epoch. 3109 5.5.4. Config_Update 3111 The Config_Update method is used to push updated configuration data 3112 across the overlay. Whenever a node detects that another node has 3113 old configuration data, it MUST generate a Config_Update request. 3114 The Config_Update request allows updating of two kinds of data: the 3115 configuration data (Section 5.3.2.1) and kind information 3116 (Section 6.4.1.1). 3118 5.5.4.1. Request Definition 3120 enum { reserved(0), config(1), kind(2), (255) } 3121 Config_UpdateType; 3123 typedef opaque KindDescription<2^16-1>; 3125 struct { 3126 Config_UpdateType type; 3127 uint32 length; 3129 select (type) { 3130 case config: 3131 opaque config_data<2^24-1>; 3133 case kind: 3134 KindDescription kinds<2^24-1>; 3136 /* This structure may be extended with new types*/ 3137 }; 3138 } Config_UpdateReq; 3140 The Config_UpdateReq message contains the following elements: 3142 type 3143 The type of the contents of the message. This structure allows 3144 for unknown content types. 3145 length 3146 The length of the remainder of the message. This is included to 3147 preserve backward compatibility and is 32 bits instead of 24 to 3148 facilitate easy conversion between network and host byte order. 3149 config_data (type==config) 3150 The contents of the configuration document. 3151 kinds (type==kind) 3152 One or more XML kind-block productions (see Section 10.1). These 3153 MUST be encoded with UTF-8 and assume a default namespace of 3154 "urn:ietf:params:xml:ns:p2p:config-base". 3156 5.5.4.2. Response Definition 3158 struct { 3159 } Config_UpdateReq 3161 If the Config_UpdateReq is of type "config" it MUST only be processed 3162 if all the following are true: 3164 o The sequence number in the document is greater than the current 3165 configuration sequence number. 3166 o The configuration document is correctly digitally signed (see 3167 Section 10 for details on signatures. 3168 Otherwise appropriate errors MUST be generated. 3170 If the Config_UpdateReq is of type "kind" it MUST only be processed 3171 if it is correctly digitally signed by an acceptable kind signer as 3172 specified in the configuraton file. Details on kind-signer field in 3173 the configuration file is described in Section 10.1. In addition, if 3174 the kind update conflicts with an existing known kind (i.e., it is 3175 signed by a different signer), then it should be rejected with 3176 "Error_Forbidden". This should not happen in correctly functioning 3177 overlays. 3179 If the update is acceptable, then the node MUST reconfigure itself to 3180 match the new information. This may include adding permissions for 3181 new kinds, deleting old kinds, or even, in extreme circumstances, 3182 exiting and reentering the overlay, if, for instance, the DHT 3183 algorithm has changed. 3185 The response for Config_Update is empty. 3187 5.6. Overlay Link Layer 3189 RELOAD can use multiple Overlay Link protocols to send its messages. 3190 Because ICE is used to establish connections (see Section 5.5.1.3), 3191 RELOAD nodes are able to detect which Overlay Link protocols are 3192 offered by other nodes and establish connections between them. Any 3193 link protocol needs to be able to establish a secure, authenticated 3194 connection and to provide data origin authentication and message 3195 integrity for individual data elements. RELOAD currently supports 3196 three Overlay Link protocols: 3198 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3199 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3200 o DTLS [RFC4347] over UDP with SR, No-ICE 3202 Note that although UDP does not properly have "connections", both TLS 3203 and DTLS have a handshake which establishes a similar, stateful 3204 association, and we simply refer to these as "connections" for the 3205 purposes of this document. 3207 If a peer receives a message that is larger than value of max- 3208 message-size defined in the overlay configuration, the peer SHOULD 3209 send an Error_Message_Too_Large error and then close the TLS or DTLS 3210 session from which the message was received. Note that this error 3211 can be sent and the session closed before receiving the complete 3212 message. If the forwarding header is larger than the max-message- 3213 size, the receiver SHOULD close the TLS or DTLS session without 3214 sending an error. 3216 The Framing Header (FH) is used to frame messages and provide timing 3217 when used on a reliable stream-based transport protocol. Simple 3218 Reliability (SR) makes use of the FH to provide congestion control 3219 and semi-reliability when using unreliable message-oriented transport 3220 protocols. We will first define each of these algorithms, then 3221 define overlay link protocols that use them. 3223 Note: We expect future Overlay Link protocols to define replacements 3224 for all components of these protocols, including the framing header. 3225 These protocols have been chosen for simplicity of implementation and 3226 reasonable performance. 3228 Note to implementers: There are inherent tradeoffs in utilizing 3229 short timeouts to determine when a link has failed. To balance the 3230 tradeoffs, an implementation should be able to quickly act to remove 3231 entries from the routing table when there is reason to suspect the 3232 link has failed. For example, in a Chord-derived overlay algorithm, 3233 a closer finger table entry could be substituted for an entry in the 3234 finger table that has experienced a timeout. That entry can be 3235 restored if it proves to resume functioning, or replaced at some 3236 point in the future if necessary. End-to-end retransmissions will 3237 handle any lost messages, but only if the failing entries do not 3238 remain in the finger table for subsequent retransmissions. 3240 5.6.1. Future Overlay Link Protocols 3242 The only currently defined overlay link protocols are TLS and DTLS. 3243 It is possible to define new link-layer protocols and apply them to a 3244 new overlay using the "overlay-link-protocol" configuration directive 3245 (see Section 10.1.). However, any new protocols MUST meet the 3246 following requirements. 3248 Endpoint authentication When a node forms an association with 3249 another endpoint, it MUST be possible to cryptographically verify 3250 that the endpoint has a given NodeId. 3252 Traffic origin authentication and integrity When a node receives 3253 traffic from another endpoint, it MUST be possible to 3254 cryptographically verify that the traffic came from a given 3255 association and that it has not been modified in transit from the 3256 other endpoint in the association. The overlay link protocol MUST 3257 also provide replay prevention/detection. 3259 Traffic confidentiality When a node sends traffic to another 3260 endpoint, it MUST NOT be possible for a third party not involved 3261 in the association to determine the contents of that traffic. 3263 Any new overlay protocol MUST be defined via RFC 5226 Standards 3264 Action; see Section 13.10. 3266 5.6.1.1. HIP 3268 The P2PSIP Working Group has expressed interest in supporting a HIP- 3269 based link protocol [RFC5201]. Such support would require specifying 3270 such details as: 3272 o How to issue certificates which provided identities meaningful to 3273 the HIP base exchange. We anticipate that this would require a 3274 mapping between ORCHIDs and NodeIds. 3275 o How to carry the HIP I1 and I2 messages. We anticipate that this 3276 would require defining a HIP Tunnel usage. 3277 o How to carry RELOAD messages over HIP. 3279 5.6.1.2. ICE-TCP 3281 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] should allow TCP to be 3282 supported as an Overlay Link protocol that can be added using ICE. 3283 However, as of the time of this writing, the draft is not making 3284 significant progress toward approval. 3286 5.6.1.3. Message-oriented Transports 3288 Modern message-oriented transports offer high performance, good 3289 congestion control, and avoid head-of-line blocking in case of lost 3290 data. These characteristics make them preferable as underlying 3291 transport protocols for RELOAD links. SCTP without message ordering 3292 and DCCP are two examples of such protocols. However, currently they 3293 are not well-supported by commonly available NATs, and specifications 3294 for ICE session establishment are not available. 3296 5.6.1.4. Tunneled Transports 3298 As of the time of this writing, there is significant interest in the 3299 IETF community in tunneling other transports over UDP, motivated by 3300 the situation that UDP is well-supported by modern NAT hardware, and 3301 similar performance can be achieved to native implementation. 3302 Currently SCTP, DCCP, and a generic tunneling extension are being 3303 proposed for message-oriented protocols. Baset et al. have proposed 3304 tunneling TCP over UDP for similar reasons 3305 [I-D.baset-tsvwg-tcp-over-udp]. Once ICE traversal has been 3306 specified for these tunneled protocols, they should be easily 3307 supported as an overlay link protocol. 3309 5.6.2. Framing Header 3311 In order to support unreliable links and to allow for quick detection 3312 of link failures when using reliable end-to-end transports, each 3313 message is wrapped in a very simple framing layer (FramedMessage) 3314 which is only used for each hop. This layer contains a sequence 3315 number which can then be used for ACKs. The same header is used for 3316 both reliable and unreliable transports for simplicity of 3317 implementation---not all aspects of the header apply to both types of 3318 transports. 3320 The definition of FramedMessage is: 3322 enum {data (128), ack (129), (255)} FramedMessageType; 3324 struct { 3325 FramedMessageType type; 3327 select (type) { 3328 case data: 3329 uint32 sequence; 3330 opaque message<0..2^24-1>; 3332 case ack: 3333 uint32 ack_sequence; 3334 uint32 received; 3335 }; 3336 } FramedMessage; 3338 The type field of the PDU is set to indicate whether the message is 3339 data or an acknowledgement. 3341 If the message is of type "data", then the remainder of the PDU is as 3342 follows: 3344 sequence 3345 the sequence number. This increments by 1 for each framed message 3346 sent over this transport session. 3348 message 3349 the message that is being transmitted. 3351 Each connection has it own sequence number space. Initially the 3352 value is zero and it increments by exactly one for each message sent 3353 over that connection. 3355 When the receiver receives a message, it SHOULD immediately send an 3356 ACK message. The receiver MUST keep track of the 32 most recent 3357 sequence numbers received on this association in order to generate 3358 the appropriate ack. 3360 If the PDU is of type "ack", the contents are as follows: 3362 ack_sequence 3363 The sequence number of the message being acknowledged. 3365 received 3366 A bitmask indicating if each of the previous 32 sequence numbers 3367 before this packet has been among the 32 packets most recently 3368 received on this connection. When a packet is received with a 3369 sequence number N, the receiver looks at the sequence number of 3370 the previously 32 packets received on this connection. Call the 3371 previously received packet number M. For each of the previous 32 3372 packets, if the sequence number M is less than N but greater than 3373 N-32, the N-M bit of the received bitmask is set to one; otherwise 3374 it is zero. Note that a bit being set to one indicates positively 3375 that a particular packet was received, but a bit being set to zero 3376 means only that it is unknown whether or not the packet has been 3377 received, because it might have been received before the 32 most 3378 recently received packets. 3380 The received field bits in the ACK provide a very high degree of 3381 redundancy so that the sender can figure out which packets the 3382 receiver has received and can then estimate packet loss rates. If 3383 the sender also keeps track of the time at which recent sequence 3384 numbers have been sent, the RTT can be estimated. 3386 5.6.3. Simple Reliability 3388 When RELOAD is carried over DTLS or another unreliable link protocol, 3389 it needs to be used with a reliability and congestion control 3390 mechanism, which is provided on a hop-by-hop basis. The basic 3391 principle is that each message, regardless of whether or not it 3392 carries a request or response, will get an ACK and be reliably 3393 retransmitted. The receiver's job is very simple, limited to just 3394 sending ACKs. All the complexity is at the sender side. This allows 3395 the sending implementation to trade off performance versus 3396 implementation complexity without affecting the wire protocol. 3398 5.6.3.1. Retransmission and Flow Control 3400 Because the receiver's role is limited to providing packet 3401 acknowledgements, a wide variety of congestion control algorithms can 3402 be implemented on the sender side while using the same basic wire 3403 protocol. Senders MUST implement a retransmission and congestion 3404 control scheme no more aggressive then TFRC[RFC5348]. One way to do 3405 that is for senders to implement the scheme in the following section. 3406 Another alternative would be TFRC-SP [RFC4828] and use the received 3407 bitmask to allow the sender to compute packet loss event rates. 3409 5.6.3.1.1. Trivial Retransmission 3411 A peer SHOULD retransmit a message if it has not received an ACK 3412 after an interval of RTO ("Retransmission TimeOut"). The peer MUST 3413 double the time to wait after each retransmission. In each 3414 retransmission, the sequence number is incremented. 3416 The RTO is an estimate of the round-trip time (RTT). Implementations 3417 can use a static value for RTO or a dynamic estimate which will 3418 result in better performance. For implementations that use a static 3419 value, the default value for RTO is 500 ms. Nodes MAY use smaller 3420 values of RTO if it is known that all nodes are within the local 3421 network. The default RTO MAY be chosen larger, and this is 3422 RECOMMENDED if it is known in advance (such as on high latency access 3423 links) that the round-trip time is larger. 3425 Implementations that use a dynamic estimate to compute the RTO MUST 3426 use the algorithm described in RFC 2988[RFC2988], with the exception 3427 that the value of RTO SHOULD NOT be rounded up to the nearest second 3428 but instead rounded up to the nearest millisecond. The RTT of a 3429 successful STUN transaction from the ICE stage is used as the initial 3430 measurement for formula 2.2 of RFC 2988. The sender keeps track of 3431 the time each message was sent for all recently sent messages. Any 3432 time an ACK is received, the sender can compute the RTT for that 3433 message by looking at the time the ACK was received and the time when 3434 the message was sent. This is used as a subsequent RTT measurement 3435 for formula 2.3 of RFC 2988 to update the RTO estimate. (Note that 3436 because retransmissions receive new sequence numbers, all received 3437 ACKs are used.) 3439 The value for RTO is calculated separately for each DTLS session. 3441 Retransmissions continue until a response is received, or until a 3442 total of 5 requests have been sent or there has been a hard ICMP 3443 error [RFC1122]. The sender knows a response was received when it 3444 receives an ACK with a sequence number that indicates it is a 3445 response to one of the transmissions of this messages. For example, 3446 assuming an RTO of 500 ms, requests would be sent at times 0 ms, 500 3447 ms, 1500 ms, 3500 ms, and 7500 ms. If all retransmissions for a 3448 message fail, then the sending node SHOULD close the connection 3449 routing the message. 3451 To determine when a link may be failing without waiting for the final 3452 timeout, observe when no ACKs have been received for an entire RTO 3453 interval, and then wait for three retransmissions to occur beyond 3454 that point. If no ACKs have been received by the time the third 3455 retransmission occurs, it is RECOMMENDED that the link be removed 3456 from the routing table. The link MAY be restored to the routing 3457 table if ACKs resume before the connection is closed, as described 3458 above. 3460 Once an ACK has been received for a message, the next message can be 3461 sent, but the peer SHOULD ensure that there is at least 10 ms between 3462 sending any two messages. The only time a value less than 10 ms can 3463 be used is when it is known that all nodes are on a network that can 3464 support retransmissions faster than 10 ms with no congestion issues. 3466 5.6.4. DTLS/UDP with SR 3468 This overlay link protocol consists of DTLS over UDP while 3469 implementing the Simple Reliability protocol. STUN Connectivity 3470 checks and keepalives are used. 3472 5.6.5. TLS/TCP with FH, No-ICE 3474 This overlay link protocol consists of TLS over TCP with the framing 3475 header. Because ICE is not used, STUN connectivity checks are not 3476 used upon establishing the TCP connection, nor are they used for 3477 keepalives. 3479 Because the TCP layer's application-level timeout is too slow to be 3480 useful for overlay routing, the Overlay Link implementation MUST 3481 using the framing header to measure the RTT of the connection and 3482 calculate an RTO as specified in Section 2 of [RFC2988]. The 3483 resulting RTO is not used for retransmissions, but as a timeout to 3484 indicate when the link SHOULD be removed from the routing table. It 3485 is RECOMMENDED that such a connection be retained for 30s to 3486 determine if the failure was transient before concluding the link has 3487 failed permanently. 3489 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3490 candidate MUST be provided. The following table shows which side of 3491 the exchange initiates the connection depending on whether they 3492 provided ICE or No-ICE candidates. Note that the active TCP role 3493 does not alter the TLS server/client determination. 3495 +----------------------+----------+-----------------+ 3496 | Offeror | Answerer | TCP Active Role | 3497 +----------------------+----------+-----------------+ 3498 | ICE | No-ICE | Offeror | 3499 | No-ICE | ICE | Answerer | 3500 | No-ICE | No-ICE | Offeror | 3501 +----------------------+----------+-----------------+ 3503 Table 1: Determining Active Role for No-ICE 3505 5.6.6. DTLS/UDP with SR, No-ICE 3507 This overlay link protocol consists of DTLS over UDP while 3508 implementing the Simple Reliability protocol. Because ICE is not 3509 used, no STUN connectivity checks or keepalives are used. 3511 5.7. Fragmentation and Reassembly 3513 In order to allow transmission over datagram protocols such as DTLS, 3514 RELOAD messages may be fragmented. 3516 Any node along the path can fragment the message but only the final 3517 destination reassembles the fragments. When a node takes a packet 3518 and fragments it, each fragment has a full copy of the Forwarding 3519 Header but the data after the Forwarding Header is broken up in 3520 appropriate sized chunks. The size of the payload chunks needs to 3521 take into account space to allow the via and destination lists to 3522 grow. Each fragment MUST contain a full copy of the via and 3523 destination list and MUST contain at least 256 bytes of the message 3524 body. If the via and destination list are so large that this is not 3525 possible, RELOAD fragmentation is not performed and IP-layer 3526 fragmentation is allowed to occur. When a message must be 3527 fragmented, it SHOULD be split into equal-sized fragments that are no 3528 larger than the PMTU of the next overlay link minus 32 bytes. This 3529 is to allow the via list to grow before further fragmentation is 3530 required. 3532 Note that this fragmentation is not optimal for the end-to-end path - 3533 a message may be refragmented multiple times as it traverses the 3534 overlay. This option has been chosen as it is far easier to 3535 implement than e2e PMTU discovery across an ever-changing overlay, 3536 and it effectively addresses the reliability issues of relying on IP- 3537 layer fragmentation. However, PING can be used to allow e2e PMTU to 3538 be implemented if desired. 3540 Upon receipt of a fragmented message by the intended peer, the peer 3541 holds the fragments in a holding buffer until the entire message has 3542 been received. The message is then reassembled into a single message 3543 and processed. In order to mitigate denial of service attacks, 3544 receivers SHOULD time out incomplete fragments after maximum request 3545 lifetime (15 seconds). Note this time was derived from looking at 3546 the end to end retransmission time and saving fragments long enough 3547 for the full end to end retransmissions to take place. Ideally the 3548 receiver would have enough buffer space to deal with as many 3549 fragments as can arrive in the maximum request lifetime. However, if 3550 the receiver runs out of buffer space to reassemble the messages it 3551 MUST drop the message. 3553 When a message is fragmented, the fragment offset value is stored in 3554 the lower 24 bits of the fragment field of the forwarding header. 3555 The offset is the number of bytes between the end of the forwarding 3556 header and the start of the data. The first fragment therefore has 3557 an offset of 0. The first and last bit indicators MUST be 3558 appropriately set. If the message is not fragmented, then both the 3559 first and last fragment are set to 1 and the offset is 0 resulting in 3560 a fragment value of 0xC0000000. 3562 6. Data Storage Protocol 3564 RELOAD provides a set of generic mechanisms for storing and 3565 retrieving data in the Overlay Instance. These mechanisms can be 3566 used for new applications simply by defining new code points and a 3567 small set of rules. No new protocol mechanisms are required. 3569 The basic unit of stored data is a single StoredData structure: 3571 struct { 3572 uint32 length; 3573 uint64 storage_time; 3574 uint32 lifetime; 3575 StoredDataValue value; 3576 Signature signature; 3577 } StoredData; 3579 The contents of this structure are as follows: 3581 length 3582 The size of the StoredData structure in octets excluding the size 3583 of length itself. 3585 storage_time 3586 The time when the data was stored in absolute time, represented in 3587 milliseconds since the Unix epoch of midnight Jan 1, 1970. Any 3588 attempt to store a data value with a storage time before that of a 3589 value already stored at this location MUST generate a 3590 Error_Data_Too_Old error. This prevents rollback attacks. Note 3591 that this does not require synchronized clocks: the receiving 3592 peer uses the storage time in the previous store, not its own 3593 clock. 3594 A node that is attempting to store new data in response to a user 3595 request (rather than as an overlay maintenance operation such as 3596 occurs during unpartitioning) is rejected with an 3597 Error_Data_Too_Old error, the node MAY elect to perform its store 3598 using a storage_time that increments the value used with the 3599 previous store. This situation may occur when the clocks of nodes 3600 storing to this location are not properly synchronized. 3602 lifetime 3603 The validity period for the data, in seconds, starting from the 3604 time of store. 3606 value 3607 The data value itself, as described in Section 6.2. 3609 signature 3610 A signature as defined in Section 6.1. 3612 Each Resource-ID specifies a single location in the Overlay Instance. 3613 However, each location may contain multiple StoredData values 3614 distinguished by Kind-ID. The definition of a kind describes both 3615 the data values which may be stored and the data model of the data. 3616 Some data models allow multiple values to be stored under the same 3617 Kind-ID. Section Section 6.2 describes the available data models. 3618 Thus, for instance, a given Resource-ID might contain a single-value 3619 element stored under Kind-ID X and an array containing multiple 3620 values stored under Kind-ID Y. 3622 6.1. Data Signature Computation 3624 Each StoredData element is individually signed. However, the 3625 signature also must be self-contained and cover the Kind-ID and 3626 Resource-ID even though they are not present in the StoredData 3627 structure. The input to the signature algorithm is: 3629 resource_id + kind + storage_time + StoredDataValue + 3630 SignerIdentity 3632 Where these values are: 3634 resource 3635 The resource ID where this data is stored. 3637 kind 3638 The Kind-ID for this data. 3640 storage_time 3641 The contents of the storage_time data value. 3642 StoredDataValue 3643 The contents of the stored data value, as described in the 3644 previous sections. 3646 SignerIdentity 3647 The signer identity as defined in Section 5.3.4. 3649 Once the signature has been computed, the signature is represented 3650 using a signature element, as described in Section 5.3.4. 3652 6.2. Data Models 3654 The protocol currently defines the following data models: 3656 o single value 3657 o array 3658 o dictionary 3660 These are represented with the StoredDataValue structure: 3662 enum { reserved(0), single_value(1), array(2), 3663 dictionary(3), (255)} DataModel; 3665 struct { 3666 Boolean exists; 3667 opaque value<0..2^32-1>; 3668 } DataValue; 3670 struct { 3671 select (DataModel) { 3672 case single_value: 3673 DataValue single_value_entry; 3675 case array: 3676 ArrayEntry array_entry; 3678 case dictionary: 3679 DictionaryEntry dictionary_entry; 3681 /* This structure may be extended */ 3682 } ; 3683 } StoredDataValue; 3685 We now discuss the properties of each data model in turn: 3687 6.2.1. Single Value 3689 A single-value element is a simple sequence of bytes. There may be 3690 only one single-value element for each Resource-ID, Kind-ID pair. 3692 A single value element is represented as a DataValue, which contains 3693 the following two elements: 3695 exists 3696 This value indicates whether the value exists at all. If it is 3697 set to False, it means that no value is present. If it is True, 3698 that means that a value is present. This gives the protocol a 3699 mechanism for indicating nonexistence as opposed to emptiness. 3701 value 3702 The stored data. 3704 6.2.2. Array 3706 An array is a set of opaque values addressed by an integer index. 3707 Arrays are zero based. Note that arrays can be sparse. For 3708 instance, a Store of "X" at index 2 in an empty array produces an 3709 array with the values [ NA, NA, "X"]. Future attempts to fetch 3710 elements at index 0 or 1 will return values with "exists" set to 3711 False. 3713 A array element is represented as an ArrayEntry: 3715 struct { 3716 uint32 index; 3717 DataValue value; 3718 } ArrayEntry; 3720 The contents of this structure are: 3722 index 3723 The index of the data element in the array. 3725 value 3726 The stored data. 3728 6.2.3. Dictionary 3730 A dictionary is a set of opaque values indexed by an opaque key with 3731 one value for each key. A single dictionary entry is represented as 3732 follows: 3734 A dictionary element is represented as a DictionaryEntry: 3736 typedef opaque DictionaryKey<0..2^16-1>; 3738 struct { 3739 DictionaryKey key; 3740 DataValue value; 3741 } DictionaryEntry; 3743 The contents of this structure are: 3745 key 3746 The dictionary key for this value. 3748 value 3749 The stored data. 3751 6.3. Access Control Policies 3753 Every kind which is storable in an overlay MUST be associated with an 3754 access control policy. This policy defines whether a request from a 3755 given node to operate on a given value should succeed or fail. It is 3756 anticipated that only a small number of generic access control 3757 policies are required. To that end, this section describes a small 3758 set of such policies and Section 13.3 establishes a registry for new 3759 policies if required. Each policy has a short string identifier 3760 which is used to reference it in the configuration document. 3762 6.3.1. USER-MATCH 3764 In the USER-MATCH policy, a given value MUST be written (or 3765 overwritten) if and only if the request is signed with a key 3766 associated with a certificate whose user name hashes (using the hash 3767 function for the overlay) to the Resource-ID for the resource. 3768 Recall that the certificate may, depending on the overlay 3769 configuration, be self-signed. 3771 6.3.2. NODE-MATCH 3773 In the NODE-MATCH policy, a given value MUST be written (or 3774 overwritten) if and only if the request is signed with a key 3775 associated with a certificate whose Node-ID hashes (using the hash 3776 function for the overlay) to the Resource-ID for the resource. 3778 6.3.3. USER-NODE-MATCH 3780 The USER-NODE-MATCH policy may only be used with dictionary types. 3781 In the USER-NODE-MATCH policy, a given value MUST be written (or 3782 overwritten) if and only if the request is signed with a key 3783 associated with a certificate whose user name hashes (using the hash 3784 function for the overlay) to the Resource-ID for the resource. In 3785 addition, the dictionary key MUST be equal to the Node-ID in the 3786 certificate. 3788 6.3.4. NODE-MULTIPLE 3790 In the NODE-MULTIPLE policy, a given value MUST be written (or 3791 overwritten) if and only if the request is signed with a key 3792 associated with a certificate containing a Node-ID such that 3793 H(Node-ID || i) is equal to the Resource-ID for some small integer 3794 value of i. When this policy is in use, the maximum value of i MUST 3795 be specified in the kind definition. 3797 6.4. Data Storage Methods 3799 RELOAD provides several methods for storing and retrieving data: 3801 o Store values in the overlay 3802 o Fetch values from the overlay 3803 o Stat: get metadata about values in the overlay 3804 o Find the values stored at an individual peer 3806 These methods are each described in the following sections. 3808 6.4.1. Store 3810 The Store method is used to store data in the overlay. The format of 3811 the Store request depends on the data model which is determined by 3812 the kind. 3814 6.4.1.1. Request Definition 3816 A StoreReq message is a sequence of StoreKindData values, each of 3817 which represents a sequence of stored values for a given kind. The 3818 same Kind-ID MUST NOT be used twice in a given store request. Each 3819 value is then processed in turn. These operations MUST be atomic. 3820 If any operation fails, the state MUST be rolled back to before the 3821 request was received. 3823 The store request is defined by the StoreReq structure: 3825 struct { 3826 KindId kind; 3827 uint64 generation_counter; 3828 StoredData values<0..2^32-1>; 3829 } StoreKindData; 3831 struct { 3832 ResourceId resource; 3833 uint8 replica_number; 3834 StoreKindData kind_data<0..2^32-1>; 3835 } StoreReq; 3837 A single Store request stores data of a number of kinds to a single 3838 resource location. The contents of the structure are: 3840 resource 3841 The resource to store at. 3843 replica_number 3844 The number of this replica. When a storing peer saves replicas to 3845 other peers each peer is assigned a replica number starting from 1 3846 and sent in the Store message. This field is set to 0 when a node 3847 is storing its own data. This allows peers to distinguish replica 3848 writes from original writes. 3850 kind_data 3851 A series of elements, one for each kind of data to be stored. 3853 If the replica number is zero, then the peer MUST check that it is 3854 responsible for the resource and, if not, reject the request. If the 3855 replica number is nonzero, then the peer MUST check that it expects 3856 to be a replica for the resource and that the request sender is 3857 consistent with being the responsible node (i.e., that the receiving 3858 peer does not know of a better node) and, if not, reject the request. 3860 Each StoreKindData element represents the data to be stored for a 3861 single Kind-ID. The contents of the element are: 3863 kind 3864 The Kind-ID. Implementations MUST reject requests corresponding 3865 to unknown kinds. 3867 generation 3868 The expected current state of the generation counter 3869 (approximately the number of times this object has been written; 3870 see below for details). 3872 values 3873 The value or values to be stored. This may contain one or more 3874 stored_data values depending on the data model associated with 3875 each kind. 3877 The peer MUST perform the following checks: 3879 o The kind_id is known and supported. 3880 o The signatures over each individual data element (if any) are 3881 valid. If this check fails, the request MUST be rejected with an 3882 Error_Forbidden error. 3883 o Each element is signed by a credential which is authorized to 3884 write this kind at this Resource-ID. If this check fails, the 3885 request MUST be rejected with an Error_Forbidden error. 3887 o For original (non-replica) stores, the peer MUST check that if the 3888 generation-counter is non-zero, it equals the current value of the 3889 generation-counter for this kind. This feature allows the 3890 generation counter to be used in a way similar to the HTTP Etag 3891 feature. 3892 o The storage time values are greater than that of any value which 3893 would be replaced by this Store. 3894 o The size and number of the stored values is consistent with the 3895 limits specified in the overlay configuration. 3897 If all these checks succeed, the peer MUST attempt to store the data 3898 values. For non-replica stores, if the store succeeds and the data 3899 is changed, then the peer must increase the generation counter by at 3900 least one. If there are multiple stored values in a single 3901 StoreKindData, it is permissible for the peer to increase the 3902 generation counter by only 1 for the entire Kind-ID, or by 1 or more 3903 than one for each value. Accordingly, all stored data values must 3904 have a generation counter of 1 or greater. 0 is used in the Store 3905 request to indicate that the generation counter should be ignored for 3906 processing this request; however the responsible peer should increase 3907 the stored generation counter and should return the correct 3908 generation counter in the response. 3910 For replica Stores, the peer MUST set the generation counter to match 3911 the generation_counter in the message, and MUST NOT check the 3912 generation counter against the current value. Replica Stores MUST 3913 NOT use a generation counter of 0. 3915 When a peer stores data previously stored by another node (e.g., for 3916 replicas or topology shifts) it MUST adjust the lifetime value 3917 downward to reflect the amount of time the value was stored at the 3918 peer. 3920 Unless otherwise specified by the usage, if a peer attempts to store 3921 data previously stored by another node (e.g., for replicas or 3922 topology shifts) and that store fails with either an 3923 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 3924 peer MUST fetch the newer data from the the peer generating the error 3925 and use that to replace its own copy. This rule allows 3926 resynchronization after partitions heal. 3928 The properties of stores for each data model are as follows: 3930 Single-value: 3932 A store of a new single-value element creates the element if it 3933 does not exist and overwrites any existing value with the new 3934 value. 3936 Array: 3937 A store of an array entry replaces (or inserts) the given value at 3938 the location specified by the index. Because arrays are sparse, a 3939 store past the end of the array extends it with nonexistent values 3940 (exists=False) as required. A store at index 0xffffffff places 3941 the new value at the end of the array regardless of the length of 3942 the array. The resulting StoredData has the correct index value 3943 when it is subsequently fetched. 3945 Dictionary: 3946 A store of a dictionary entry replaces (or inserts) the given 3947 value at the location specified by the dictionary key. 3949 The following figure shows the relationship between these structures 3950 for an example store which stores the following values at resource 3951 "1234" 3953 o The value "abc" in the single value location for kind X 3954 o The value "foo" at index 0 in the array for kind Y 3955 o The value "bar" at index 1 in the array for kind Y 3956 Store 3957 resource=1234 3958 replica_number = 0 3959 / \ 3960 / \ 3961 StoreKindData StoreKindData 3962 kind=X (Single-Value) kind=Y (Array) 3963 generation_counter = 99 generation_counter = 107 3964 | /\ 3965 | / \ 3966 StoredData / \ 3967 storage_time = xxxxxxx / \ 3968 lifetime = 86400 / \ 3969 signature = XXXX / \ 3970 | | | 3971 | StoredData StoredData 3972 | storage_time = storage_time = 3973 | yyyyyyyy zzzzzzz 3974 | lifetime = 86400 lifetime = 33200 3975 | signature = YYYY signature = ZZZZ 3976 | | | 3977 StoredDataValue | | 3978 value="abc" | | 3979 | | 3980 StoredDataValue StoredDataValue 3981 index=0 index=1 3982 value="foo" value="bar" 3984 6.4.1.2. Response Definition 3986 In response to a successful Store request the peer MUST return a 3987 StoreAns message containing a series of StoreKindResponse elements 3988 containing the current value of the generation counter for each 3989 Kind-ID, as well as a list of the peers where the data will be 3990 replicated. 3992 struct { 3993 KindId kind; 3994 uint64 generation_counter; 3995 NodeId replicas<0..2^16-1>; 3996 } StoreKindResponse; 3998 struct { 3999 StoreKindResponse kind_responses<0..2^16-1>; 4000 } StoreAns; 4002 The contents of each StoreKindResponse are: 4004 kind 4005 The Kind-ID being represented. 4007 generation 4008 The current value of the generation counter for that Kind-ID. 4010 replicas 4011 The list of other peers at which the data was/will be replicated. 4012 In overlays and applications where the responsible peer is 4013 intended to store redundant copies, this allows the storing peer 4014 to independently verify that the replicas have in fact been 4015 stored. It does this verification by using the Stat method. Note 4016 that the storing peer is not require to perform this verification. 4018 The response itself is just StoreKindResponse values packed end-to- 4019 end. 4021 If any of the generation counters in the request precede the 4022 corresponding stored generation counter, then the peer MUST fail the 4023 entire request and respond with an Error_Generation_Counter_Too_Low 4024 error. The error_info in the ErrorResponse MUST be a StoreAns 4025 response containing the correct generation counter for each kind and 4026 the replica list, which will be empty. For original (non-replica) 4027 stores, a node which receives such an error SHOULD attempt to fetch 4028 the data and, if the storage_time value is newer, replace its own 4029 data with that newer data. This rule improves data consistency in 4030 the case of partitions and merges. 4032 If the data being stored is too large for the allowed limit by the 4033 given usage, then the peer MUST fail the request and generate an 4034 Error_Data_Too_Large error. 4036 If any type of request tries to access a data kind that the node does 4037 not know about, an Error_Unknown_Kind MUST be generated. The 4038 error_info in the Error_Response is: 4040 KindId unknown_kinds<2^8-1>; 4042 which lists all the kinds that were unrecognized. 4044 6.4.1.3. Removing Values 4046 This version of RELOAD (unlike previous versions) does not have an 4047 explicit Remove operation. Rather, values are Removed by storing 4048 "nonexistent" values in their place. Each DataValue contains a 4049 boolean value called "exists" which indicates whether a value is 4050 present at that location. In order to effectively remove a value, 4051 the owner stores a new DataValue with: 4053 exists = false 4054 value = {} (0 length) 4056 Storing nodes MUST treat these nonexistent values the same way they 4057 treat any other stored value, including overwriting the existing 4058 value, replicating them, and aging them out as necessary when 4059 lifetime expires. When a stored nonexistent value's lifetime 4060 expires, it is simply removed from the storing node like any other 4061 stored value expiration. Note that in the case of arrays and 4062 dictionaries, this may create an implicit, unsigned "nonexistent" 4063 value to represent a gap in the data structure. However, this value 4064 isn't persistent nor is it replicated. It is simply synthesized by 4065 the storing node. 4067 6.4.2. Fetch 4069 The Fetch request retrieves one or more data elements stored at a 4070 given Resource-ID. A single Fetch request can retrieve multiple 4071 different kinds. 4073 6.4.2.1. Request Definition 4075 struct { 4076 int32 first; 4077 int32 last; 4078 } ArrayRange; 4080 struct { 4081 KindId kind; 4082 uint64 generation; 4083 uint16 length; 4085 select (model) { 4086 case single_value: ; /* Empty */ 4088 case array: 4089 ArrayRange indices<0..2^16-1>; 4091 case dictionary: 4092 DictionaryKey keys<0..2^16-1>; 4094 /* This structure may be extended */ 4096 } model_specifier; 4097 } StoredDataSpecifier; 4099 struct { 4100 ResourceId resource; 4101 StoredDataSpecifier specifiers<0..2^16-1>; 4102 } FetchReq; 4104 The contents of the Fetch requests are as follows: 4106 resource 4107 The resource ID to fetch from. 4109 specifiers 4110 A sequence of StoredDataSpecifier values, each specifying some of 4111 the data values to retrieve. 4113 Each StoredDataSpecifier specifies a single kind of data to retrieve 4114 and (if appropriate) the subset of values that are to be retrieved. 4115 The contents of the StoredDataSpecifier structure are as follows: 4117 kind 4118 The Kind-ID of the data being fetched. Implementations SHOULD 4119 reject requests corresponding to unknown kinds unless specifically 4120 configured otherwise. 4122 model 4123 The data model of the data. This must be checked against the 4124 Kind-ID. 4126 generation 4127 The last generation counter that the requesting node saw. This 4128 may be used to avoid unnecessary fetches or it may be set to zero. 4130 length 4131 The length of the rest of the structure, thus allowing 4132 extensibility. 4134 model_specifier 4135 A reference to the data value being requested within the data 4136 model specified for the kind. For instance, if the data model is 4137 "array", it might specify some subset of the values. 4139 The model_specifier is as follows: 4141 o If the data model is single value, the specifier is empty. 4142 o If the data model is array, the specifier contains a list of 4143 ArrayRange elements, each of which contains two integers. The 4144 first integer is the beginning of the range and the second is the 4145 end of the range. 0 is used to indicate the first element and 4146 0xffffffff is used to indicate the final element. The first 4147 integer must be less than the second. The ranges MUST NOT 4148 overlap. 4149 o If the data model is dictionary then the specifier contains a list 4150 of the dictionary keys being requested. If no keys are specified, 4151 than this is a wildcard fetch and all key-value pairs are 4152 returned. 4154 The generation-counter is used to indicate the requester's expected 4155 state of the storing peer. If the generation-counter in the request 4156 matches the stored counter, then the storing peer returns a response 4157 with no StoredData values. 4159 Note that because the certificate for a user is typically stored at 4160 the same location as any data stored for that user, a requesting node 4161 that does not already have the user's certificate should request the 4162 certificate in the Fetch as an optimization. 4164 6.4.2.2. Response Definition 4166 The response to a successful Fetch request is a FetchAns message 4167 containing the data requested by the requester. 4169 struct { 4170 KindId kind; 4171 uint64 generation; 4172 StoredData values<0..2^32-1>; 4173 } FetchKindResponse; 4175 struct { 4176 FetchKindResponse kind_responses<0..2^32-1>; 4177 } FetchAns; 4179 The FetchAns structure contains a series of FetchKindResponse 4180 structures. There MUST be one FetchKindResponse element for each 4181 Kind-ID in the request. 4183 The contents of the FetchKindResponse structure are as follows: 4185 kind 4186 the kind that this structure is for. 4188 generation 4189 the generation counter for this kind. 4191 values 4192 the relevant values. If the generation counter in the request 4193 matches the generation-counter in the stored data, then no 4194 StoredData values are returned. Otherwise, all relevant data 4195 values MUST be returned. A nonexistent value is represented with 4196 "exists" set to False. 4198 There is one subtle point about signature computation on arrays. If 4199 the storing node uses the append feature (where the 4200 index=0xffffffff), then the index in the StoredData that is returned 4201 will not match that used by the storing node, which would break the 4202 signature. In order to avoid this issue, the index value in the 4203 array is set to zero before the signature is computed. This implies 4204 that malicious storing nodes can reorder array entries without being 4205 detected. 4207 6.4.3. Stat 4209 The Stat request is used to get metadata (length, generation counter, 4210 digest, etc.) for a stored element without retrieving the element 4211 itself. The name is from the UNIX stat(2) system call which performs 4212 a similar function for files in a filesystem. It also allows the 4213 requesting node to get a list of matching elements without requesting 4214 the entire element. 4216 6.4.3.1. Request Definition 4218 The Stat request is identical to the Fetch request. It simply 4219 specifies the elements to get metadata about. 4221 struct { 4222 ResourceId resource; 4223 StoredDataSpecifier specifiers<0..2^16-1>; 4224 } StatReq; 4226 6.4.3.2. Response Definition 4228 The Stat response contains the same sort of entries that a Fetch 4229 response would contain; however, instead of containing the element 4230 data it contains metadata. 4232 struct { 4233 Boolean exists; 4234 uint32 value_length; 4235 HashAlgorithm hash_algorithm; 4236 opaque hash_value<0..255>; 4237 } MetaData; 4239 struct { 4240 uint32 index; 4241 MetaData value; 4242 } ArrayEntryMeta; 4244 struct { 4245 DictionaryKey key; 4246 MetaData value; 4247 } DictionaryEntryMeta; 4249 struct { 4250 select (model) { 4251 case single_value: 4252 MetaData single_value_entry; 4254 case array: 4256 ArrayEntryMeta array_entry; 4258 case dictionary: 4259 DictionaryEntryMeta dictionary_entry; 4261 /* This structure may be extended */ 4262 } ; 4263 } MetaDataValue; 4265 struct { 4266 uint32 value_length; 4267 uint64 storage_time; 4268 uint32 lifetime; 4269 MetaDataValue metadata; 4270 } StoredMetaData; 4272 struct { 4273 KindId kind; 4274 uint64 generation; 4275 StoredMetaData values<0..2^32-1>; 4276 } StatKindResponse; 4278 struct { 4279 StatKindResponse kind_responses<0..2^32-1>; 4280 } StatAns; 4282 The structures used in StatAns parallel those used in FetchAns: a 4283 response consists of multiple StatKindResponse values, one for each 4284 kind that was in the request. The contents of the StatKindResponse 4285 are the same as those in the FetchKindResponse, except that the 4286 values list contains StoredMetaData entries instead of StoredData 4287 entries. 4289 The contents of the StoredMetaData structure are the same as the 4290 corresponding fields in StoredData except that there is no signature 4291 field and the value is a MetaDataValue rather than a StoredDataValue. 4293 A MetaDataValue is a variant structure, like a StoredDataValue, 4294 except for the types of each arm, which replace DataValue with 4295 MetaData. 4297 The only really new structure is MetaData, which has the following 4298 contents: 4300 exists 4301 Same as in DataValue 4303 value_length 4304 The length of the stored value. 4306 hash_algorithm 4307 The hash algorithm used to perform the digest of the value. 4309 hash_value 4310 A digest of the value using hash_algorithm. 4312 6.4.4. Find 4314 The Find request can be used to explore the Overlay Instance. A Find 4315 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4316 (if any) of the resource of kind T known to the target peer which is 4317 closest to R. This method can be used to walk the Overlay Instance by 4318 interactively fetching R_n+1=nearest(1 + R_n). 4320 6.4.4.1. Request Definition 4322 The FindReq message contains a series of Resource-IDs and Kind-IDs 4323 identifying the resource the peer is interested in. 4325 struct { 4326 ResourceId resource; 4327 KindId kinds<0..2^8-1>; 4328 } FindReq; 4330 The request contains a list of Kind-IDs which the Find is for, as 4331 indicated below: 4333 resource 4334 The desired Resource-ID 4336 kinds 4337 The desired Kind-IDs. Each value MUST only appear once. 4339 6.4.4.2. Response Definition 4341 A response to a successful Find request is a FindAns message 4342 containing the closest Resource-ID on the peer for each kind 4343 specified in the request. 4345 struct { 4346 KindId kind; 4347 ResourceId closest; 4348 } FindKindData; 4350 struct { 4351 FindKindData results<0..2^16-1>; 4352 } FindAns; 4354 If the processing peer is not responsible for the specified 4355 Resource-ID, it SHOULD return a 404 RELOAD error code. 4357 For each Kind-ID in the request the response MUST contain a 4358 FindKindData indicating the closest Resource-ID for that Kind-ID, 4359 unless the kind is not allowed to be used with Find in which case a 4360 FindKindData for that Kind-ID MUST NOT be included in the response. 4361 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4362 0. Note that different Kind-IDs may have different closest Resource- 4363 IDs. 4365 The response is simply a series of FindKindData elements, one per 4366 kind, concatenated end-to-end. The contents of each element are: 4368 kind 4369 The Kind-ID. 4371 closest 4372 The closest resource ID to the specified resource ID. This is 0 4373 if no resource ID is known. 4375 Note that the response does not contain the contents of the data 4376 stored at these Resource-IDs. If the requester wants this, it must 4377 retrieve it using Fetch. 4379 6.4.5. Defining New Kinds 4381 There are two ways to define a new kind. The first is by writing a 4382 document and registering the kind-id with IANA. This is the 4383 preferred method for kinds which may be widely used and reused. The 4384 second method is to simply define the kind and its parameters in the 4385 configuration document using the section of kind-id space set aside 4386 for private use. This method MAY be used to define ad hoc kinds in 4387 new overlays. 4389 However a kind is defined, the definition must include: 4391 o The meaning of the data to be stored (in some textual form). 4392 o The Kind-ID. 4393 o The data model (single value, array, dictionary, etc). 4394 o The access control model. 4396 In addition, when kinds are registered with IANA, each kind is 4397 assigned a short string name which is used to refer to it in 4398 configuration documents. 4400 While each kind needs to define what data model is used for its data, 4401 that does not mean that it must define new data models. Where 4402 practical, kinds should use the existing data models. The intention 4403 is that the basic data model set be sufficient for most applications/ 4404 usages. 4406 7. Certificate Store Usage 4408 The Certificate Store usage allows a peer to store its certificate in 4409 the overlay, thus avoiding the need to send a certificate in each 4410 message - a reference may be sent instead. 4412 A user/peer MUST store its certificate at Resource-IDs derived from 4413 two Resource Names: 4415 o The user name in the certificate. 4416 o The Node-ID in the certificate. 4418 Note that in the second case the certificate is not stored at the 4419 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4420 intention here (as is common throughout RELOAD) is to avoid making a 4421 peer responsible for its own data. 4423 A peer MUST ensure that the user's certificates are stored in the 4424 Overlay Instance. New certificates are stored at the end of the 4425 list. This structure allows users to store an old and a new 4426 certificate that both have the same Node-ID, which allows for 4427 migration of certificates when they are renewed. 4429 This usage defines the following kinds: 4431 Name: CERTIFICATE_BY_NODE 4432 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4434 Access Control: NODE-MATCH. 4436 Name: CERTIFICATE_BY_USER 4438 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4440 Access Control: USER-MATCH. 4442 8. TURN Server Usage 4444 The TURN server usage allows a RELOAD peer to advertise that it is 4445 prepared to be a TURN server as defined in [RFC5766]. When a node 4446 starts up, it joins the overlay network and forms several connections 4447 in the process. If the ICE stage in any of these connections returns 4448 a reflexive address that is not the same as the peer's perceived 4449 address, then the peer is behind a NAT and not a candidate for a TURN 4450 server. Additionally, if the peer's IP address is in the private 4451 address space range, then it is also not a candidate for a TURN 4452 server. Otherwise, the peer SHOULD assume it is a potential TURN 4453 server and follow the procedures below. 4455 If the node is a candidate for a TURN server it will insert some 4456 pointers in the overlay so that other peers can find it. The overlay 4457 configuration file specifies a turnDensity parameter that indicates 4458 how many times each TURN server should record itself in the overlay. 4459 Typically this should be set to the reciprocal of the estimate of 4460 what percentage of peers will act as TURN servers. For each value, 4461 called d, between 1 and turnDensity, the peer forms a Resource Name 4462 by concatenating its Peer-ID and the value d. This Resource Name is 4463 hashed to form a Resource-ID. The address of the peer is stored at 4464 that Resource-ID using type TURN-SERVICE and the TurnServer object: 4466 struct { 4467 uint8 iteration; 4468 IpAddressAndPort server_address; 4469 } TurnServer; 4471 The contents of this structure are as follows: 4473 iteration 4474 the d value 4476 server_address 4477 the address at which the TURN server can be contacted. 4479 Note: Correct functioning of this algorithm depends critically on 4480 having turnDensity be an accurate estimate of the true density of 4481 TURN servers. If turnDensity is too high, then the process of 4482 finding TURN servers becomes extremely expensive as multiple 4483 candidate Resource-IDs must be probed. 4485 Peers that provide this service need to support the TURN extensions 4486 to STUN for media relay of both UDP and TCP traffic as defined in 4487 [RFC5766] and [RFC5382]. 4489 This usage defines the following kind to indicate that a peer is 4490 willing to act as a TURN server: 4492 Name TURN-SERVICE 4493 Data Model The TURN-SERVICE kind stores a single value for each 4494 Resource-ID. 4495 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4497 Peers can find other servers by selecting a random Resource-ID and 4498 then doing a Find request for the appropriate server type with that 4499 Resource-ID. The Find request gets routed to a random peer based on 4500 the Resource-ID. If that peer knows of any servers, they will be 4501 returned. The returned response may be empty if the peer does not 4502 know of any servers, in which case the process gets repeated with 4503 some other random Resource-ID. As long as the ratio of servers 4504 relative to peers is not too low, this approach will result in 4505 finding a server relatively quickly. 4507 9. Chord Algorithm 4509 This algorithm is assigned the name chord-reload to indicate it is an 4510 adaptation of the basic Chord DHT algorithm. 4512 This algorithm differs from the originally presented Chord algorithm 4513 [Chord]. It has been updated based on more recent research results 4514 and implementation experiences, and to adapt it to the RELOAD 4515 protocol. A short list of differences: 4516 o The original Chord algorithm specified that a single predecessor 4517 and a successor list be stored. The chord-reload algorithm 4518 attempts to have more than one predecessor and successor. The 4519 predecessor sets help other neighbors learn their successor list. 4521 o The original Chord specification and analysis called for iterative 4522 routing. RELOAD specifies recursive routing. In addition to the 4523 performance implications, the cost of NAT traversal dictates 4524 recursive routing. 4525 o Finger table entries are indexed in opposite order. Original 4526 Chord specifies finger[0] as the immediate successor of the peer. 4527 chord-reload specifies finger[0] as the peer 180 degrees around 4528 the ring from the peer. This change was made to simplify 4529 discussion and implementation of variable sized finger tables. 4530 However, with either approach no more than O(log N) entries should 4531 typically be stored in a finger table. 4532 o The stabilize() and fix_fingers() algorithms in the original Chord 4533 algorithm are merged into a single periodic process. 4534 Stabilization is implemented slightly differently because of the 4535 larger neighborhood, and fix_fingers is not as aggressive to 4536 reduce load, nor does it search for optimal matches of the finger 4537 table entries. 4538 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4539 not designed to be used in networks with close to or more than 4540 2^128 nodes. 4541 o RELOAD uses randomized finger entries as described in 4542 Section 9.6.4.2. 4543 o This algorithm allows the use of either reactive or periodic 4544 recovery. The original Chord paper used periodic recovery. 4545 Reactive recovery provides better performance in small overlays, 4546 but is believed to be unstable in large (>1000) overlays with high 4547 levels of churn [handling-churn-usenix04]. The overlay 4548 configuration file specifies a "chord-reload-reactive" element 4549 that indicates whether reactive recovery should be used. 4551 9.1. Overview 4553 The algorithm described here is a modified version of the Chord 4554 algorithm. Each peer keeps track of a finger table and a neighbor 4555 table. The neighbor table contains at least the three peers before 4556 and after this peer in the DHT ring. There may not be three entries 4557 in all cases such as small rings or while the ring topology is 4558 changing. The first entry in the finger table contains the peer 4559 half-way around the ring from this peer; the second entry contains 4560 the peer that is 1/4 of the way around; the third entry contains the 4561 peer that is 1/8th of the way around, and so on. Fundamentally, the 4562 chord data structure can be thought of a doubly-linked list formed by 4563 knowing the successors and predecessor peers in the neighbor table, 4564 sorted by the Node-ID. As long as the successor peers are correct, 4565 the DHT will return the correct result. The pointers to the prior 4566 peers are kept to enable the insertion of new peers into the list 4567 structure. Keeping multiple predecessor and successor pointers makes 4568 it possible to maintain the integrity of the data structure even when 4569 consecutive peers simultaneously fail. The finger table forms a skip 4570 list, so that entries in the linked list can be found in O(log(N)) 4571 time instead of the typical O(N) time that a linked list would 4572 provide. 4574 A peer, n, is responsible for a particular Resource-ID k if k is less 4575 than or equal to n and k is greater than p, where p is the peer id of 4576 the previous peer in the neighbor table. Care must be taken when 4577 computing to note that all math is modulo 2^128. 4579 9.2. Routing 4581 The routing table is the union of the neighbor table and the finger 4582 table. 4584 If a peer is not responsible for a Resource-ID k, but is directly 4585 connected to a node with Node-ID k, then it routes the message to 4586 that node. Otherwise, it routes the request to the peer in the 4587 routing table that has the largest Node-ID that is in the interval 4588 between the peer and k. If no such node is found, it finds the 4589 smallest node id that is greater than k and routes the message to 4590 that node. 4592 9.3. Redundancy 4594 When a peer receives a Store request for Resource-ID k, and it is 4595 responsible for Resource-ID k, it stores the data and returns a 4596 success response. It then sends a Store request to its successor in 4597 the neighbor table and to that peer's successor. Note that these 4598 Store requests are addressed to those specific peers, even though the 4599 Resource-ID they are being asked to store is outside the range that 4600 they are responsible for. The peers receiving these check they came 4601 from an appropriate predecessor in their neighbor table and that they 4602 are in a range that this predecessor is responsible for, and then 4603 they store the data. They do not themselves perform further Stores 4604 because they can determine that they are not responsible for the 4605 Resource-ID. 4607 Managing replicas as the overlay changes is described in 4608 Section 9.6.3. 4610 The sequential replicas used in this overlay algorithm protect 4611 against peer failure but not against malicious peers. Additional 4612 replication from the Usage is required to protect resources from such 4613 attacks, as discussed in Section 12.5.4. 4615 9.4. Joining 4617 The join process for a joining party (JP) with Node-ID n is as 4618 follows. 4620 1. JP MUST connect to its chosen bootstrap node. 4621 2. JP SHOULD use a series of Pings to populate its routing table. 4622 3. JP SHOULD send Attach requests to initiate connections to each of 4623 the peers in the neighbor table as well as to the desired finger 4624 table entries. Note that this does not populate their routing 4625 tables, but only their connection tables, so JP will not get 4626 messages that it is expected to route to other nodes. 4627 4. JP MUST enter all the peers it has contacted into its routing 4628 table. 4629 5. JP SHOULD send a Join to its immediate successor, the admitting 4630 peer (AP) for Node-ID n. The AP sends the response to the Join. 4631 6. AP MUST do a series of Store requests to JP to store the data 4632 that JP will be responsible for. 4633 7. AP MUST send JP an Update explicitly labeling JP as its 4634 predecessor. At this point, JP is part of the ring and 4635 responsible for a section of the overlay. AP can now forget any 4636 data which is assigned to JP and not AP. 4637 8. The AP MUST send an Update to all of its neighbors with the new 4638 values of its neighbor set (including JP). 4639 9. The JP MUST send Updates to all the peers in its neighbor table. 4641 In order to populate its neighbor table, JP sends a Ping via the 4642 bootstrap node directed at Resource-ID n+1 (directly after its own 4643 Resource-ID). This allows it to discover its own successor. Call 4644 that node p0. It then sends a ping to p0+1 to discover its successor 4645 (p1). This process can be repeated to discover as many successors as 4646 desired. The values for the two peers before p will be found at a 4647 later stage when n receives an Update. 4649 In order to set up its finger table entry for peer i, JP simply sends 4650 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4651 approximately the right location around the ring. 4653 The joining peer MUST NOT send any Update message placing itself in 4654 the overlay until it has successfully completed an Attach with each 4655 peer that should be in its neighbor table. 4657 9.5. Routing Attaches 4659 When a peer needs to Attach to a new peer in its neighbor table, it 4660 MUST source-route the Attach request through the peer from which it 4661 learned the new peer's Node-ID. Source-routing these requests allows 4662 the overlay to recover from instability. 4664 All other Attach requests, such as those for new finger table 4665 entries, are routed conventionally through the overlay. 4667 9.6. Updates 4669 A chord Update is defined as 4671 enum { reserved (0), 4672 peer_ready(1), neighbors(2), full(3), (255) } 4673 ChordUpdateType; 4675 struct { 4676 uint32 uptime; 4677 ChordUpdateType type; 4678 select(type){ 4679 case peer_ready: /* Empty */ 4680 ; 4682 case neighbors: 4683 NodeId predecessors<0..2^16-1>; 4684 NodeId successors<0..2^16-1>; 4686 case full: 4687 NodeId predecessors<0..2^16-1>; 4688 NodeId successors<0..2^16-1>; 4689 NodeId fingers<0..2^16-1>; 4690 }; 4691 } ChordUpdate; 4693 The "type" field contains the type of the update, which depends on 4694 the reason the update was sent. 4696 uptime: time this peer has been up in seconds. 4698 peer_ready: this peer is ready to receive messages. This message 4699 is used to indicate that a node which has Attached is a peer and 4700 can be routed through. It is also used as a connectivity check to 4701 non-neighbor peers. 4703 neighbors: this version is sent to members of the Chord neighbor 4704 table. 4706 full: this version is sent to peers which request an Update with a 4707 RouteQueryReq. 4709 If the message is of type "neighbors", then the contents of the 4710 message will be: 4712 predecessors 4713 The predecessor set of the Updating peer. 4715 successors 4716 The successor set of the Updating peer. 4718 If the message is of type "full", then the contents of the message 4719 will be: 4721 predecessors 4722 The predecessor set of the Updating peer. 4724 successors 4725 The successor set of the Updating peer. 4727 fingers 4728 The finger table of the Updating peer, in numerically ascending 4729 order. 4731 A peer MUST maintain an association (via Attach) to every member of 4732 its neighbor set. A peer MUST attempt to maintain at least three 4733 predecessors and three successors, even though this will not be 4734 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 4735 predecessors and successors be maintained in the neighbor set. 4737 9.6.1. Handling Neighbor Failures 4739 Every time a connection to a peer in the neighbor table is lost (as 4740 determined by connectivity pings or the failure of some request), the 4741 peer MUST remove the entry from its neighbor table and replace it 4742 with the best match it has from the other peers in its routing table. 4743 If using reactive recovery, it then sends an immediate Update to all 4744 nodes in its Neighbor Table. The update will contain all the Node- 4745 IDs of the current entries of the table (after the failed one has 4746 been removed). Note that when replacing a successor the peer SHOULD 4747 delay the creation of new replicas for successor replacement hold- 4748 down time (30 seconds) after removing the failed entry from its 4749 neighbor table in order to allow a triggered update to inform it of a 4750 better match for its neighbor table. 4752 If the neighbor failure effects the peer's range of responsible IDs, 4753 then the Update MUST be sent to all nodes in its Connection Table. 4755 A peer MAY attempt to reestablish connectivity with a lost neighbor 4756 either by waiting additional time to see if connectivity returns or 4757 by actively routing a new ATTACH to the lost peer. Details for these 4758 procedures are beyond the scope of this document. In no event does 4759 an attempt to reestablish connectivity with a lost neighbor allow the 4760 peer to remain in the neighbor table. Such a peer is returned to the 4761 neighbor table once connectivity is reestablished. 4763 If connectivity is lost to all successor peers in the neighbor table, 4764 then this peer should behave as if it is joining the network and use 4765 Pings to find a peer and send it a Join. If connectivity is lost to 4766 all the peers in the finger table, this peer should assume that it 4767 has been disconnected from the rest of the network, and it should 4768 periodically try to join the DHT. 4770 9.6.2. Handling Finger Table Entry Failure 4772 If a finger table entry is found to have failed, all references to 4773 the failed peer are removed from the finger table and replaced with 4774 the closest preceding peer from the finger table or neighbor table. 4776 If using reactive recovery, the peer initiates a search for a new 4777 finger table entry as described below. 4779 9.6.3. Receiving Updates 4781 When a peer, N, receives an Update request, it examines the Node-IDs 4782 in the UpdateReq and at its neighbor table and decides if this 4783 UpdateReq would change its neighbor table. This is done by taking 4784 the set of peers currently in the neighbor table and comparing them 4785 to the peers in the update request. There are two major cases: 4787 o The UpdateReq contains peers that match N's neighbor table, so no 4788 change is needed to the neighbor set. 4789 o The UpdateReq contains peers N does not know about that should be 4790 in N's neighbor table, i.e. they are closer than entries in the 4791 neighbor table. 4793 In the first case, no change is needed. 4795 In the second case, N MUST attempt to Attach to the new peers and if 4796 it is successful it MUST adjust its neighbor set accordingly. Note 4797 that it can maintain the now inferior peers as neighbors, but it MUST 4798 remember the closer ones. 4800 After any Pings and Attaches are done, if the neighbor table changes 4801 and the peer is using reactive recovery, the peer sends an Update 4802 request to each member of its Connection Table. These Update 4803 requests are what end up filling in the predecessor/successor tables 4804 of peers that this peer is a neighbor to. A peer MUST NOT enter 4805 itself in its successor or predecessor table and instead should leave 4806 the entries empty. 4808 If peer N is responsible for a Resource-ID R, and N discovers that 4809 the replica set for R (the next two nodes in its successor set) has 4810 changed, it MUST send a Store for any data associated with R to any 4811 new node in the replica set. It SHOULD NOT delete data from peers 4812 which have left the replica set. 4814 When a peer N detects that it is no longer in the replica set for a 4815 resource R (i.e., there are three predecessors between N and R), it 4816 SHOULD delete all data associated with R from its local store. 4818 When a peer discovers that its range of responsible IDs have changed, 4819 it MUST send an UPDATE to all entries in its connection table. 4821 9.6.4. Stabilization 4823 There are four components to stabilization: 4824 1. exchange Updates with all peers in its neighbor table to exchange 4825 state. 4826 2. search for better peers to place in its finger table. 4827 3. search to determine if the current finger table size is 4828 sufficiently large. 4829 4. search to determine if the overlay has partitioned and needs to 4830 recover. 4832 9.6.4.1. Updating neighbor table 4834 A peer MUST periodically send an Update request to every peer in its 4835 Connection Table. The purpose of this is to keep the predecessor and 4836 successor lists up to date and to detect failed peers. The default 4837 time is about every ten minutes, but the enrollment server SHOULD set 4838 this in the configuration document using the "chord-reload-update- 4839 interval" element (denominated in seconds.) A peer SHOULD randomly 4840 offset these Update requests so they do not occur all at once. 4842 9.6.4.2. Refreshing finger table 4844 A peer MUST periodically search for new peers to replace invalid 4845 (repeated) entries in the finger table. A finger table entry i is 4846 valid if it is in the range [n+2^(128-i), 4847 n+2^(128-(i-1))-2^(128-(i+1))]. Invalid entries occur in the finger 4848 table when a previous finger table entry has failed or when no peer 4849 has been found in that range. 4851 A peer SHOULD NOT send Ping requests looking for new finger table 4852 entries more often than the configuration element "chord-reload-ping- 4853 interval", which defaults to 3600 seconds (one per hour). 4855 Two possible methods for searching for new peers for the finger table 4856 entries are presented: 4858 Alternative 1: A peer selects one entry in the finger table from 4859 among the invalid entries. It pings for a new peer for that finger 4860 table entry. The selection SHOULD be exponentially weighted to 4861 attempt to replace earlier (lower i) entries in the finger table. A 4862 simple way to implement this selection is to search through the 4863 finger table entries from i=0 and each time an invalid entry is 4864 encountered, send a Ping to replace that entry with probability 0.5. 4866 Alternative 2: A peer monitors the Update messages received from its 4867 connections to observe when an Update indicates a peer that would be 4868 used to replace in invalid finger table entry, i, and flags that 4869 entry in the finger table. Every "chord-reload-ping-interval" 4870 seconds, the peer selects from among those flagged candidates using 4871 an exponentially weighted probability as above. 4873 When searching for a better entry, the peer SHOULD send the Ping to a 4874 Node-ID selected randomly from that range. Random selection is 4875 preferred over a search for strictly spaced entries to minimize the 4876 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 4877 implementation or subsequent specification MAY choose a method for 4878 selecting finger table entries other than choosing randomly within 4879 the range. Any such alternate methods SHOULD be employed only on 4880 finger table stabilization and not for the selection of initial 4881 finger table entries unless the alternative method is faster and 4882 imposes less overhead on the overlay. 4884 A peer MAY choose to keep connections to multiple peers that can act 4885 for a given finger table entry. 4887 9.6.4.3. Adjusting finger table size 4889 If the finger table has less than 16 entries, the node SHOULD attempt 4890 to discover more fingers to grow the size of the table to 16. The 4891 value 16 was chosen to ensure high odds of a node maintaining 4892 connectivity to the overlay even with strange network partitions. 4894 For many overlays, 16 finger table entries will be enough, but as an 4895 overlay grows very large, more than 16 entries may be required in the 4896 finger table for efficient routing. An implementation SHOULD be 4897 capable of increasing the number of entries in the finger table to 4898 128 entries. 4900 Note to implementers: Although log(N) entries are all that are 4901 required for optimal performance, careful implementation of 4902 stabilization will result in no additional traffic being generated 4903 when maintaining a finger table larger than log(N) entries. 4904 Implementers are encouraged to make use of RouteQuery and algorithms 4905 for determining where new finger table entries may be found. 4906 Complete details of possible implementations are outside the scope of 4907 this specification. 4909 A simple approach to sizing the finger table is to ensure the finger 4910 table is large enough to contain at least the final successor in the 4911 peer's neighbor table. 4913 9.6.4.4. Detecting partitioning 4915 To detect that a partitioning has occurred and to heal the overlay, a 4916 peer P MUST periodically repeat the discovery process used in the 4917 initial join for the overlay to locate an appropriate bootstrap node, 4918 B. P should then send a Ping for its own Node-ID routed through B. If 4919 a response is received from a peer S', which is not P's successor, 4920 then the overlay is partitioned and P should send an Attach to S' 4921 routed through B, followed by an Update sent to S'. (Note that S' 4922 may not be in P's neighbor table once the overlay is healed, but the 4923 connection will allow S' to discover appropriate neighbor entries for 4924 itself via its own stabilization.) 4926 Future specifications may describe alternative mechanisms for 4927 determining when to repeat the discovery process. 4929 9.7. Route Query 4931 For this topology plugin, the RouteQueryReq contains no additional 4932 information. The RouteQueryAns contains the single node ID of the 4933 next peer to which the responding peer would have routed the request 4934 message in recursive routing: 4936 struct { 4937 NodeId next_peer; 4938 } ChordRouteQueryAns; 4940 The contents of this structure are as follows: 4942 next_peer 4943 The peer to which the responding peer would route the message in 4944 order to deliver it to the destination listed in the request. 4946 If the requester has set the send_update flag, the responder SHOULD 4947 initiate an Update immediately after sending the RouteQueryAns. 4949 9.8. Leaving 4951 To support extensions, such as [I-D.maenpaa-p2psip-self-tuning], 4952 Peers SHOULD send a Leave request to all members of their neighbor 4953 table prior to exiting the Overlay Instance. The 4954 overlay_specific_data field MUST contain the ChordLeaveData structure 4955 defined below: 4957 enum { reserved (0), 4958 from_succ(1), from_pred(2), (255) } 4959 ChordLeaveType; 4961 struct { 4962 ChordLeaveType type; 4964 select(type) { 4965 case from_succ: 4966 NodeId successors<0..2^16-1>; 4967 case from_pred: 4968 NodeId predecessors<0..2^16-1>; 4969 }; 4970 } ChordLeaveData; 4972 The 'type' field indicates whether the Leave request was sent by a 4973 predecessor or a successor of the recipient: 4975 from_succ 4976 The Leave request was sent by a successor. 4978 from_pred 4979 The Leave request was sent by a predecessor. 4981 If the type of the request is 'from_succ', the contents will be: 4983 successors 4984 The sender's successor list. 4986 If the type of the request is 'from_pred', the contents will be: 4988 predecessors 4989 The sender's predecessor list. 4991 Any peer which receives a Leave for a peer n in its neighbor set 4992 follows procedures as if it had detected a peer failure as described 4993 in Section 9.6.1. 4995 10. Enrollment and Bootstrap 4997 10.1. Overlay Configuration 4999 This specification defines a new content type "application/ 5000 p2p-overlay+xml" for an MIME entity that contains overlay 5001 information. An example document is shown below. 5003 5005 5008 5010 false 5011 5012 5013 5014 30 5015 TLS 5016 false 5017 10 5018 4000 5019 https://example.org 5020 foo 5021 300 5022 400 5023 false 5025 asecret 5026 chord 5027 16 5028 DATA GOES HERE 5029 5030 5031 5032 single 5033 user-match 5034 1 5035 100 5036 5037 5038 VGhpcyBpcyBub3QgcmlnaHQhCg== 5039 5040 5041 5042 5043 array 5044 node-multiple 5045 3 5046 22 5047 4 5048 1 5049 5050 5051 5052 VGhpcyBpcyBub3QgcmlnaHQhCg== 5053 5054 5055 5056 47112162e84c69ba 5057 6eba45d31a900c06 5058 6ebc45d31a900c06 5059 5060 VGhpcyBpcyBub3QgcmlnaHQhCg== 5061 5063 The file MUST be a well formed XML document and it SHOULD contain an 5064 encoding declaration in the XML declaration. If the charset 5065 parameter of the MIME content type declaration is present and it is 5066 different from the encoding declaration, the charset parameter takes 5067 precedence. Every application conforming to this specification MUST 5068 accept the UTF-8 character encoding to ensure minimal 5069 interoperability. The namespace for the elements defined in this 5070 specification is urn:ietf:params:xml:ns:p2p:config-base and 5071 urn:ietf:params:xml:ns:p2p:config-chord". 5073 The file can contain multiple "configuration" elements where each one 5074 contains the configuration information for a different overlay. Each 5075 "configuration" has the following attributes: 5077 instance-name: name of the overlay 5078 expiration: time in future at which this overlay configuration is no 5079 longer valid and needs to be retrieved again 5080 sequence: a monotonically increasing sequence number between 1 and 5081 2^32 5083 Inside each overlay element, the following elements can occur: 5085 topology-plugin This element has defines the overlay algorithm being 5086 used. 5087 node-id-length This element contains the length of a NodeId 5088 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5089 and 20 (160 bits). If this element is not present, the default of 5090 16 is used. 5091 root-cert This element contains a PEM encoded X.509v3 certificate 5092 that is a root trust anchor used to sign all certificates in this 5093 overlay. There can be more than one root-cert element. 5094 enrollment-server This element contains the URL at which the 5095 enrollment server can be reached in a "url" element. This URL 5096 MUST be of type "https:". More than one enrollment-server element 5097 may be present. 5098 self-signed-permitted This element indicates whether self-signed 5099 certificates are permitted. If it is set to "true", then self- 5100 signed certificates are allowed, in which case the enrollment- 5101 server and root-cert elements may be absent. Otherwise, it SHOULD 5102 be absent, but MAY be set to "false". This element also contains 5103 an attribute "digest" which indicates the digest to be used to 5104 compute the Node-ID. Valid values for this parameter are "SHA-1" 5105 and "SHA-256". Implementations MUST support both of these 5106 algorithms. 5107 direct-return-response-permitted This element indicates whether 5108 direct return routed responses as described in Section 5.3.2.4 are 5109 permitted. If it is set to "true", they MAY be used. Otherwise, 5110 it SHOULD be absent, but MAY be set to "false". Implementations 5111 MAY support direct return routed respone. 5113 bootstrap-node This element represents the address of one of the 5114 bootstrap nodes. It has an attribute called "address" that 5115 represents the IP address (either IPv4 or IPv6, since they can be 5116 distinguished) and an attribute called "port" that represents the 5117 port. The IP address is in typical hexidecimal form using 5118 standard period and colon separators as specified in 5119 [I-D.ietf-6man-text-addr-representation]. More than one 5120 bootstrap-peer element may be present. 5121 turn-density This element is a positive integer that represents the 5122 approximate reciprocal of density of nodes that can act as TURN 5123 servers. For example, if 10% of the nodes can act as TURN 5124 servers, this would be set to 10. If it is not present, the 5125 default value is 1. 5126 multicast-bootstrap This element represents the address of a 5127 multicast, broadcast, or anycast address and port that may be used 5128 for bootstrap. Nodes SHOULD listen on the address. It has an 5129 attributed called "address" that represents the IP address and an 5130 attribute called "port" that represents the port. More than one 5131 "multicast-bootstrap" element may be present. 5132 clients-permitted This element represents whether clients are 5133 permitted or whether all nodes must be peers. If it is set to 5134 "TRUE" or absent, this indicates that clients are permitted. If 5135 it is set to "FALSE" then nodes MUST join as peers. 5136 no-ice This element represents whether nodes are required to use 5137 the "No-ICE" Overlay Link protocols in this overlay. If it is 5138 absent, it is treated as if it were set to "FALSE". 5139 chord-update-interval The update frequency for the Chord-reload 5140 topology plugin (see Section 9). 5141 chord-ping-interval The ping frequency for the Chord-reload 5142 topology plugin (see Section 9). 5143 chord-reload-reactive Whether reactive recovery should be used for 5144 this overlay. (see Section 9). 5145 shared-secret If shared secret mode is used, this contains the 5146 shared secret. 5147 max-message-size Maximum size in bytes of any message in the 5148 overlay. If this value is not present, the default is 5000. 5149 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5150 for messages. If this value is not present, the default is 100. 5151 overlay-link-protocol Indicates a permissible overlay link protocol 5152 (see Section 5.6.1 for requirements for such protocols). An 5153 arbitrary number of these elements may appear. If none appear, 5154 then this implies the default value, "TLS", which refers to the 5155 use of TLS and DTLS. If one or more elements appear, then no 5156 default value applies. 5158 kind-signer This contains a single Node-ID in hexadecimal and 5159 indicates that the certificate with this Node-ID is allowed to 5160 sign kinds. Identifying kind-signer by Node-ID instead of 5161 certificate allows the use of short lived certificates without 5162 constantly having to provide an updated configuration file. 5163 bad-node This contains a single Node-ID in hexadecimal and 5164 indicates that the certificate with this Node-ID MUST NOT be 5165 considered valid. This allows certificate revocation. 5167 Inside each overlay element, the required-kinds elements can also 5168 occur. This element indicates the kinds that members must support 5169 and contains multiple kind-block elements that each define a single 5170 kind that MUST be supported by nodes in the overlay. Each kind-block 5171 consists of a single kind element and a kind-signature. The kind 5172 element defines the kind. The kind-signature is the signature 5173 computed over the kind element. 5175 Each kind has either an ID attribute or a name atribute. The name 5176 attribute is a string representing the kind (the name registered to 5177 IANA) while the ID is an integer kind-id allocated out of private 5178 space. 5180 In addition, the kind element contains the following elements: 5181 max-count: the maximum number of values which members of the overlay 5182 must support. 5183 data-model: the data model to be used. 5184 max-size: the maximum size of individual values. 5185 access-control: the access control model to be used. 5186 max-node-multiple: This is optional and only used when the access 5187 control is NODE-MULTIPLE. This indicates the maximum value for 5188 the i counter. This is an integer greater than 0. 5190 All of the non optional values MUST be provided. If the kind is 5191 registered with IANA, the data-model and access-control attributes 5192 MUST match those in the kind registration. For instance, the example 5193 above indicates that members must support SIP-REGISTRATION with a 5194 maximum of 10 values of up to 1000 bytes each. Multiple required- 5195 kinds elements MAY be present. 5197 The kind-block element also MUST contain a "kind-signature" element. 5198 This signature is computed across the kind from the beginning of the 5199 first < of the kind to the end of the last > of the kind in the same 5200 way as the "signature element described later in this section. 5202 The configuration file is a binary file and cannot be changed - 5203 including whitespace changes - or the signature will break. The 5204 signature is computed by taking each configuration element and 5205 starting form, and including, the first < at the start of 5206 up to and including the > in and 5207 treating this as a binary blob that is signed using the standard 5208 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5209 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5210 signature element following the configuration object in the config 5211 file. 5213 When a node receives a new configuration file, it MUST change its 5214 configuration to meet the new requirements. This may require the 5215 node to exit the DHT and re-join. If a node is not capable of 5216 supporting the new requirements, it MUST exit the overlay. If some 5217 information about a particular kind changes from what the node 5218 previously knew about the kind (for example the max size), the new 5219 information in the configuration files overrides any previously 5220 learned information. If any kind data was signed by a node that is 5221 no longer allowed to sign kinds, that kind MUST be discarded along 5222 with any stored information of that kind. Note that forcing an 5223 avalanche restart of the overlay with a configuration change that 5224 requires re-joining the overlay may result in serious performance 5225 problems, including total collapse of the network if configuration 5226 parameters are not properly considered. Such an event may be 5227 necessary in case of a compromised CA or similar problem, but for 5228 large overlays should be avoided in almost all circumstances. 5230 10.1.1. Relax NG Grammar 5232 The grammar for the configuration data is: 5234 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5235 namespace local = "" 5236 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5237 namespace rng = "http://relaxng.org/ns/structure/1.0" 5239 anything = 5240 (element * { anything } 5241 | attribute * { text } 5242 | text)* 5244 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5245 { anything }* 5246 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5247 { text }* 5248 foreign-nodes = (foreign-attributes | foreign-elements)* 5250 start = 5251 element p2pcf:overlay { 5252 element configuration { 5253 attribute instance-name { text }, 5254 attribute expiration { xsd:dateTime }, 5255 attribute sequence { xsd:long }, 5256 parameter 5257 }, 5258 element signature { 5259 attribute algorithm { signature-algorithm-type }?, 5260 xsd:base64Binary 5261 }? 5262 } 5263 signature-algorithm-type |= "rsa-sha1" 5265 parameter &= element topology-plugin { topology-plugin-type } 5266 parameter &= element max-message-size { xsd:int }? 5267 parameter &= element initial-ttl { xsd:int }? 5268 parameter &= element root-cert { text }? 5269 parameter &= element required-kinds { kind-block* } 5270 parameter &= element enrollment-server { xsd:anyURI }? 5271 parameter &= element kind-signer { text }* 5272 parameter &= element bad-node { text }* 5273 parameter &= element no-ice { xsd:boolean }? 5274 parameter &= 5275 element direct-return-response-permitted { xsd:boolean }? 5276 parameter &= element shared-secret { xsd:string }? 5277 parameter &= element overlay-link-protocol { xsd:string }* 5278 parameter &= element clients-permitted { xsd:boolean }? 5279 parameter &= element turn-density { xsd:int }? 5280 parameter &= element node-id-length { xsd:int }? 5281 parameter &= foreign-elements* 5282 parameter &= 5283 element self-signed-permitted { 5284 attribute digest { self-signed-digest-type }, 5285 xsd:boolean 5286 }? 5287 self-signed-digest-type |= "sha1" 5288 parameter &= 5289 element bootstrap-node { 5290 attribute address { xsd:string }, 5291 attribute port { xsd:int } 5292 }+ 5293 hostPort = text 5294 parameter &= 5295 element multicast-bootstrap { hostPort 5296 }* 5298 kind-block = element kind-block { 5299 element kind { 5300 (attribute name { kind-names } 5301 | attribute id { xsd:int }), 5303 kind-paramter 5304 } & 5305 element kind-signature { 5306 attribute algorithm { signature-algorithm-type }?, 5307 xsd:base64Binary 5308 }? 5310 } 5312 kind-paramter &= element max-count { xsd:int } 5313 kind-paramter &= element max-size { xsd:int } 5314 kind-paramter &= element data-model { data-model-type } 5315 data-model-type |= "single" 5316 data-model-type |= "array" 5317 data-model-type |= "dictionary" 5318 kind-paramter &= element access-control { access-control-type } 5319 kind-paramter &= element max-node-multiple { xsd:int }? 5320 access-control-type |= "user-match" 5321 access-control-type |= "node-match" 5322 access-control-type |= "user-node-match" 5323 access-control-type |= "node-multiple" 5324 access-control-type |= "user-match-with-anon-create" 5325 kind-paramter &= foreign-elements* 5327 # Chord specific paramters 5328 topology-plugin-type |= "chord" 5329 kind-names |= "sip-registration" 5330 kind-names |= "turn-service" 5331 parameter &= element chord:chord-ping-interval { xsd:int }? 5332 parameter &= element chord:chord-update-interval { xsd:int }? 5334 10.2. Discovery Through Enrollment Server 5336 When a node first enrolls in a new overlay, it starts with a 5337 discovery process to find an enrollment server. Related work to the 5338 approach used here is described in 5339 [I-D.garcia-p2psip-dns-sd-bootstrapping] and 5340 [I-D.matthews-p2psip-bootstrap-mechanisms]. Another scheme for 5341 referencing overlays is described in 5342 [I-D.hardie-p2poverlay-pointers]. 5344 The node first determines the overlay name. This value is provided 5345 by the user or some other out-of-band provisioning mechanism. The 5346 out-of-band mechanisms may also provide an optional URL for the 5347 enrollment server. If a URL for the enrollment server is not 5348 provided, the node MUST do a DNS SRV query using a Service name of 5349 "p2psip_enroll" and a protocol of tcp to find an enrollment server 5350 and form the URL by appending a path of "/p2psip/enroll" to the 5351 overlay name. For example, if the overlay name was example.com, the 5352 URL would be "https://example.com/p2psip/enroll". 5354 Once an address and URL for the enrollment server is determined, the 5355 peer forms an HTTPS connection to that IP address. The certificate 5356 MUST match the overlay name as described in [RFC2818]. Then the node 5357 MUST fetch a new copy of the configuration file. To do this, the 5358 peer performs a GET to the URL. The result of the HTTP GET is an XML 5359 configuration file described above, which replaces any previously 5360 learned configuration file for this overlay. 5362 For overlays that do not use an enrollment server, nodes obtain the 5363 configuration information needed to join the overlay through some out 5364 of band approach such an an XML configuration file sent over email. 5366 10.3. Credentials 5368 If the configuration document contains a enrollment-server element, 5369 credentials are required to join the Overlay Instance. A peer which 5370 does not yet have credentials MUST contact the enrollment server to 5371 acquire them. 5373 RELOAD defines its own trivial certificate request protocol. We 5374 would have liked to have used an existing protocol but were concerned 5375 about the implementation burden of even the simplest of those 5376 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5377 have a protocol which could be easily implemented in a Web server 5378 which the operator did not control (e.g., in a hosted service) and 5379 was compatible with the existing certificate handling tooling as used 5380 with the Web certificate infrastructure. This means accepting bare 5381 PKCS#10 requests and returning a single bare X.509 certificate. 5382 Although the MIME types for these objects are defined, none of the 5383 existing protocols support exactly this model. 5385 The certificate request protocol is performed over HTTPS. The 5386 request is an HTTP POST with the following properties: 5388 o If authentication is required, there is a URL parameter of 5389 "password" and "username" containing the user's name and password 5390 in the clear (hence the need for HTTPS) 5391 o The body is of content type "application/pkcs10", as defined in 5392 [RFC2311]. 5393 o The Accept header contains the type "application/pkix-cert", 5394 indicating the type that is expected in the response. 5396 The enrollment server MUST authenticate the request using the 5397 provided user name and password. If the authentication succeeds and 5398 the requested user name is acceptable, the server generates and 5399 returns a certificate. The SubjectAltName field in the certificate 5400 contains the following values: 5402 o One or more Node-IDs which MUST be cryptographically random 5403 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5404 way that they are unpredictable to the requesting user. Each is 5405 placed in the subjectAltName using the uniformResourceIdentifier 5406 type and MUST contain RELOAD URIs as described in Section 13.14 5407 and MUST contain a Destination list with a single entry of type 5408 "node_id". 5409 o A single name this user is allowed to use in the overlay, using 5410 type rfc822Name. 5412 The certificate is returned as type "application/pkix-cert", with an 5413 HTTP status code of 200 OK. Certificate processing errors should be 5414 treated as HTTP errors and have appropriate HTTP status codes. 5416 The client MUST check that the certificate returned was signed by one 5417 of the certificates received in the "root-cert" list of the overlay 5418 configuration data. The node then reads the certificate to find the 5419 Node-IDs it can use. 5421 10.3.1. Self-Generated Credentials 5423 If the "self-signed-permitted" element is present and set to "TRUE", 5424 then a node MUST generate its own self-signed certificate to join the 5425 overlay. The self-signed certificate MAY contain any user name of 5426 the users choice. 5428 The Node-ID MUST be computed by applying the digest specified in the 5429 self-signed-permitted element to the DER representation of the user's 5430 public key (more specifically the subjectPublicKeyInfo) and taking 5431 the high order bits. When accepting a self-signed certificate, nodes 5432 MUST check that the Node-ID and public keys match. This prevents 5433 Node-ID theft. 5435 Once the node has constructed a self-signed certificate, it MAY join 5436 the overlay. Before storing its certificate in the overlay 5437 (Section 7) it SHOULD look to see if the user name is already taken 5438 and if so choose another user name. Note that this only provides 5439 protection against accidental name collisions. Name theft is still 5440 possible. If protection against name theft is desired, then the 5441 enrollment service must be used. 5443 10.4. Searching for a Bootstrap Node 5445 If no cached bootstrap nodes are available and the config file has an 5446 multicast-bootstrap element, then the node SHOULD send a Ping request 5447 over UDP to the address and port found to each multicast-bootstrap 5448 element found in the configuration document. This MAY be a 5449 multicast, broadcast, or anycast address. The Ping should use the 5450 wildcard Node-ID as the destination Node-ID. 5452 The responder node that receives the Ping request SHOULD check that 5453 the overlay name is correct and that the requester peer sending the 5454 request has appropriate credentials for the overlay before responding 5455 to the Ping request even if the response is only an error. 5457 10.5. Contacting a Bootstrap Node 5459 In order to join the overlay, the joining node MUST contact a node in 5460 the overlay. Typically this means contacting the bootstrap nodes, 5461 since they are reachable by the local peer or have public IP 5462 addresses. If the joining node has cached a list of peers it has 5463 previously been connected with in this overlay, as an optimization it 5464 MAY attempt to use one or more of them as bootstrap nodes before 5465 falling back to the bootstrap nodes listed in the configuration file. 5467 When contacting a bootstrap node, the joining node first forms the 5468 DTLS or TLS connection to the boostrap node and then sends an Attach 5469 request over this connection with the destination Node-ID set to the 5470 joining node's Node-ID. 5472 When the requester node finally does receive a response from some 5473 responding node, it can note the Node-ID in the response and use this 5474 Node-ID to start sending requests to join the Overlay Instance as 5475 described in Section 5.4. 5477 After a node has successfully joined the overlay network, it will 5478 have direct connections to several peers. Some MAY be added to the 5479 cached bootstrap nodes list and used in future boots. Peers that are 5480 not directly connected MUST NOT be cached. The suggested number of 5481 peers to cache is 10. Algorithms for determining which peers to 5482 cache are beyond the scope of this specification. 5484 11. Message Flow Example 5486 The following abbreviation are used in the message flow diagrams: JP 5487 = joining peer, AP = admitting peer, NP = next peer after the AP, NNP 5488 = next next peer which is the peer after NP, PP = previous peer 5489 before the AP, PPP = previous previous peer which is the peer before 5490 the PP, BP = bootstrap peer. 5492 The follwowing abbreviation are used in the message flow diagrams: 5494 In the following example, we assume that JP has formed a connection 5495 to one of the bootstrap nodes. JP then sends an Attach through that 5496 peer to the admitting peer (AP) to initiate a connection. When AP 5497 responds, JP and AP use ICE to set up a connection and then set up 5498 TLS. 5500 JP PPP PP AP NP NNP BP 5501 | | | | | | | 5502 | | | | | | | 5503 | | | | | | | 5504 |Attach Dest=JP | | | | | 5505 |---------------------------------------------------------->| 5506 | | | | | | | 5507 | | | | | | | 5508 | | |Attach Dest=JP | | | 5509 | | |<--------------------------------------| 5510 | | | | | | | 5511 | | | | | | | 5512 | | |Attach Dest=JP | | | 5513 | | |-------->| | | | 5514 | | | | | | | 5515 | | | | | | | 5516 | | |AttachAns | | | 5517 | | |<--------| | | | 5518 | | | | | | | 5519 | | | | | | | 5520 | | |AttachAns | | | 5521 | | |-------------------------------------->| 5522 | | | | | | | 5523 | | | | | | | 5524 |AttachAns | | | | | 5525 |<----------------------------------------------------------| 5526 | | | | | | | 5527 | | | | | | | 5528 |TLS | | | | | | 5529 |.............................| | | | 5530 | | | | | | | 5531 | | | | | | | 5532 | | | | | | | 5533 | | | | | | | 5535 Once JP has connected to AP, it needs to populate its Routing Table. 5536 In Chord, this means that it needs to populate its neighbor table and 5537 its finger table. To populate its neighbor table, it needs the 5538 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 5539 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 5540 to set up a connection. 5542 JP PPP PP AP NP NNP BP 5543 | | | | | | | 5544 | | | | | | | 5545 | | | | | | | 5546 |Attach AP+1 | | | | | 5547 |---------------------------->| | | | 5548 | | | | | | | 5549 | | | | | | | 5550 | | | |Attach AP+1 | | 5551 | | | |-------->| | | 5552 | | | | | | | 5553 | | | | | | | 5554 | | | |AttachAns | | 5555 | | | |<--------| | | 5556 | | | | | | | 5557 | | | | | | | 5558 |AttachAns | | | | | 5559 |<----------------------------| | | | 5560 | | | | | | | 5561 | | | | | | | 5562 |Attach | | | | | | 5563 |-------------------------------------->| | | 5564 | | | | | | | 5565 | | | | | | | 5566 |TLS | | | | | | 5567 |.......................................| | | 5568 | | | | | | | 5569 | | | | | | | 5570 | | | | | | | 5571 | | | | | | | 5573 JP also needs to populate its finger table (for Chord). It issues an 5574 Attach to a variety of locations around the overlay. The diagram 5575 below shows it sending an Attach halfway around the Chord ring to the 5576 JP + 2^127. 5578 JP NP XX TP 5579 | | | | 5580 | | | | 5581 | | | | 5582 |Attach JP+2<<126 | | 5583 |-------->| | | 5584 | | | | 5585 | | | | 5586 | |Attach JP+2<<126 | 5587 | |-------->| | 5588 | | | | 5589 | | | | 5590 | | |Attach JP+2<<126 5591 | | |-------->| 5592 | | | | 5593 | | | | 5594 | | |AttachAns| 5595 | | |<--------| 5596 | | | | 5597 | | | | 5598 | |AttachAns| | 5599 | |<--------| | 5600 | | | | 5601 | | | | 5602 |AttachAns| | | 5603 |<--------| | | 5604 | | | | 5605 | | | | 5606 |TLS | | | 5607 |.............................| 5608 | | | | 5609 | | | | 5610 | | | | 5611 | | | | 5613 Once JP has a reasonable set of connections it is ready to take its 5614 place in the DHT. It does this by sending a Join to AP. AP does a 5615 series of Store requests to JP to store the data that JP will be 5616 responsible for. AP then sends JP an Update explicitly labeling JP 5617 as its predecessor. At this point, JP is part of the ring and 5618 responsible for a section of the overlay. AP can now forget any data 5619 which is assigned to JP and not AP. 5621 JP PPP PP AP NP NNP BP 5622 | | | | | | | 5623 | | | | | | | 5624 | | | | | | | 5625 |JoinReq | | | | | | 5626 |---------------------------->| | | | 5627 | | | | | | | 5628 | | | | | | | 5629 |JoinAns | | | | | | 5630 |<----------------------------| | | | 5631 | | | | | | | 5632 | | | | | | | 5633 |StoreReq Data A | | | | | 5634 |<----------------------------| | | | 5635 | | | | | | | 5636 | | | | | | | 5637 |StoreAns | | | | | | 5638 |---------------------------->| | | | 5639 | | | | | | | 5640 | | | | | | | 5641 |StoreReq Data B | | | | | 5642 |<----------------------------| | | | 5643 | | | | | | | 5644 | | | | | | | 5645 |StoreAns | | | | | | 5646 |---------------------------->| | | | 5647 | | | | | | | 5648 | | | | | | | 5649 |UpdateReq| | | | | | 5650 |<----------------------------| | | | 5651 | | | | | | | 5652 | | | | | | | 5653 |UpdateAns| | | | | | 5654 |---------------------------->| | | | 5655 | | | | | | | 5656 | | | | | | | 5657 | | | | | | | 5658 | | | | | | | 5660 In Chord, JP's neighbor table needs to contain its own predecessors. 5661 It couldn't connect to them previously because it did not yet know 5662 their addresses. However, now that it has received an Update from 5663 AP, it has AP's predecessors, which are also its own, so it sends 5664 Attaches to them. Below it is shown connecting to AP's closest 5665 predecessor, PP. 5667 JP PPP PP AP NP NNP BP 5668 | | | | | | | 5669 | | | | | | | 5670 | | | | | | | 5671 |Attach Dest=PP | | | | | 5672 |---------------------------->| | | | 5673 | | | | | | | 5674 | | | | | | | 5675 | | |Attach Dest=PP | | | 5676 | | |<--------| | | | 5677 | | | | | | | 5678 | | | | | | | 5679 | | |AttachAns| | | | 5680 | | |-------->| | | | 5681 | | | | | | | 5682 | | | | | | | 5683 |AttachAns| | | | | | 5684 |<----------------------------| | | | 5685 | | | | | | | 5686 | | | | | | | 5687 |TLS | | | | | | 5688 |...................| | | | | 5689 | | | | | | | 5690 | | | | | | | 5691 |UpdateReq| | | | | | 5692 |------------------>| | | | | 5693 | | | | | | | 5694 | | | | | | | 5695 |UpdateAns| | | | | | 5696 |<------------------| | | | | 5697 | | | | | | | 5698 | | | | | | | 5699 |UpdateReq| | | | | | 5700 |---------------------------->| | | | 5701 | | | | | | | 5702 | | | | | | | 5703 |UpdateAns| | | | | | 5704 |<----------------------------| | | | 5705 | | | | | | | 5706 | | | | | | | 5707 |UpdateReq| | | | | | 5708 |-------------------------------------->| | | 5709 | | | | | | | 5710 | | | | | | | 5711 |UpdateAns| | | | | | 5712 |<--------------------------------------| | | 5713 | | | | | | | 5714 | | | | | | | 5716 Finally, now that JP has a copy of all the data and is ready to route 5717 messages and receive requests, it sends Updates to everyone in its 5718 Routing Table to tell them it is ready to go. Below, it is shown 5719 sending such an update to TP. 5721 JP NP XX TP 5722 | | | | 5723 | | | | 5724 | | | | 5725 |Update | | | 5726 |---------------------------->| 5727 | | | | 5728 | | | | 5729 |UpdateAns| | | 5730 |<----------------------------| 5731 | | | | 5732 | | | | 5733 | | | | 5734 | | | | 5736 12. Security Considerations 5738 12.1. Overview 5740 RELOAD provides a generic storage service, albeit one designed to be 5741 useful for P2PSIP. In this section we discuss security issues that 5742 are likely to be relevant to any usage of RELOAD. More background 5743 information can be found in [RFC5765]. 5745 In any Overlay Instance, any given user depends on a number of peers 5746 with which they have no well-defined relationship except that they 5747 are fellow members of the Overlay Instance. In practice, these other 5748 nodes may be friendly, lazy, curious, or outright malicious. No 5749 security system can provide complete protection in an environment 5750 where most nodes are malicious. The goal of security in RELOAD is to 5751 provide strong security guarantees of some properties even in the 5752 face of a large number of malicious nodes and to allow the overlay to 5753 function correctly in the face of a modest number of malicious nodes. 5755 P2PSIP deployments require the ability to authenticate both peers and 5756 resources (users) without the active presence of a trusted entity in 5757 the system. We describe two mechanisms. The first mechanism is 5758 based on public key certificates and is suitable for general 5759 deployments. The second is an admission control mechanism based on 5760 an overlay-wide shared symmetric key. 5762 12.2. Attacks on P2P Overlays 5764 The two basic functions provided by overlay nodes are storage and 5765 routing: some node is responsible for storing a peer's data and for 5766 allowing a third peer to fetch this stored data. Other nodes are 5767 responsible for routing messages to and from the storing nodes. Each 5768 of these issues is covered in the following sections. 5770 P2P overlays are subject to attacks by subversive nodes that may 5771 attempt to disrupt routing, corrupt or remove user registrations, or 5772 eavesdrop on signaling. The certificate-based security algorithms we 5773 describe in this specification are intended to protect overlay 5774 routing and user registration information in RELOAD messages. 5776 To protect the signaling from attackers pretending to be valid peers 5777 (or peers other than themselves), the first requirement is to ensure 5778 that all messages are received from authorized members of the 5779 overlay. For this reason, RELOAD transports all messages over a 5780 secure channel (TLS and DTLS are defined in this document) which 5781 provides message integrity and authentication of the directly 5782 communicating peer. In addition, messages and data are digitally 5783 signed with the sender's private key, providing end-to-end security 5784 for communications. 5786 12.3. Certificate-based Security 5788 This specification stores users' registrations and possibly other 5789 data in an overlay network. This requires a solution to securing 5790 this data as well as securing, as well as possible, the routing in 5791 the overlay. Both types of security are based on requiring that 5792 every entity in the system (whether user or peer) authenticate 5793 cryptographically using an asymmetric key pair tied to a certificate. 5795 When a user enrolls in the Overlay Instance, they request or are 5796 assigned a unique name, such as "alice@dht.example.net". These names 5797 are unique and are meant to be chosen and used by humans much like a 5798 SIP Address of Record (AOR) or an email address. The user is also 5799 assigned one or more Node-IDs by the central enrollment authority. 5800 Both the name and the Node-ID are placed in the certificate, along 5801 with the user's public key. 5803 Each certificate enables an entity to act in two sorts of roles: 5805 o As a user, storing data at specific Resource-IDs in the Overlay 5806 Instance corresponding to the user name. 5807 o As a overlay peer with the Peer-ID(s) listed in the certificate. 5809 Note that since only users of this Overlay Instance need to validate 5810 a certificate, this usage does not require a global PKI. Instead, 5811 certificates are signed by a central enrollment authority which acts 5812 as the certificate authority for the Overlay Instance. This 5813 authority signs each peer's certificate. Because each peer possesses 5814 the CA's certificate (which they receive on enrollment) they can 5815 verify the certificates of the other entities in the overlay without 5816 further communication. Because the certificates contain the user/ 5817 peer's public key, communications from the user/peer can be verified 5818 in turn. 5820 If self-signed certificates are used, then the security provided is 5821 significantly decreased, since attackers can mount Sybil attacks. In 5822 addition, attackers cannot trust the user names in certificates 5823 (though they can trust the Node-IDs because they are 5824 cryptographically verifiable). This scheme may be appropriate for 5825 some small deployments, such as a small office or an ad hoc overlay 5826 set up among participants in a meeting where all hosts on the network 5827 are trusted. Some additional security can be provided by using the 5828 shared secret admission control scheme as well. 5830 Because all stored data is signed by the owner of the data the 5831 storing peer can verify that the storer is authorized to perform a 5832 store at that Resource-ID and also allow any consumer of the data to 5833 verify the provenance and integrity of the data when it retrieves it. 5835 Note that RELOAD does not itself provide a revocation/status 5836 mechanism (though certificates may of course include OCSP responder 5837 information). Thus, certificate lifetimes should be chosen to 5838 balance the compromise window versus the cost of certificate renewal. 5839 Because RELOAD is already designed to operate in the face of some 5840 fraction of malicious peers, this form of compromise is not fatal. 5842 All implementations MUST implement certificate-based security. 5844 12.4. Shared-Secret Security 5846 RELOAD also supports a shared secret admission control scheme that 5847 relies on a single key that is shared among all members of the 5848 overlay. It is appropriate for small groups that wish to form a 5849 private network without complexity. In shared secret mode, all the 5850 peers share a single symmetric key which is used to key TLS-PSK 5851 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 5852 key cannot form TLS connections with any other peer and therefore 5853 cannot join the overlay. 5855 One natural approach to a shared-secret scheme is to use a user- 5856 entered password as the key. The difficulty with this is that in 5857 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 5859 If passwords are used as the source of shared-keys, then TLS-SRP is a 5860 superior choice because it is not subject to dictionary attacks. 5862 12.5. Storage Security 5864 When certificate-based security is used in RELOAD, any given 5865 Resource-ID/Kind-ID pair is bound to some small set of certificates. 5866 In order to write data, the writer must prove possession of the 5867 private key for one of those certificates. Moreover, all data is 5868 stored, signed with the same private key that was used to authorize 5869 the storage. This set of rules makes questions of authorization and 5870 data integrity - which have historically been thorny for overlays - 5871 relatively simple. 5873 12.5.1. Authorization 5875 When a client wants to store some value, it first digitally signs the 5876 value with its own private key. It then sends a Store request that 5877 contains both the value and the signature towards the storing peer 5878 (which is defined by the Resource Name construction algorithm for 5879 that particular kind of value). 5881 When the storing peer receives the request, it must determine whether 5882 the storing client is authorized to store at this Resource-ID/Kind-ID 5883 pair. Determining this requires comparing the user's identity to the 5884 requirements of the access control model (see Section 6.3). If it 5885 satisfies those requirements the user is authorized to write, pending 5886 quota checks as described in the next section. 5888 For example, consider the certificate with the following properties: 5890 User name: alice@dht.example.com 5891 Node-ID: 013456789abcdef 5892 Serial: 1234 5894 If Alice wishes to Store a value of the "SIP Location" kind, the 5895 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 5896 Resource-ID will be determined by hashing the Resource Name. Because 5897 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 5898 the user name in the certificate hashes to the requested Resource-ID. 5899 It then verifies that the node-id in the certificate matches the 5900 dictionary key being used for the store. If both of these checks 5901 succeed, the Store is authorized. Note that because the access 5902 control model is different for different kinds, the exact set of 5903 checks will vary. 5905 12.5.2. Distributed Quota 5907 Being a peer in an Overlay Instance carries with it the 5908 responsibility to store data for a given region of the Overlay 5909 Instance. However, allowing clients to store unlimited amounts of 5910 data would create unacceptable burdens on peers and would also enable 5911 trivial denial of service attacks. RELOAD addresses this issue by 5912 requiring configurations to define maximum sizes for each kind of 5913 stored data. Attempts to store values exceeding this size MUST be 5914 rejected (if peers are inconsistent about this, then strange 5915 artifacts will happen when the zone of responsibility shifts and a 5916 different peer becomes responsible for overlarge data). Because each 5917 Resource-ID/Kind-ID pair is bound to a small set of certificates, 5918 these size restrictions also create a distributed quota mechanism, 5919 with the quotas administered by the central enrollment server. 5921 Allowing different kinds of data to have different size restrictions 5922 allows new usages the flexibility to define limits that fit their 5923 needs without requiring all usages to have expansive limits. 5925 12.5.3. Correctness 5927 Because each stored value is signed, it is trivial for any retrieving 5928 peer to verify the integrity of the stored value. Some more care 5929 needs to be taken to prevent version rollback attacks. Rollback 5930 attacks on storage are prevented by the use of store times and 5931 lifetime values in each store. A lifetime represents the latest time 5932 at which the data is valid and thus limits (though does not 5933 completely prevent) the ability of the storing node to perform a 5934 rollback attack on retrievers. In order to prevent a rollback attack 5935 at the time of the Store request, we require that storage times be 5936 monotonically increasing. Storing peers MUST reject Store requests 5937 with storage times smaller than or equal to those they are currently 5938 storing. In addition, a fetching node which receives a data value 5939 with a storage time older than the result of the previous fetch knows 5940 a rollback has occurred. 5942 12.5.4. Residual Attacks 5944 The mechanisms described here provides a high degree of security, but 5945 some attacks remain possible. Most simply, it is possible for 5946 storing nodes to refuse to store a value (i.e., reject any request). 5947 In addition, a storing node can deny knowledge of values which it has 5948 previously accepted. To some extent these attacks can be ameliorated 5949 by attempting to store to/retrieve from replicas, but a retrieving 5950 client does not know whether it should try this or not, since there 5951 is a cost to doing so. 5953 The certificate-based authentication scheme prevents a single peer 5954 from being able to forge data owned by other peers. Furthermore, 5955 although a subversive peer can refuse to return data resources for 5956 which it is responsible, it cannot return forged data because it 5957 cannot provide authentication for such registrations. Therefore 5958 parallel searches for redundant registrations can mitigate most of 5959 the effects of a compromised peer. The ultimate reliability of such 5960 an overlay is a statistical question based on the replication factor 5961 and the percentage of compromised peers. 5963 In addition, when a kind is multivalued (e.g., an array data model), 5964 the storing node can return only some subset of the values, thus 5965 biasing its responses. This can be countered by using single values 5966 rather than sets, but that makes coordination between multiple 5967 storing agents much more difficult. This is a trade off that must be 5968 made when designing any usage. 5970 12.6. Routing Security 5972 Because the storage security system guarantees (within limits) the 5973 integrity of the stored data, routing security focuses on stopping 5974 the attacker from performing a DOS attack that misroutes requests in 5975 the overlay. There are a few obvious observations to make about 5976 this. First, it is easy to ensure that an attacker is at least a 5977 valid peer in the Overlay Instance. Second, this is a DOS attack 5978 only. Third, if a large percentage of the peers on the Overlay 5979 Instance are controlled by the attacker, it is probably impossible to 5980 perfectly secure against this. 5982 12.6.1. Background 5984 In general, attacks on DHT routing are mounted by the attacker 5985 arranging to route traffic through one or two nodes it controls. In 5986 the Eclipse attack [Eclipse] the attacker tampers with messages to 5987 and from nodes for which it is on-path with respect to a given victim 5988 node. This allows it to pretend to be all the nodes that are 5989 reachable through it. In the Sybil attack [Sybil], the attacker 5990 registers a large number of nodes and is therefore able to capture a 5991 large amount of the traffic through the DHT. 5993 Both the Eclipse and Sybil attacks require the attacker to be able to 5994 exercise control over her Peer-IDs. The Sybil attack requires the 5995 creation of a large number of peers. The Eclipse attack requires 5996 that the attacker be able to impersonate specific peers. In both 5997 cases, these attacks are limited by the use of centralized, 5998 certificate-based admission control. 6000 12.6.2. Admissions Control 6002 Admission to a RELOAD Overlay Instance is controlled by requiring 6003 that each peer have a certificate containing its Peer-ID. The 6004 requirement to have a certificate is enforced by using certificate- 6005 based mutual authentication on each connection. (Note: the 6006 following only applies when self-signed certificates are not used.) 6007 Whenever a peer connects to another peer, each side automatically 6008 checks that the other has a suitable certificate. These Peer-IDs are 6009 randomly assigned by the central enrollment server. This has two 6010 benefits: 6012 o It allows the enrollment server to limit the number of peer IDs 6013 issued to any individual user. 6014 o It prevents the attacker from choosing specific Peer-IDs. 6016 The first property allows protection against Sybil attacks (provided 6017 the enrollment server uses strict rate limiting policies). The 6018 second property deters but does not completely prevent Eclipse 6019 attacks. Because an Eclipse attacker must impersonate peers on the 6020 other side of the attacker, he must have a certificate for suitable 6021 Peer-IDs, which requires him to repeatedly query the enrollment 6022 server for new certificates, which will match only by chance. From 6023 the attacker's perspective, the difficulty is that if he only has a 6024 small number of certificates, the region of the Overlay Instance he 6025 is impersonating appears to be very sparsely populated by comparison 6026 to the victim's local region. 6028 12.6.3. Peer Identification and Authentication 6030 In general, whenever a peer engages in overlay activity that might 6031 affect the routing table it must establish its identity. This 6032 happens in two ways. First, whenever a peer establishes a direct 6033 connection to another peer it authenticates via certificate-based 6034 mutual authentication. All messages between peers are sent over this 6035 protected channel and therefore the peers can verify the data origin 6036 of the last hop peer for requests and responses without further 6037 cryptography. 6039 In some situations, however, it is desirable to be able to establish 6040 the identity of a peer with whom one is not directly connected. The 6041 most natural case is when a peer Updates its state. At this point, 6042 other peers may need to update their view of the overlay structure, 6043 but they need to verify that the Update message came from the actual 6044 peer rather than from an attacker. To prevent this, all overlay 6045 routing messages are signed by the peer that generated them. 6047 Replay is typically prevented for messages that impact the topology 6048 of the overlay by having the information come directly, or be 6049 verified by, the nodes that claimed to have generated the update. 6050 Data storage replay detection is done by signing time of the node 6051 that generated the signature on the store request thus providing a 6052 time based replay protection but the time synchronization is only 6053 needed between peers that can write to the same location. 6055 12.6.4. Protecting the Signaling 6057 The goal here is to stop an attacker from knowing who is signaling 6058 what to whom. An attacker is unlikely to be able to observe the 6059 activities of a specific individual given the randomization of IDs 6060 and routing based on the present peers discussed above. Furthermore, 6061 because messages can be routed using only the header information, the 6062 actual body of the RELOAD message can be encrypted during 6063 transmission. 6065 There are two lines of defense here. The first is the use of TLS or 6066 DTLS for each communications link between peers. This provides 6067 protection against attackers who are not members of the overlay. The 6068 second line of defense is to digitally sign each message. This 6069 prevents adversarial peers from modifying messages in flight, even if 6070 they are on the routing path. 6072 12.6.5. Residual Attacks 6074 The routing security mechanisms in RELOAD are designed to contain 6075 rather than eliminate attacks on routing. It is still possible for 6076 an attacker to mount a variety of attacks. In particular, if an 6077 attacker is able to take up a position on the overlay routing between 6078 A and B it can make it appear as if B does not exist or is 6079 disconnected. It can also advertise false network metrics in an 6080 attempt to reroute traffic. However, these are primarily DOS 6081 attacks. 6083 The certificate-based security scheme secures the namespace, but if 6084 an individual peer is compromised or if an attacker obtains a 6085 certificate from the CA, then a number of subversive peers can still 6086 appear in the overlay. While these peers cannot falsify responses to 6087 resource queries, they can respond with error messages, effecting a 6088 DoS attack on the resource registration. They can also subvert 6089 routing to other compromised peers. To defend against such attacks, 6090 a resource search must still consist of parallel searches for 6091 replicated registrations. 6093 13. IANA Considerations 6095 This section contains the new code points registered by this 6096 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6097 the RFC number for this specification in the following list.] 6099 13.1. Port Registrations 6101 [[Note to RFC Editor - this paragraph can be removed before 6102 publication. ]] IANA has already allocated a port for the main peer 6103 to peer protocol. This port has the name p2p-sip and the port number 6104 of 6084. The names of this port may need to be changed as this draft 6105 progresses and if it does careful instructions will be needed to IANA 6106 to ensure the final RFC and IANA registrations are in sync. 6108 IANA will make the following port registration: 6110 +-------------------------------+-----------------------------------+ 6111 | Registration Technical | Cullen Jennings | 6112 | Contact | | 6113 | Registration Owner | IETF | 6114 | Transport Protocol | TCP, UDP | 6115 | Port Number | 6084 | 6116 | Service Name | p2psip_enroll | 6117 | Description | RELOAD P2P Protcol | 6118 | Reference | [RFC-AAAA] | 6119 +-------------------------------+-----------------------------------+ 6121 13.2. Overlay Algorithm Types 6123 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6124 Entries in this registry are strings denoting the names of overlay 6125 algorithms. The registration policy for this registry is RFC 5226 6126 IETF Review. The initial contents of this registry are: 6128 +----------------+----------+ 6129 | Algorithm Name | RFC | 6130 +----------------+----------+ 6131 | chord-reload | RFC-AAAA | 6132 +----------------+----------+ 6134 13.3. Access Control Policies 6136 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6137 in this registry are strings denoting access control policies, as 6138 described in Section 6.3. New entries in this registry SHALL be 6139 registered via RFC 5226 Standards Action. The initial contents of 6140 this registry are: 6142 USER-MATCH 6143 NODE-MATCH 6144 USER-NODE-MATCH 6145 NODE-MULTIPLE 6147 13.4. Application-ID 6149 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6150 this registry are 16-bit integers denoting applictions kinds. Code 6151 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6152 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6153 registered via RFC 5226 Expert Review. Code points in the range 6154 0xf001 to 0xfffe are reserved for private us. The initial contents 6155 of this registry are: 6157 +-------------+----------------+-------------------------------+ 6158 | Application | Application-ID | Specification | 6159 +-------------+----------------+-------------------------------+ 6160 | INVALID | 0 | RFC-AAAA | 6161 | RELOAD | 1 | RFC-AAAA | 6162 | SIP | 5060 | Reserved for use by SIP Usage | 6163 | SIP | 5061 | Reserved for use by SIP Usage | 6164 | Reserved | 0xffff | RFC-AAAA | 6165 +-------------+----------------+-------------------------------+ 6167 13.5. Data Kind-ID 6169 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6170 registry are 32-bit integers denoting data kinds, as described in 6171 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 6172 SHALL be registered via RFC 5226 Standards Action. Code points in 6173 the range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 6174 Expert Review. Code points in the range 0xf0000001 to 0xffffffff are 6175 reserved for private use via the kind description mechanism described 6176 in Section 10. The initial contents of this registry are: 6178 +---------------------+------------+----------+ 6179 | Kind | Kind-ID | RFC | 6180 +---------------------+------------+----------+ 6181 | INVALID | 0 | RFC-AAAA | 6182 | TURN_SERVICE | 2 | RFC-AAAA | 6183 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6184 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6185 | Reserved | 0x7fffffff | RFC-AAAA | 6186 | Reserved | 0xffffffff | RFC-AAAA | 6187 +---------------------+------------+----------+ 6189 13.6. Data Model 6191 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6192 registry are 8-bit integers denoting data models, as described in 6193 Section 6.2. Code points in this registry SHALL be registered via 6194 RFC 5226 Standards Action. The initial contents of this registry 6195 are: 6197 +--------------+------+----------+ 6198 | Data Model | Code | RFC | 6199 +--------------+------+----------+ 6200 | INVALID | 0 | RFC-AAAA | 6201 | SINGLE_VALUE | 1 | RFC-AAAA | 6202 | ARRAY | 2 | RFC-AAAA | 6203 | DICTIONARY | 3 | RFC-AAAA | 6204 | RESERVED | 255 | RFC-AAAA | 6205 +--------------+------+----------+ 6207 13.7. Message Codes 6209 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6210 registry are 16-bit integers denoting method codes as described in 6211 Section 5.3.3. These codes SHALL be registered via RFC 5226 6212 Standards Action. The initial contents of this registry are: 6214 +---------------------------------+----------------+----------+ 6215 | Message Code Name | Code Value | RFC | 6216 +---------------------------------+----------------+----------+ 6217 | invalid | 0 | RFC-AAAA | 6218 | probe_req | 1 | RFC-AAAA | 6219 | probe_ans | 2 | RFC-AAAA | 6220 | attach_req | 3 | RFC-AAAA | 6221 | attach_ans | 4 | RFC-AAAA | 6222 | unused | 5 | | 6223 | unused | 6 | | 6224 | store_req | 7 | RFC-AAAA | 6225 | store_ans | 8 | RFC-AAAA | 6226 | fetch_req | 9 | RFC-AAAA | 6227 | fetch_ans | 10 | RFC-AAAA | 6228 | remove_req | 11 | RFC-AAAA | 6229 | remove_ans | 12 | RFC-AAAA | 6230 | find_req | 13 | RFC-AAAA | 6231 | find_ans | 14 | RFC-AAAA | 6232 | join_req | 15 | RFC-AAAA | 6233 | join_ans | 16 | RFC-AAAA | 6234 | leave_req | 17 | RFC-AAAA | 6235 | leave_ans | 18 | RFC-AAAA | 6236 | update_req | 19 | RFC-AAAA | 6237 | update_ans | 20 | RFC-AAAA | 6238 | route_query_req | 21 | RFC-AAAA | 6239 | route_query_ans | 22 | RFC-AAAA | 6240 | ping_req | 23 | RFC-AAAA | 6241 | ping_ans | 24 | RFC-AAAA | 6242 | stat_req | 25 | RFC-AAAA | 6243 | stat_ans | 26 | RFC-AAAA | 6244 | unused (was attachlite_req) | 27 | RFC-AAAA | 6245 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6246 | app_attach_req | 29 | RFC-AAAA | 6247 | app_attach_ans | 30 | RFC-AAAA | 6248 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6249 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6250 | reserved | 0x8000..0xfffe | RFC-AAAA | 6251 | error | 0xffff | RFC-AAAA | 6252 +---------------------------------+----------------+----------+ 6254 13.8. Error Codes 6256 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6257 registry are 16-bit integers denoting error codes. New entries SHALL 6258 be defined via RFC 5226 Standards Action. The initial contents of 6259 this registry are: 6261 +-------------------------------------+----------------+----------+ 6262 | Error Code Name | Code Value | RFC | 6263 +-------------------------------------+----------------+----------+ 6264 | invalid | 0 | RFC-AAAA | 6265 | Unused | 1 | RFC-AAAA | 6266 | Error_Forbidden | 2 | RFC-AAAA | 6267 | Error_Not_Found | 3 | RFC-AAAA | 6268 | Error_Request_Timeout | 4 | RFC-AAAA | 6269 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6270 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6271 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6272 | Error_Data_Too_Large | 8 | RFC-AAAA | 6273 | Error_Data_Too_Old | 9 | RFC-AAAA | 6274 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6275 | Error_Message_Too_Large | 11 | RFC-AAAA | 6276 | Error_Unknown_Kind | 12 | RFC-AAAA | 6277 | Error_Unknown_Extension | 13 | RFC-AAAA | 6278 | reserved | 0x8000..0xfffe | RFC-AAAA | 6279 +-------------------------------------+----------------+----------+ 6281 13.9. Overlay Link Types 6283 IANA shall create a "RELOAD Overlay Link." New entries SHALL be 6284 defined via RFC 5226 Standards Action. This registry SHALL be 6285 initially populated with the following values: 6287 +--------------------+------+---------------+ 6288 | Protocol | Code | Specification | 6289 +--------------------+------+---------------+ 6290 | reserved | 0 | RFC-AAAA | 6291 | DTLS-UDP-SR | 1 | RFC-AAAA | 6292 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6293 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6294 | reserved | 255 | RFC-AAAA | 6295 +--------------------+------+---------------+ 6297 13.10. Overlay Link Protocols 6299 IANA shall create an "Overlay Link Protocol Registry". Entries in 6300 this registry SHALL be defined via RFC 5226 Standards Action. This 6301 registry SHALL be initially populated with the following value: 6302 "TLS". 6304 13.11. Forwarding Options 6306 IANA shall create a "Forwarding Option Registry". Entries in this 6307 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6308 Action. Entries in this registry between 128 and 254 SHALL be 6309 defined via RFC 5226 Specification Required. This registry SHALL be 6310 initially populated with the following values: 6312 +-------------------+------+---------------+ 6313 | Forwarding Option | Code | Specification | 6314 +-------------------+------+---------------+ 6315 | invalid | 0 | RFC-AAAA | 6316 | reserved | 255 | RFC-AAAA | 6317 +-------------------+------+---------------+ 6319 13.12. Probe Information Types 6321 IANA shall create a "RELOAD Probe Information Type Registry". 6322 Entries in this registry SHALL be defined via RFC 5226 Standards 6323 Action. This registry SHALL be initially populated with the 6324 following values: 6326 +-----------------+------+---------------+ 6327 | Probe Option | Code | Specification | 6328 +-----------------+------+---------------+ 6329 | invalid | 0 | RFC-AAAA | 6330 | responsible_set | 1 | RFC-AAAA | 6331 | num_resources | 2 | RFC-AAAA | 6332 | uptime | 3 | RFC-AAAA | 6333 | reserved | 255 | RFC-AAAA | 6334 +-----------------+------+---------------+ 6336 13.13. Message Extensions 6338 IANA shall create a "RELOAD Extensions Registry". Entries in this 6339 registry SHALL be defined via RFC 5226 Specification Required. This 6340 registry SHALL be initially populated with the following values: 6342 +-----------------+--------+---------------+ 6343 | Extensions Name | Code | Specification | 6344 +-----------------+--------+---------------+ 6345 | invalid | 0 | RFC-AAAA | 6346 | reserved | 0xFFFF | RFC-AAAA | 6347 +-----------------+--------+---------------+ 6349 13.14. reload URI Scheme 6351 This section describes the scheme for a reload URI, which can be used 6352 to refer to either: 6354 o A peer. 6356 o A resource inside a peer. 6358 The reload URI is defined using a subset of the URI schema specified 6359 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6360 [RFC4395] per the following ABNF syntax: 6362 RELOAD-URI = "reload://" destination "@" overlay "/" 6363 [specifier] 6365 destination = 1 * HEXDIG 6366 overlay = reg-name 6367 specifier = 1*HEXDIG 6369 The definitions of these productions are as follows: 6371 destination: a hex-encoded Destination List object. 6373 overlay: the name of the overlay. 6375 specifier : a hex-encoded StoredDataSpecifier indicating the data 6376 element. 6378 If no specifier is present then this URI addresses the peer which can 6379 be reached via the indicated destination list at the indicated 6380 overlay name. If a specifier is present, then the URI addresses the 6381 data value. 6383 13.14.1. URI Registration 6385 The following summarizes the information necessary to register the 6386 reload URI. 6388 URI Scheme Name: reload 6389 Status: permanent 6390 URI Scheme Syntax: see Section 13.14 of RFC-AAAA 6391 URI Scheme Semantics: The reload URI is intended to be used as a 6392 reference to a RELOAD peer or resource. 6393 Encoding Considerations: The reload URI is not intended to be 6394 human-readable text, so it is encoded entirely in US-ASCII. 6395 Applications/protocols that use this URI scheme: The RELOAD 6396 protocol described in RFC-AAAA. 6397 Interoperability considerations See RFC-AAAA. 6398 Security considerations See RFC-AAAA 6399 Contact Cullen Jennings 6400 Author/Change controller IESG 6401 References RFC-AAAA 6403 14. Acknowledgments 6405 This specification is a merge of the "REsource LOcation And Discovery 6406 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6407 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6408 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6409 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6410 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6411 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6412 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6413 Matuszewski. Thanks to the authors of RFC 5389 for text included 6414 from that. Vidya Narayanan provided many comments and imporvements. 6416 The ideas and text for the Chord specific extension data to the Leave 6417 mechanisms was provided by J. Maenpaa, G. Camarillo, and J. 6418 Hautakorpi. 6420 Thanks to the many people who contributed including Ted Hardie, 6421 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6422 David Bryan, Dave Craig, and Julian Cain. Extensinve working last 6423 call comments were provided by: Jouni Maenpaa, Roni Even, Ari 6424 Keranen, John Buford, Michael Chen, Frederic-Philippe Met, and David 6425 Bryan. 6427 15. References 6429 15.1. Normative References 6431 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6432 Requirement Levels", BCP 14, RFC 2119, March 1997. 6434 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 6435 (ICE): A Protocol for Network Address Translator (NAT) 6436 Traversal for Offer/Answer Protocols", RFC 5245, 6437 April 2010. 6439 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 6440 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 6441 October 2008. 6443 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 6444 Relays around NAT (TURN): Relay Extensions to Session 6445 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 6447 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6448 (CMC): Transport Protocols", RFC 5273, June 2008. 6450 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6451 (CMC)", RFC 5272, June 2008. 6453 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6454 for Transport Layer Security (TLS)", RFC 4279, 6455 December 2005. 6457 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6458 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6460 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6461 Security", RFC 4347, April 2006. 6463 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 6464 Friendly Rate Control (TFRC): Protocol Specification", 6465 RFC 5348, September 2008. 6467 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6468 Encodings", RFC 4648, October 2006. 6470 [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission 6471 Timer", RFC 2988, November 2000. 6473 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6474 Resource Identifier (URI): Generic Syntax", STD 66, 6475 RFC 3986, January 2005. 6477 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6478 Registration Procedures for New URI Schemes", BCP 35, 6479 RFC 4395, February 2006. 6481 [I-D.ietf-6man-text-addr-representation] 6482 Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 6483 Address Text Representation", 6484 draft-ietf-6man-text-addr-representation-07 (work in 6485 progress), February 2010. 6487 15.2. Informative References 6489 [I-D.ietf-mmusic-ice-tcp] 6490 Rosenberg, J., "TCP Candidates with Interactive 6491 Connectivity Establishment (ICE)", 6492 draft-ietf-mmusic-ice-tcp-07 (work in progress), 6493 July 2008. 6495 [I-D.maenpaa-p2psip-self-tuning] 6496 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 6497 tuning Distributed Hash Table (DHT) for REsource LOcation 6498 And Discovery (RELOAD)", 6499 draft-maenpaa-p2psip-self-tuning-01 (work in progress), 6500 October 2009. 6502 [I-D.baset-tsvwg-tcp-over-udp] 6503 Baset, S. and H. Schulzrinne, "TCP-over-UDP", 6504 draft-baset-tsvwg-tcp-over-udp-01 (work in progress), 6505 June 2009. 6507 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 6508 "Host Identity Protocol", RFC 5201, April 2008. 6510 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 6511 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 6512 April 2007. 6514 [I-D.ietf-p2psip-concepts] 6515 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 6516 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 6517 draft-ietf-p2psip-concepts-02 (work in progress), 6518 July 2008. 6520 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6521 Communication Layers", STD 3, RFC 1122, October 1989. 6523 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 6524 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 6525 RFC 5382, October 2008. 6527 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 6528 the Session Description Protocol (SDP)", RFC 4145, 6529 September 2005. 6531 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6533 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6534 Requirements for Security", BCP 106, RFC 4086, June 2005. 6536 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 6537 "Using the Secure Remote Password (SRP) Protocol for TLS 6538 Authentication", RFC 5054, November 2007. 6540 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6541 Housley, R., and W. Polk, "Internet X.509 Public Key 6542 Infrastructure Certificate and Certificate Revocation List 6543 (CRL) Profile", RFC 5280, May 2008. 6545 [I-D.matthews-p2psip-bootstrap-mechanisms] 6546 Cooper, E., "Bootstrap Mechanisms for P2PSIP", 6547 draft-matthews-p2psip-bootstrap-mechanisms-00 (work in 6548 progress), February 2007. 6550 [I-D.garcia-p2psip-dns-sd-bootstrapping] 6551 Garcia, G., "P2PSIP bootstrapping using DNS-SD", 6552 draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in 6553 progress), October 2007. 6555 [I-D.pascual-p2psip-clients] 6556 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 6557 Yongchao, "P2PSIP Clients", 6558 draft-pascual-p2psip-clients-01 (work in progress), 6559 February 2008. 6561 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 6562 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 6563 RFC 4787, January 2007. 6565 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 6566 L. Repka, "S/MIME Version 2 Message Specification", 6567 RFC 2311, March 1998. 6569 [I-D.jiang-p2psip-sep] 6570 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 6571 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 6572 February 2008. 6574 [I-D.hardie-p2poverlay-pointers] 6575 Hardie, T., "Mechanisms for use in pointing to overlay 6576 networks, nodes, or resources", 6577 draft-hardie-p2poverlay-pointers-00 (work in progress), 6578 January 2008. 6580 [I-D.ietf-p2psip-sip] 6581 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 6582 H. Schulzrinne, "A SIP Usage for RELOAD", 6583 draft-ietf-p2psip-sip-01 (work in progress), March 2009. 6585 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 6587 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 6588 "Eclipse Attacks on Overlay Networks: Threats and 6589 Defenses", INFOCOM 2006, April 2006. 6591 [non-transitive-dhts-worlds05] 6592 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 6593 Stoica, "Non-Transitive Connectivity and DHTs", 6594 WORLDS'05. 6596 [lookups-churn-p2p06] 6597 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 6598 Improving DHT Lookup Performance under Churn", IEEE 6599 P2P'06. 6601 [bryan-design-hotp2p08] 6602 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 6603 a Versatile, Secure P2PSIP Communications Architecture for 6604 the Public Internet", Hot-P2P'08. 6606 [opendht-sigcomm05] 6607 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 6608 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 6609 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 6611 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 6612 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 6613 Scalable Peer-to-peer Lookup Protocol for Internet 6614 Applications", IEEE/ACM Transactions on Networking Volume 6615 11, Issue 1, 17-32, Feb 2003. 6617 [vulnerabilities-acsac04] 6618 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 6619 Threats in Structured Peer-to-Peer Systems: A Quantitative 6620 Analysis", ACSAC 2004. 6622 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 6623 Issues and Solutions in Peer-to-Peer Systems for Realtime 6624 Communications", RFC 5765, February 2010. 6626 [handling-churn-usenix04] 6627 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 6628 "Handling Churn in a DHT", In Proc. of the USENIX Annual 6629 Technical Conference June 2004 USENIX 2004. 6631 [minimizing-churn-sigcomm06] 6632 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 6633 in Distributed Systems", SIGCOMM 2006. 6635 Appendix A. Change Log 6637 A.1. Changes since draft-ietf-p2psip-reload-09 6639 o Made NodeId length configurable on a per-overlay basis. (Per 6640 consensus call at IETF 78). 6641 o Added support for replacing TLS if necessary. 6642 o Added a "send_update" flag to the AttachReqAns structure. 6643 o Added support for Direct Return Responses. 6644 o Clarified support for overlays with No-ICE. 6645 o Added a note that peers which do not modify the via list must 6646 somehow garbage collect state. 6648 Appendix B. Routing Alternatives 6650 Significant discussion has been focused on the selection of a routing 6651 algorithm for P2PSIP. This section discusses the motivations for 6652 selecting symmetric recursive routing for RELOAD and describes the 6653 extensions that would be required to support additional routing 6654 algorithms. 6656 B.1. Iterative vs Recursive 6658 Iterative routing has a number of advantages. It is easier to debug, 6659 consumes fewer resources on intermediate peers, and allows the 6660 querying peer to identify and route around misbehaving peers 6661 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 6662 iterative routing is intolerably expensive because a new connection 6663 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 6665 Iterative routing is supported through the Route_Query mechanism and 6666 is primarily intended for debugging. It also allows the querying 6667 peer to evaluate the routing decisions made by the peers at each hop, 6668 consider alternatives, and perhaps detect at what point the 6669 forwarding path fails. 6671 B.2. Symmetric vs Forward response 6673 An alternative to the symmetric recursive routing method used by 6674 RELOAD is Forward-Only routing, where the response is routed to the 6675 requester as if it were a new message initiated by the responder (in 6676 the previous example, Z sends the response to A as if it were sending 6677 a request). Forward-only routing requires no state in either the 6678 message or intermediate peers. 6680 The drawback of forward-only routing is that it does not work when 6681 the overlay is unstable. For example, if A is in the process of 6682 joining the overlay and is sending a Join request to Z, it is not yet 6683 reachable via forward routing. Even if it is established in the 6684 overlay, if network failures produce temporary instability, A may not 6685 be reachable (and may be trying to stabilize its network connectivity 6686 via Attach messages). 6688 Furthermore, forward-only responses are less likely to reach the 6689 querying peer than symmetric recursive ones are, because the forward 6690 path is more likely to have a failed peer than is the request path 6691 (which was just tested to route the request) 6692 [non-transitive-dhts-worlds05]. 6694 An extension to RELOAD that supports forward-only routing but relies 6695 on symmetric responses as a fallback would be possible, but due to 6696 the complexities of determining when to use forward-only and when to 6697 fallback to symmetric, we have chosen not to include it as an option 6698 at this point. 6700 B.3. Direct Response 6702 Another routing option is Direct Response routing, in which the 6703 response is returned directly to the querying node. In the previous 6704 example, if A encodes its IP address in the request, then Z can 6705 simply deliver the response directly to A. In the absence of NATs or 6706 other connectivity issues, this is the optimal routing technique. 6708 The challenge of implementing direct response is the presence of 6709 NATs. There are a number of complexities that must be addressed. In 6710 this discussion, we will continue our assumption that A issued the 6711 request and Z is generating the response. 6713 o The IP address listed by A may be unreachable, either due to NAT 6714 or firewall rules. Therefore, a direct response technique must 6715 fallback to symmetric response [non-transitive-dhts-worlds05]. 6716 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 6717 received the message (and the TLS negotiation will provide earlier 6718 confirmation that A is reachable), but this fallback requires a 6719 timeout that will increase the response latency whenever A is not 6720 reachable from Z. 6721 o Whenever A is behind a NAT it will have multiple candidate IP 6722 addresses, each of which must be advertised to ensure 6723 connectivity; therefore Z will need to attempt multiple 6724 connections to deliver the response. 6725 o One (or all) of A's candidate addresses may route from Z to a 6726 different device on the Internet. In the worst case these nodes 6727 may actually be running RELOAD on the same port. Therefore, it is 6728 absolutely necessary to establish a secure connection to 6729 authenticate A before delivering the response. This step 6730 diminishes the efficiency of direct response because multiple 6731 roundtrips are required before the message can be delivered. 6732 o If A is behind a NAT and does not have a connection already 6733 established with Z, there are only two ways the direct response 6734 will work. The first is that A and Z both be behind the same NAT, 6735 in which case the NAT is not involved. In the more common case, 6736 when Z is outside A's NAT, the response will only be received if 6737 A's NAT implements endpoint-independent filtering. As the choice 6738 of filtering mode conflates application transparency with security 6739 [RFC4787], and no clear recommendation is available, the 6740 prevalence of this feature in future devices remains unclear. 6742 An extension to RELOAD that supports direct response routing but 6743 relies on symmetric responses as a fallback would be possible, but 6744 due to the complexities of determining when to use direct response 6745 and when to fallback to symmetric, and the reduced performance for 6746 responses to peers behind restrictive NATs, we have chosen not to 6747 include it as an option at this point. 6749 B.4. Relay Peers 6751 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 6752 response by having A identify a peer, Q, that will be directly 6753 reachable by any other peer. A uses Attach to establish a connection 6754 with Q and advertises Q's IP address in the request sent to Z. Z 6755 sends the response to Q, which relays it to A. This then reduces the 6756 latency to two hops, plus Z negotiating a secure connection to Q. 6758 This technique relies on the relative population of nodes such as A 6759 that require relay peers and peers such as Q that are capable of 6760 serving as a relay peer. It also requires nodes to be able to 6761 identify which category they are in. This identification problem has 6762 turned out to be hard to solve and is still an open area of 6763 exploration. 6765 An extension to RELOAD that supports relay peers is possible, but due 6766 to the complexities of implementing such an alternative, we have not 6767 added such a feature to RELOAD at this point. 6769 A concept similar to relay peers, essentially choosing a relay peer 6770 at random, has previously been suggested to solve problems of 6771 pairwise non-transitivity [non-transitive-dhts-worlds05], but 6772 deterministic filtering provided by NATs makes random relay peers no 6773 more likely to work than the responding peer. 6775 B.5. Symmetric Route Stability 6777 A common concern about symmetric recursive routing has been that one 6778 or more peers along the request path may fail before the response is 6779 received. The significance of this problem essentially depends on 6780 the response latency of the overlay. An overlay that produces slow 6781 responses will be vulnerable to churn, whereas responses that are 6782 delivered very quickly are vulnerable only to failures that occur 6783 over that small interval. 6785 The other aspect of this issue is whether the request itself can be 6786 successfully delivered. Assuming typical connection maintenance 6787 intervals, the time period between the last maintenance and the 6788 request being sent will be orders of magnitude greater than the delay 6789 between the request being forwarded and the response being received. 6790 Therefore, if the path was stable enough to be available to route the 6791 request, it is almost certainly going to remain available to route 6792 the response. 6794 An overlay that is unstable enough to suffer this type of failure 6795 frequently is unlikely to be able to support reliable functionality 6796 regardless of the routing mechanism. However, regardless of the 6797 stability of the return path, studies show that in the event of high 6798 churn, iterative routing is a better solution to ensure request 6799 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 6801 Finally, because RELOAD retries the end-to-end request, that retry 6802 will address the issues of churn that remain. 6804 Appendix C. Why Clients? 6806 There are a wide variety of reasons a node may act as a client rather 6807 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 6808 some of those scenarios and how the client's behavior changes based 6809 on its capabilities. 6811 C.1. Why Not Only Peers? 6813 For a number of reasons, a particular node may be forced to act as a 6814 client even though it is willing to act as a peer. These include: 6816 o The node does not have appropriate network connectivity, typically 6817 because it has a low-bandwidth network connection. 6818 o The node may not have sufficient resources, such as computing 6819 power, storage space, or battery power. 6821 o The overlay algorithm may dictate specific requirements for peer 6822 selection. These may include participating in the overlay to 6823 determine trustworthiness; controlling the number of peers in the 6824 overlay to reduce overly-long routing paths; or ensuring minimum 6825 application uptime before a node can join as a peer. 6827 The ultimate criteria for a node to become a peer are determined by 6828 the overlay algorithm and specific deployment. A node acting as a 6829 client that has a full implementation of RELOAD and the appropriate 6830 overlay algorithm is capable of locating its responsible peer in the 6831 overlay and using Attach to establish a direct connection to that 6832 peer. In that way, it may elect to be reachable under either of the 6833 routing approaches listed above. Particularly for overlay algorithms 6834 that elect nodes to serve as peers based on trustworthiness or 6835 population, the overlay algorithm may require such a client to locate 6836 itself at a particular place in the overlay. 6838 C.2. Clients as Application-Level Agents 6840 SIP defines an extensive protocol for registration and security 6841 between a client and its registrar/proxy server(s). Any SIP device 6842 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 6843 peer that implements the server-side functionality required by the 6844 SIP protocol. In this case, the peer would be acting as if it were 6845 the user's peer, and would need the appropriate credentials for that 6846 user. 6848 Application-level support for clients is defined by a usage. A usage 6849 offering support for application-level clients should specify how the 6850 security of the system is maintained when the data is moved between 6851 the application and RELOAD layers. 6853 Authors' Addresses 6855 Cullen Jennings 6856 Cisco 6857 170 West Tasman Drive 6858 MS: SJC-21/2 6859 San Jose, CA 95134 6860 USA 6862 Phone: +1 408 421-9990 6863 Email: fluffy@cisco.com 6864 Bruce B. Lowekamp (editor) 6865 Skype 6866 Palo Alto, CA 6867 USA 6869 Email: bbl@lowekamp.net 6871 Eric Rescorla 6872 Network Resonance 6873 2064 Edgewood Drive 6874 Palo Alto, CA 94303 6875 USA 6877 Phone: +1 650 320-8549 6878 Email: ekr@networkresonance.com 6880 Salman A. Baset 6881 Columbia University 6882 1214 Amsterdam Avenue 6883 New York, NY 6884 USA 6886 Email: salman@cs.columbia.edu 6888 Henning Schulzrinne 6889 Columbia University 6890 1214 Amsterdam Avenue 6891 New York, NY 6892 USA 6894 Email: hgs@cs.columbia.edu