idnits 2.17.1 draft-ietf-p2psip-base-11.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 1826 has weird spacing: '...Options optio...' == Line 2085 has weird spacing: '...hReqAns con...' == Line 2122 has weird spacing: '...ionType type;...' == Line 2272 has weird spacing: '...te_type typ...' == Line 2332 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 (Oct 12, 2010) is 4944 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 1721, but not defined -- Looks like a reference, but probably isn't: '0' on line 4524 == Missing Reference: 'RFC-AAAA' is mentioned on line 6139, 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) ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) == 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 5785 (Obsoleted by RFC 8615) == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-01 Summary: 8 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. B. Lowekamp, Ed. 5 Expires: April 15, 2011 E.K. Rescorla 6 Skype 7 S.A. Baset 8 H.G. Schulzrinne 9 Columbia University 10 Oct 12, 2010 12 REsource LOcation And Discovery (RELOAD) Base Protocol 13 draft-ietf-p2psip-base-11 15 Abstract 17 In this document the term BCP 78 and BCP 79 refer to RFC 3978 and RFC 18 3979 respectively. They refer only to those RFCs and not to any 19 documents that update or supersede them. 21 This specification defines REsource LOcation And Discovery (RELOAD), 22 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 23 P2P signaling protocol provides its clients with an abstract storage 24 and messaging service between a set of cooperating peers that form 25 the overlay network. RELOAD is designed to support a P2P Session 26 Initiation Protocol (P2PSIP) network, but can be utilized by other 27 applications with similar requirements by defining new usages that 28 specify the kinds of data that must be stored for a particular 29 application. RELOAD defines a security model based on a certificate 30 enrollment service that provides unique identities. NAT traversal is 31 a fundamental service of the protocol. RELOAD also allows access 32 from "client" nodes that do not need to route traffic or store data 33 for others. 35 Legal 37 This documents and the information contained therein are provided on 38 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 39 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 40 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 41 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 42 WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE 43 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 44 FOR A PARTICULAR PURPOSE. 46 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 April 15, 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 . . . . . . . . . . . . . . 36 130 5.2.1. Request Origination . . . . . . . . . . . . . . . . 36 131 5.2.2. Response Origination . . . . . . . . . . . . . . . . 37 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 . . . . . . . . . . . . . . 47 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 . . . . . . . . . . . . . . . . . 67 167 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 67 168 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 68 169 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 68 170 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 69 171 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 69 172 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 69 173 5.5.4. ConfigUpdate . . . . . . . . . . . . . . . . . . . . 70 174 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 70 175 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 71 176 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 71 177 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 72 178 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 73 179 5.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 73 180 5.6.1.3. Message-oriented Transports . . . . . . . . . . . 73 181 5.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 74 182 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 74 183 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 76 184 5.6.3.1. Retransmission and Flow Control . . . . . . . . . 76 185 5.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 77 186 5.6.5. TLS/TCP with FH, No-ICE . . . . . . . . . . . . . . 77 187 5.6.6. DTLS/UDP with SR, No-ICE . . . . . . . . . . 78 188 5.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 78 189 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 79 190 6.1. Data Signature Computation . . . . . . . . . . . . . . . 81 191 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 81 192 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 82 193 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 83 194 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 83 195 6.3. Access Control Policies . . . . . . . . . . . . . . . . 84 196 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 84 197 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 84 198 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 84 199 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 84 200 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 85 201 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 85 202 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 85 203 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 89 204 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 90 205 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 90 206 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 91 207 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 93 208 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 93 209 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 94 210 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 94 211 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 96 212 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 96 213 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 96 214 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 97 215 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 98 216 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 99 217 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 100 218 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 101 219 9.2. Routing . . . . . . . . . . . . . . . . . . . . . . . . 102 220 9.3. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 102 221 9.4. Joining . . . . . . . . . . . . . . . . . . . . . . . . 103 222 9.5. Routing Attaches . . . . . . . . . . . . . . . . . . . . 103 223 9.6. Updates . . . . . . . . . . . . . . . . . . . . . . . . 104 224 9.6.1. Handling Neighbor Failures . . . . . . . . . . . . . 105 225 9.6.2. Handling Finger Table Entry Failure . . . . . . . . 106 226 9.6.3. Receiving Updates . . . . . . . . . . . . . . . . . 106 227 9.6.4. Stabilization . . . . . . . . . . . . . . . . . . . 107 228 9.6.4.1. Updating neighbor table . . . . . . . . . . . . . 107 229 9.6.4.2. Refreshing finger table . . . . . . . . . . . . . 107 230 9.6.4.3. Adjusting finger table size . . . . . . . . . . . 108 231 9.6.4.4. Detecting partitioning . . . . . . . . . . . . . 109 232 9.7. Route Query . . . . . . . . . . . . . . . . . . . . . . 109 233 9.8. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 110 235 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 111 236 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 111 237 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 116 238 10.2. Discovery Through Enrollment Server . . . . . . . . . . 118 239 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 119 240 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 120 241 10.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 121 242 10.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 121 243 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 122 244 12. Security Considerations . . . . . . . . . . . . . . . . . . . 128 245 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 128 246 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 129 247 12.3. Certificate-based Security . . . . . . . . . . . . . . . 129 248 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 130 249 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 131 250 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 131 251 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 132 252 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 132 253 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 132 254 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 133 255 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 133 256 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 134 257 12.6.3. Peer Identification and Authentication . . . . . . . 134 258 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 135 259 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 135 260 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 136 261 13.1. Well-Known URI Registration . . . . . . . . . . . . . . 136 262 13.2. Port Registrations . . . . . . . . . . . . . . . . . . . 136 263 13.3. Overlay Algorithm Types . . . . . . . . . . . . . . . . 137 264 13.4. Access Control Policies . . . . . . . . . . . . . . . . 137 265 13.5. Application-ID . . . . . . . . . . . . . . . . . . . . . 137 266 13.6. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 138 267 13.7. Data Model . . . . . . . . . . . . . . . . . . . . . . . 138 268 13.8. Message Codes . . . . . . . . . . . . . . . . . . . . . 139 269 13.9. Error Codes . . . . . . . . . . . . . . . . . . . . . . 140 270 13.10. Overlay Link Types . . . . . . . . . . . . . . . . . . . 141 271 13.11. Overlay Link Protocols . . . . . . . . . . . . . . . . . 141 272 13.12. Forwarding Options . . . . . . . . . . . . . . . . . . . 142 273 13.13. Probe Information Types . . . . . . . . . . . . . . . . 142 274 13.14. Message Extensions . . . . . . . . . . . . . . . . . . . 142 275 13.15. reload URI Scheme . . . . . . . . . . . . . . . . . . . 143 276 13.15.1. URI Registration . . . . . . . . . . . . . . . . . . 143 277 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 144 278 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 144 279 15.1. Normative References . . . . . . . . . . . . . . . . . . 144 280 15.2. Informative References . . . . . . . . . . . . . . . . . 146 281 Appendix A. Routing Alternatives . . . . . . . . . . . . . . . . 148 282 A.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 149 283 A.2. Symmetric vs Forward response . . . . . . . . . . . . . 149 284 A.3. Direct Response . . . . . . . . . . . . . . . . . . . . 149 285 A.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 151 286 A.5. Symmetric Route Stability . . . . . . . . . . . . . . . 151 287 Appendix B. Why Clients? . . . . . . . . . . . . . . . . . . . . 152 288 B.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 152 289 B.2. Clients as Application-Level Agents . . . . . . . . . . 152 290 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 153 292 1. Introduction 294 This document defines REsource LOcation And Discovery (RELOAD), a 295 peer-to-peer (P2P) signaling protocol for use on the Internet. It 296 provides a generic, self-organizing overlay network service, allowing 297 nodes to efficiently route messages to other nodes and to efficiently 298 store and retrieve data in the overlay. RELOAD provides several 299 features that are critical for a successful P2P protocol for the 300 Internet: 302 Security Framework: A P2P network will often be established among a 303 set of peers that do not trust each other. RELOAD leverages a 304 central enrollment server to provide credentials for each peer 305 which can then be used to authenticate each operation. This 306 greatly reduces the possible attack surface. 308 Usage Model: RELOAD is designed to support a variety of 309 applications, including P2P multimedia communications with the 310 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 311 the definition of new application usages, each of which can define 312 its own data types, along with the rules for their use. This 313 allows RELOAD to be used with new applications through a simple 314 documentation process that supplies the details for each 315 application. 317 NAT Traversal: RELOAD is designed to function in environments where 318 many if not most of the nodes are behind NATs or firewalls. 319 Operations for NAT traversal are part of the base design, 320 including using ICE to establish new RELOAD or application 321 protocol connections. 323 High Performance Routing: The very nature of overlay algorithms 324 introduces a requirement that peers participating in the P2P 325 network route requests on behalf of other peers in the network. 326 This introduces a load on those other peers, in the form of 327 bandwidth and processing power. RELOAD has been defined with a 328 simple, lightweight forwarding header, thus minimizing the amount 329 of effort required by intermediate peers. 331 Pluggable Overlay Algorithms: RELOAD has been designed with an 332 abstract interface to the overlay layer to simplify implementing a 333 variety of structured (e.g., distributed hash tables) and 334 unstructured overlay algorithms. This specification also defines 335 how RELOAD is used with the Chord DHT algorithm, which is 336 mandatory to implement. Specifying a default "must implement" 337 overlay algorithm promotes interoperability, while extensibility 338 allows selection of overlay algorithms optimized for a particular 339 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 354 document[I-D.ietf-p2psip-concepts] for more details. A RELOAD 355 Overlay Instance consists of a set of nodes arranged in a connected 356 graph. Each node in the overlay is assigned a numeric Node-ID which, 357 together with the specific overlay algorithm in use, determines its 358 position in the graph and the set of nodes it connects to. The 359 figure below shows a trivial example which isn't drawn from any 360 particular overlay algorithm, but was chosen for convenience of 361 representation. 363 +--------+ +--------+ +--------+ 364 | Node 10|--------------| Node 20|--------------| Node 30| 365 +--------+ +--------+ +--------+ 366 | | | 367 | | | 368 +--------+ +--------+ +--------+ 369 | Node 40|--------------| Node 50|--------------| Node 60| 370 +--------+ +--------+ +--------+ 371 | | | 372 | | | 373 +--------+ +--------+ +--------+ 374 | Node 70|--------------| Node 80|--------------| Node 90| 375 +--------+ +--------+ +--------+ 376 | 377 | 378 +--------+ 379 | Node 85| 380 |(Client)| 381 +--------+ 383 Because the graph is not fully connected, when a node wants to send a 384 message to another node, it may need to route it through the network. 385 For instance, Node 10 can talk directly to nodes 20 and 40, but not 386 to Node 70. In order to send a message to Node 70, it would first 387 send it to Node 40 with instructions to pass it along to Node 70. 388 Different overlay algorithms will have different connectivity graphs, 389 but the general idea behind all of them is to allow any node in the 390 graph to efficiently reach every other node within a small number of 391 hops. 393 The RELOAD network is not only a messaging network. It is also a 394 storage network. Records are stored under numeric addresses which 395 occupy the same space as node identifiers. Peers are responsible for 396 storing the data associated with some set of addresses as determined 397 by their Node-ID. For instance, we might say that every peer is 398 responsible for storing any data value which has an address less than 399 or equal to its own Node-ID, but greater than the next lowest 400 Node-ID. Thus, Node-20 would be responsible for storing values 401 11-20. 403 RELOAD also supports clients. These are nodes which have Node-IDs 404 but do not participate in routing or storage. For instance, in the 405 figure above Node 85 is a client. It can route to the rest of the 406 RELOAD network via Node 80, but no other node will route through it 407 and Node 90 is still responsible for all addresses between 81-90. We 408 refer to non-client nodes as peers. 410 Other applications (for instance, SIP) can be defined on top of 411 RELOAD and use these two basic RELOAD services to provide their own 412 services. 414 1.2. Architecture 416 RELOAD is fundamentally an overlay network. The following figure 417 shows the layered RELOAD architecture. 419 Application 421 +-------+ +-------+ 422 | SIP | | XMPP | ... 423 | Usage | | Usage | 424 +-------+ +-------+ 425 ------------------------------------ Messaging Service Boundary 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 Service Boundary 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 Service. 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 specification 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 [I-D.ietf-p2psip-sip], that use the 533 abstract Message Transport Service provided by RELOAD. The goal of 534 this layer is to implement application-specific usages of the generic 535 overlay services provided by RELOAD. The usage defines how a 536 specific application maps its data into something that can be stored 537 in the overlay, where to store the data, how to secure the data, and 538 finally how applications can 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 542 softphone application may also require a voicemail usage. A usage 543 may define multiple kinds of data that are stored in the overlay and 544 may also 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 sent 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 Service is similar to those described as 575 providing "Key based routing" (KBR), although as RELOAD supports 576 different overlay algorithms (including non-DHT overlay algorithms) 577 that calculate keys in different ways, the actual interface must 578 accept 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 also utilizes a framing header to encapsulate messages as 654 they are forwarding along each hop. This header aids reliability 655 congestion control, flow control, etc. It has meaning only in the 656 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. In order to form a 689 TLS connection to any node in the overlay, a new node needs to know 690 the shared overlay key, thus restricting access to authorized users 691 only. This feature is used together with certificate-based access 692 control, not as a replacement for it. It is typically used when 693 self-signed certificates are being used but would generally not be 694 used when the certificates were all signed by an enrollment server. 696 1.4. Structure of This Document 698 The remainder of this document is structured as follows. 700 o Section 2 provides definitions of terms used in this document. 701 o Section 3 provides an overview of the mechanisms used to establish 702 and maintain the overlay. 703 o Section 4 provides an overview of the mechanism RELOAD provides to 704 support other applications. 705 o Section 5 defines the protocol messages that RELOAD uses to 706 establish and maintain the overlay. 707 o Section 6 defines the protocol messages that are used to store and 708 retrieve data using RELOAD. 709 o Section 7 defines the Certificate Store Usage that is fundamental 710 to RELOAD security. 711 o Section 8 defines the TURN Server Usage needed to locate TURN 712 servers for NAT traversal. 713 o Section 9 defines a specific Topology Plugin using Chord. 714 o Section 10 defines the mechanisms that new RELOAD nodes use to 715 join the overlay for the first time. 716 o Section 11 provides an extended example. 718 2. Terminology 720 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 721 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 722 document are to be interpreted as described in RFC 2119 [RFC2119]. 724 We use the terminology and definitions from the Concepts and 725 Terminology for Peer to Peer SIP [I-D.ietf-p2psip-concepts] draft 726 extensively in this document. Other terms used in this document are 727 defined inline when used and are also defined below for reference. 729 DHT: A distributed hash table. A DHT is an abstract hash table 730 service realized by storing the contents of the hash table across 731 a set of peers. 733 Overlay Algorithm: An overlay algorithm defines the rules for 734 determining which peers in an overlay store a particular piece of 735 data and for determining a topology of interconnections amongst 736 peers in order to find a piece of data. 738 Overlay Instance: A specific overlay algorithm and the collection of 739 peers that are collaborating to provide read and write access to 740 it. There can be any number of overlay instances running in an IP 741 network at a time, and each operates in isolation of the others. 743 Peer: A host that is participating in the overlay. Peers are 744 responsible for holding some portion of the data that has been 745 stored in the overlay and also route messages on behalf of other 746 hosts as required by the Overlay Algorithm. 748 Client: A host that is able to store data in and retrieve data from 749 the overlay but which is not participating in routing or data 750 storage for the overlay. 752 Kind: A kind defines a particular type of data that can be stored in 753 the overlay. Applications define new Kinds to story the data they 754 use. Each Kind is identified with a unique IANA assigned integer 755 called a Kind-ID. 757 Node: We use the term "Node" to refer to a host that may be either a 758 Peer or a Client. Because RELOAD uses the same protocol for both 759 clients and peers, much of the text applies equally to both. 760 Therefore we use "Node" when the text applies to both Clients and 761 Peers and the more specific term (i.e. client or peer) when the 762 text applies only to Clients or only to Peers. 764 Node-ID: A fixed-length value that uniquely identifies a node. 765 Node-IDs of all 0s and all 1s are reserved and are invalid Node- 766 IDs. A value of zero is not used in the wire protocol but can be 767 used to indicate an invalid node in implementations and APIs. The 768 Node-ID of all 1s is used on the wire protocol as a wildcard. 770 Resource: An object or group of objects associated with a string 771 identifier. See "Resource Name" below. 773 Resource Name: The potentially human readable name by which a 774 resource is identified. In unstructured P2P networks, the 775 resource name is sometimes used directly as a Resource-ID. In 776 structured P2P networks the resource name is typically mapped into 777 a Resource-ID by using the string as the input to hash function. 778 A SIP resource, for example, is often identified by its AOR which 779 is an example of a Resource Name. 781 Resource-ID: A value that identifies some resources and which is 782 used as a key for storing and retrieving the resource. Often this 783 is not human friendly/readable. One way to generate a Resource-ID 784 is by applying a mapping function to some other unique name (e.g., 785 user name or service name) for the resource. The Resource-ID is 786 used by the distributed database algorithm to determine the peer 787 or peers that are responsible for storing the data for the 788 overlay. In structured P2P networks, Resource-IDs are generally 789 fixed length and are formed by hashing the resource name. In 790 unstructured networks, resource names may be used directly as 791 Resource-IDs and may be variable lengths. 793 Connection Table: The set of nodes to which a node is directly 794 connected. This includes nodes with which Attach handshakes have 795 been done but which have not sent any Updates. 797 Routing Table: The set of peers which a node can use to route 798 overlay messages. In general, these peers will all be on the 799 connection table but not vice versa, because some peers will have 800 Attached but not sent updates. Peers may send messages directly 801 to peers that are in the connection table but may only route 802 messages to other peers through peers that are in the routing 803 table. 805 Destination List: A list of IDs through which a message is to be 806 routed. A single Node-ID is a trivial form of destination list. 808 Usage: A usage is an application that wishes to use the overlay for 809 some purpose. Each application wishing to use the overlay defines 810 a set of data kinds that it wishes to use. The SIP usage defines 811 the location data kind. 813 The term "maximum request lifetime" is the maximum time a request 814 will wait for a response; it defaults to 15 seconds. The term 815 "successor replacement hold-down time" is the amount of time to wait 816 before starting replication when a new successor is found; it 817 defaults to 30 seconds. 819 3. Overlay Management Overview 821 The most basic function of RELOAD is as a generic overlay network. 822 Nodes need to be able to join the overlay, form connections to other 823 nodes, and route messages through the overlay to nodes to which they 824 are not directly connected. This section provides an overview of the 825 mechanisms that perform these functions. 827 3.1. Security and Identification 829 Every node in the RELOAD overlay is identified by a Node-ID. The 830 Node-ID is used for three major purposes: 832 o To address the node itself. 833 o To determine its position in the overlay topology when the overlay 834 is structured. 835 o To determine the set of resources for which the node is 836 responsible. 838 Each node has a certificate [RFC5280] containing a Node-ID, which is 839 unique within an overlay instance. 841 The certificate serves multiple purposes: 843 o It entitles the user to store data at specific locations in the 844 Overlay Instance. Each data kind defines the specific rules for 845 determining which certificates can access each Resource-ID/Kind-ID 846 pair. For instance, some kinds might allow anyone to write at a 847 given location, whereas others might restrict writes to the owner 848 of a single certificate. 849 o It entitles the user to operate a node that has a Node-ID found in 850 the certificate. When the node forms a connection to another 851 peer, it uses this certificate so that a node connecting to it 852 knows it is connected to the correct node (technically: a (D)TLS 853 association with client authentication is formed.) In addition, 854 the node can sign messages, thus providing integrity and 855 authentication for messages which are sent from the node. 856 o It entitles the user to use the user name found in the 857 certificate. 859 If a user has more than one device, typically they would get one 860 certificate for each device. This allows each device to act as a 861 separate peer. 863 RELOAD supports multiple certificate issuance models. The first is 864 based on a central enrollment process which allocates a unique name 865 and Node-ID and puts them in a certificate for the user. All peers 866 in a particular Overlay Instance have the enrollment server as a 867 trust anchor and so can verify any other peer's certificate. 869 In some settings, a group of users want to set up an overlay network 870 but are not concerned about attack by other users in the network. 871 For instance, users on a LAN might want to set up a short term ad hoc 872 network without going to the trouble of setting up an enrollment 873 server. RELOAD supports the use of self-generated, self-signed 874 certificates. When self-signed certificates are used, the node also 875 generates its own Node-ID and username. The Node-ID is computed as a 876 digest of the public key, to prevent Node-ID theft; however this 877 model is still subject to a number of known attacks (most notably 878 Sybil attacks [Sybil]) and can only be safely used in closed networks 879 where users are mutually trusting. 881 The general principle here is that the security mechanisms (TLS and 882 message signatures) are always used, even if the certificates are 883 self-signed. This allows for a single set of code paths in the 884 systems with the only difference being whether certificate 885 verification is required to chain to a single root of trust. 887 3.1.1. Shared-Key Security 889 RELOAD also provides an admission control system based on shared 890 keys. In this model, the peers all share a single key which is used 891 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 893 3.2. Clients 895 RELOAD defines a single protocol that is used both as the peer 896 protocol and as the client protocol for the overlay. This simplifies 897 implementation, particularly for devices that may act in either role, 898 and allows clients to inject messages directly into the overlay. 900 We use the term "peer" to identify a node in the overlay that routes 901 messages for nodes other than those to which it is directly 902 connected. Peers typically also have storage responsibilities. We 903 use the term "client" to refer to nodes that do not have routing or 904 storage responsibilities. When text applies to both peers and 905 clients, we will simply refer such devices as "nodes." 907 RELOAD's client support allows nodes that are not participating in 908 the overlay as peers to utilize the same implementation and to 909 benefit from the same security mechanisms as the peers. Clients 910 possess and use certificates that authorize the user to store data at 911 certain locations in the overlay. The Node-ID in the certificate is 912 used to identify the particular client as a member of the overlay and 913 to authenticate its messages. 915 In RELOAD, unlike some other designs, clients are not a first-class 916 concept. From the perspective of a peer, a client is simply a node 917 which has not yet sent any Updates or Joins. It might never do so 918 (if it's a client) or it might eventually do so (if it's just a node 919 that's taking a long time to join). The routing and storage rules 920 for RELOAD provide for correct behavior by peers regardless of 921 whether other nodes attached to them are clients or peers. Of 922 course, a client implementation must know that it intends to be a 923 client, but this localizes complexity only to that node. 925 For more discussion of the motivation for RELOAD's client support, 926 see Appendix B. 928 3.2.1. Client Routing 930 Clients may insert themselves in the overlay in two ways: 932 o Establish a connection to the peer responsible for the client's 933 Node-ID in the overlay. Then requests may be sent from/to the 934 client using its Node-ID in the same manner as if it were a peer, 935 because the responsible peer in the overlay will handle the final 936 step of routing to the client. This may require a TURN relay in 937 cases where NATs or firewalls prevent a client from forming a 938 direct connections with its responsible peer. Note that clients 939 that choose this option MUST process Update messages from the 940 peer. Those updates can indicate that the peer no longer is 941 responsible for the Client's Node-ID. The client then MUST form a 942 connection to the appropriate peer. Failure to do so will result 943 in the client no longer receiving messages. 944 o Establish a connection with an arbitrary peer in the overlay 945 (perhaps based on network proximity or an inability to establish a 946 direct connection with the responsible peer). In this case, the 947 client will rely on RELOAD's Destination List feature to ensure 948 reachability. The client can initiate requests, and any node in 949 the overlay that knows the Destination List to its current 950 location can reach it, but the client is not directly reachable 951 using only its Node-ID. If the client is to receive incoming 952 requests from other members of the overlay, the Destination List 953 required to reach it must be learnable via other mechanisms, such 954 as being stored in the overlay by a usage. 956 3.2.2. Minimum Functionality Requirements for Clients 958 A node may act as a client simply because it does not have the 959 resources or even an implementation of the topology plugin required 960 to act as a peer in the overlay. In order to exchange RELOAD 961 messages with a peer, a client must meet a minimum level of 962 functionality. Such a client must: 964 o Implement RELOAD's connection-management operations that are used 965 to establish the connection with the peer. 966 o Implement RELOAD's data retrieval methods (with client 967 functionality). 968 o Be able to calculate Resource-IDs used by the overlay. 969 o Possess security credentials required by the overlay it is 970 implementing. 972 A client speaks the same protocol as the peers, knows how to 973 calculate Resource-IDs, and signs its requests in the same manner as 974 peers. While a client does not necessarily require a full 975 implementation of the overlay algorithm, calculating the Resource-ID 976 requires an implementation of the appropriate algorithm for the 977 overlay. 979 3.3. Routing 981 This section will discuss the requirements RELOAD's routing 982 capabilities must meet, then describe the routing features in the 983 protocol, and then provide a brief overview of how they are used. 984 Appendix A discusses some alternative designs and the tradeoffs that 985 would be necessary to support them. 987 RELOAD's routing capabilities must meet the following requirements: 989 NAT Traversal: RELOAD must support establishing and using 990 connections between nodes separated by one or more NATs, including 991 locating peers behind NATs for those overlays allowing/requiring 992 it. 993 Clients: RELOAD must support requests from and to clients that do 994 not participate in overlay routing. 995 Client promotion: RELOAD must support clients that become peers at a 996 later point as determined by the overlay algorithm and deployment. 997 Low state: RELOAD's routing algorithms must not require 998 significant state to be stored on intermediate peers. 999 Return routability in unstable topologies: At some points in 1000 times, different nodes may have inconsistent information about the 1001 connectivity of the routing graph. In all cases, the response to 1002 a request needs to delivered to the node that sent the request and 1003 not to some other node. 1005 RELOAD's routing provides three mechanisms designed to assist in 1006 meeting these needs: 1008 Destination Lists: While in principle it is possible to just 1009 inject a message into the overlay with a bare NodeID as the 1010 destination, RELOAD provides a source routing capability in the 1011 form of "Destination Lists". A "Destination List provides a list 1012 of the nodes through which a message must flow. 1013 Via Lists: In order to allow responses to follow the same path as 1014 requests, each message also contains a "Via List", which is added 1015 to by each node a message traverses. This via list can then be 1016 inverted and used as a destination list for the response. 1017 RouteQuery: The RouteQuery method allows a node to query a peer 1018 for the next hop it will use to route a message. This method is 1019 useful for diagnostics and for iterative routing. 1021 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1022 We will first describe symmetric recursive routing and then discuss 1023 its advantages in terms of the requirements discussed above. 1025 Symmetric recursive routing requires that a message follow a path 1026 through the overlay to the destination without returning to the 1027 originating node: each peer forwards the message closer to its 1028 destination. The return path of the response is then the same path 1029 followed in reverse. For example, a message following a route from A 1030 to Z through B and X: 1032 A B X Z 1033 ------------------------------- 1035 ----------> 1036 Dest=Z 1037 ----------> 1038 Via=A 1039 Dest=Z 1040 ----------> 1041 Via=A, B 1042 Dest=Z 1044 <---------- 1045 Dest=X, B, A 1046 <---------- 1047 Dest=B, A 1048 <---------- 1049 Dest=A 1051 Note that the preceding Figure does not indicate whether A is a 1052 client or peer: A forwards its request to B and the response is 1053 returned to A in the same manner regardless of A's role in the 1054 overlay. 1056 This figure shows use of full via-lists by intermediate peers B and 1057 X. However, if B and/or X are willing to store state, then they may 1058 elect to truncate the lists, save that information internally (keyed 1059 by the transaction id), and return the response message along the 1060 path from which it was received when the response is received. This 1061 option requires greater state to be stored on intermediate peers but 1062 saves a small amount of bandwidth and reduces the need for modifying 1063 the message en route. Selection of this mode of operation is a 1064 choice for the individual peer; the techniques are interoperable even 1065 on a single message. The figure below shows B using full via lists 1066 but X truncating them to X1 and saving the state internally. 1068 A B X Z 1069 ------------------------------- 1071 ----------> 1072 Dest=Z 1073 ----------> 1074 Via=A 1075 Dest=Z 1076 ----------> 1077 Dest=Z, X1 1079 <---------- 1080 Dest=X,X1 1081 <---------- 1082 Dest=B, A 1083 <---------- 1084 Dest=A 1086 RELOAD also supports a basic Iterative routing mode (where the 1087 intermediate peers merely return a response indicating the next hop, 1088 but do not actually forward the message to that next hop themselves). 1089 Iterative routing is implemented using the RouteQuery method, which 1090 requests this behavior. Note that iterative routing is selected only 1091 by the initiating node. 1093 3.4. Connectivity Management 1095 In order to provide efficient routing, a peer needs to maintain a set 1096 of direct connections to other peers in the Overlay Instance. Due to 1097 the presence of NATs, these connections often cannot be formed 1098 directly. Instead, we use the Attach request to establish a 1099 connection. Attach uses ICE [RFC5245] to establish the connection. 1100 It is assumed that the reader is familiar with ICE. 1102 Say that peer A wishes to form a direct connection to peer B. It 1103 gathers ICE candidates and packages them up in an Attach request 1104 which it sends to B through usual overlay routing procedures. B does 1105 its own candidate gathering and sends back a response with its 1106 candidates. A and B then do ICE connectivity checks on the candidate 1107 pairs. The result is a connection between A and B. At this point, A 1108 and B can add each other to their routing tables and send messages 1109 directly between themselves without going through other overlay 1110 peers. 1112 There is one special case in which Attach cannot be used: when a 1113 peer is joining the overlay and is not connected to any peers. In 1114 order to support this case, some small number of "bootstrap nodes" 1115 typically need to be publicly accessible so that new peers can 1116 directly connect to them. Section 10 contains more detail on this. 1118 In general, a peer needs to maintain connections to all of the peers 1119 near it in the Overlay Instance and to enough other peers to have 1120 efficient routing (the details depend on the specific overlay). If a 1121 peer cannot form a connection to some other peer, this isn't 1122 necessarily a disaster; overlays can route correctly even without 1123 fully connected links. However, a peer should try to maintain the 1124 specified link set and if it detects that it has fewer direct 1125 connections, should form more as required. This also implies that 1126 peers need to periodically verify that the connected peers are still 1127 alive and if not try to reform the connection or form an alternate 1128 one. 1130 3.5. Overlay Algorithm Support 1132 The Topology Plugin allows RELOAD to support a variety of overlay 1133 algorithms. This specification defines a DHT based on Chord [Chord], 1134 which is mandatory to implement, but the base RELOAD protocol is 1135 designed to support a variety of overlay algorithms. 1137 3.5.1. Support for Pluggable Overlay Algorithms 1139 RELOAD defines three methods for overlay maintenance: Join, Update, 1140 and Leave. However, the contents of those messages, when they are 1141 sent, and their precise semantics are specified by the actual overlay 1142 algorithm; RELOAD merely provides a framework of commonly-needed 1143 methods that provides uniformity of notation (and ease of debugging) 1144 for a variety of overlay algorithms. 1146 3.5.2. Joining, Leaving, and Maintenance Overview 1148 When a new peer wishes to join the Overlay Instance, it must have a 1149 Node-ID that it is allowed to use and a set of credentials which 1150 match that Node-ID. When an enrollment server is used that Node-ID 1151 will be in the certificate the node received from the enrollment 1152 server. The details of the joining procedure are defined by the 1153 overlay algorithm, but the general steps for joining an Overlay 1154 Instance are: 1156 o Forming connections to some other peers. 1157 o Acquiring the data values this peer is responsible for storing. 1158 o Informing the other peers which were previously responsible for 1159 that data that this peer has taken over responsibility. 1161 The first thing the peer needs to do is to form a connection to some 1162 "bootstrap node". Because this is the first connection the peer 1163 makes, these nodes must have public IP addresses so that they can be 1164 connected to directly. Once a peer has connected to one or more 1165 bootstrap nodes, it can form connections in the usual way by routing 1166 Attach messages through the overlay to other nodes. Once a peer has 1167 connected to the overlay for the first time, it can cache the set of 1168 nodes it has connected to with public IP addresses for use as future 1169 bootstrap nodes. 1171 Once a peer has connected to a bootstrap node, it then needs to take 1172 up its appropriate place in the overlay. This requires two major 1173 operations: 1175 o Forming connections to other peers in the overlay to populate its 1176 Routing Table. 1177 o Getting a copy of the data it is now responsible for storing and 1178 assuming responsibility for that data. 1180 The second operation is performed by contacting the Admitting Peer 1181 (AP), the node which is currently responsible for that section of the 1182 overlay. 1184 The details of this operation depend mostly on the overlay algorithm 1185 involved, but a typical case would be: 1187 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1188 announcing its intention to join. 1189 2. AP sends a Join response. 1190 3. AP does a sequence of Stores to JP to give it the data it will 1191 need. 1192 4. AP does Updates to JP and to other peers to tell it about its own 1193 routing table. At this point, both JP and AP consider JP 1194 responsible for some section of the Overlay Instance. 1195 5. JP makes its own connections to the appropriate peers in the 1196 Overlay Instance. 1198 After this process is completed, JP is a full member of the Overlay 1199 Instance and can process Store/Fetch requests. 1201 Note that the first node is a special case. When ordinary nodes 1202 cannot form connections to the bootstrap nodes, then they are not 1203 part of the overlay. However, the first node in the overlay can 1204 obviously not connect to other nodes. In order to support this case, 1205 potential first nodes (which must also serve as bootstrap nodes 1206 initially) must somehow be instructed (perhaps by configuration 1207 settings) that they are the entire overlay, rather than not part of 1208 it. 1210 Note that clients do not perform either of these operations. 1212 3.6. First-Time Setup 1214 Previous sections addressed how RELOAD works once a node has 1215 connected. This section provides an overview of how users get 1216 connected to the overlay for the first time. RELOAD is designed so 1217 that users can start with the name of the overlay they wish to join 1218 and perhaps a username and password, and leverage that into having a 1219 working peer with minimal user intervention. This helps avoid the 1220 problems that have been experienced with conventional SIP clients 1221 where users are required to manually configure a large number of 1222 settings. 1224 3.6.1. Initial Configuration 1226 In the first phase of the process, the user starts out with the name 1227 of the overlay and uses this to download an initial set of overlay 1228 configuration parameters. The node does a DNS SRV lookup on the 1229 overlay name to get the address of a configuration server. It can 1230 then connect to this server with HTTPS to download a configuration 1231 document which contains the basic overlay configuration parameters as 1232 well as a set of bootstrap nodes which can be used to join the 1233 overlay. 1235 If a node already has the valid configuration document that it 1236 received by some out of band method, this step can be skipped. 1238 3.6.2. Enrollment 1240 If the overlay is using centralized enrollment, then a user needs to 1241 acquire a certificate before joining the overlay. The certificate 1242 attests both to the user's name within the overlay and to the Node- 1243 IDs which they are permitted to operate. In that case, the 1244 configuration document will contain the address of an enrollment 1245 server which can be used to obtain such a certificate. The 1246 enrollment server may (and probably will) require some sort of 1247 username and password before issuing the certificate. The enrollment 1248 server's ability to restrict attackers' access to certificates in the 1249 overlay is one of the cornerstones of RELOAD's security. 1251 4. Application Support Overview 1253 RELOAD is not intended to be used alone, but rather as a substrate 1254 for other applications. These applications can use RELOAD for a 1255 variety of purposes: 1257 o To store data in the overlay and retrieve data stored by other 1258 nodes. 1259 o As a discovery mechanism for services such as TURN. 1260 o To form direct connections which can be used to transmit 1261 application-level messages without using the overlay. 1263 This section provides an overview of these services. 1265 4.1. Data Storage 1267 RELOAD provides operations to Store and Fetch data. Each location in 1268 the Overlay Instance is referenced by a Resource-ID. However, each 1269 location may contain data elements corresponding to multiple kinds 1270 (e.g., certificate, SIP registration). Similarly, there may be 1271 multiple elements of a given kind, as shown below: 1273 +--------------------------------+ 1274 | Resource-ID | 1275 | | 1276 | +------------+ +------------+ | 1277 | | Kind 1 | | Kind 2 | | 1278 | | | | | | 1279 | | +--------+ | | +--------+ | | 1280 | | | Value | | | | Value | | | 1281 | | +--------+ | | +--------+ | | 1282 | | | | | | 1283 | | +--------+ | | +--------+ | | 1284 | | | Value | | | | Value | | | 1285 | | +--------+ | | +--------+ | | 1286 | | | +------------+ | 1287 | | +--------+ | | 1288 | | | Value | | | 1289 | | +--------+ | | 1290 | +------------+ | 1291 +--------------------------------+ 1293 Each kind is identified by a Kind-ID, which is a code point assigned 1294 by IANA. As part of the kind definition, protocol designers may 1295 define constraints, such as limits on size, on the values which may 1296 be stored. For many kinds, the set may be restricted to a single 1297 value; some sets may be allowed to contain multiple identical items 1298 while others may only have unique items. Note that a kind may be 1299 employed by multiple usages and new usages are encouraged to use 1300 previously defined kinds where possible. We define the following 1301 data models in this document, though other usages can define their 1302 own structures: 1304 single value: There can be at most one item in the set and any value 1305 overwrites the previous item. 1307 array: Many values can be stored and addressed by a numeric index. 1309 dictionary: The values stored are indexed by a key. Often this key 1310 is one of the values from the certificate of the peer sending the 1311 Store request. 1313 In order to protect stored data from tampering, by other nodes, each 1314 stored value is digitally signed by the node which created it. When 1315 a value is retrieved, the digital signature can be verified to detect 1316 tampering. 1318 4.1.1. Storage Permissions 1320 A major issue in peer-to-peer storage networks is minimizing the 1321 burden of becoming a peer, and in particular minimizing the amount of 1322 data which any peer is required to store for other nodes. RELOAD 1323 addresses this issue by only allowing any given node to store data at 1324 a small number of locations in the overlay, with those locations 1325 being determined by the node's certificate. When a peer uses a Store 1326 request to place data at a location authorized by its certificate, it 1327 signs that data with the private key that corresponds to its 1328 certificate. Then the peer responsible for storing the data is able 1329 to verify that the peer issuing the request is authorized to make 1330 that request. Each data kind defines the exact rules for determining 1331 what certificate is appropriate. 1333 The most natural rule is that a certificate authorizes a user to 1334 store data keyed with their user name X. This rule is used for all 1335 the kinds defined in this specification. Thus, only a user with a 1336 certificate for "alice@example.org" could write to that location in 1337 the overlay. However, other usages can define any rules they choose, 1338 including publicly writable values. 1340 The digital signature over the data serves two purposes. First, it 1341 allows the peer responsible for storing the data to verify that this 1342 Store is authorized. Second, it provides integrity for the data. 1344 The signature is saved along with the data value (or values) so that 1345 any reader can verify the integrity of the data. Of course, the 1346 responsible peer can "lose" the value but it cannot undetectably 1347 modify it. 1349 The size requirements of the data being stored in the overlay are 1350 variable. For instance, a SIP AOR and voicemail differ widely in the 1351 storage size. RELOAD leaves it to the Usage and overlay 1352 configuration to limit size imbalance of various kinds. 1354 4.1.2. Usages 1356 By itself, the distributed storage layer just provides infrastructure 1357 on which applications are built. In order to do anything useful, a 1358 usage must be defined. Each Usage needs to specify several things: 1360 o Registers Kind-ID code points for any kinds that the Usage 1361 defines. 1362 o Defines the data structure for each of the kinds. 1363 o Defines access control rules for each of the kinds. 1364 o Defines how the Resource Name is formed that is hashed to form the 1365 Resource-ID where each kind is stored. 1366 o Describes how values will be merged after a network partition. 1367 Unless otherwise specified, the default merging rule is to act as 1368 if all the values that need to be merged were stored and as if the 1369 order they were stored in corresponds to the stored time values 1370 associated with (and carried in) their values. Because the stored 1371 time values are those associated with the peer which did the 1372 writing, clock skew is generally not an issue. If two nodes are 1373 on different partitions, write to the same location, and have 1374 clock skew, this can create merge conflicts. However because 1375 RELOAD deliberately segregates storage so that data from different 1376 users and peers is stored in different locations, and a single 1377 peer will typically only be in a single network partition, this 1378 case will generally not arise. 1380 The kinds defined by a usage may also be applied to other usages. 1381 However, a need for different parameters, such as different size 1382 limits, would imply the need to create a new kind. 1384 4.1.3. Replication 1386 Replication in P2P overlays can be used to provide: 1388 persistence: if the responsible peer crashes and/or if the storing 1389 peer leaves the overlay 1390 security: to guard against DoS attacks by the responsible peer or 1391 routing attacks to that responsible peer 1392 load balancing: to balance the load of queries for popular 1393 resources. 1395 A variety of schemes are used in P2P overlays to achieve some of 1396 these goals. Common techniques include replicating on neighbors of 1397 the responsible peer, randomly locating replicas around the overlay, 1398 or replicating along the path to the responsible peer. 1400 The core RELOAD specification does not specify a particular 1401 replication strategy. Instead, the first level of replication 1402 strategies are determined by the overlay algorithm, which can base 1403 the replication strategy on its particular topology. For example, 1404 Chord places replicas on successor peers, which will take over 1405 responsibility should the responsible peer fail [Chord]. 1407 If additional replication is needed, for example if data persistence 1408 is particularly important for a particular usage, then that usage may 1409 specify additional replication, such as implementing random 1410 replications by inserting a different well known constant into the 1411 Resource Name used to store each replicated copy of the resource. 1412 Such replication strategies can be added independent of the 1413 underlying algorithm, and their usage can be determined based on the 1414 needs of the particular usage. 1416 4.2. Service Discovery 1418 RELOAD does not currently define a generic service discovery 1419 algorithm as part of the base protocol, although a simplistic TURN- 1420 specific discovery mechanism is provided. A variety of service 1421 discovery algorithms can be implemented as extensions to the base 1422 protocol, such as the service discovery algorithm ReDIR 1423 [opendht-sigcomm05]. 1425 4.3. Application Connectivity 1427 There is no requirement that a RELOAD usage must use RELOAD's 1428 primitives for establishing its own communication if it already 1429 possesses its own means of establishing connections. For example, 1430 one could design a RELOAD-based resource discovery protocol which 1431 used HTTP to retrieve the actual data. 1433 For more common situations, however, it is the overlay itself - 1434 rather than an external authority such as DNS - which is used to 1435 establish a connection. RELOAD provides connectivity to applications 1436 using the AppAttach method. For example, if a P2PSIP node wishes to 1437 establish a SIP dialog with another P2PSIP node, it will use 1438 AppAttach to establish a direct connection with the other node. This 1439 new connection is separate from the peer protocol connection. It is 1440 a dedicated UDP or TCP flow used only for the SIP dialog. Each usage 1441 specifies which types of connections can be initiated using 1442 AppAttach. 1444 5. Overlay Management Protocol 1446 This section defines the basic protocols used to create, maintain, 1447 and use the RELOAD overlay network. We start by defining the basic 1448 concept of how message destinations are interpreted when routing 1449 messages. We then describe the symmetric recursive routing model, 1450 which is RELOAD's default routing algorithm. We then define the 1451 message structure and then finally define the messages used to join 1452 and maintain the overlay. 1454 5.1. Message Receipt and Forwarding 1456 When a peer receives a message, it first examines the overlay, 1457 version, and other header fields to determine whether the message is 1458 one it can process. If any of these are incorrect (e.g., the message 1459 is for an overlay in which the peer does not participate) it is an 1460 error. The peer SHOULD generate an appropriate error but local 1461 policy can override this and cause the messages to be silently 1462 dropped. 1464 Once the peer has determined that the message is correctly formatted, 1465 it examines the first entry on the destination list. There are three 1466 possible cases here: 1468 o The first entry on the destination list is an ID for which the 1469 peer is responsible. 1470 o The first entry on the destination list is an ID for which another 1471 peer is responsible. 1472 o The first entry on the destination list is a private ID that is 1473 being used for destination list compression. This is described 1474 later (note that private IDs can be distinguished from NodeIDs and 1475 Resource IDs on the wire; see Section 5.3.2.2). 1477 These cases are handled as discussed below. 1479 5.1.1. Responsible ID 1481 If the first entry on the destination list is an ID for which the 1482 node is responsible, there are several sub-cases to consider. 1484 o 1485 o If the entry is a Resource-ID, then it MUST be the only entry on 1486 the destination list. If there are other entries, the message 1487 MUST be silently dropped. Otherwise, the message is destined for 1488 this node and it passes it up to the upper layers. 1489 o If the entry is a Node-ID which equals this node's Node-ID, then 1490 the message is destined for this node. If this is the only entry 1491 on the destination list, the message is destined for this node and 1492 is passed up to the upper layers. Otherwise the entry is removed 1493 from the destination list and the message is passed to the Message 1494 Transport. If the message is a response and there is state for 1495 the transaction ID, the state is reinserted into the destination 1496 list before the message is further processed. 1497 o If the entry is a Node-ID which is not equal to this node, then 1498 the node MUST drop the message silently unless the Node-ID 1499 corresponds to a node which is directly connected to this node 1500 (i.e., a client). In that case, it MUST forward the message to 1501 the destination node as described in the next section. 1503 Note that this implies that in order to address a message to "the 1504 peer that controls region X", a sender sends to Resource-ID X, not 1505 Node-ID X. 1507 5.1.2. Other ID 1509 If neither of the other three cases applies, then the peer MUST 1510 forward the message towards the first entry on the destination list. 1511 This means that it MUST select one of the peers to which it is 1512 connected and which is likely to be responsible for the first entry 1513 on the destination list. If the first entry on the destination list 1514 is in the peer's connection table, then it SHOULD forward the message 1515 to that peer directly. Otherwise, the peer consults the routing 1516 table to forward the message. 1518 Any intermediate peer which forwards a RELOAD message MUST arrange 1519 that if it receives a response to that message the response can be 1520 routed back through the set of nodes through which the request 1521 passed. This may be arranged in one of two ways: 1523 o The peer MAY add an entry to the via list in the forwarding header 1524 that will enable it to determine the correct node. 1525 o The peer MAY keep per-transaction state which will allow it to 1526 determine the correct node. 1528 As an example of the first strategy, if node D receives a message 1529 from node C with via list (A, B), then D would forward to the next 1530 node (E) with via list (A, B, C). Now, if E wants to respond to the 1531 message, it reverses the via list to produce the destination list, 1532 resulting in (D, C, B, A). When D forwards the response to C, the 1533 destination list will contain (C, B, A). 1535 As an example of the second strategy, if node D receives a message 1536 from node C with transaction ID X and via list (A, B), it could store 1537 (X, C) in its state database and forward the message with the via 1538 list unchanged. When D receives the response, it consults its state 1539 database for transaction id X, determines that the request came from 1540 C, and forwards the response to C. 1542 Intermediate peers which modify the via list are not required to 1543 simply add entries. The only requirement is that the peer be able to 1544 reconstruct the correct destination list on the return route. RELOAD 1545 provides explicit support for this functionality in the form of 1546 private IDs, which can replace any number of via list entries. For 1547 instance, in the above example, Node D might send E a via list 1548 containing only the private ID (I). E would then use the destination 1549 list (D, I) to send its return message. When D processes this 1550 destination list, it would detect that I is a private ID, recover the 1551 via list (A, B, C), and reverse that to produce the correct 1552 destination list (C, B, A) before sending it to C. This feature is 1553 called List Compression. It MAY either be a compressed version of 1554 the original via list or an index into a state database containing 1555 the original via list. 1557 No matter what mechanism for storing via list state is used, if an 1558 intermediate peer exits the overlay, then on the return trip the 1559 message cannot be forwarded and will be dropped. The ordinary 1560 timeout and retransmission mechanisms provide stability over this 1561 type of failure. 1563 Note that if an intermediate peer retains per-transaction state 1564 instead of modifying the via list, it needs some mechanism for timing 1565 out that state, otherwise its state database will grow without bound. 1566 Whatever algorithm is used, state MUST be maintained for at least the 1567 value of the overlay reliability timer (3 seconds) and MAY be kept 1568 longer. 1570 5.1.3. Private ID 1572 If the first entry in the destination list is a private id (e.g., a 1573 compressed via list), the peer MUST replace that entry with the 1574 original via list that it replaced and then re-examine the 1575 destination list to determine which of the above cases now applies. 1577 5.2. Symmetric Recursive Routing 1579 This Section defines RELOAD's symmetric recursive routing algorithm, 1580 which is the default algorithm used by nodes to route messages 1581 through the overlay. All implementations MUST implement this routing 1582 algorithm. An overlay may be configured to use alternative routing 1583 algorithms, and alternative routing algorithms may be selected on a 1584 per-message basis. 1586 5.2.1. Request Origination 1588 In order to originate a message to a given Node-ID or Resource-ID, a 1589 node constructs an appropriate destination list. The simplest such 1590 destination list is a single entry containing the Node-ID or 1591 Resource-ID. The resulting message will use the normal overlay 1592 routing mechanisms to forward the message to that destination. The 1593 node can also construct a more complicated destination list for 1594 source routing. 1596 Once the message is constructed, the node sends the message to some 1597 adjacent peer. If the first entry on the destination list is 1598 directly connected, then the message MUST be routed down that 1599 connection. Otherwise, the topology plugin MUST be consulted to 1600 determine the appropriate next hop. 1602 Parallel searches for the resource are a common solution to improve 1603 reliability in the face of churn or of subversive peers. Parallel 1604 searches for usage-specified replicas are managed by the usage layer. 1605 However, a single request can also be routed through multiple 1606 adjacent peers, even when known to be sub-optimal, to improve 1607 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1608 specified by the topology plugin. 1610 Because messages may be lost in transit through the overlay, RELOAD 1611 incorporates an end-to-end reliability mechanism. When an 1612 originating node transmits a request it MUST set a 3 second timer. 1613 If a response has not been received when the timer fires, the request 1614 is retransmitted with the same transaction identifier. The request 1615 MAY be retransmitted up to 4 times (for a total of 5 messages). 1616 After the timer for the fifth transmission fires, the message SHALL 1617 be considered to have failed. Note that this retransmission 1618 procedure is not followed by intermediate nodes. They follow the 1619 hop-by-hop reliability procedure described in Section 5.6.3. 1621 The above algorithm can result in multiple requests being delivered 1622 to a node. Receiving nodes MUST generate semantically equivalent 1623 responses to retransmissions of the same request (this can be 1624 determined by transaction id) if the request is received within the 1625 maximum request lifetime (15 seconds). For some requests (e.g., 1626 Fetch) this can be accomplished merely by processing the request 1627 again. For other requests, (e.g., Store) it may be necessary to 1628 maintain state for the duration of the request lifetime. 1630 5.2.2. Response Origination 1632 When a peer sends a response to a request using this routing 1633 algorithm, it MUST construct the destination list by reversing the 1634 order of the entries on the via list. This has the result that the 1635 response traverses the same peers as the request traversed, except in 1636 reverse order (symmetric routing). 1638 5.3. Message Structure 1640 RELOAD is a message-oriented request/response protocol. The messages 1641 are encoded using binary fields. All integers are represented in 1642 network byte order. The general philosophy behind the design was to 1643 use Type, Length, Value fields to allow for extensibility. However, 1644 for the parts of a structure that were required in all messages, we 1645 just define these in a fixed position, as adding a type and length 1646 for them is unnecessary and would simply increase bandwidth and 1647 introduces new potential for interoperability issues. 1649 Each message has three parts, concatenated as shown below: 1651 +-------------------------+ 1652 | Forwarding Header | 1653 +-------------------------+ 1654 | Message Contents | 1655 +-------------------------+ 1656 | Security Block | 1657 +-------------------------+ 1659 The contents of these parts are as follows: 1661 Forwarding Header: Each message has a generic header which is used 1662 to forward the message between peers and to its final destination. 1663 This header is the only information that an intermediate peer 1664 (i.e., one that is not the target of a message) needs to examine. 1666 Message Contents: The message being delivered between the peers. 1667 From the perspective of the forwarding layer, the contents are 1668 opaque, however, they are interpreted by the higher layers. 1670 Security Block: A security block containing certificates and a 1671 digital signature over the ""Message Contents". Note that this 1672 signature can be computed without parsing the message contents. 1673 All messages MUST be signed by their originator. 1675 The following sections describe the format of each part of the 1676 message. 1678 5.3.1. Presentation Language 1680 The structures defined in this document are defined using a C-like 1681 syntax based on the presentation language used to define TLS. 1682 [RFC5246] Advantages of this style include: 1684 o It familiar enough looking that most readers can grasp it quickly. 1685 o The ability to define nested structures allows a separation 1686 between high-level and low-level message structures. 1687 o It has a straightforward wire encoding that allows quick 1688 implementation, but the structures can be comprehended without 1689 knowing the encoding. 1690 o The ability to mechanically compile encoders and decoders. 1692 Several idiosyncrasies of this language are worth noting. 1694 o All lengths are denoted in bytes, not objects. 1695 o Variable length values are denoted like arrays with angle 1696 brackets. 1697 o "select" is used to indicate variant structures. 1699 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1700 but only up to 127 values of two bytes (16 bits) each. 1702 5.3.1.1. Common Definitions 1704 The following definitions are used throughout RELOAD and so are 1705 defined here. They also provide a convenient introduction to how to 1706 read the presentation language. 1708 An enum represents an enumerated type. The values associated with 1709 each possibility are represented in parentheses and the maximum value 1710 is represented as a nameless value, for purposes of describing the 1711 width of the containing integral type. For instance, Boolean 1712 represents a true or false: 1714 enum { false (0), true(1), (255)} Boolean; 1716 A boolean value is either a 1 or a 0. The max value of 255 indicates 1717 this is represented as a single byte on the wire. 1719 The NodeId, shown below, represents a single Node-ID. 1721 typedef opaque NodeId[NodeIdLength]; 1723 A NodeId is a fixed-length structure represented as a series of 1724 bytes, with the most significant byte first. The length is set on a 1725 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1726 (See Section 10.1 for how NodeIdLength is set.) Note: the use of 1727 "typedef" here is an extension to the TLS language, but its meaning 1728 should be relatively obvious. Note the [ size ] syntax defines a 1729 fixed length element that does not include the length of the element 1730 in the on the wire encoding. 1732 A ResourceId, shown below, represents a single Resource-ID. 1734 typedef opaque ResourceId<0..2^8-1>; 1736 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1737 NodeIds, ResourceIds are variable length, up to 255 bytes (2048 bits) 1738 in length. On the wire, each ResourceId is preceded by a single 1739 length byte (allowing lengths up to 255). Thus, the 3-byte value 1740 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1741 defines a variable length element that does include the length of the 1742 element in the on the wire encoding. The number of bytes to encode 1743 the length on the wire is derived by range; i.e., it is the minimum 1744 number of bytes which can encode the largest range value. 1746 A more complicated example is IpAddressPort, which represents a 1747 network address and can be used to carry either an IPv6 or IPv4 1748 address: 1750 enum {reservedAddr(0), ipv4_address (1), ipv6_address (2), 1751 (255)} AddressType; 1753 struct { 1754 uint32 addr; 1755 uint16 port; 1756 } IPv4AddrPort; 1758 struct { 1759 uint128 addr; 1760 uint16 port; 1761 } IPv6AddrPort; 1763 struct { 1764 AddressType type; 1765 uint8 length; 1767 select (type) { 1768 case ipv4_address: 1769 IPv4AddrPort v4addr_port; 1771 case ipv6_address: 1772 IPv6AddrPort v6addr_port; 1774 /* This structure can be extended */ 1776 } IpAddressPort; 1778 The first two fields in the structure are the same no matter what 1779 kind of address is being represented: 1781 type: the type of address (v4 or v6). 1782 length: the length of the rest of the structure. 1784 By having the type and the length appear at the beginning of the 1785 structure regardless of the kind of address being represented, an 1786 implementation which does not understand new address type X can still 1787 parse the IpAddressPort field and then discard it if it is not 1788 needed. 1790 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1791 an IPv6AddrPort. Both of these simply consist of an address 1792 represented as an integer and a 16-bit port. As an example, here is 1793 the wire representation of the IPv4 address "192.0.2.1" with port 1794 "6100". 1796 01 ; type = IPv4 1797 06 ; length = 6 1798 c0 00 02 01 ; address = 192.0.2.1 1799 17 d4 ; port = 6100 1801 Unless a given structure that uses a select explicitly allows for 1802 unknown types in the select, any unknown type SHOULD be treated as an 1803 parsing error and the whole message discarded with no response. 1805 5.3.2. Forwarding Header 1807 The forwarding header is defined as a ForwardingHeader structure, as 1808 shown below. 1810 struct { 1811 uint32 relo_token; 1812 uint32 overlay; 1813 uint16 configuration_sequence; 1814 uint8 version; 1815 uint8 ttl; 1816 uint32 fragment; 1817 uint32 length; 1818 uint64 transaction_id; 1819 uint32 max_response_length; 1820 uint16 via_list_length; 1821 uint16 destination_list_length; 1822 uint16 options_length; 1823 Destination via_list[via_list_length]; 1824 Destination destination_list 1825 [destination_list_length]; 1826 ForwardingOptions options[options_length]; 1827 } ForwardingHeader; 1829 The contents of the structure are: 1831 relo_token: The first four bytes identify this message as a RELOAD 1832 message. The message is easy to demultiplex from STUN messages by 1833 looking at the first bit. This field MUST contain the value 1834 0xd2454c4f (the string 'RELO' with the high bit of the first byte 1835 set.). 1837 overlay: The 32 bit checksum/hash of the overlay being used. The 1838 variable length string representing the overlay name is hashed 1839 with SHA-1 and the low order 32 bits are used. The purpose of 1840 this field is to allow nodes to participate in multiple overlays 1841 and to detect accidental misconfiguration. This is not a security 1842 critical function. 1844 configuration_sequence: The sequence number of the configuration 1845 file. 1847 version: The version of the RELOAD protocol being used. This is a 1848 fixed point integer between 0.1 and 25.4. This document describes 1849 version 0.1, with a value of 0x01. [[ Note to RFC Editor: Please 1850 update this to version 1.0 with value of 0x0a and remove this 1851 note. ]] 1853 ttl: An 8 bit field indicating the number of iterations, or hops, a 1854 message can experience before it is discarded. The TTL value MUST 1855 be decremented by one at every hop along the route the message 1856 traverses. If the TTL is 0, the message MUST NOT be propagated 1857 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1858 should be generated. The initial value of the TTL SHOULD be 100 1859 unless defined otherwise by the overlay configuration. 1861 fragment: This field is used to handle fragmentation. The high 1862 order two bits are used to indicate the fragmentation status: If 1863 the high bit (0x80000000) is set, it indicates that the message is 1864 a fragment. If the next bit (0x40000000) is set, it indicates 1865 that this is the last fragment. The next six bits (0x20000000 to 1866 0x01000000) are reserved and SHOULD be set to zero. The remainder 1867 of the field is used to indicate the fragment offset; see 1868 Section 5.7 1870 length: The count in bytes of the size of the message, including the 1871 header. 1873 transaction_id: A unique 64 bit number that identifies this 1874 transaction and also allows receivers to disambiguate transactions 1875 which are otherwise identical. In order to provide a high 1876 probability that transaction IDs are unique, they MUST be randomly 1877 generated. Responses use the same Transaction ID as the request 1878 they correspond to. Transaction IDs are also used for fragment 1879 reassembly. 1881 max_response_length: The maximum size in bytes of a response. Used 1882 by requesting nodes to avoid receiving (unexpected) very large 1883 responses. If this value is non-zero, responding peers MUST check 1884 that any response would not exceed it and if so generate an 1885 Error_Response_Too_Large value. This value SHOULD be set to zero 1886 for responses. 1888 via_list_length: The length of the via list in bytes. Note that in 1889 this field and the following two length fields we depart from the 1890 usual variable-length convention of having the length immediately 1891 precede the value in order to make it easier for hardware decoding 1892 engines to quickly determine the length of the header. 1894 destination_list_length: The length of the destination list in 1895 bytes. 1897 options_length: The length of the header options in bytes. 1899 via_list: The via_list contains the sequence of destinations through 1900 which the message has passed. The via_list starts out empty and 1901 grows as the message traverses each peer. 1903 destination_list: The destination_list contains a sequence of 1904 destinations which the message should pass through. The 1905 destination list is constructed by the message originator. The 1906 first element in the destination list is where the message goes 1907 next. The list shrinks as the message traverses each listed peer. 1909 options: Contains a series of ForwardingOptions entries. See 1910 Section 5.3.2.3. 1912 5.3.2.1. Processing Configuration Sequence Numbers 1914 In order to be part of the overlay, a node MUST have a copy of the 1915 overlay configuration document. In order to allow for configuration 1916 document changes, each version of the configuration document has a 1917 sequence number which is monotonically increasing mod 65536. Because 1918 the sequence number may in principle wrap, greater than or less than 1919 are interpreted by modulo arithmetic as in TCP. 1921 When a destination node receives a request, it MUST check that the 1922 configuration_sequence field is equal to its own configuration 1923 sequence number. If they do not match, it MUST generate an error, 1924 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1925 the configuration file in the request is too old, it MUST generate a 1926 ConfigUpdate message to update the requesting node. This allows new 1927 configuration documents to propagate quickly throughout the system. 1928 The one exception to this rule is that if the configuration_sequence 1929 field is equal to 0xffff, and the message type is ConfigUpdate, then 1930 the message MUST be accepted regardless of the receiving node's 1931 configuration sequence number. Since 65535 is a special value, peers 1932 sending a new configuration when the configuration sequence is 1933 currently 65534 MUST set the configuration sequence number to 0 when 1934 they send out a new configuration. 1936 5.3.2.2. Destination and Via Lists 1938 The destination list and via lists are sequences of Destination 1939 values: 1941 enum {reserved(0), node(1), resource(2), compressed(3), 1942 /* 128-255 not allowed */ (255) } 1943 DestinationType; 1945 select (destination_type) { 1946 case node: 1947 NodeId node_id; 1949 case resource: 1950 ResourceId resource_id; 1952 case compressed: 1953 opaque compressed_id<0..2^8-1>; 1955 /* This structure may be extended with new types */ 1956 } DestinationData; 1958 struct { 1959 DestinationType type; 1960 uint8 length; 1961 DestinationData destination_data; 1962 } Destination; 1964 struct { 1965 uint16 compressed_id; /* top bit MUST be 1 */ 1966 } Destination; 1968 If a destination structure has its first bit set to 1, then it is a 1969 16 bit integer. If the first bit is not set, then it is a structure 1970 starting with DestinationType. If it is a 16 bit integer, it is 1971 treated as if it were a full structure with a DestinationType of 1972 compressed and a compressed_id that was 2 bytes long with the value 1973 of the 16 bit integer. When the destination structure is not a 16 1974 bit integer, it is the TLV structure with the following contents: 1976 type 1977 The type of the DestinationData Payload Data Unit (PDU). This may 1978 be one of "node", "resource", or "compressed". 1980 length 1981 The length of the destination_data. 1983 destination_value 1984 The destination value itself, which is an encoded DestinationData 1985 structure, depending on the value of "type". 1987 Note: This structure encodes a type, length, value. The length 1988 field specifies the length of the DestinationData values, which 1989 allows the addition of new DestinationTypes. This allows an 1990 implementation which does not understand a given DestinationType 1991 to skip over it. 1993 A DestinationData can be one of three types: 1995 node 1996 A Node-ID. 1998 compressed 1999 A compressed list of Node-IDs and/or resources. Because this 2000 value was compressed by one of the peers, it is only meaningful to 2001 that peer and cannot be decoded by other peers. Thus, it is 2002 represented as an opaque string. 2004 resource 2005 The Resource-ID of the resource which is desired. This type MUST 2006 only appear in the final location of a destination list and MUST 2007 NOT appear in a via list. It is meaningless to try to route 2008 through a resource. 2010 One possible encoding of the 16 bit integer version as an opaque 2011 identifier is to encode an index into a connection table. To avoid 2012 misrouting responses in the event a response is delayed and the 2013 connection table entry has changed, the identifier SHOULD be split 2014 between an index and a generation counter for that index. At 2015 startup, the generation counters should be initialized to random 2016 values. An implementation could use 12 bits for the connection table 2017 index and 3 bits for the generation counter. (Note that this does 2018 not suggest a 4096 entry connection table for every node, only the 2019 ability to encode for a larger connection table.) When a connection 2020 table slot is used for a new connection, the generation counter is 2021 incremented (with wrapping). Connection table slots are used on a 2022 rotating basis to maximize the time interval between uses of the same 2023 slot for different connections. When routing a message to an entry 2024 in the destination list encoding a connection table entry, the node 2025 confirms that the generation counter matches the current generation 2026 counter of that index before forwarding the message. If it does not 2027 match, the message is silently dropped. 2029 5.3.2.3. Forwarding Options 2031 The Forwarding header can be extended with forwarding header options, 2032 which are a series of ForwardingOptions structures: 2034 enum { reservedForwarding(0), 2035 directResponseForwarding(1), (255) } ForwardingOptionsType; 2037 struct { 2038 ForwardingOptionsType type; 2039 uint8 flags; 2040 uint16 length; 2041 select (type) { 2042 case directResponseForwarding: 2043 DirectResponseForwardingOption directResponseForwardingOption; 2044 /* This type may be extended */ 2045 } option; 2046 } ForwardingOption; 2048 Each ForwardingOption consists of the following values: 2050 type 2051 The type of the option. This structure allows for unknown options 2052 types. 2054 length 2055 The length of the rest of the structure. 2057 flags 2058 Three flags are defined FORWARD_CRITICAL(0x01), 2059 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2060 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2061 set, any node that would forward the message but does not 2062 understand this options MUST reject the request with an 2063 Error_Unsupported_Forwarding_Option error response. If the 2064 DESTINATION_CRITICAL flag is set, any node that generates a 2065 response to the message but does not understand the forwarding 2066 option MUST reject the request with an 2067 Error_Unsupported_Forwarding_Option error response. If the 2068 RESPONSE_COPY flag is set, any node generating a response MUST 2069 copy the option from the request to the response except that the 2070 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags 2071 must be cleared. 2073 option 2074 The option value. 2076 5.3.2.4. Direct Return Response Forwarding Options 2078 This section defines an OPTIONAL forwarding option that allows the 2079 originator of a request to signal that the node responding to the 2080 request should try to route the response directly to the node that 2081 made the request instead of having the responses traverse the 2082 overlay. : 2084 struct { 2085 AttachReqAns connection_information; 2086 NodeID requesting_node; 2087 } DirectResponseForwardingOption; 2089 Each ForwardingOption consists of the following values: 2091 connection_information 2092 All of the information needed to initiate a new connection to the 2093 requesting node. This type is defined in Section 5.5.1.1. 2095 requesting_node 2096 The NodeID of the node that originated the request. This is used 2097 to match the TLS certificate. 2099 This option can only be used if the direct-return-response-permitted 2100 flag in the configuration for the overlay is set to TRUE. The 2101 RESPONSE_COPY flag SHOULD be set to false while the FORWARD_CRITICAL 2102 and DESTINATION_CRITICAL MUST be set to true. When a node that 2103 supports this forwarding options receives a request with it, it acts 2104 as if it had send an Attach request to the requesting_node and it had 2105 received the connection_information in the answer. This causes it to 2106 form a new connection directly to that node. Once that is complete 2107 the response to this request is sent over that connection. If a 2108 connection already exists directly to that node, it is used instead 2109 of a new connection being formed. The connection MAY be closed at 2110 any point but is typically kept open until it has not been used for a 2111 significant period of time or one of the nodes needs to reclaim 2112 resources. 2114 5.3.3. Message Contents Format 2116 The second major part of a RELOAD message is the contents part, which 2117 is defined by MessageContents: 2119 enum { reservedMessagesExtension(0), (2^16-1) } MessageExtensionType; 2121 struct { 2122 MessageExtensionType type; 2123 Boolean critical; 2124 opaque extension_contents<0..2^32-1>; 2125 } MessageExtension; 2127 struct { 2128 uint16 message_code; 2129 opaque message_body<0..2^32-1>; 2130 MessageExtensions extensions<0..2^32-1>; 2131 } MessageContents; 2133 The contents of this structure are as follows: 2135 message_code 2136 This indicates the message that is being sent. The code space is 2137 broken up as follows. 2139 0 Reserved 2141 1 .. 0x7fff Requests and responses. These code points are always 2142 paired, with requests being odd and the corresponding response 2143 being the request code plus 1. Thus, "probe_request" (the 2144 Probe request) has value 1 and "probe_answer" (the Probe 2145 response) has value 2 2147 0xffff Error 2148 The message codes are defined in Section 13.8 2149 message_body 2150 The message body itself, represented as a variable-length string 2151 of bytes. The bytes themselves are dependent on the code value. 2152 See the sections describing the various RELOAD methods (Join, 2153 Update, Attach, Store, Fetch, etc.) for the definitions of the 2154 payload contents. 2155 extensions 2156 Extensions to the message. Currently no extensions are defined, 2157 but new extensions can be defined by the process described in 2158 Section 13.14. 2160 All extensions have the following form: 2162 type 2163 The extension type. 2165 critical 2166 Whether this extension must be understood in order to process the 2167 message. If critical = True and the recipient does not understand 2168 the message, it MUST generate an Error_Unknown_Extension error. 2169 If critical = False, the recipient MAY choose to process the 2170 message even if it does not understand the extension. 2172 extension_contents 2173 The contents of the extension (extension-dependent). 2175 5.3.3.1. Response Codes and Response Errors 2177 A peer processing a request returns its status in the message_code 2178 field. If the request was a success, then the message code is the 2179 response code that matches the request (i.e., the next code up). The 2180 response payload is then as defined in the request/response 2181 descriptions. 2183 If the request has failed, then the message code is set to 0xffff 2184 (error) and the payload MUST be an error_response PDU, as shown 2185 below. 2187 When the message code is 0xffff, the payload MUST be an 2188 ErrorResponse. 2190 public struct { 2191 uint16 error_code; 2192 opaque error_info<0..2^16-1>; 2193 } ErrorResponse; 2195 The contents of this structure are as follows: 2197 error_code 2198 A numeric error code indicating the error that occurred. 2200 error_info 2201 An optional arbitrary byte string. Unless otherwise specified, 2202 this will be a UTF-8 text string providing further information 2203 about what went wrong. 2205 The following error code values are defined. The numeric values for 2206 these are defined in Section 13.9. 2208 Error_Forbidden: The requesting node does not have permission to 2209 make this request. 2211 Error_Not_Found: The resource or peer cannot be found or does not 2212 exist. 2214 Error_Request_Timeout: A response to the request has not been 2215 received in a suitable amount of time. The requesting node MAY 2216 resend the request at a later time. 2218 Error_Data_Too_Old: A store cannot be completed because the 2219 storage_time precedes the existing value. 2221 Error_Data_Too_Old: A store cannot be completed because the 2222 storage_time precedes the existing value. 2224 Error_Data_Too_Large: A store cannot be completed because the 2225 requested object exceeds the size limits for that kind. 2227 Error_Generation_Counter_Too_Low: A store cannot be completed 2228 because the generation counter precedes the existing value. 2230 Error_Incompatible_with_Overlay: A peer receiving the request is 2231 using a different overlay, overlay algorithm, or hash algorithm. 2233 Error_Unsupported_Forwarding_Option: A peer receiving the request 2234 with a forwarding options flagged as critical but the peer does 2235 not support this option. See section Section 5.3.2.3. 2237 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2238 decremented to zero. See section Section 5.3.2. 2240 Error_Message_Too_Large: A peer receiving the request that was too 2241 large. See section Section 5.6. 2243 Error_Response_Too_Large: A peer would have generated a response 2244 that is too large per the max_response_length field. 2246 Error_Config_Too_Old: A destination peer received a request with a 2247 configuration sequence that's too old. A node which generates 2248 this response MUST then generate a ConfigUpdate message containing 2249 the correct configuration. 2251 Error_Config_Too_New: A destination node received a request with a 2252 configuration sequence that's too new. A node which receives this 2253 error MUST generate a ConfigUpdate message to send a new copy of 2254 the configuration document to the node which generated the error. 2256 Error_Unknown_Kind: A destination node received a request with an 2257 unknown kind-id. A node which receives this error MUST generate a 2258 ConfigUpdate message which contains the appropriate kind 2259 definition (assuming that in fact a kind was used which was 2260 defined in the configuration document). 2261 Error_Unknown_Extension: A destination node received a request with 2262 an unknown extension. 2264 5.3.4. Security Block 2266 The third part of a RELOAD message is the security block. The 2267 security block is represented by a SecurityBlock structure: 2269 enum { x509(0), (255) } certificate_type; 2271 struct { 2272 certificate_type type; 2273 opaque certificate<0..2^16-1>; 2274 } GenericCertificate; 2276 struct { 2277 GenericCertificate certificates<0..2^16-1>; 2278 Signature signature; 2279 } SecurityBlock; 2281 The contents of this structure are: 2283 certificates 2284 A bucket of certificates. 2286 signature 2287 A signature over the message contents. 2289 The certificates bucket SHOULD contain all the certificates necessary 2290 to verify every signature in both the message and the internal 2291 message objects. This is the only location in the message which 2292 contains certificates, thus allowing for only a single copy of each 2293 certificate to be sent. In systems which have some alternate 2294 certificate distribution mechanism, some certificates MAY be omitted. 2295 However, implementors should note that this creates the possibility 2296 that messages may not be immediately verifiable because certificates 2297 must first be retrieved. 2299 Each certificate is represented by a GenericCertificate structure, 2300 which has the following contents: 2302 type 2303 The type of the certificate. Only one type is defined: x509 2304 representing an X.509 certificate. 2306 certificate 2307 The encoded version of the certificate. For X.509 certificates, 2308 it is the DER form. 2310 The signature is computed over the payload and parts of the 2311 forwarding header. The payload, in case of a Store, may contain an 2312 additional signature computed over a StoreReq structure. All 2313 signatures are formatted using the Signature element. This element 2314 is also used in other contexts where signatures are needed. The 2315 input structure to the signature computation varies depending on the 2316 data element being signed. 2318 enum { reservedSignerIdentity(0), 2319 cert_hash(1), (255)} SignerIdentityType; 2321 select (identity_type) { 2322 case cert_hash; 2323 HashAlgorithm hash_alg; // From TLS 2324 opaque certificate_hash<0..2^8-1>; 2326 /* This structure may be extended with new types if necessary*/ 2327 } SignerIdentityValue; 2329 struct { 2330 SignerIdentityType identity_type; 2331 uint16 length; 2332 SignerIdentityValue identity[SignerIdentity.length]; 2333 } SignerIdentity; 2335 struct { 2336 SignatureAndHashAlgorithm algorithm; // From TLS 2337 SignerIdentity identity; 2338 opaque signature_value<0..2^16-1>; 2339 } Signature; 2341 The signature construct contains the following values: 2343 algorithm 2344 The signature algorithm in use. The algorithm definitions are 2345 found in the IANA TLS SignatureAlgorithm Registry. 2347 identity 2348 The identity used to form the signature. 2350 signature_value 2351 The value of the signature. 2353 The only currently permitted identity format is a hash of the 2354 signer's certificate. The hash_alg field is used to indicate the 2355 algorithm used to produce the hash. The certificate_hash contains 2356 the hash of the certificate object. The SignerIdentity structure is 2357 typed purely to allow for future (unanticipated) extensibility. 2359 For signatures over messages the input to the signature is computed 2360 over: 2362 overlay + transaction_id + MessageContents + SignerIdentity 2364 where overlay and transaction_id come from the forwarding header and 2365 + indicates concatenation. 2367 The input to signatures over data values is different, and is 2368 described in Section 6.1. 2370 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2371 MUST verify the signature and the authorizing certificate. This 2372 check provides a minimal level of assurance that the sending node is 2373 a valid part of the overlay as well as cryptographic authentication 2374 of the sending node. In addition, responses MUST be checked as 2375 follows: 2377 1. The response to a message sent to a specific Node-ID MUST have 2378 been sent by that Node-ID. 2379 2. The response to a message sent to a Resource-Id MUST have been 2380 sent by a Node-ID which is as close to or closer to the target 2381 Resource-Id than any node in the requesting node's neighbor 2382 table. 2384 The second condition serves as a primitive check for responses from 2385 wildly wrong nodes but is not a complete check. Note that in periods 2386 of churn, it is possible for the requesting node to obtain a closer 2387 neighbor while the request is outstanding. This will cause the 2388 response to be rejected and the request to be retransmitted. 2390 In addition, some methods (especially Store) have additional 2391 authentication requirements, which are described in the sections 2392 covering those methods. 2394 5.4. Overlay Topology 2396 As discussed in previous sections, RELOAD does not itself implement 2397 any overlay topology. Rather, it relies on Topology Plugins, which 2398 allow a variety of overlay algorithms to be used while maintaining 2399 the same RELOAD core. This section describes the requirements for 2400 new topology plugins and the methods that RELOAD provides for overlay 2401 topology maintenance. 2403 5.4.1. Topology Plugin Requirements 2405 When specifying a new overlay algorithm, at least the following need 2406 to be described: 2408 o Joining procedures, including the contents of the Join message. 2409 o Stabilization procedures, including the contents of the Update 2410 message, the frequency of topology probes and keepalives, and the 2411 mechanism used to detect when peers have disconnected. 2412 o Exit procedures, including the contents of the Leave message. 2413 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2414 compute the hash of an identifier. 2415 o The procedures that peers use to route messages. 2416 o The replication strategy used to ensure data redundancy. 2418 All overlay algorithms MUST specify maintenance procedures that send 2419 Updates to clients and peers that have established connections to the 2420 peer responsible for a particular ID when the responsibility for that 2421 ID changes. Because tracking this information is difficult, overlay 2422 algorithms MAY simply specify that an Update is sent to all members 2423 of the Connection Table whenever the range of IDs for which the peer 2424 is responsible changes. 2426 5.4.2. Methods and types for use by topology plugins 2428 This section describes the methods that topology plugins use to join, 2429 leave, and maintain the overlay. 2431 5.4.2.1. Join 2433 A new peer (but one that already has credentials) uses the JoinReq 2434 message to join the overlay. The JoinReq is sent to the responsible 2435 peer depending on the routing mechanism described in the topology 2436 plugin. This notifies the responsible peer that the new peer is 2437 taking over some of the overlay and it needs to synchronize its 2438 state. 2440 struct { 2441 NodeId joining_peer_id; 2442 opaque overlay_specific_data<0..2^16-1>; 2443 } JoinReq; 2445 The minimal JoinReq contains only the Node-ID which the sending peer 2446 wishes to assume. Overlay algorithms MAY specify other data to 2447 appear in this request. 2449 If the request succeeds, the responding peer responds with a JoinAns 2450 message, as defined below: 2452 struct { 2453 opaque overlay_specific_data<0..2^16-1>; 2454 } JoinAns; 2456 If the request succeeds, the responding peer MUST follow up by 2457 executing the right sequence of Stores and Updates to transfer the 2458 appropriate section of the overlay space to the joining peer. In 2459 addition, overlay algorithms MAY define data to appear in the 2460 response payload that provides additional info. 2462 In general, nodes which cannot form connections SHOULD report an 2463 error. However, implementations MUST provide some mechanism whereby 2464 nodes can determine that they are potentially the first node and take 2465 responsibility for the overlay. This specification does not mandate 2466 any particular mechanism, but a configuration flag or setting seems 2467 appropriate. 2469 5.4.2.2. Leave 2471 The LeaveReq message is used to indicate that a node is exiting the 2472 overlay. A node SHOULD send this message to each peer with which it 2473 is directly connected prior to exiting the overlay. 2475 public struct { 2476 NodeId leaving_peer_id; 2477 opaque overlay_specific_data<0..2^16-1>; 2478 } LeaveReq; 2480 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2481 algorithms MAY specify other data to appear in this request. 2483 Upon receiving a Leave request, a peer MUST update its own routing 2484 table, and send the appropriate Store/Update sequences to re- 2485 stabilize the overlay. 2487 5.4.2.3. Update 2489 Update is the primary overlay-specific maintenance message. It is 2490 used by the sender to notify the recipient of the sender's view of 2491 the current state of the overlay (its routing state), and it is up to 2492 the recipient to take whatever actions are appropriate to deal with 2493 the state change. In general, peers send Update messages to all 2494 their adjacencies whenever they detect a topology shift. 2496 When a peer detects through an Update that it is no longer 2497 responsible for any data value it is storing, it MUST attempt to 2498 Store a copy to the correct node unless it knows the newly 2499 responsible node already has a copy of the data. This prevents data 2500 loss during large-scale topology shifts such as the merging of 2501 partitioned overlays. 2503 The contents of the UpdateReq message are completely overlay- 2504 specific. The UpdateAns response is expected to be either success or 2505 an error. 2507 5.4.2.4. Route_Query 2509 The Route_Query request allows the sender to ask a peer where they 2510 would route a message directed to a given destination. In other 2511 words, a RouteQuery for a destination X requests the Node-ID for the 2512 node that the receiving peer would next route to in order to get to 2513 X. A RouteQuery can also request that the receiving peer initiate an 2514 Update request to transfer the receiving peer's routing table. 2516 One important use of the RouteQuery request is to support iterative 2517 routing. The sender selects one of the peers in its routing table 2518 and sends it a RouteQuery message with the destination_object set to 2519 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2520 responds with information about the peers to which the request would 2521 be routed. The sending peer MAY then use the Attach method to attach 2522 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2523 gets a response from a peer that is closest to the identifier in the 2524 destination_object as determined by the topology plugin. At that 2525 point, the sender can send messages directly to that peer. 2527 5.4.2.4.1. Request Definition 2529 A RouteQueryReq message indicates the peer or resource that the 2530 requesting node is interested in. It also contains a "send_update" 2531 option allowing the requesting node to request a full copy of the 2532 other peer's routing table. 2534 struct { 2535 Boolean send_update; 2536 Destination destination; 2537 opaque overlay_specific_data<0..2^16-1>; 2538 } RouteQueryReq; 2540 The contents of the RouteQueryReq message are as follows: 2542 send_update 2543 A single byte. This may be set to "true" to indicate that the 2544 requester wishes the responder to initiate an Update request 2545 immediately. Otherwise, this value MUST be set to "false". 2547 destination 2548 The destination which the requester is interested in. This may be 2549 any valid destination object, including a Node-ID, compressed ids, 2550 or Resource-ID. 2552 overlay_specific_data 2553 Other data as appropriate for the overlay. 2555 5.4.2.4.2. Response Definition 2557 A response to a successful RouteQueryReq request is a RouteQueryAns 2558 message. This is completely overlay specific. 2560 5.4.2.5. Probe 2562 Probe provides primitive "exploration" services: it allows node to 2563 determine which resources another node is responsible for; and it 2564 allows some discovery services using multicast, anycast, or 2565 broadcast. A probe can be addressed to a specific Node-ID, or the 2566 peer controlling a given location (by using a resource ID). In 2567 either case, the target Node-IDs respond with a simple response 2568 containing some status information. 2570 5.4.2.5.1. Request Definition 2572 The ProbeReq message contains a list (potentially empty) of the 2573 pieces of status information that the requester would like the 2574 responder to provide. 2576 enum { reservedProbeInformation(0), responsible_set(1), 2577 num_resources(2), uptime(3), (255)} 2578 ProbeInformationType; 2580 struct { 2581 ProbeInformationType requested_info<0..2^8-1>; 2582 } ProbeReq 2584 The currently defined values for ProbeInformation are: 2586 responsible_set 2587 indicates that the peer should Respond with the fraction of the 2588 overlay for which the responding peer is responsible. 2590 num_resources 2591 indicates that the peer should Respond with the number of 2592 resources currently being stored by the peer. 2594 uptime 2595 indicates that the peer should Respond with how long the peer has 2596 been up in seconds. 2598 5.4.2.5.2. Response Definition 2600 A successful ProbeAns response contains the information elements 2601 requested by the peer. 2603 struct { 2604 select (type) { 2605 case responsible_set: 2606 uint32 responsible_ppb; 2608 case num_resources: 2609 uint32 num_resources; 2611 case uptime: 2612 uint32 uptime; 2613 /* This type may be extended */ 2615 }; 2616 } ProbeInformationData; 2618 struct { 2619 ProbeInformationType type; 2620 uint8 length; 2621 ProbeInformationData value; 2622 } ProbeInformation; 2624 struct { 2625 ProbeInformation probe_info<0..2^16-1>; 2626 } ProbeAns; 2628 A ProbeAns message contains a sequence of ProbeInformation 2629 structures. Each has a "length" indicating the length of the 2630 following value field. This structure allows for unknown option 2631 types. 2633 Each of the current possible Probe information types is a 32-bit 2634 unsigned integer. For type "responsible_ppb", it is the fraction of 2635 the overlay for which the peer is responsible in parts per billion. 2636 For type "num_resources", it is the number of resources the peer is 2637 storing. For the type "uptime" it is the number of seconds the peer 2638 has been up. 2640 The responding peer SHOULD include any values that the requesting 2641 node requested and that it recognizes. They SHOULD be returned in 2642 the requested order. Any other values MUST NOT be returned. 2644 5.5. Forwarding and Link Management Layer 2646 Each node maintains connections to a set of other nodes defined by 2647 the topology plugin. This section defines the methods RELOAD uses to 2648 form and maintain connections between nodes in the overlay. Three 2649 methods are defined: 2651 Attach: used to form RELOAD connections between nodes. When node 2652 A wants to connect to node B, it sends an Attach message to node B 2653 through the overlay. The Attach contains A's ICE parameters. B 2654 responds with its ICE parameters and the two nodes perform ICE to 2655 form connection. Attach also allows two nodes to connect via No- 2656 ICE instead of full ICE. 2657 AppAttach: used to form application layer connections between 2658 nodes. 2659 Ping: is a simple request/response which is used to verify 2660 connectivity of the target peer. 2662 5.5.1. Attach 2664 A node sends an Attach request when it wishes to establish a direct 2665 TCP or UDP connection to another node for the purpose of sending 2666 RELOAD messages. 2668 As described in Section 5.1, an Attach may be routed to either a 2669 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2670 will fail if that node is not reached. An Attach routed to a 2671 Resource-ID will establish a connection with the peer currently 2672 responsible for that Resource-ID, which may be useful in establishing 2673 a direct connection to the responsible peer for use with frequent or 2674 large resource updates. 2676 An Attach in and of itself does not result in updating the routing 2677 table of either node. That function is performed by Updates. If 2678 node A has Attached to node B, but not received any Updates from B, 2679 it MAY route messages which are directly addressed to B through that 2680 channel but MUST NOT route messages through B to other peers via that 2681 channel. The process of Attaching is separate from the process of 2682 becoming a peer (using Join and Update), to prevent half-open states 2683 where a node has started to form connections but is not really ready 2684 to act as a peer. Thus, clients (unlike peers) can simply Attach 2685 without sending Join or Update. 2687 5.5.1.1. Request Definition 2689 An Attach request message contains the requesting node ICE connection 2690 parameters formatted into a binary structure. 2692 enum { reservedOverlayLink(0), DTLS-UDP-SR(1), 2693 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2694 (255) } OverlayLinkType; 2696 enum { reservedCand(0), host(1), srflx(2), prflx(3), relay(4), 2697 (255) } CandType; 2699 struct { 2700 opaque name<2^16-1>; 2701 opaque value<2^16-1>; 2702 } IceExtension; 2704 struct { 2705 IpAddressPort addr_port; 2706 OverlayLinkType overlay_link; 2707 opaque foundation<0..255>; 2708 uint32 priority; 2709 CandType type; 2710 select (type){ 2711 case host: 2712 ; /* Nothing */ 2713 case srflx: 2714 case prflx: 2715 case relay: 2716 IpAddressPort rel_addr_port; 2717 } 2718 IceExtension extensions<0..2^16-1>; 2719 } IceCandidate; 2721 struct { 2722 opaque ufrag<0..2^8-1>; 2723 opaque password<0..2^8-1>; 2724 opaque role<0..2^8-1>; 2725 IceCandidate candidates<0..2^16-1>; 2726 Boolean send_update; 2727 } AttachReqAns; 2729 The values contained in AttachReqAns are: 2731 ufrag 2732 The username fragment (from ICE). 2734 password 2735 The ICE password. 2737 role 2738 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2739 value MUST be 'passive' for the offerer (the peer sending the 2740 Attach request) and 'active' for the answerer (the peer sending 2741 the Attach response). 2743 candidates 2744 One or more ICE candidate values, as described below. 2745 send_update 2746 Has the same meaning as the send_update field in RouteQueryReq. 2748 Each ICE candidate is represented as an IceCandidate structure, which 2749 is a direct translation of the information from the ICE string 2750 structures, with the exception of the component ID. Since there is 2751 only one component, it is always 1, and thus left out of the PDU. 2752 The remaining values are specified as follows: 2754 addr_port 2755 corresponds to the connection-address and port productions. 2757 overlay_link 2758 corresponds to the OverlayLinkType production, Overlay Link 2759 protocols used with No-ICE MUST specify "No-ICE" in their 2760 description. Future overlay link values can be added be defining 2761 new OverlayLinkType values in the IANA registry in Section 13.10. 2762 Future extensions to the encapsulation or framing that provide for 2763 backward compatibility with that specified by a previously defined 2764 OverlayLinkType values MUST use that previous value. 2765 OverlayLinkType protocols are defined in Section 5.6 2766 A single AttachReqAns MUST NOT include both candidates whose 2767 OverlayLinkType protocols use ICE (the default) and candidates 2768 that specify "No-ICE". 2770 foundation 2771 corresponds to the foundation production. 2773 priority 2774 corresponds to the priority production. 2776 type 2777 corresponds to the cand-type production. 2779 rel_addr_port 2780 corresponds to the rel-addr and rel-port productions. Only 2781 present for type "relay". 2783 extensions 2784 ICE extensions. The name and value fields correspond to binary 2785 translations of the equivalent fields in the ICE extensions. 2787 These values should be generated using the procedures described in 2788 Section 5.5.1.3. 2790 5.5.1.2. Response Definition 2792 If a peer receives an Attach request, it MUST process the request and 2793 SHOULD generate its own response with a AttachReqAns. A peer which 2794 is overloaded or detects some other kind of error may of course 2795 generate an error instead of an AttachReqAns. It should then begin 2796 ICE checks. When a peer receives an Attach response, it SHOULD parse 2797 the response and begin its own ICE checks. 2799 5.5.1.3. Using ICE With RELOAD 2801 This section describes the profile of ICE that is used with RELOAD. 2802 RELOAD implementations MUST implement full ICE. 2804 In ICE as defined by [RFC5245], SDP is used to carry the ICE 2805 parameters. In RELOAD, this function is performed by a binary 2806 encoding in the Attach method. This encoding is more restricted than 2807 the SDP encoding because the RELOAD environment is simpler: 2809 o Only a single media stream is supported. 2810 o In this case, the "stream" refers not to RTP or other types of 2811 media, but rather to a connection for RELOAD itself or for SIP 2812 signaling. 2813 o RELOAD only allows for a single offer/answer exchange. Unlike the 2814 usage of ICE within SIP, there is never a need to send a 2815 subsequent offer to update the default candidates to match the 2816 ones selected by ICE. 2818 An agent follows the ICE specification as described in [RFC5245] with 2819 the changes and additional procedures described in the subsections 2820 below. 2822 5.5.1.4. Collecting STUN Servers 2824 ICE relies on the node having one or more STUN servers to use. In 2825 conventional ICE, it is assumed that nodes are configured with one or 2826 more STUN servers through some out of band mechanism. This is still 2827 possible in RELOAD but RELOAD also learns STUN servers as it connects 2828 to other peers. Because all RELOAD peers implement ICE and use STUN 2829 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2830 peer a node knows will be willing to be a STUN server -- though of 2831 course it may be behind a NAT. 2833 A peer on a well-provisioned wide-area overlay will be configured 2834 with one or more bootstrap nodes. These nodes make an initial list 2835 of STUN servers. However, as the peer forms connections with 2836 additional peers, it builds more peers it can use as STUN servers. 2838 Because complicated NAT topologies are possible, a peer may need more 2839 than one STUN server. Specifically, a peer that is behind a single 2840 NAT will typically observe only two IP addresses in its STUN checks: 2841 its local address and its server reflexive address from a STUN server 2842 outside its NAT. However, if there are more NATs involved, it may 2843 learn additional server reflexive addresses (which vary based on 2844 where in the topology the STUN server is). To maximize the chance of 2845 achieving a direct connection, a peer SHOULD group other peers by the 2846 peer-reflexive addresses it discovers through them. It SHOULD then 2847 select one peer from each group to use as a STUN server for future 2848 connections. 2850 Only peers to which the peer currently has connections may be used. 2851 If the connection to that host is lost, it MUST be removed from the 2852 list of stun servers and a new server from the same group MUST be 2853 selected unless there are no others servers in the group in which 2854 case some other peer MAY be used. 2856 5.5.1.5. Gathering Candidates 2858 When a node wishes to establish a connection for the purposes of 2859 RELOAD signaling or application signaling, it follows the process of 2860 gathering candidates as described in Section 4 of ICE [RFC5245]. 2861 RELOAD utilizes a single component. Consequently, gathering for 2862 these "streams" requires a single component. In the case where a 2863 node has not yet found a TURN server, the agent would not include a 2864 relayed candidate. 2866 The ICE specification assumes that an ICE agent is configured with, 2867 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2868 for an agent to learn these by querying the overlay, as described in 2869 Section 5.5.1.4 and Section 8. 2871 The default candidate selection described in Section 4.1.4 of ICE is 2872 ignored; defaults are not signaled or utilized by RELOAD. 2874 An alternative to using the full ICE supported by the Attach request 2875 is to use No-ICE mechanism by providing candidates with "No-ICE" 2876 Overlay Link protocols. Configuration for the overlay indicates 2877 whether or not these Overlay Link protocols can be used. An overlay 2878 MUST be either all ICE or all No-ICE. 2880 No-ICE will not work in all of the scenarios where ICE would work, 2881 but in some cases, particularly those with no NATs or firewalls, it 2882 will work. Therefore it is RECOMMENDED that full ICE be used even 2883 for a node that has a public, unfiltered IP address, to take 2884 advantage of STUN connectivity checks, etc. 2886 5.5.1.6. Prioritizing Candidates 2888 At the time of writing, UDP is the only transport protocol specified 2889 to work with ICE. However, standardization of additional protocols 2890 for use with ICE is expected, including TCP and datagram-oriented 2891 protocols such as SCTP and DCCP. In particular, UDP encapsulations 2892 for SCTP and DCCP are expected to be standardized in the near future, 2893 greatly expanding the available Overlay Link protocols available for 2894 RELOAD. When additional protocols are available, the following 2895 prioritization is RECOMMENDED: 2897 o Highest priority is assigned to message-oriented protocols that 2898 offer well-understood congestion and flow control without head of 2899 line blocking. For example, SCTP without message ordering, DCCP, 2900 or those protocols encapsulated using UDP. 2901 o Second highest priority is assigned to stream-oriented protocols, 2902 e.g. TCP. 2903 o Lowest priority is assigned to protocols encapsulated over UDP 2904 that do not implement well-established congestion control 2905 algorithms. The DTLS/UDP with SR overlay link protocol is an 2906 example of such a protocol. 2908 5.5.1.7. Encoding the Attach Message 2910 Section 4.3 of ICE describes procedures for encoding the SDP for 2911 conveying RELOAD candidates. Instead of actually encoding an SDP, 2912 the candidate information (IP address and port and transport 2913 protocol, priority, foundation, type and related address) is carried 2914 within the attributes of the Attach request or its response. 2915 Similarly, the username fragment and password are carried in the 2916 Attach message or its response. Section 5.5.1 describes the detailed 2917 attribute encoding for Attach. The Attach request and its response 2918 do not contain any default candidates or the ice-lite attribute, as 2919 these features of ICE are not used by RELOAD. 2921 Since the Attach request contains the candidate information and short 2922 term credentials, it is considered as an offer for a single media 2923 stream that happens to be encoded in a format different than SDP, but 2924 is otherwise considered a valid offer for the purposes of following 2925 the ICE specification. Similarly, the Attach response is considered 2926 a valid answer for the purposes of following the ICE specification. 2928 5.5.1.8. Verifying ICE Support 2930 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2931 of ICE. Since RELOAD requires full ICE from all agents, this check 2932 is not required. 2934 5.5.1.9. Role Determination 2936 The roles of controlling and controlled as described in Section 5.2 2937 of ICE are still utilized with RELOAD. However, the offerer (the 2938 entity sending the Attach request) will always be controlling, and 2939 the answerer (the entity sending the Attach response) will always be 2940 controlled. The connectivity checks MUST still contain the ICE- 2941 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2942 role reversal capability for which they are defined will never be 2943 needed with RELOAD. This is to allow for a common codebase between 2944 ICE for RELOAD and ICE for SDP. 2946 5.5.1.10. Full ICE 2948 When neither side has provided an No-ICE candidate, connectivity 2949 checks and nominations are used as in regular ICE. 2951 5.5.1.10.1. Connectivity Checks 2953 The processes of forming check lists in Section 5.7 of ICE, 2954 scheduling checks in Section 5.8, and checking connectivity checks in 2955 Section 7 are used with RELOAD without change. 2957 5.5.1.10.2. Concluding ICE 2959 The procedures in Section 8 of ICE are followed to conclude ICE, with 2960 the following exceptions: 2962 o The controlling agent MUST NOT attempt to send an updated offer 2963 once the state of its single media stream reaches Completed. 2964 o Once the state of ICE reaches Completed, the agent can immediately 2965 free all unused candidates. This is because RELOAD does not have 2966 the concept of forking, and thus the three second delay in Section 2967 8.3 of ICE does not apply. 2969 5.5.1.10.3. Media Keepalives 2971 STUN MUST be utilized for the keepalives described in Section 10 of 2972 ICE. 2974 5.5.1.11. No-ICE 2976 No-ICE is selected when either side has provided "no ICE" Overlay 2977 Link candidates. STUN is not used for connectivity checks when doing 2978 No-ICE; instead the DTLS or TLS handshake (or similar security layer 2979 of future overlay link protocols) forms the connectivity check. The 2980 certificate exchanged during the (D)TLS handshake must match the node 2981 that sent the AttachReqAns and if it does not, the connection MUST be 2982 closed. 2984 5.5.1.12. Subsequent Offers and Answers 2986 An agent MUST NOT send a subsequent offer or answer. Thus, the 2987 procedures in Section 9 of ICE MUST be ignored. 2989 5.5.1.13. Sending Media 2991 The procedures of Section 11 of ICE apply to RELOAD as well. 2992 However, in this case, the "media" takes the form of application 2993 layer protocols (RELOAD or SIP for example) over TLS or DTLS. 2994 Consequently, once ICE processing completes, the agent will begin TLS 2995 or DTLS procedures to establish a secure connection. The node which 2996 sent the Attach request MUST be the TLS server. The other node MUST 2997 be the TLS client. The server MUST request TLS client 2998 authentication. The nodes MUST verify that the certificate presented 2999 in the handshake matches the identity of the other peer as found in 3000 the Attach message. Once the TLS or DTLS signaling is complete, the 3001 application protocol is free to use the connection. 3003 The concept of a previous selected pair for a component does not 3004 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3006 5.5.1.14. Receiving Media 3008 An agent MUST be prepared to receive packets for the application 3009 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3010 time. The jitter and RTP considerations in Section 11 of ICE do not 3011 apply to RELOAD. 3013 5.5.2. AppAttach 3015 A node sends an AppAttach request when it wishes to establish a 3016 direct connection to another node for the purposes of sending 3017 application layer messages. AppAttach is basically like Attach, 3018 except for the purpose of the connection. A separate request is used 3019 to avoid implementor confusion between the two methods (this was 3020 found to be a real problem with initial implementations). The 3021 AppAttach request and its response contain an application attribute, 3022 which indicates what protocol is to be run over the connection. 3024 5.5.2.1. Request Definition 3026 An AppAttachReq message contains the requesting node's ICE connection 3027 parameters formatted into a binary structure. 3029 struct { 3030 opaque ufrag<0..2^8-1>; 3031 opaque password<0..2^8-1>; 3032 uint16 application; 3033 opaque role<0..2^8-1>; 3034 IceCandidate candidates<0..2^16-1>; 3035 } AppAttachReq; 3037 The values contained in AppAttachReq and AppAttachAns are: 3039 ufrag 3040 The username fragment (from ICE) 3042 password 3043 The ICE password. 3045 application 3046 A 16-bit application-id as defined in the Section 13.5. This 3047 number represents the IANA registered application that is going to 3048 send data on this connection. For SIP, this is 5060 or 5061. 3050 role 3051 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3053 candidates 3054 One or more ICE candidate values 3056 5.5.2.2. Response Definition 3058 If a peer receives an AppAttach request, it SHOULD process the 3059 request and generate its own response with a AppAttachAns. It should 3060 then begin ICE checks. When a peer receives an AppAttach response, 3061 it SHOULD parse the response and begin its own ICE checks. 3063 struct { 3064 opaque ufrag<0..2^8-1>; 3065 opaque password<0..2^8-1>; 3066 uint16 application; 3067 opaque role<0..2^8-1>; 3068 IceCandidate candidates<0..2^16-1>; 3069 } AppAttachAns; 3071 The meaning of the fields is the same as in the AppAttachReq. 3073 5.5.3. Ping 3075 Ping is used to test connectivity along a path. A ping can be 3076 addressed to a specific Node-ID, to the peer controlling a given 3077 location (by using a resource ID), or to the broadcast Node-ID 3078 (2^128-1). 3080 5.5.3.1. Request Definition 3082 struct { 3083 } PingReq 3085 5.5.3.2. Response Definition 3087 A successful PingAns response contains the information elements 3088 requested by the peer. 3090 struct { 3091 uint64 response_id; 3092 uint64 time; 3093 } PingAns; 3095 A PingAns message contains the following elements: 3097 response_id 3098 A randomly generated 64-bit response ID. This is used to 3099 distinguish Ping responses. 3101 time 3102 The time when the ping responses was created in absolute UNIX 3103 style time, represented in milliseconds since midnight Jan 1, 1970 3104 and not counting leap seconds. 3106 5.5.4. ConfigUpdate 3108 The ConfigUpdate method is used to push updated configuration data 3109 across the overlay. Whenever a node detects that another node has 3110 old configuration data, it MUST generate a ConfigUpdate request. The 3111 ConfigUpdate request allows updating of two kinds of data: the 3112 configuration data (Section 5.3.2.1) and kind information 3113 (Section 6.4.1.1). 3115 5.5.4.1. Request Definition 3117 enum { reservedConfigUpdate(0), config(1), kind(2), (255) } 3118 ConfigUpdateType; 3120 typedef opaque KindDescription<2^16-1>; 3122 struct { 3123 ConfigUpdateType type; 3124 uint32 length; 3126 select (type) { 3127 case config: 3128 opaque config_data<2^24-1>; 3130 case kind: 3131 KindDescription kinds<2^24-1>; 3133 /* This structure may be extended with new types*/ 3134 }; 3135 } ConfigUpdateReq; 3137 The ConfigUpdateReq message contains the following elements: 3139 type 3140 The type of the contents of the message. This structure allows 3141 for unknown content types. 3142 length 3143 The length of the remainder of the message. This is included to 3144 preserve backward compatibility and is 32 bits instead of 24 to 3145 facilitate easy conversion between network and host byte order. 3147 config_data (type==config) 3148 The contents of the configuration document. 3149 kinds (type==kind) 3150 One or more XML kind-block productions (see Section 10.1). These 3151 MUST be encoded with UTF-8 and assume a default namespace of 3152 "urn:ietf:params:xml:ns:p2p:config-base". 3154 5.5.4.2. Response Definition 3156 struct { 3157 } ConfigUpdateRsp 3159 If the ConfigUpdateReq is of type "config" it MUST only be processed 3160 if all the following are true: 3161 o The sequence number in the document is greater than the current 3162 configuration sequence number. 3163 o The configuration document is correctly digitally signed (see 3164 Section 10 for details on signatures. 3165 Otherwise appropriate errors MUST be generated. 3167 If the ConfigUpdateReq is of type "kind" it MUST only be processed if 3168 it is correctly digitally signed by an acceptable kind signer as 3169 specified in the configuration file. Details on kind-signer field in 3170 the configuration file is described in Section 10.1. In addition, if 3171 the kind update conflicts with an existing known kind (i.e., it is 3172 signed by a different signer), then it should be rejected with 3173 "Error_Forbidden". This should not happen in correctly functioning 3174 overlays. 3176 If the update is acceptable, then the node MUST reconfigure itself to 3177 match the new information. This may include adding permissions for 3178 new kinds, deleting old kinds, or even, in extreme circumstances, 3179 exiting and reentering the overlay, if, for instance, the DHT 3180 algorithm has changed. 3182 The response for ConfigUpdate is empty. 3184 5.6. Overlay Link Layer 3186 RELOAD can use multiple Overlay Link protocols to send its messages. 3187 Because ICE is used to establish connections (see Section 5.5.1.3), 3188 RELOAD nodes are able to detect which Overlay Link protocols are 3189 offered by other nodes and establish connections between them. Any 3190 link protocol needs to be able to establish a secure, authenticated 3191 connection and to provide data origin authentication and message 3192 integrity for individual data elements. RELOAD currently supports 3193 three Overlay Link protocols: 3195 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3196 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3197 o DTLS [RFC4347] over UDP with SR, No-ICE 3199 Note that although UDP does not properly have "connections", both TLS 3200 and DTLS have a handshake which establishes a similar, stateful 3201 association, and we simply refer to these as "connections" for the 3202 purposes of this document. 3204 If a peer receives a message that is larger than value of max- 3205 message-size defined in the overlay configuration, the peer SHOULD 3206 send an Error_Message_Too_Large error and then close the TLS or DTLS 3207 session from which the message was received. Note that this error 3208 can be sent and the session closed before receiving the complete 3209 message. If the forwarding header is larger than the max-message- 3210 size, the receiver SHOULD close the TLS or DTLS session without 3211 sending an error. 3213 The Framing Header (FH) is used to frame messages and provide timing 3214 when used on a reliable stream-based transport protocol. Simple 3215 Reliability (SR) makes use of the FH to provide congestion control 3216 and semi-reliability when using unreliable message-oriented transport 3217 protocols. We will first define each of these algorithms, then 3218 define overlay link protocols that use them. 3220 Note: We expect future Overlay Link protocols to define replacements 3221 for all components of these protocols, including the framing header. 3222 These protocols have been chosen for simplicity of implementation and 3223 reasonable performance. 3225 Note to implementers: There are inherent tradeoffs in utilizing 3226 short timeouts to determine when a link has failed. To balance the 3227 tradeoffs, an implementation should be able to quickly act to remove 3228 entries from the routing table when there is reason to suspect the 3229 link has failed. For example, in a Chord-derived overlay algorithm, 3230 a closer finger table entry could be substituted for an entry in the 3231 finger table that has experienced a timeout. That entry can be 3232 restored if it proves to resume functioning, or replaced at some 3233 point in the future if necessary. End-to-end retransmissions will 3234 handle any lost messages, but only if the failing entries do not 3235 remain in the finger table for subsequent retransmissions. 3237 5.6.1. Future Overlay Link Protocols 3239 The only currently defined overlay link protocols are TLS and DTLS. 3240 It is possible to define new link-layer protocols and apply them to a 3241 new overlay using the "overlay-link-protocol" configuration directive 3242 (see Section 10.1.). However, any new protocols MUST meet the 3243 following requirements. 3245 Endpoint authentication When a node forms an association with 3246 another endpoint, it MUST be possible to cryptographically verify 3247 that the endpoint has a given NodeId. 3249 Traffic origin authentication and integrity When a node receives 3250 traffic from another endpoint, it MUST be possible to 3251 cryptographically verify that the traffic came from a given 3252 association and that it has not been modified in transit from the 3253 other endpoint in the association. The overlay link protocol MUST 3254 also provide replay prevention/detection. 3256 Traffic confidentiality When a node sends traffic to another 3257 endpoint, it MUST NOT be possible for a third party not involved 3258 in the association to determine the contents of that traffic. 3260 Any new overlay protocol MUST be defined via RFC 5226 Standards 3261 Action; see Section 13.11. 3263 5.6.1.1. HIP 3265 The P2PSIP Working Group has expressed interest in supporting a HIP- 3266 based link protocol [RFC5201]. Such support would require specifying 3267 such details as: 3269 o How to issue certificates which provided identities meaningful to 3270 the HIP base exchange. We anticipate that this would require a 3271 mapping between ORCHIDs and NodeIds. 3272 o How to carry the HIP I1 and I2 messages. We anticipate that this 3273 would require defining a HIP Tunnel usage. 3274 o How to carry RELOAD messages over HIP. 3276 5.6.1.2. ICE-TCP 3278 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] should allow TCP to be 3279 supported as an Overlay Link protocol that can be added using ICE. 3281 5.6.1.3. Message-oriented Transports 3283 Modern message-oriented transports offer high performance, good 3284 congestion control, and avoid head of line blocking in case of lost 3285 data. These characteristics make them preferable as underlying 3286 transport protocols for RELOAD links. SCTP without message ordering 3287 and DCCP are two examples of such protocols. However, currently they 3288 are not well-supported by commonly available NATs, and specifications 3289 for ICE session establishment are not available. 3291 5.6.1.4. Tunneled Transports 3293 As of the time of this writing, there is significant interest in the 3294 IETF community in tunneling other transports over UDP, motivated by 3295 the situation that UDP is well-supported by modern NAT hardware, and 3296 similar performance can be achieved to native implementation. 3297 Currently SCTP, DCCP, and a generic tunneling extension are being 3298 proposed for message-oriented protocols. Baset et al. have proposed 3299 tunneling TCP over UDP for similar reasons 3300 [I-D.baset-tsvwg-tcp-over-udp]. Once ICE traversal has been 3301 specified for these tunneled protocols, they should be 3302 straightforward to support as overlay link protocols. 3304 5.6.2. Framing Header 3306 In order to support unreliable links and to allow for quick detection 3307 of link failures when using reliable end-to-end transports, each 3308 message is wrapped in a very simple framing layer (FramedMessage) 3309 which is only used for each hop. This layer contains a sequence 3310 number which can then be used for ACKs. The same header is used for 3311 both reliable and unreliable transports for simplicity of 3312 implementation - not all aspects of the header apply to both types of 3313 transports. 3315 The definition of FramedMessage is: 3317 enum { data(128), ack(129), (255)} FramedMessageType; 3319 struct { 3320 FramedMessageType type; 3322 select (type) { 3323 case data: 3324 uint32 sequence; 3325 opaque message<0..2^24-1>; 3327 case ack: 3328 uint32 ack_sequence; 3329 uint32 received; 3330 }; 3331 } FramedMessage; 3333 The type field of the PDU is set to indicate whether the message is 3334 data or an acknowledgement. 3336 If the message is of type "data", then the remainder of the PDU is as 3337 follows: 3339 sequence 3340 the sequence number. This increments by 1 for each framed message 3341 sent over this transport session. 3343 message 3344 the message that is being transmitted. 3346 Each connection has it own sequence number space. Initially the 3347 value is zero and it increments by exactly one for each message sent 3348 over that connection. 3350 When the receiver receives a message, it SHOULD immediately send an 3351 ACK message. The receiver MUST keep track of the 32 most recent 3352 sequence numbers received on this association in order to generate 3353 the appropriate ack. 3355 If the PDU is of type "ack", the contents are as follows: 3357 ack_sequence 3358 The sequence number of the message being acknowledged. 3360 received 3361 A bitmask indicating if each of the previous 32 sequence numbers 3362 before this packet has been among the 32 packets most recently 3363 received on this connection. When a packet is received with a 3364 sequence number N, the receiver looks at the sequence number of 3365 the previously 32 packets received on this connection. Call the 3366 previously received packet number M. For each of the previous 32 3367 packets, if the sequence number M is less than N but greater than 3368 N-32, the N-M bit of the received bitmask is set to one; otherwise 3369 it is zero. Note that a bit being set to one indicates positively 3370 that a particular packet was received, but a bit being set to zero 3371 means only that it is unknown whether or not the packet has been 3372 received, because it might have been received before the 32 most 3373 recently received packets. 3375 The received field bits in the ACK provide a high degree of 3376 redundancy so that the sender can figure out which packets the 3377 receiver has received and can then estimate packet loss rates. If 3378 the sender also keeps track of the time at which recent sequence 3379 numbers have been sent, the RTT can be estimated. 3381 5.6.3. Simple Reliability 3383 When RELOAD is carried over DTLS or another unreliable link protocol, 3384 it needs to be used with a reliability and congestion control 3385 mechanism, which is provided on a hop-by-hop basis. The basic 3386 principle is that each message, regardless of whether or not it 3387 carries a request or response, will get an ACK and be reliably 3388 retransmitted. The receiver's job is very simple, limited to just 3389 sending ACKs. All the complexity is at the sender side. This allows 3390 the sending implementation to trade off performance versus 3391 implementation complexity without affecting the wire protocol. 3393 5.6.3.1. Retransmission and Flow Control 3395 Because the receiver's role is limited to providing packet 3396 acknowledgements, a wide variety of congestion control algorithms can 3397 be implemented on the sender side while using the same basic wire 3398 protocol. Senders MUST implement a retransmission and congestion 3399 control scheme no more aggressive then TFRC[RFC5348]. One way to do 3400 that is for senders to implement the scheme in the following section. 3401 Another alternative would be TFRC-SP [RFC4828] and use the received 3402 bitmask to allow the sender to compute packet loss event rates. 3404 5.6.3.1.1. Trivial Retransmission 3406 A peer SHOULD retransmit a message if it has not received an ACK 3407 after an interval of RTO ("Retransmission TimeOut"). The peer MUST 3408 double the time to wait after each retransmission. In each 3409 retransmission, the sequence number is incremented. 3411 The RTO is an estimate of the round-trip time (RTT). Implementations 3412 can use a static value for RTO or a dynamic estimate which will 3413 result in better performance. For implementations that use a static 3414 value, the default value for RTO is 500 ms. Nodes MAY use smaller 3415 values of RTO if it is known that all nodes are within the local 3416 network. The default RTO MAY be chosen larger, and this is 3417 RECOMMENDED if it is known in advance (such as on high latency access 3418 links) that the round-trip time is larger. 3420 Implementations that use a dynamic estimate to compute the RTO MUST 3421 use the algorithm described in RFC 2988[RFC2988], with the exception 3422 that the value of RTO SHOULD NOT be rounded up to the nearest second 3423 but instead rounded up to the nearest millisecond. The RTT of a 3424 successful STUN transaction from the ICE stage is used as the initial 3425 measurement for formula 2.2 of RFC 2988. The sender keeps track of 3426 the time each message was sent for all recently sent messages. Any 3427 time an ACK is received, the sender can compute the RTT for that 3428 message by looking at the time the ACK was received and the time when 3429 the message was sent. This is used as a subsequent RTT measurement 3430 for formula 2.3 of RFC 2988 to update the RTO estimate. (Note that 3431 because retransmissions receive new sequence numbers, all received 3432 ACKs are used.) 3434 The value for RTO is calculated separately for each DTLS session. 3436 Retransmissions continue until a response is received, or until a 3437 total of 5 requests have been sent or there has been a hard ICMP 3438 error [RFC1122] or a TLS alert. The sender knows a response was 3439 received when it receives an ACK with a sequence number that 3440 indicates it is a response to one of the transmissions of this 3441 messages. For example, assuming an RTO of 500 ms, requests would be 3442 sent at times 0 ms, 500 ms, 1500 ms, 3500 ms, and 7500 ms. If all 3443 retransmissions for a message fail, then the sending node SHOULD 3444 close the connection routing the message. 3446 To determine when a link may be failing without waiting for the final 3447 timeout, observe when no ACKs have been received for an entire RTO 3448 interval, and then wait for three retransmissions to occur beyond 3449 that point. If no ACKs have been received by the time the third 3450 retransmission occurs, it is RECOMMENDED that the link be removed 3451 from the routing table. The link MAY be restored to the routing 3452 table if ACKs resume before the connection is closed, as described 3453 above. 3455 Once an ACK has been received for a message, the next message can be 3456 sent, but the peer SHOULD ensure that there is at least 10 ms between 3457 sending any two messages. The only time a value less than 10 ms can 3458 be used is when it is known that all nodes are on a network that can 3459 support retransmissions faster than 10 ms with no congestion issues. 3461 5.6.4. DTLS/UDP with SR 3463 This overlay link protocol consists of DTLS over UDP while 3464 implementing the Simple Reliability protocol. STUN Connectivity 3465 checks and keepalives are used. 3467 5.6.5. TLS/TCP with FH, No-ICE 3469 This overlay link protocol consists of TLS over TCP with the framing 3470 header. Because ICE is not used, STUN connectivity checks are not 3471 used upon establishing the TCP connection, nor are they used for 3472 keepalives. 3474 Because the TCP layer's application-level timeout is too slow to be 3475 useful for overlay routing, the Overlay Link implementation MUST use 3476 the framing header to measure the RTT of the connection and calculate 3477 an RTO as specified in Section 2 of [RFC2988]. The resulting RTO is 3478 not used for retransmissions, but as a timeout to indicate when the 3479 link SHOULD be removed from the routing table. It is RECOMMENDED 3480 that such a connection be retained for 30s to determine if the 3481 failure was transient before concluding the link has failed 3482 permanently. 3484 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3485 candidate MUST be provided. The following table shows which side of 3486 the exchange initiates the connection depending on whether they 3487 provided ICE or No-ICE candidates. Note that the active TCP role 3488 does not alter the TLS server/client determination. 3490 +----------------------+----------+-----------------+ 3491 | Offeror | Answerer | TCP Active Role | 3492 +----------------------+----------+-----------------+ 3493 | ICE | No-ICE | Offeror | 3494 | No-ICE | ICE | Answerer | 3495 | No-ICE | No-ICE | Offeror | 3496 +----------------------+----------+-----------------+ 3498 Table 1: Determining Active Role for No-ICE 3500 5.6.6. DTLS/UDP with SR, No-ICE 3502 This overlay link protocol consists of DTLS over UDP while 3503 implementing the Simple Reliability protocol. Because ICE is not 3504 used, no STUN connectivity checks or keepalives are used. 3506 5.7. Fragmentation and Reassembly 3508 In order to allow transmission over datagram protocols such as DTLS, 3509 RELOAD messages may be fragmented. 3511 Any node along the path can fragment the message but only the final 3512 destination reassembles the fragments. When a node takes a packet 3513 and fragments it, each fragment has a full copy of the Forwarding 3514 Header but the data after the Forwarding Header is broken up in 3515 appropriate sized chunks. The size of the payload chunks needs to 3516 take into account space to allow the via and destination lists to 3517 grow. Each fragment MUST contain a full copy of the via and 3518 destination list and MUST contain at least 256 bytes of the message 3519 body. If the via and destination list are so large that this is not 3520 possible, RELOAD fragmentation is not performed and IP-layer 3521 fragmentation is allowed to occur. When a message must be 3522 fragmented, it SHOULD be split into equal-sized fragments that are no 3523 larger than the PMTU of the next overlay link minus 32 bytes. This 3524 is to allow the via list to grow before further fragmentation is 3525 required. 3527 Note that this fragmentation is not optimal for the end-to-end path - 3528 a message may be refragmented multiple times as it traverses the 3529 overlay. This option has been chosen as it is far easier to 3530 implement than e2e PMTU discovery across an ever-changing overlay, 3531 and it effectively addresses the reliability issues of relying on IP- 3532 layer fragmentation. However, PING can be used to allow e2e PMTU to 3533 be implemented if desired. 3535 Upon receipt of a fragmented message by the intended peer, the peer 3536 holds the fragments in a holding buffer until the entire message has 3537 been received. The message is then reassembled into a single message 3538 and processed. In order to mitigate denial of service attacks, 3539 receivers SHOULD time out incomplete fragments after maximum request 3540 lifetime (15 seconds). Note this time was derived from looking at 3541 the end to end retransmission time and saving fragments long enough 3542 for the full end to end retransmissions to take place. Ideally the 3543 receiver would have enough buffer space to deal with as many 3544 fragments as can arrive in the maximum request lifetime. However, if 3545 the receiver runs out of buffer space to reassemble the messages it 3546 MUST drop the message. 3548 When a message is fragmented, the fragment offset value is stored in 3549 the lower 24 bits of the fragment field of the forwarding header. 3550 The offset is the number of bytes between the end of the forwarding 3551 header and the start of the data. The first fragment therefore has 3552 an offset of 0. The first and last bit indicators MUST be 3553 appropriately set. If the message is not fragmented, then both the 3554 first and last fragment bits are set to 1 and the offset is 0 3555 resulting in a fragment value of 0xC0000000. 3557 6. Data Storage Protocol 3559 RELOAD provides a set of generic mechanisms for storing and 3560 retrieving data in the Overlay Instance. These mechanisms can be 3561 used for new applications simply by defining new code points and a 3562 small set of rules. No new protocol mechanisms are required. 3564 The basic unit of stored data is a single StoredData structure: 3566 struct { 3567 uint32 length; 3568 uint64 storage_time; 3569 uint32 lifetime; 3570 StoredDataValue value; 3571 Signature signature; 3572 } StoredData; 3574 The contents of this structure are as follows: 3576 length 3577 The size of the StoredData structure in octets excluding the size 3578 of length itself. 3580 storage_time 3581 The time when the data was stored in absolute time, represented in 3582 milliseconds since the Unix epoch of midnight Jan 1, 1970 and not 3583 counting leap seconds. Any attempt to store a data value with a 3584 storage time before that of a value already stored at this 3585 location MUST generate a Error_Data_Too_Old error. This prevents 3586 rollback attacks. Note that this does not require synchronized 3587 clocks: the receiving peer uses the storage time in the previous 3588 store, not its own clock. 3589 A node that is attempting to store new data in response to a user 3590 request (rather than as an overlay maintenance operation such as 3591 occurs during unpartitioning) is rejected with an 3592 Error_Data_Too_Old error, the node MAY elect to perform its store 3593 using a storage_time that increments the value used with the 3594 previous store. This situation may occur when the clocks of nodes 3595 storing to this location are not properly synchronized. 3597 lifetime 3598 The validity period for the data, in seconds, starting from the 3599 time of store. 3601 value 3602 The data value itself, as described in Section 6.2. 3604 signature 3605 A signature as defined in Section 6.1. 3607 Each Resource-ID specifies a single location in the Overlay Instance. 3608 However, each location may contain multiple StoredData values 3609 distinguished by Kind-ID. The definition of a kind describes both 3610 the data values which may be stored and the data model of the data. 3611 Some data models allow multiple values to be stored under the same 3612 Kind-ID. Section Section 6.2 describes the available data models. 3613 Thus, for instance, a given Resource-ID might contain a single-value 3614 element stored under Kind-ID X and an array containing multiple 3615 values stored under Kind-ID Y. 3617 6.1. Data Signature Computation 3619 Each StoredData element is individually signed. However, the 3620 signature also must be self-contained and cover the Kind-ID and 3621 Resource-ID even though they are not present in the StoredData 3622 structure. The input to the signature algorithm is: 3624 resource_id + kind + storage_time + StoredDataValue + 3625 SignerIdentity 3627 Where these values are: 3629 resource 3630 The resource ID where this data is stored. 3632 kind 3633 The Kind-ID for this data. 3635 storage_time 3637 The contents of the storage_time data value. 3638 StoredDataValue 3639 The contents of the stored data value, as described in the 3640 previous sections. 3642 SignerIdentity 3643 The signer identity as defined in Section 5.3.4. 3645 Once the signature has been computed, the signature is represented 3646 using a signature element, as described in Section 5.3.4. 3648 6.2. Data Models 3650 The protocol currently defines the following data models: 3652 o single value 3653 o array 3654 o dictionary 3656 These are represented with the StoredDataValue structure: 3658 enum { reserved(0), single_value(1), array(2), 3659 dictionary(3), (255)} DataModel; 3661 struct { 3662 Boolean exists; 3663 opaque value<0..2^32-1>; 3664 } DataValue; 3666 struct { 3667 select (DataModel) { 3668 case single_value: 3669 DataValue single_value_entry; 3671 case array: 3672 ArrayEntry array_entry; 3674 case dictionary: 3675 DictionaryEntry dictionary_entry; 3677 /* This structure may be extended */ 3678 } ; 3679 } StoredDataValue; 3681 We now discuss the properties of each data model in turn: 3683 6.2.1. Single Value 3685 A single-value element is a simple sequence of bytes. There may be 3686 only one single-value element for each Resource-ID, Kind-ID pair. 3688 A single value element is represented as a DataValue, which contains 3689 the following two elements: 3691 exists 3692 This value indicates whether the value exists at all. If it is 3693 set to False, it means that no value is present. If it is True, 3694 that means that a value is present. This gives the protocol a 3695 mechanism for indicating nonexistence as opposed to emptiness. 3697 value 3698 The stored data. 3700 6.2.2. Array 3702 An array is a set of opaque values addressed by an integer index. 3703 Arrays are zero based. Note that arrays can be sparse. For 3704 instance, a Store of "X" at index 2 in an empty array produces an 3705 array with the values [ NA, NA, "X"]. Future attempts to fetch 3706 elements at index 0 or 1 will return values with "exists" set to 3707 False. 3709 A array element is represented as an ArrayEntry: 3711 struct { 3712 uint32 index; 3713 DataValue value; 3714 } ArrayEntry; 3716 The contents of this structure are: 3718 index 3719 The index of the data element in the array. 3721 value 3722 The stored data. 3724 6.2.3. Dictionary 3726 A dictionary is a set of opaque values indexed by an opaque key with 3727 one value for each key. A single dictionary entry is represented as 3728 follows: 3730 A dictionary element is represented as a DictionaryEntry: 3732 typedef opaque DictionaryKey<0..2^16-1>; 3734 struct { 3735 DictionaryKey key; 3736 DataValue value; 3737 } DictionaryEntry; 3739 The contents of this structure are: 3741 key 3742 The dictionary key for this value. 3744 value 3745 The stored data. 3747 6.3. Access Control Policies 3749 Every kind which is storable in an overlay MUST be associated with an 3750 access control policy. This policy defines whether a request from a 3751 given node to operate on a given value should succeed or fail. It is 3752 anticipated that only a small number of generic access control 3753 policies are required. To that end, this section describes a small 3754 set of such policies and Section 13.4 establishes a registry for new 3755 policies if required. Each policy has a short string identifier 3756 which is used to reference it in the configuration document. 3758 6.3.1. USER-MATCH 3760 In the USER-MATCH policy, a given value MUST be written (or 3761 overwritten) if and only if the request is signed with a key 3762 associated with a certificate whose user name hashes (using the hash 3763 function for the overlay) to the Resource-ID for the resource. 3764 Recall that the certificate may, depending on the overlay 3765 configuration, be self-signed. 3767 6.3.2. NODE-MATCH 3769 In the NODE-MATCH policy, a given value MUST be written (or 3770 overwritten) if and only if the request is signed with a key 3771 associated with a certificate whose Node-ID hashes (using the hash 3772 function for the overlay) to the Resource-ID for the resource. 3774 6.3.3. USER-NODE-MATCH 3776 The USER-NODE-MATCH policy may only be used with dictionary types. 3777 In the USER-NODE-MATCH policy, a given value MUST be written (or 3778 overwritten) if and only if the request is signed with a key 3779 associated with a certificate whose user name hashes (using the hash 3780 function for the overlay) to the Resource-ID for the resource. In 3781 addition, the dictionary key MUST be equal to the Node-ID in the 3782 certificate. 3784 6.3.4. NODE-MULTIPLE 3786 In the NODE-MULTIPLE policy, a given value MUST be written (or 3787 overwritten) if and only if the request is signed with a key 3788 associated with a certificate containing a Node-ID such that 3789 H(Node-ID || i) is equal to the Resource-ID for some small integer 3790 value of i. When this policy is in use, the maximum value of i MUST 3791 be specified in the kind definition. 3793 6.4. Data Storage Methods 3795 RELOAD provides several methods for storing and retrieving data: 3797 o Store values in the overlay 3798 o Fetch values from the overlay 3799 o Stat: get metadata about values in the overlay 3800 o Find the values stored at an individual peer 3802 These methods are each described in the following sections. 3804 6.4.1. Store 3806 The Store method is used to store data in the overlay. The format of 3807 the Store request depends on the data model which is determined by 3808 the kind. 3810 6.4.1.1. Request Definition 3812 A StoreReq message is a sequence of StoreKindData values, each of 3813 which represents a sequence of stored values for a given kind. The 3814 same Kind-ID MUST NOT be used twice in a given store request. Each 3815 value is then processed in turn. These operations MUST be atomic. 3816 If any operation fails, the state MUST be rolled back to before the 3817 request was received. 3819 The store request is defined by the StoreReq structure: 3821 struct { 3822 KindId kind; 3823 uint64 generation_counter; 3824 StoredData values<0..2^32-1>; 3825 } StoreKindData; 3827 struct { 3828 ResourceId resource; 3829 uint8 replica_number; 3830 StoreKindData kind_data<0..2^32-1>; 3831 } StoreReq; 3833 A single Store request stores data of a number of kinds to a single 3834 resource location. The contents of the structure are: 3836 resource 3837 The resource to store at. 3839 replica_number 3840 The number of this replica. When a storing peer saves replicas to 3841 other peers each peer is assigned a replica number starting from 1 3842 and sent in the Store message. This field is set to 0 when a node 3843 is storing its own data. This allows peers to distinguish replica 3844 writes from original writes. 3846 kind_data 3847 A series of elements, one for each kind of data to be stored. 3849 If the replica number is zero, then the peer MUST check that it is 3850 responsible for the resource and, if not, reject the request. If the 3851 replica number is nonzero, then the peer MUST check that it expects 3852 to be a replica for the resource and that the request sender is 3853 consistent with being the responsible node (i.e., that the receiving 3854 peer does not know of a better node) and, if not, reject the request. 3856 Each StoreKindData element represents the data to be stored for a 3857 single Kind-ID. The contents of the element are: 3859 kind 3860 The Kind-ID. Implementations MUST reject requests corresponding 3861 to unknown kinds. 3863 generation 3864 The expected current state of the generation counter 3865 (approximately the number of times this object has been written; 3866 see below for details). 3868 values 3869 The value or values to be stored. This may contain one or more 3870 stored_data values depending on the data model associated with 3871 each kind. 3873 The peer MUST perform the following checks: 3875 o The kind_id is known and supported. 3876 o The signatures over each individual data element (if any) are 3877 valid. If this check fails, the request MUST be rejected with an 3878 Error_Forbidden error. 3879 o Each element is signed by a credential which is authorized to 3880 write this kind at this Resource-ID. If this check fails, the 3881 request MUST be rejected with an Error_Forbidden error. 3883 o For original (non-replica) stores, the peer MUST check that if the 3884 generation-counter is non-zero, it equals the current value of the 3885 generation-counter for this kind. This feature allows the 3886 generation counter to be used in a way similar to the HTTP Etag 3887 feature. 3888 o For replica Stores, the peer MUST set the generation counter to 3889 match the generation_counter in the message, and MUST NOT check 3890 the generation counter against the current value. Replica Stores 3891 MUST NOT use a generation counter of 0. 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 When a peer stores data previously stored by another node (e.g., for 3911 replicas or topology shifts) it MUST adjust the lifetime value 3912 downward to reflect the amount of time the value was stored at the 3913 peer. 3915 Unless otherwise specified by the usage, if a peer attempts to store 3916 data previously stored by another node (e.g., for replicas or 3917 topology shifts) and that store fails with either an 3918 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 3919 peer MUST fetch the newer data from the peer generating the error and 3920 use that to replace its own copy. This rule allows resynchronization 3921 after partitions heal. 3923 The properties of stores for each data model are as follows: 3925 Single-value: 3926 A store of a new single-value element creates the element if it 3927 does not exist and overwrites any existing value with the new 3928 value. 3930 Array: 3931 A store of an array entry replaces (or inserts) the given value at 3932 the location specified by the index. Because arrays are sparse, a 3933 store past the end of the array extends it with nonexistent values 3934 (exists=False) as required. A store at index 0xffffffff places 3935 the new value at the end of the array regardless of the length of 3936 the array. The resulting StoredData has the correct index value 3937 when it is subsequently fetched. 3939 Dictionary: 3940 A store of a dictionary entry replaces (or inserts) the given 3941 value at the location specified by the dictionary key. 3943 The following figure shows the relationship between these structures 3944 for an example store which stores the following values at resource 3945 "1234" 3947 o The value "abc" in the single value location for kind X 3948 o The value "foo" at index 0 in the array for kind Y 3949 o The value "bar" at index 1 in the array for kind Y 3951 Store 3952 resource=1234 3953 replica_number = 0 3954 / \ 3955 / \ 3956 StoreKindData StoreKindData 3957 kind=X (Single-Value) kind=Y (Array) 3958 generation_counter = 99 generation_counter = 107 3959 | /\ 3960 | / \ 3961 StoredData / \ 3962 storage_time = xxxxxxx / \ 3963 lifetime = 86400 / \ 3964 signature = XXXX / \ 3965 | | | 3966 | StoredData StoredData 3967 | storage_time = storage_time = 3968 | yyyyyyyy zzzzzzz 3969 | lifetime = 86400 lifetime = 33200 3970 | signature = YYYY signature = ZZZZ 3971 | | | 3972 StoredDataValue | | 3973 value="abc" | | 3974 | | 3975 StoredDataValue StoredDataValue 3976 index=0 index=1 3978 value="foo" value="bar" 3980 6.4.1.2. Response Definition 3982 In response to a successful Store request the peer MUST return a 3983 StoreAns message containing a series of StoreKindResponse elements 3984 containing the current value of the generation counter for each 3985 Kind-ID, as well as a list of the peers where the data will be 3986 replicated by the node processing the request.. 3988 struct { 3989 KindId kind; 3990 uint64 generation_counter; 3991 NodeId replicas<0..2^16-1>; 3992 } StoreKindResponse; 3994 struct { 3995 StoreKindResponse kind_responses<0..2^16-1>; 3996 } StoreAns; 3998 The contents of each StoreKindResponse are: 4000 kind 4001 The Kind-ID being represented. 4003 generation 4004 The current value of the generation counter for that Kind-ID. 4006 replicas 4007 The list of other peers at which the data was/will be replicated. 4008 In overlays and applications where the responsible peer is 4009 intended to store redundant copies, this allows the storing peer 4010 to independently verify that the replicas have in fact been 4011 stored. It does this verification by using the Stat method. Note 4012 that the storing peer is not require to perform this verification. 4014 The response itself is just StoreKindResponse values packed end-to- 4015 end. 4017 If any of the generation counters in the request precede the 4018 corresponding stored generation counter, then the peer MUST fail the 4019 entire request and respond with an Error_Generation_Counter_Too_Low 4020 error. The error_info in the ErrorResponse MUST be a StoreAns 4021 response containing the correct generation counter for each kind and 4022 the replica list, which will be empty. For original (non-replica) 4023 stores, a node which receives such an error SHOULD attempt to fetch 4024 the data and, if the storage_time value is newer, replace its own 4025 data with that newer data. This rule improves data consistency in 4026 the case of partitions and merges. 4028 If the data being stored is too large for the allowed limit by the 4029 given usage, then the peer MUST fail the request and generate an 4030 Error_Data_Too_Large error. 4032 If any type of request tries to access a data kind that the node does 4033 not know about, an Error_Unknown_Kind MUST be generated. The 4034 error_info in the Error_Response is: 4036 KindId unknown_kinds<0..2^8-1>; 4038 which lists all the kinds that were unrecognized. 4040 6.4.1.3. Removing Values 4042 This version of RELOAD (unlike previous versions) does not have an 4043 explicit Remove operation. Rather, values are Removed by storing 4044 "nonexistent" values in their place. Each DataValue contains a 4045 boolean value called "exists" which indicates whether a value is 4046 present at that location. In order to effectively remove a value, 4047 the owner stores a new DataValue with: 4049 exists = false 4050 value = {} (0 length) 4052 Storing nodes MUST treat these nonexistent values the same way they 4053 treat any other stored value, including overwriting the existing 4054 value, replicating them, and aging them out as necessary when 4055 lifetime expires. When a stored nonexistent value's lifetime 4056 expires, it is simply removed from the storing node like any other 4057 stored value expiration. Note that in the case of arrays and 4058 dictionaries, this may create an implicit, unsigned "nonexistent" 4059 value to represent a gap in the data structure. However, this value 4060 isn't persistent nor is it replicated. It is simply synthesized by 4061 the storing node. 4063 6.4.2. Fetch 4065 The Fetch request retrieves one or more data elements stored at a 4066 given Resource-ID. A single Fetch request can retrieve multiple 4067 different kinds. 4069 6.4.2.1. Request Definition 4071 struct { 4072 int32 first; 4073 int32 last; 4074 } ArrayRange; 4076 struct { 4077 KindId kind; 4078 uint64 generation; 4079 uint16 length; 4081 select (model) { 4082 case single_value: ; /* Empty */ 4084 case array: 4085 ArrayRange indices<0..2^16-1>; 4087 case dictionary: 4088 DictionaryKey keys<0..2^16-1>; 4090 /* This structure may be extended */ 4092 } model_specifier; 4093 } StoredDataSpecifier; 4095 struct { 4096 ResourceId resource; 4097 StoredDataSpecifier specifiers<0..2^16-1>; 4098 } FetchReq; 4100 The contents of the Fetch requests are as follows: 4102 resource 4103 The resource ID to fetch from. 4105 specifiers 4106 A sequence of StoredDataSpecifier values, each specifying some of 4107 the data values to retrieve. 4109 Each StoredDataSpecifier specifies a single kind of data to retrieve 4110 and (if appropriate) the subset of values that are to be retrieved. 4111 The contents of the StoredDataSpecifier structure are as follows: 4113 kind 4114 The Kind-ID of the data being fetched. Implementations SHOULD 4115 reject requests corresponding to unknown kinds unless specifically 4116 configured otherwise. 4118 model 4119 The data model of the data. This must be checked against the 4120 Kind-ID. 4122 generation 4123 The last generation counter that the requesting node saw. This 4124 may be used to avoid unnecessary fetches or it may be set to zero. 4126 length 4127 The length of the rest of the structure, thus allowing 4128 extensibility. 4130 model_specifier 4131 A reference to the data value being requested within the data 4132 model specified for the kind. For instance, if the data model is 4133 "array", it might specify some subset of the values. 4135 The model_specifier is as follows: 4137 o If the data model is single value, the specifier is empty. 4138 o If the data model is array, the specifier contains a list of 4139 ArrayRange elements, each of which contains two integers. The 4140 first integer is the beginning of the range and the second is the 4141 end of the range. 0 is used to indicate the first element and 4142 0xffffffff is used to indicate the final element. The first 4143 integer must be less than the second. While multiple ranges MAY 4144 be specified, they MUST NOT overlap. 4145 o If the data model is dictionary then the specifier contains a list 4146 of the dictionary keys being requested. If no keys are specified, 4147 than this is a wildcard fetch and all key-value pairs are 4148 returned. 4150 The generation-counter is used to indicate the requester's expected 4151 state of the storing peer. If the generation-counter in the request 4152 matches the stored counter, then the storing peer returns a response 4153 with no StoredData values. 4155 Note that because the certificate for a user is typically stored at 4156 the same location as any data stored for that user, a requesting node 4157 that does not already have the user's certificate should request the 4158 certificate in the Fetch as an optimization. 4160 6.4.2.2. Response Definition 4162 The response to a successful Fetch request is a FetchAns message 4163 containing the data requested by the requester. 4165 struct { 4166 KindId kind; 4167 uint64 generation; 4168 StoredData values<0..2^32-1>; 4169 } FetchKindResponse; 4171 struct { 4172 FetchKindResponse kind_responses<0..2^32-1>; 4173 } FetchAns; 4175 The FetchAns structure contains a series of FetchKindResponse 4176 structures. There MUST be one FetchKindResponse element for each 4177 Kind-ID in the request. 4179 The contents of the FetchKindResponse structure are as follows: 4181 kind 4182 the kind that this structure is for. 4184 generation 4185 the generation counter for this kind. 4187 values 4188 the relevant values. If the generation counter in the request 4189 matches the generation-counter in the stored data, then no 4190 StoredData values are returned. Otherwise, all relevant data 4191 values MUST be returned. A nonexistent value is represented with 4192 "exists" set to False. 4194 There is one subtle point about signature computation on arrays. If 4195 the storing node uses the append feature (where the 4196 index=0xffffffff), then the index in the StoredData that is returned 4197 will not match that used by the storing node, which would break the 4198 signature. In order to avoid this issue, the index value in the 4199 array is set to zero before the signature is computed. This implies 4200 that malicious storing nodes can reorder array entries without being 4201 detected. 4203 6.4.3. Stat 4205 The Stat request is used to get metadata (length, generation counter, 4206 digest, etc.) for a stored element without retrieving the element 4207 itself. The name is from the UNIX stat(2) system call which performs 4208 a similar function for files in a file system. It also allows the 4209 requesting node to get a list of matching elements without requesting 4210 the entire element. 4212 6.4.3.1. Request Definition 4214 The Stat request is identical to the Fetch request. It simply 4215 specifies the elements to get metadata about. 4217 struct { 4218 ResourceId resource; 4219 StoredDataSpecifier specifiers<0..2^16-1>; 4220 } StatReq; 4222 6.4.3.2. Response Definition 4224 The Stat response contains the same sort of entries that a Fetch 4225 response would contain; however, instead of containing the element 4226 data it contains metadata. 4228 struct { 4229 Boolean exists; 4230 uint32 value_length; 4231 HashAlgorithm hash_algorithm; 4232 opaque hash_value<0..255>; 4233 } MetaData; 4235 struct { 4236 uint32 index; 4237 MetaData value; 4238 } ArrayEntryMeta; 4240 struct { 4241 DictionaryKey key; 4242 MetaData value; 4243 } DictionaryEntryMeta; 4245 struct { 4246 select (model) { 4247 case single_value: 4248 MetaData single_value_entry; 4250 case array: 4252 ArrayEntryMeta array_entry; 4254 case dictionary: 4255 DictionaryEntryMeta dictionary_entry; 4257 /* This structure may be extended */ 4258 } ; 4259 } MetaDataValue; 4261 struct { 4262 uint32 value_length; 4263 uint64 storage_time; 4264 uint32 lifetime; 4265 MetaDataValue metadata; 4266 } StoredMetaData; 4268 struct { 4269 KindId kind; 4270 uint64 generation; 4271 StoredMetaData values<0..2^32-1>; 4272 } StatKindResponse; 4274 struct { 4275 StatKindResponse kind_responses<0..2^32-1>; 4276 } StatAns; 4278 The structures used in StatAns parallel those used in FetchAns: a 4279 response consists of multiple StatKindResponse values, one for each 4280 kind that was in the request. The contents of the StatKindResponse 4281 are the same as those in the FetchKindResponse, except that the 4282 values list contains StoredMetaData entries instead of StoredData 4283 entries. 4285 The contents of the StoredMetaData structure are the same as the 4286 corresponding fields in StoredData except that there is no signature 4287 field and the value is a MetaDataValue rather than a StoredDataValue. 4289 A MetaDataValue is a variant structure, like a StoredDataValue, 4290 except for the types of each arm, which replace DataValue with 4291 MetaData. 4293 The only really new structure is MetaData, which has the following 4294 contents: 4296 exists 4297 Same as in DataValue 4299 value_length 4300 The length of the stored value. 4302 hash_algorithm 4303 The hash algorithm used to perform the digest of the value. 4305 hash_value 4306 A digest of the value using hash_algorithm. 4308 6.4.4. Find 4310 The Find request can be used to explore the Overlay Instance. A Find 4311 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4312 (if any) of the resource of kind T known to the target peer which is 4313 closest to R. This method can be used to walk the Overlay Instance by 4314 interactively fetching R_n+1=nearest(1 + R_n). 4316 6.4.4.1. Request Definition 4318 The FindReq message contains a Resource-ID and a series of Kind-IDs 4319 identifying the resource the peer is interested in. 4321 struct { 4322 ResourceId resource; 4323 KindId kinds<0..2^8-1>; 4324 } FindReq; 4326 The request contains a list of Kind-IDs which the Find is for, as 4327 indicated below: 4329 resource 4330 The desired Resource-ID 4332 kinds 4333 The desired Kind-IDs. Each value MUST only appear once, and if 4334 not the request MUST be rejected with an error. 4336 6.4.4.2. Response Definition 4338 A response to a successful Find request is a FindAns message 4339 containing the closest Resource-ID on the peer for each kind 4340 specified in the request. 4342 struct { 4343 KindId kind; 4344 ResourceId closest; 4345 } FindKindData; 4347 struct { 4348 FindKindData results<0..2^16-1>; 4349 } FindAns; 4351 If the processing peer is not responsible for the specified 4352 Resource-ID, it SHOULD return a 404 RELOAD error code. 4354 For each Kind-ID in the request the response MUST contain a 4355 FindKindData indicating the closest Resource-ID for that Kind-ID, 4356 unless the kind is not allowed to be used with Find in which case a 4357 FindKindData for that Kind-ID MUST NOT be included in the response. 4358 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4359 0. Note that different Kind-IDs may have different closest Resource- 4360 IDs. 4362 The response is simply a series of FindKindData elements, one per 4363 kind, concatenated end-to-end. The contents of each element are: 4365 kind 4366 The Kind-ID. 4368 closest 4369 The closest resource ID to the specified resource ID. This is 0 4370 if no resource ID is known. 4372 Note that the response does not contain the contents of the data 4373 stored at these Resource-IDs. If the requester wants this, it must 4374 retrieve it using Fetch. 4376 6.4.5. Defining New Kinds 4378 There are two ways to define a new kind. The first is by writing a 4379 document and registering the kind-id with IANA. This is the 4380 preferred method for kinds which may be widely used and reused. The 4381 second method is to simply define the kind and its parameters in the 4382 configuration document using the section of kind-id space set aside 4383 for private use. This method MAY be used to define ad hoc kinds in 4384 new overlays. 4386 However a kind is defined, the definition must include: 4388 o The meaning of the data to be stored (in some textual form). 4389 o The Kind-ID. 4390 o The data model (single value, array, dictionary, etc). 4391 o The access control model. 4393 In addition, when kinds are registered with IANA, each kind is 4394 assigned a short string name which is used to refer to it in 4395 configuration documents. 4397 While each kind needs to define what data model is used for its data, 4398 that does not mean that it must define new data models. Where 4399 practical, kinds should use the existing data models. The intention 4400 is that the basic data model set be sufficient for most applications/ 4401 usages. 4403 7. Certificate Store Usage 4405 The Certificate Store usage allows a peer to store its certificate in 4406 the overlay, thus avoiding the need to send a certificate in each 4407 message - a reference may be sent instead. 4409 A user/peer MUST store its certificate at Resource-IDs derived from 4410 two Resource Names: 4412 o The user name in the certificate. 4413 o The Node-ID in the certificate. 4415 Note that in the second case the certificate is not stored at the 4416 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4417 intention here (as is common throughout RELOAD) is to avoid making a 4418 peer responsible for its own data. 4420 A peer MUST ensure that the user's certificates are stored in the 4421 Overlay Instance. New certificates are stored at the end of the 4422 list. This structure allows users to store an old and a new 4423 certificate that both have the same Node-ID, which allows for 4424 migration of certificates when they are renewed. 4426 This usage defines the following kinds: 4428 Name: CERTIFICATE_BY_NODE 4429 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4431 Access Control: NODE-MATCH. 4433 Name: CERTIFICATE_BY_USER 4435 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4437 Access Control: USER-MATCH. 4439 8. TURN Server Usage 4441 The TURN server usage allows a RELOAD peer to advertise that it is 4442 prepared to be a TURN server as defined in [RFC5766]. When a node 4443 starts up, it joins the overlay network and forms several connections 4444 in the process. If the ICE stage in any of these connections returns 4445 a reflexive address that is not the same as the peer's perceived 4446 address, then the peer is behind a NAT and not a candidate for a TURN 4447 server. Additionally, if the peer's IP address is in the private 4448 address space range, then it is also not a candidate for a TURN 4449 server. Otherwise, the peer SHOULD assume it is a potential TURN 4450 server and follow the procedures below. 4452 If the node is a candidate for a TURN server it will insert some 4453 pointers in the overlay so that other peers can find it. The overlay 4454 configuration file specifies a turn-density parameter that indicates 4455 how many times each TURN server should record itself in the overlay. 4456 Typically this should be set to the reciprocal of the estimate of 4457 what percentage of peers will act as TURN servers. If the turn- 4458 density is not set to zero, for each value, called d, between 1 and 4459 turn-density, the peer forms a Resource Name by concatenating its 4460 Peer-ID and the value d. This Resource Name is hashed to form a 4461 Resource-ID. The address of the peer is stored at that Resource-ID 4462 using type TURN-SERVICE and the TurnServer object: 4464 struct { 4465 uint8 iteration; 4466 IpAddressAndPort server_address; 4467 } TurnServer; 4469 The contents of this structure are as follows: 4471 iteration 4472 the d value 4474 server_address 4475 the address at which the TURN server can be contacted. 4477 Note: Correct functioning of this algorithm depends critically on 4478 having turn-density be an accurate estimate of the true density of 4479 TURN servers. If turn-density is too high, then the process of 4480 finding TURN servers becomes extremely expensive as multiple 4481 candidate Resource-IDs must be probed. 4483 Peers that provide this service need to support the TURN extensions 4484 to STUN for media relay as defined in [RFC5766]. 4486 This usage defines the following kind to indicate that a peer is 4487 willing to act as a TURN server: 4489 Name TURN-SERVICE 4490 Data Model The TURN-SERVICE kind stores a single value for each 4491 Resource-ID. 4492 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4494 Peers can find other servers by selecting a random Resource-ID and 4495 then doing a Find request for the appropriate server type with that 4496 Resource-ID. The Find request gets routed to a random peer based on 4497 the Resource-ID. If that peer knows of any servers, they will be 4498 returned. The returned response may be empty if the peer does not 4499 know of any servers, in which case the process gets repeated with 4500 some other random Resource-ID. As long as the ratio of servers 4501 relative to peers is not too low, this approach will result in 4502 finding a server relatively quickly. 4504 9. Chord Algorithm 4506 This algorithm is assigned the name chord-reload to indicate it is an 4507 adaptation of the basic Chord DHT algorithm. 4509 This algorithm differs from the originally presented Chord algorithm 4510 [Chord]. It has been updated based on more recent research results 4511 and implementation experiences, and to adapt it to the RELOAD 4512 protocol. A short list of differences: 4514 o The original Chord algorithm specified that a single predecessor 4515 and a successor list be stored. The chord-reload algorithm 4516 attempts to have more than one predecessor and successor. The 4517 predecessor sets help other neighbors learn their successor list. 4518 o The original Chord specification and analysis called for iterative 4519 routing. RELOAD specifies recursive routing. In addition to the 4520 performance implications, the cost of NAT traversal dictates 4521 recursive routing. 4522 o Finger table entries are indexed in opposite order. Original 4523 Chord specifies finger[0] as the immediate successor of the peer. 4524 chord-reload specifies finger[0] as the peer 180 degrees around 4525 the ring from the peer. This change was made to simplify 4526 discussion and implementation of variable sized finger tables. 4527 However, with either approach no more than O(log N) entries should 4528 typically be stored in a finger table. 4529 o The stabilize() and fix_fingers() algorithms in the original Chord 4530 algorithm are merged into a single periodic process. 4531 Stabilization is implemented slightly differently because of the 4532 larger neighborhood, and fix_fingers is not as aggressive to 4533 reduce load, nor does it search for optimal matches of the finger 4534 table entries. 4535 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4536 not designed to be used in networks with close to or more than 4537 2^128 nodes (and it is hard to see how one would assemble such a 4538 network). 4539 o RELOAD uses randomized finger entries as described in 4540 Section 9.6.4.2. 4541 o This algorithm allows the use of either reactive or periodic 4542 recovery. The original Chord paper used periodic recovery. 4543 Reactive recovery provides better performance in small overlays, 4544 but is believed to be unstable in large (>1000) overlays with high 4545 levels of churn [handling-churn-usenix04]. The overlay 4546 configuration file specifies a "chord-reload-reactive" element 4547 that indicates whether reactive recovery should be used. 4549 9.1. Overview 4551 The algorithm described here is a modified version of the Chord 4552 algorithm. Each peer keeps track of a finger table and a neighbor 4553 table. The neighbor table contains at least the three peers before 4554 and after this peer in the DHT ring. There may not be three entries 4555 in all cases such as small rings or while the ring topology is 4556 changing. The first entry in the finger table contains the peer 4557 half-way around the ring from this peer; the second entry contains 4558 the peer that is 1/4 of the way around; the third entry contains the 4559 peer that is 1/8th of the way around, and so on. Fundamentally, the 4560 chord data structure can be thought of a doubly-linked list formed by 4561 knowing the successors and predecessor peers in the neighbor table, 4562 sorted by the Node-ID. As long as the successor peers are correct, 4563 the DHT will return the correct result. The pointers to the prior 4564 peers are kept to enable the insertion of new peers into the list 4565 structure. Keeping multiple predecessor and successor pointers makes 4566 it possible to maintain the integrity of the data structure even when 4567 consecutive peers simultaneously fail. The finger table forms a skip 4568 list, so that entries in the linked list can be found in O(log(N)) 4569 time instead of the typical O(N) time that a linked list would 4570 provide. 4572 A peer, n, is responsible for a particular Resource-ID k if k is less 4573 than or equal to n and k is greater than p, where p is the peer id of 4574 the previous peer in the neighbor table. Care must be taken when 4575 computing to note that all math is modulo 2^128. 4577 9.2. Routing 4579 The routing table is the union of the neighbor table and the finger 4580 table. 4582 If a peer is not responsible for a Resource-ID k, but is directly 4583 connected to a node with Node-ID k, then it routes the message to 4584 that node. Otherwise, it routes the request to the peer in the 4585 routing table that has the largest Node-ID that is in the interval 4586 between the peer and k. If no such node is found, it finds the 4587 smallest node id that is greater than k and routes the message to 4588 that node. 4590 9.3. Redundancy 4592 When a peer receives a Store request for Resource-ID k, and it is 4593 responsible for Resource-ID k, it stores the data and returns a 4594 success response. It then sends a Store request to its successor in 4595 the neighbor table and to that peer's successor. Note that these 4596 Store requests are addressed to those specific peers, even though the 4597 Resource-ID they are being asked to store is outside the range that 4598 they are responsible for. The peers receiving these check they came 4599 from an appropriate predecessor in their neighbor table and that they 4600 are in a range that this predecessor is responsible for, and then 4601 they store the data. They do not themselves perform further Stores 4602 because they can determine that they are not responsible for the 4603 Resource-ID. 4605 Managing replicas as the overlay changes is described in 4606 Section 9.6.3. 4608 The sequential replicas used in this overlay algorithm protect 4609 against peer failure but not against malicious peers. Additional 4610 replication from the Usage is required to protect resources from such 4611 attacks, as discussed in Section 12.5.4. 4613 9.4. Joining 4615 The join process for a joining party (JP) with Node-ID n is as 4616 follows. 4618 1. JP MUST connect to its chosen bootstrap node. 4619 2. JP SHOULD use a series of Pings to populate its routing table. 4620 3. JP SHOULD send Attach requests to initiate connections to each of 4621 the peers in the neighbor table as well as to the desired finger 4622 table entries. Note that this does not populate their routing 4623 tables, but only their connection tables, so JP will not get 4624 messages that it is expected to route to other nodes. 4625 4. JP MUST enter all the peers it has contacted into its routing 4626 table. 4627 5. JP SHOULD send a Join to its immediate successor, the admitting 4628 peer (AP) for Node-ID n. The AP sends the response to the Join. 4629 6. AP MUST do a series of Store requests to JP to store the data 4630 that JP will be responsible for. 4631 7. AP MUST send JP an Update explicitly labeling JP as its 4632 predecessor. At this point, JP is part of the ring and 4633 responsible for a section of the overlay. AP can now forget any 4634 data which is assigned to JP and not AP. 4635 8. The AP MUST send an Update to all of its neighbors with the new 4636 values of its neighbor set (including JP). 4637 9. The JP MUST send Updates to all the peers in its neighbor table. 4639 In order to populate its neighbor table, JP sends a Ping via the 4640 bootstrap node directed at Resource-ID n+1 (directly after its own 4641 Resource-ID). This allows it to discover its own successor. Call 4642 that node p0. It then sends a ping to p0+1 to discover its successor 4643 (p1). This process can be repeated to discover as many successors as 4644 desired. The values for the two peers before p will be found at a 4645 later stage when n receives an Update. 4647 In order to set up its finger table entry for peer i, JP simply sends 4648 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4649 approximately the right location around the ring. 4651 The joining peer MUST NOT send any Update message placing itself in 4652 the overlay until it has successfully completed an Attach with each 4653 peer that should be in its neighbor table. 4655 9.5. Routing Attaches 4657 When a peer needs to Attach to a new peer in its neighbor table, it 4658 MUST source-route the Attach request through the peer from which it 4659 learned the new peer's Node-ID. Source-routing these requests allows 4660 the overlay to recover from instability. 4662 All other Attach requests, such as those for new finger table 4663 entries, are routed conventionally through the overlay. 4665 9.6. Updates 4667 A chord Update is defined as 4669 enum { reserved (0), 4670 peer_ready(1), neighbors(2), full(3), (255) } 4671 ChordUpdateType; 4673 struct { 4674 uint32 uptime; 4675 ChordUpdateType type; 4676 select(type){ 4677 case peer_ready: /* Empty */ 4678 ; 4680 case neighbors: 4681 NodeId predecessors<0..2^16-1>; 4682 NodeId successors<0..2^16-1>; 4684 case full: 4685 NodeId predecessors<0..2^16-1>; 4686 NodeId successors<0..2^16-1>; 4687 NodeId fingers<0..2^16-1>; 4688 }; 4689 } ChordUpdate; 4691 The "uptime" field contains the time this peer has been up in 4692 seconds. 4694 The "type" field contains the type of the update, which depends on 4695 the reason the update was sent. 4697 peer_ready: this peer is ready to receive messages. This message 4698 is used to indicate that a node which has Attached is a peer and 4699 can be routed through. It is also used as a connectivity check to 4700 non-neighbor peers. 4702 neighbors: this version is sent to members of the Chord neighbor 4703 table. 4705 full: this version is sent to peers which request an Update with a 4706 RouteQueryReq. 4708 If the message is of type "neighbors", then the contents of the 4709 message will be: 4711 predecessors 4712 The predecessor set of the Updating peer. 4714 successors 4715 The successor set of the Updating peer. 4717 If the message is of type "full", then the contents of the message 4718 will be: 4720 predecessors 4721 The predecessor set of the Updating peer. 4723 successors 4724 The successor set of the Updating peer. 4726 fingers 4727 The finger table of the Updating peer, in numerically ascending 4728 order. 4730 A peer MUST maintain an association (via Attach) to every member of 4731 its neighbor set. A peer MUST attempt to maintain at least three 4732 predecessors and three successors, even though this will not be 4733 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 4734 predecessors and successors be maintained in the neighbor set. 4736 9.6.1. Handling Neighbor Failures 4738 Every time a connection to a peer in the neighbor table is lost (as 4739 determined by connectivity pings or the failure of some request), the 4740 peer MUST remove the entry from its neighbor table and replace it 4741 with the best match it has from the other peers in its routing table. 4742 If using reactive recovery, it then sends an immediate Update to all 4743 nodes in its Neighbor Table. The update will contain all the Node- 4744 IDs of the current entries of the table (after the failed one has 4745 been removed). Note that when replacing a successor the peer SHOULD 4746 delay the creation of new replicas for successor replacement hold- 4747 down time (30 seconds) after removing the failed entry from its 4748 neighbor table in order to allow a triggered update to inform it of a 4749 better match for its neighbor table. 4751 If the neighbor failure effects the peer's range of responsible IDs, 4752 then the Update MUST be sent to all nodes in its Connection Table. 4754 A peer MAY attempt to reestablish connectivity with a lost neighbor 4755 either by waiting additional time to see if connectivity returns or 4756 by actively routing a new ATTACH to the lost peer. Details for these 4757 procedures are beyond the scope of this document. In no event does 4758 an attempt to reestablish connectivity with a lost neighbor allow the 4759 peer to remain in the neighbor table. Such a peer is returned to the 4760 neighbor table once connectivity is reestablished. 4762 If connectivity is lost to all successor peers in the neighbor table, 4763 then this peer should behave as if it is joining the network and use 4764 Pings to find a peer and send it a Join. If connectivity is lost to 4765 all the peers in the finger table, this peer should assume that it 4766 has been disconnected from the rest of the network, and it should 4767 periodically try to join the DHT. 4769 9.6.2. Handling Finger Table Entry Failure 4771 If a finger table entry is found to have failed, all references to 4772 the failed peer are removed from the finger table and replaced with 4773 the closest preceding peer from the finger table or neighbor table. 4775 If using reactive recovery, the peer initiates a search for a new 4776 finger table entry as described below. 4778 9.6.3. Receiving Updates 4780 When a peer, N, receives an Update request, it examines the Node-IDs 4781 in the UpdateReq and at its neighbor table and decides if this 4782 UpdateReq would change its neighbor table. This is done by taking 4783 the set of peers currently in the neighbor table and comparing them 4784 to the peers in the update request. There are two major cases: 4786 o The UpdateReq contains peers that match N's neighbor table, so no 4787 change is needed to the neighbor set. 4788 o The UpdateReq contains peers N does not know about that should be 4789 in N's neighbor table, i.e. they are closer than entries in the 4790 neighbor table. 4792 In the first case, no change is needed. 4794 In the second case, N MUST attempt to Attach to the new peers and if 4795 it is successful it MUST adjust its neighbor set accordingly. Note 4796 that it can maintain the now inferior peers as neighbors, but it MUST 4797 remember the closer ones. 4799 After any Pings and Attaches are done, if the neighbor table changes 4800 and the peer is using reactive recovery, the peer sends an Update 4801 request to each member of its Connection Table. These Update 4802 requests are what end up filling in the predecessor/successor tables 4803 of peers that this peer is a neighbor to. A peer MUST NOT enter 4804 itself in its successor or predecessor table and instead should leave 4805 the entries empty. 4807 If peer N is responsible for a Resource-ID R, and N discovers that 4808 the replica set for R (the next two nodes in its successor set) has 4809 changed, it MUST send a Store for any data associated with R to any 4810 new node in the replica set. It SHOULD NOT delete data from peers 4811 which have left the replica set. 4813 When a peer N detects that it is no longer in the replica set for a 4814 resource R (i.e., there are three predecessors between N and R), it 4815 SHOULD delete all data associated with R from its local store. 4817 When a peer discovers that its range of responsible IDs have changed, 4818 it MUST send an UPDATE to all entries in its connection table. 4820 9.6.4. Stabilization 4822 There are four components to stabilization: 4823 1. exchange Updates with all peers in its neighbor table to exchange 4824 state. 4825 2. search for better peers to place in its finger table. 4826 3. search to determine if the current finger table size is 4827 sufficiently large. 4828 4. search to determine if the overlay has partitioned and needs to 4829 recover. 4831 9.6.4.1. Updating neighbor table 4833 A peer MUST periodically send an Update request to every peer in its 4834 Connection Table. The purpose of this is to keep the predecessor and 4835 successor lists up to date and to detect failed peers. The default 4836 time is about every ten minutes, but the enrollment server SHOULD set 4837 this in the configuration document using the "chord-reload-update- 4838 interval" element (denominated in seconds.) A peer SHOULD randomly 4839 offset these Update requests so they do not occur all at once. 4841 9.6.4.2. Refreshing finger table 4843 A peer MUST periodically search for new peers to replace invalid 4844 (repeated) entries in the finger table. A finger table entry i is 4845 valid if it is in the range [n+2^(128-i), 4846 n+2^(128-(i-1))-2^(128-(i+1))]. Invalid entries occur in the finger 4847 table when a previous finger table entry has failed or when no peer 4848 has been found in that range. 4850 A peer SHOULD NOT send Ping requests looking for new finger table 4851 entries more often than the configuration element "chord-reload-ping- 4852 interval", which defaults to 3600 seconds (one per hour). 4854 Two possible methods for searching for new peers for the finger table 4855 entries are presented: 4857 Alternative 1: A peer selects one entry in the finger table from 4858 among the invalid entries. It pings for a new peer for that finger 4859 table entry. The selection SHOULD be exponentially weighted to 4860 attempt to replace earlier (lower i) entries in the finger table. A 4861 simple way to implement this selection is to search through the 4862 finger table entries from i=0 and each time an invalid entry is 4863 encountered, send a Ping to replace that entry with probability 0.5. 4865 Alternative 2: A peer monitors the Update messages received from its 4866 connections to observe when an Update indicates a peer that would be 4867 used to replace in invalid finger table entry, i, and flags that 4868 entry in the finger table. Every "chord-reload-ping-interval" 4869 seconds, the peer selects from among those flagged candidates using 4870 an exponentially weighted probability as above. 4872 When searching for a better entry, the peer SHOULD send the Ping to a 4873 Node-ID selected randomly from that range. Random selection is 4874 preferred over a search for strictly spaced entries to minimize the 4875 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 4876 implementation or subsequent specification MAY choose a method for 4877 selecting finger table entries other than choosing randomly within 4878 the range. Any such alternate methods SHOULD be employed only on 4879 finger table stabilization and not for the selection of initial 4880 finger table entries unless the alternative method is faster and 4881 imposes less overhead on the overlay. 4883 A peer MAY choose to keep connections to multiple peers that can act 4884 for a given finger table entry. 4886 9.6.4.3. Adjusting finger table size 4888 If the finger table has less than 16 entries, the node SHOULD attempt 4889 to discover more fingers to grow the size of the table to 16. The 4890 value 16 was chosen to ensure high odds of a node maintaining 4891 connectivity to the overlay even with strange network partitions. 4893 For many overlays, 16 finger table entries will be enough, but as an 4894 overlay grows very large, more than 16 entries may be required in the 4895 finger table for efficient routing. An implementation SHOULD be 4896 capable of increasing the number of entries in the finger table to 4897 128 entries. 4899 Note to implementers: Although log(N) entries are all that are 4900 required for optimal performance, careful implementation of 4901 stabilization will result in no additional traffic being generated 4902 when maintaining a finger table larger than log(N) entries. 4903 Implementers are encouraged to make use of RouteQuery and algorithms 4904 for determining where new finger table entries may be found. 4905 Complete details of possible implementations are outside the scope of 4906 this specification. 4908 A simple approach to sizing the finger table is to ensure the finger 4909 table is large enough to contain at least the final successor in the 4910 peer's neighbor table. 4912 9.6.4.4. Detecting partitioning 4914 To detect that a partitioning has occurred and to heal the overlay, a 4915 peer P MUST periodically repeat the discovery process used in the 4916 initial join for the overlay to locate an appropriate bootstrap node, 4917 B. P should then send a Ping for its own Node-ID routed through B. If 4918 a response is received from a peer S', which is not P's successor, 4919 then the overlay is partitioned and P should send an Attach to S' 4920 routed through B, followed by an Update sent to S'. (Note that S' 4921 may not be in P's neighbor table once the overlay is healed, but the 4922 connection will allow S' to discover appropriate neighbor entries for 4923 itself via its own stabilization.) 4925 Future specifications may describe alternative mechanisms for 4926 determining when to repeat the discovery process. 4928 9.7. Route Query 4930 For this topology plugin, the RouteQueryReq contains no additional 4931 information. The RouteQueryAns contains the single node ID of the 4932 next peer to which the responding peer would have routed the request 4933 message in recursive routing: 4935 struct { 4936 NodeId next_peer; 4937 } ChordRouteQueryAns; 4939 The contents of this structure are as follows: 4941 next_peer 4942 The peer to which the responding peer would route the message in 4943 order to deliver it to the destination listed in the request. 4945 If the requester has set the send_update flag, the responder SHOULD 4946 initiate an Update immediately after sending the RouteQueryAns. 4948 9.8. Leaving 4950 To support extensions, such as [I-D.maenpaa-p2psip-self-tuning], 4951 Peers SHOULD send a Leave request to all members of their neighbor 4952 table prior to exiting the Overlay Instance. The 4953 overlay_specific_data field MUST contain the ChordLeaveData structure 4954 defined below: 4956 enum { reserved (0), 4957 from_succ(1), from_pred(2), (255) } 4958 ChordLeaveType; 4960 struct { 4961 ChordLeaveType type; 4963 select(type) { 4964 case from_succ: 4965 NodeId successors<0..2^16-1>; 4966 case from_pred: 4967 NodeId predecessors<0..2^16-1>; 4968 }; 4969 } ChordLeaveData; 4971 The 'type' field indicates whether the Leave request was sent by a 4972 predecessor or a successor of the recipient: 4974 from_succ 4975 The Leave request was sent by a successor. 4977 from_pred 4978 The Leave request was sent by a predecessor. 4980 If the type of the request is 'from_succ', the contents will be: 4982 successors 4983 The sender's successor list. 4985 If the type of the request is 'from_pred', the contents will be: 4987 predecessors 4988 The sender's predecessor list. 4990 Any peer which receives a Leave for a peer n in its neighbor set 4991 follows procedures as if it had detected a peer failure as described 4992 in Section 9.6.1. 4994 10. Enrollment and Bootstrap 4996 The section defines the format of the configuration data as well the 4997 process to join a new overlay. 4999 10.1. Overlay Configuration 5001 This specification defines a new content type "application/ 5002 p2p-overlay+xml" for an MIME entity that contains overlay 5003 information. An example document is shown below. 5005 5007 5010 5012 false 5013 5014 5015 5016 30 5017 TLS 5018 false 5019 10 5020 4000 5021 https://example.org 5022 foo 5023 300 5024 400 5025 false 5027 asecret 5028 chord 5029 16 5030 DATA GOES HERE 5031 5032 5033 5034 single 5035 user-match 5036 1 5037 100 5038 5039 5040 VGhpcyBpcyBub3QgcmlnaHQhCg== 5041 5042 5043 5044 5045 array 5046 node-multiple 5047 3 5048 22 5049 4 5050 1 5051 5052 5053 5054 VGhpcyBpcyBub3QgcmlnaHQhCg== 5055 5056 5057 5058 47112162e84c69ba 5059 6eba45d31a900c06 5060 6ebc45d31a900c06 5061 5062 VGhpcyBpcyBub3QgcmlnaHQhCg== 5063 5064 The file MUST be a well formed XML document and it SHOULD contain an 5065 encoding declaration in the XML declaration. If the charset 5066 parameter of the MIME content type declaration is present and it is 5067 different from the encoding declaration, the charset parameter takes 5068 precedence. Every application conforming to this specification MUST 5069 accept the UTF-8 character encoding to ensure minimal 5070 interoperability. The namespace for the elements defined in this 5071 specification is urn:ietf:params:xml:ns:p2p:config-base and 5072 urn:ietf:params:xml:ns:p2p:config-chord". 5074 The file can contain multiple "configuration" elements where each one 5075 contains the configuration information for a different overlay. Each 5076 "configuration" has the following attributes: 5078 instance-name: name of the overlay 5079 expiration: time in future at which this overlay configuration is no 5080 longer valid and needs to be retrieved again 5081 sequence: a monotonically increasing sequence number between 1 and 5082 2^32 5084 Inside each overlay element, the following elements can occur: 5086 topology-plugin This element has defines the overlay algorithm being 5087 used. 5088 node-id-length This element contains the length of a NodeId 5089 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5090 and 20 (160 bits). If this element is not present, the default of 5091 16 is used. 5092 root-cert This element contains a PEM encoded X.509v3 certificate 5093 that is a root trust anchor used to sign all certificates in this 5094 overlay. There can be more than one root-cert element. 5095 enrollment-server This element contains the URL at which the 5096 enrollment server can be reached in a "url" element. This URL 5097 MUST be of type "https:". More than one enrollment-server element 5098 may be present. 5099 self-signed-permitted This element indicates whether self-signed 5100 certificates are permitted. If it is set to "true", then self- 5101 signed certificates are allowed, in which case the enrollment- 5102 server and root-cert elements may be absent. Otherwise, it SHOULD 5103 be absent, but MAY be set to "false". This element also contains 5104 an attribute "digest" which indicates the digest to be used to 5105 compute the Node-ID. Valid values for this parameter are "SHA-1" 5106 and "SHA-256". Implementations MUST support both of these 5107 algorithms. 5109 direct-return-response-permitted This element indicates whether 5110 direct return routed responses as described in Section 5.3.2.4 are 5111 permitted. If it is set to "true", they MAY be used. Otherwise, 5112 it SHOULD be absent, but MAY be set to "false". Implementations 5113 MAY support direct return routed response. 5114 bootstrap-node This element represents the address of one of the 5115 bootstrap nodes. It has an attribute called "address" that 5116 represents the IP address (either IPv4 or IPv6, since they can be 5117 distinguished) and an attribute called "port" that represents the 5118 port. The IP address is in typical hexadecimal form using 5119 standard period and colon separators as specified in 5120 [I-D.ietf-6man-text-addr-representation]. More than one 5121 bootstrap-peer element may be present. 5122 turn-density This element is a positive integer that represents the 5123 approximate reciprocal of density of nodes that can act as TURN 5124 servers. For example, if 5% of the nodes can act as TURN servers, 5125 this would be set to 20. If it is not present, the default value 5126 is 1. If there are no TURN servers in the overlay, it is set to 5127 zero. 5128 multicast-bootstrap This element represents the address of a 5129 multicast, broadcast, or anycast address and port that may be used 5130 for bootstrap. Nodes SHOULD listen on the address. It has an 5131 attributed called "address" that represents the IP address and an 5132 attribute called "port" that represents the port. More than one 5133 "multicast-bootstrap" element may be present. 5134 clients-permitted This element represents whether clients are 5135 permitted or whether all nodes must be peers. If it is set to 5136 "TRUE" or absent, this indicates that clients are permitted. If 5137 it is set to "FALSE" then nodes MUST join as peers. 5138 no-ice This element represents whether nodes are required to use 5139 the "No-ICE" Overlay Link protocols in this overlay. If it is 5140 absent, it is treated as if it were set to "FALSE". 5141 chord-update-interval The update frequency for the Chord-reload 5142 topology plugin (see Section 9). 5143 chord-ping-interval The ping frequency for the Chord-reload 5144 topology plugin (see Section 9). 5145 chord-reload-reactive Whether reactive recovery should be used for 5146 this overlay. (see Section 9). 5147 shared-secret If shared secret mode is used, this contains the 5148 shared secret. 5149 max-message-size Maximum size in bytes of any message in the 5150 overlay. If this value is not present, the default is 5000. 5151 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5152 for messages. If this value is not present, the default is 100. 5154 overlay-link-protocol Indicates a permissible overlay link protocol 5155 (see Section 5.6.1 for requirements for such protocols). An 5156 arbitrary number of these elements may appear. If none appear, 5157 then this implies the default value, "TLS", which refers to the 5158 use of TLS and DTLS. If one or more elements appear, then no 5159 default value applies. 5160 kind-signer This contains a single Node-ID in hexadecimal and 5161 indicates that the certificate with this Node-ID is allowed to 5162 sign kinds. Identifying kind-signer by Node-ID instead of 5163 certificate allows the use of short lived certificates without 5164 constantly having to provide an updated configuration file. 5165 bad-node This contains a single Node-ID in hexadecimal and 5166 indicates that the certificate with this Node-ID MUST NOT be 5167 considered valid. This allows certificate revocation. An 5168 arbitrary number of these elements can be provided. Note that 5169 because certificates may expire, bad-node entries need only be 5170 present for the lifetime of the certificate. Technically 5171 speaking, bad node-ids may be reused once their certificates have 5172 expired, the requirement for node-ids to be pseudo randomly 5173 generated gives this event a vanishing probability. 5175 Inside each overlay element, the required-kinds elements can also 5176 occur. This element indicates the kinds that members must support 5177 and contains multiple kind-block elements that each define a single 5178 kind that MUST be supported by nodes in the overlay. Each kind-block 5179 consists of a single kind element and a kind-signature. The kind 5180 element defines the kind. The kind-signature is the signature 5181 computed over the kind element. 5183 Each kind has either an ID attribute or a name attribute. The name 5184 attribute is a string representing the kind (the name registered to 5185 IANA) while the ID is an integer kind-id allocated out of private 5186 space. 5188 In addition, the kind element contains the following elements: 5189 max-count: the maximum number of values which members of the overlay 5190 must support. 5191 data-model: the data model to be used. 5192 max-size: the maximum size of individual values. 5193 access-control: the access control model to be used. 5194 max-node-multiple: This is optional and only used when the access 5195 control is NODE-MULTIPLE. This indicates the maximum value for 5196 the i counter. This is an integer greater than 0. 5198 All of the non optional values MUST be provided. If the kind is 5199 registered with IANA, the data-model and access-control attributes 5200 MUST match those in the kind registration. For instance, the example 5201 above indicates that members must support SIP-REGISTRATION with a 5202 maximum of 10 values of up to 1000 bytes each. Multiple required- 5203 kinds elements MAY be present. 5205 The kind-block element also MUST contain a "kind-signature" element. 5206 This signature is computed across the kind from the beginning of the 5207 first < of the kind to the end of the last > of the kind in the same 5208 way as the "signature element described later in this section. 5210 The configuration file is a binary file and cannot be changed - 5211 including whitespace changes - or the signature will break. The 5212 signature is computed by taking each configuration element and 5213 starting from, and including, the first < at the start of 5214 up to and including the > in and 5215 treating this as a binary blob that is signed using the standard 5216 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5217 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5218 signature element following the configuration object in the config 5219 file. 5221 When a node receives a new configuration file, it MUST change its 5222 configuration to meet the new requirements. This may require the 5223 node to exit the DHT and re-join. If a node is not capable of 5224 supporting the new requirements, it MUST exit the overlay. If some 5225 information about a particular kind changes from what the node 5226 previously knew about the kind (for example the max size), the new 5227 information in the configuration files overrides any previously 5228 learned information. If any kind data was signed by a node that is 5229 no longer allowed to sign kinds, that kind MUST be discarded along 5230 with any stored information of that kind. Note that forcing an 5231 avalanche restart of the overlay with a configuration change that 5232 requires re-joining the overlay may result in serious performance 5233 problems, including total collapse of the network if configuration 5234 parameters are not properly considered. Such an event may be 5235 necessary in case of a compromised CA or similar problem, but for 5236 large overlays should be avoided in almost all circumstances. 5238 10.1.1. Relax NG Grammar 5240 The grammar for the configuration data is: 5242 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5243 namespace local = "" 5244 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5245 namespace rng = "http://relaxng.org/ns/structure/1.0" 5247 anything = 5248 (element * { anything } 5249 | attribute * { text } 5250 | text)* 5252 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5253 { anything }* 5254 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5255 { text }* 5256 foreign-nodes = (foreign-attributes | foreign-elements)* 5258 start = 5259 element p2pcf:overlay { 5260 element configuration { 5261 attribute instance-name { text }, 5262 attribute expiration { xsd:dateTime }, 5263 attribute sequence { xsd:long }, 5264 parameter 5265 }, 5266 element signature { 5267 attribute algorithm { signature-algorithm-type }?, 5268 xsd:base64Binary 5269 }? 5270 } 5271 signature-algorithm-type |= "rsa-sha1" 5273 parameter &= element topology-plugin { topology-plugin-type } 5274 parameter &= element max-message-size { xsd:int }? 5275 parameter &= element initial-ttl { xsd:int }? 5276 parameter &= element root-cert { text }? 5277 parameter &= element required-kinds { kind-block* } 5278 parameter &= element enrollment-server { xsd:anyURI }? 5279 parameter &= element kind-signer { text }* 5280 parameter &= element bad-node { text }* 5281 parameter &= element no-ice { xsd:boolean }? 5282 parameter &= 5283 element direct-return-response-permitted { xsd:boolean }? 5284 parameter &= element shared-secret { xsd:string }? 5285 parameter &= element overlay-link-protocol { xsd:string }* 5286 parameter &= element clients-permitted { xsd:boolean }? 5287 parameter &= element turn-density { xsd:int }? 5288 parameter &= element node-id-length { xsd:int }? 5289 parameter &= foreign-elements* 5290 parameter &= 5291 element self-signed-permitted { 5292 attribute digest { self-signed-digest-type }, 5293 xsd:boolean 5294 }? 5295 self-signed-digest-type |= "sha1" 5296 parameter &= 5297 element bootstrap-node { 5298 attribute address { xsd:string }, 5299 attribute port { xsd:int } 5300 }+ 5301 hostPort = text 5302 parameter &= 5303 element multicast-bootstrap { hostPort 5304 }* 5306 kind-block = element kind-block { 5307 element kind { 5308 (attribute name { kind-names } 5309 | attribute id { xsd:int }), 5310 kind-paramter 5311 } & 5312 element kind-signature { 5313 attribute algorithm { signature-algorithm-type }?, 5314 xsd:base64Binary 5315 }? 5317 } 5319 kind-paramter &= element max-count { xsd:int } 5320 kind-paramter &= element max-size { xsd:int } 5321 kind-paramter &= element data-model { data-model-type } 5322 data-model-type |= "single" 5323 data-model-type |= "array" 5324 data-model-type |= "dictionary" 5325 kind-paramter &= element access-control { access-control-type } 5326 kind-paramter &= element max-node-multiple { xsd:int }? 5327 access-control-type |= "user-match" 5328 access-control-type |= "node-match" 5329 access-control-type |= "user-node-match" 5330 access-control-type |= "node-multiple" 5331 access-control-type |= "user-match-with-anon-create" 5332 kind-paramter &= foreign-elements* 5334 # Chord specific paramters 5335 topology-plugin-type |= "chord" 5336 kind-names |= "sip-registration" 5337 kind-names |= "turn-service" 5338 parameter &= element chord:chord-ping-interval { xsd:int }? 5339 parameter &= element chord:chord-update-interval { xsd:int }? 5341 10.2. Discovery Through Enrollment Server 5343 When a node first enrolls in a new overlay, it starts with a 5344 discovery process to find an enrollment server. 5346 The node first determines the overlay name. This value is provided 5347 by the user or some other out of band provisioning mechanism. The 5348 out of band mechanisms may also provide an optional URL for the 5349 enrollment server. If a URL for the enrollment server is not 5350 provided, the node MUST do a DNS SRV query using a Service name of 5351 "p2psip-enroll" and a protocol of TCP to find an enrollment server 5352 and form the URL by appending a path of "/.well-known/p2psip-enroll" 5353 to the overlay name. This uses the "well known URI" framework 5354 defined in [RFC5785]. For example, if the overlay name was 5355 example.com, the URL would be 5356 "https://example.com//.well-known/p2psip-enroll". 5358 Once an address and URL for the enrollment server is determined, the 5359 peer forms an HTTPS connection to that IP address. The certificate 5360 MUST match the overlay name as described in [RFC2818]. Then the node 5361 MUST fetch a new copy of the configuration file. To do this, the 5362 peer performs a GET to the URL. The result of the HTTP GET is an XML 5363 configuration file described above, which replaces any previously 5364 learned configuration file for this overlay. 5366 For overlays that do not use an enrollment server, nodes obtain the 5367 configuration information needed to join the overlay through some out 5368 of band approach such an XML configuration file sent over email. 5370 10.3. Credentials 5372 If the configuration document contains a enrollment-server element, 5373 credentials are required to join the Overlay Instance. A peer which 5374 does not yet have credentials MUST contact the enrollment server to 5375 acquire them. 5377 RELOAD defines its own trivial certificate request protocol. We 5378 would have liked to have used an existing protocol but were concerned 5379 about the implementation burden of even the simplest of those 5380 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5381 have a protocol which could be easily implemented in a Web server 5382 which the operator did not control (e.g., in a hosted service) and 5383 was compatible with the existing certificate handling tooling as used 5384 with the Web certificate infrastructure. This means accepting bare 5385 PKCS#10 requests and returning a single bare X.509 certificate. 5386 Although the MIME types for these objects are defined, none of the 5387 existing protocols support exactly this model. 5389 The certificate request protocol is performed over HTTPS. The 5390 request is an HTTP POST with the following properties: 5392 o If authentication is required, there is a URL parameter of 5393 "password" and "username" containing the user's name and password 5394 in the clear (hence the need for HTTPS) 5395 o The body is of content type "application/pkcs10", as defined in 5396 [RFC2311]. 5397 o The Accept header contains the type "application/pkix-cert", 5398 indicating the type that is expected in the response. 5400 The enrollment server MUST authenticate the request using the 5401 provided user name and password. If the authentication succeeds and 5402 the requested user name is acceptable, the server generates and 5403 returns a certificate. The SubjectAltName field in the certificate 5404 contains the following values: 5406 o One or more Node-IDs which MUST be cryptographically random 5407 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5408 way that they are unpredictable to the requesting user. E.g., the 5409 user MUST NOT be informed of potential (random) Node-IDs prior to 5410 authenticating. Each is placed in the subjectAltName using the 5411 uniformResourceIdentifier type and MUST contain RELOAD URIs as 5412 described in Section 13.15 and MUST contain a Destination list 5413 with a single entry of type "node_id". 5414 o A single name this user is allowed to use in the overlay, using 5415 type rfc822Name. 5417 The certificate is returned as type "application/pkix-cert", with an 5418 HTTP status code of 200 OK. Certificate processing errors should be 5419 treated as HTTP errors and have appropriate HTTP status codes. 5421 The client MUST check that the certificate returned was signed by one 5422 of the certificates received in the "root-cert" list of the overlay 5423 configuration data. The node then reads the certificate to find the 5424 Node-IDs it can use. 5426 10.3.1. Self-Generated Credentials 5428 If the "self-signed-permitted" element is present in the 5429 configuration and set to "TRUE", then a node MUST generate its own 5430 self-signed certificate to join the overlay. The self-signed 5431 certificate MAY contain any user name of the users choice. 5433 The Node-ID MUST be computed by applying the digest specified in the 5434 self-signed-permitted element to the DER representation of the user's 5435 public key (more specifically the subjectPublicKeyInfo) and taking 5436 the high order bits. When accepting a self-signed certificate, nodes 5437 MUST check that the Node-ID and public keys match. This prevents 5438 Node-ID theft. 5440 Once the node has constructed a self-signed certificate, it MAY join 5441 the overlay. Before storing its certificate in the overlay 5442 (Section 7) it SHOULD look to see if the user name is already taken 5443 and if so choose another user name. Note that this only provides 5444 protection against accidental name collisions. Name theft is still 5445 possible. If protection against name theft is desired, then the 5446 enrollment service must be used. 5448 10.4. Searching for a Bootstrap Node 5450 If no cached bootstrap nodes are available and the config file has an 5451 multicast-bootstrap element, then the node SHOULD send a Ping request 5452 over UDP to the address and port found to each multicast-bootstrap 5453 element found in the configuration document. This MAY be a 5454 multicast, broadcast, or anycast address. The Ping should use the 5455 wildcard Node-ID as the destination Node-ID. 5457 The responder node that receives the Ping request SHOULD check that 5458 the overlay name is correct and that the requester peer sending the 5459 request has appropriate credentials for the overlay before responding 5460 to the Ping request even if the response is only an error. 5462 10.5. Contacting a Bootstrap Node 5464 In order to join the overlay, the joining node MUST contact a node in 5465 the overlay. Typically this means contacting the bootstrap nodes, 5466 since they are reachable by the local peer or have public IP 5467 addresses. If the joining node has cached a list of peers it has 5468 previously been connected with in this overlay, as an optimization it 5469 MAY attempt to use one or more of them as bootstrap nodes before 5470 falling back to the bootstrap nodes listed in the configuration file. 5472 When contacting a bootstrap node, the joining node first forms the 5473 DTLS or TLS connection to the bootstrap node and then sends an Attach 5474 request over this connection with the destination Node-ID set to the 5475 joining node's Node-ID. 5477 When the requester node finally does receive a response from some 5478 responding node, it can note the Node-ID in the response and use this 5479 Node-ID to start sending requests to join the Overlay Instance as 5480 described in Section 5.4. 5482 After a node has successfully joined the overlay network, it will 5483 have direct connections to several peers. Some MAY be added to the 5484 cached bootstrap nodes list and used in future boots. Peers that are 5485 not directly connected MUST NOT be cached. The suggested number of 5486 peers to cache is 10. Algorithms for determining which peers to 5487 cache are beyond the scope of this specification. 5489 11. Message Flow Example 5491 The following abbreviation are used in the message flow diagrams: JP 5492 = joining peer, AP = admitting peer, NP = next peer after the AP, NNP 5493 = next next peer which is the peer after NP, PP = previous peer 5494 before the AP, PPP = previous previous peer which is the peer before 5495 the PP, BP = bootstrap peer. 5497 The following abbreviation are used in the message flow diagrams: 5499 In the following example, we assume that JP has formed a connection 5500 to one of the bootstrap nodes. JP then sends an Attach through that 5501 peer to the admitting peer (AP) to initiate a connection. When AP 5502 responds, JP and AP use ICE to set up a connection and then set up 5503 TLS. 5505 JP PPP PP AP NP NNP BP 5506 | | | | | | | 5507 | | | | | | | 5508 | | | | | | | 5509 |Attach Dest=JP | | | | | 5510 |---------------------------------------------------------->| 5511 | | | | | | | 5512 | | | | | | | 5513 | | |Attach Dest=JP | | | 5514 | | |<--------------------------------------| 5515 | | | | | | | 5516 | | | | | | | 5517 | | |Attach Dest=JP | | | 5518 | | |-------->| | | | 5519 | | | | | | | 5520 | | | | | | | 5521 | | |AttachAns | | | 5522 | | |<--------| | | | 5523 | | | | | | | 5524 | | | | | | | 5525 | | |AttachAns | | | 5526 | | |-------------------------------------->| 5527 | | | | | | | 5528 | | | | | | | 5529 |AttachAns | | | | | 5530 |<----------------------------------------------------------| 5531 | | | | | | | 5532 | | | | | | | 5533 |TLS | | | | | | 5534 |.............................| | | | 5535 | | | | | | | 5536 | | | | | | | 5537 | | | | | | | 5538 | | | | | | | 5540 Once JP has connected to AP, it needs to populate its Routing Table. 5541 In Chord, this means that it needs to populate its neighbor table and 5542 its finger table. To populate its neighbor table, it needs the 5543 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 5544 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 5545 to set up a connection. 5547 JP PPP PP AP NP NNP BP 5548 | | | | | | | 5549 | | | | | | | 5550 | | | | | | | 5551 |Attach AP+1 | | | | | 5552 |---------------------------->| | | | 5553 | | | | | | | 5554 | | | | | | | 5555 | | | |Attach AP+1 | | 5556 | | | |-------->| | | 5557 | | | | | | | 5558 | | | | | | | 5559 | | | |AttachAns | | 5560 | | | |<--------| | | 5561 | | | | | | | 5562 | | | | | | | 5563 |AttachAns | | | | | 5564 |<----------------------------| | | | 5565 | | | | | | | 5566 | | | | | | | 5567 |Attach | | | | | | 5568 |-------------------------------------->| | | 5569 | | | | | | | 5570 | | | | | | | 5571 |TLS | | | | | | 5572 |.......................................| | | 5573 | | | | | | | 5574 | | | | | | | 5575 | | | | | | | 5576 | | | | | | | 5578 JP also needs to populate its finger table (for Chord). It issues an 5579 Attach to a variety of locations around the overlay. The diagram 5580 below shows it sending an Attach halfway around the Chord ring to the 5581 JP + 2^127. 5583 JP NP XX TP 5584 | | | | 5585 | | | | 5586 | | | | 5587 |Attach JP+2<<126 | | 5588 |-------->| | | 5589 | | | | 5590 | | | | 5591 | |Attach JP+2<<126 | 5592 | |-------->| | 5593 | | | | 5594 | | | | 5595 | | |Attach JP+2<<126 5596 | | |-------->| 5597 | | | | 5598 | | | | 5599 | | |AttachAns| 5600 | | |<--------| 5601 | | | | 5602 | | | | 5603 | |AttachAns| | 5604 | |<--------| | 5605 | | | | 5606 | | | | 5607 |AttachAns| | | 5608 |<--------| | | 5609 | | | | 5610 | | | | 5611 |TLS | | | 5612 |.............................| 5613 | | | | 5614 | | | | 5615 | | | | 5616 | | | | 5618 Once JP has a reasonable set of connections it is ready to take its 5619 place in the DHT. It does this by sending a Join to AP. AP does a 5620 series of Store requests to JP to store the data that JP will be 5621 responsible for. AP then sends JP an Update explicitly labeling JP 5622 as its predecessor. At this point, JP is part of the ring and 5623 responsible for a section of the overlay. AP can now forget any data 5624 which is assigned to JP and not AP. 5626 JP PPP PP AP NP NNP BP 5627 | | | | | | | 5628 | | | | | | | 5629 | | | | | | | 5630 |JoinReq | | | | | | 5631 |---------------------------->| | | | 5632 | | | | | | | 5633 | | | | | | | 5634 |JoinAns | | | | | | 5635 |<----------------------------| | | | 5636 | | | | | | | 5637 | | | | | | | 5638 |StoreReq Data A | | | | | 5639 |<----------------------------| | | | 5640 | | | | | | | 5641 | | | | | | | 5642 |StoreAns | | | | | | 5643 |---------------------------->| | | | 5644 | | | | | | | 5645 | | | | | | | 5646 |StoreReq Data B | | | | | 5647 |<----------------------------| | | | 5648 | | | | | | | 5649 | | | | | | | 5650 |StoreAns | | | | | | 5651 |---------------------------->| | | | 5652 | | | | | | | 5653 | | | | | | | 5654 |UpdateReq| | | | | | 5655 |<----------------------------| | | | 5656 | | | | | | | 5657 | | | | | | | 5658 |UpdateAns| | | | | | 5659 |---------------------------->| | | | 5660 | | | | | | | 5661 | | | | | | | 5662 | | | | | | | 5663 | | | | | | | 5665 In Chord, JP's neighbor table needs to contain its own predecessors. 5666 It couldn't connect to them previously because it did not yet know 5667 their addresses. However, now that it has received an Update from 5668 AP, it has AP's predecessors, which are also its own, so it sends 5669 Attaches to them. Below it is shown connecting to AP's closest 5670 predecessor, PP. 5672 JP PPP PP AP NP NNP BP 5673 | | | | | | | 5674 | | | | | | | 5675 | | | | | | | 5676 |Attach Dest=PP | | | | | 5677 |---------------------------->| | | | 5678 | | | | | | | 5679 | | | | | | | 5680 | | |Attach Dest=PP | | | 5681 | | |<--------| | | | 5682 | | | | | | | 5683 | | | | | | | 5684 | | |AttachAns| | | | 5685 | | |-------->| | | | 5686 | | | | | | | 5687 | | | | | | | 5688 |AttachAns| | | | | | 5689 |<----------------------------| | | | 5690 | | | | | | | 5691 | | | | | | | 5692 |TLS | | | | | | 5693 |...................| | | | | 5694 | | | | | | | 5695 | | | | | | | 5696 |UpdateReq| | | | | | 5697 |------------------>| | | | | 5698 | | | | | | | 5699 | | | | | | | 5700 |UpdateAns| | | | | | 5701 |<------------------| | | | | 5702 | | | | | | | 5703 | | | | | | | 5704 |UpdateReq| | | | | | 5705 |---------------------------->| | | | 5706 | | | | | | | 5707 | | | | | | | 5708 |UpdateAns| | | | | | 5709 |<----------------------------| | | | 5710 | | | | | | | 5711 | | | | | | | 5712 |UpdateReq| | | | | | 5713 |-------------------------------------->| | | 5714 | | | | | | | 5715 | | | | | | | 5716 |UpdateAns| | | | | | 5717 |<--------------------------------------| | | 5718 | | | | | | | 5719 | | | | | | | 5721 Finally, now that JP has a copy of all the data and is ready to route 5722 messages and receive requests, it sends Updates to everyone in its 5723 Routing Table to tell them it is ready to go. Below, it is shown 5724 sending such an update to TP. 5726 JP NP XX TP 5727 | | | | 5728 | | | | 5729 | | | | 5730 |Update | | | 5731 |---------------------------->| 5732 | | | | 5733 | | | | 5734 |UpdateAns| | | 5735 |<----------------------------| 5736 | | | | 5737 | | | | 5738 | | | | 5739 | | | | 5741 12. Security Considerations 5743 12.1. Overview 5745 RELOAD provides a generic storage service, albeit one designed to be 5746 useful for P2PSIP. In this section we discuss security issues that 5747 are likely to be relevant to any usage of RELOAD. More background 5748 information can be found in [RFC5765]. 5750 In any Overlay Instance, any given user depends on a number of peers 5751 with which they have no well-defined relationship except that they 5752 are fellow members of the Overlay Instance. In practice, these other 5753 nodes may be friendly, lazy, curious, or outright malicious. No 5754 security system can provide complete protection in an environment 5755 where most nodes are malicious. The goal of security in RELOAD is to 5756 provide strong security guarantees of some properties even in the 5757 face of a large number of malicious nodes and to allow the overlay to 5758 function correctly in the face of a modest number of malicious nodes. 5760 P2PSIP deployments require the ability to authenticate both peers and 5761 resources (users) without the active presence of a trusted entity in 5762 the system. We describe two mechanisms. The first mechanism is 5763 based on public key certificates and is suitable for general 5764 deployments. The second is an admission control mechanism based on 5765 an overlay-wide shared symmetric key. 5767 12.2. Attacks on P2P Overlays 5769 The two basic functions provided by overlay nodes are storage and 5770 routing: some node is responsible for storing a peer's data and for 5771 allowing a third peer to fetch this stored data. Other nodes are 5772 responsible for routing messages to and from the storing nodes. Each 5773 of these issues is covered in the following sections. 5775 P2P overlays are subject to attacks by subversive nodes that may 5776 attempt to disrupt routing, corrupt or remove user registrations, or 5777 eavesdrop on signaling. The certificate-based security algorithms we 5778 describe in this specification are intended to protect overlay 5779 routing and user registration information in RELOAD messages. 5781 To protect the signaling from attackers pretending to be valid peers 5782 (or peers other than themselves), the first requirement is to ensure 5783 that all messages are received from authorized members of the 5784 overlay. For this reason, RELOAD transports all messages over a 5785 secure channel (TLS and DTLS are defined in this document) which 5786 provides message integrity and authentication of the directly 5787 communicating peer. In addition, messages and data are digitally 5788 signed with the sender's private key, providing end-to-end security 5789 for communications. 5791 12.3. Certificate-based Security 5793 This specification stores users' registrations and possibly other 5794 data in an overlay network. This requires a solution to securing 5795 this data as well as securing, as well as possible, the routing in 5796 the overlay. Both types of security are based on requiring that 5797 every entity in the system (whether user or peer) authenticate 5798 cryptographically using an asymmetric key pair tied to a certificate. 5800 When a user enrolls in the Overlay Instance, they request or are 5801 assigned a unique name, such as "alice@dht.example.net". These names 5802 are unique and are meant to be chosen and used by humans much like a 5803 SIP Address of Record (AOR) or an email address. The user is also 5804 assigned one or more Node-IDs by the central enrollment authority. 5805 Both the name and the Node-ID are placed in the certificate, along 5806 with the user's public key. 5808 Each certificate enables an entity to act in two sorts of roles: 5810 o As a user, storing data at specific Resource-IDs in the Overlay 5811 Instance corresponding to the user name. 5812 o As a overlay peer with the Peer-ID(s) listed in the certificate. 5814 Note that since only users of this Overlay Instance need to validate 5815 a certificate, this usage does not require a global PKI. Instead, 5816 certificates are signed by a central enrollment authority which acts 5817 as the certificate authority for the Overlay Instance. This 5818 authority signs each peer's certificate. Because each peer possesses 5819 the CA's certificate (which they receive on enrollment) they can 5820 verify the certificates of the other entities in the overlay without 5821 further communication. Because the certificates contain the user/ 5822 peer's public key, communications from the user/peer can be verified 5823 in turn. 5825 If self-signed certificates are used, then the security provided is 5826 significantly decreased, since attackers can mount Sybil attacks. In 5827 addition, attackers cannot trust the user names in certificates 5828 (though they can trust the Node-IDs because they are 5829 cryptographically verifiable). This scheme may be appropriate for 5830 some small deployments, such as a small office or an ad hoc overlay 5831 set up among participants in a meeting where all hosts on the network 5832 are trusted. Some additional security can be provided by using the 5833 shared secret admission control scheme as well. 5835 Because all stored data is signed by the owner of the data the 5836 storing peer can verify that the storer is authorized to perform a 5837 store at that Resource-ID and also allow any consumer of the data to 5838 verify the provenance and integrity of the data when it retrieves it. 5840 Note that RELOAD does not itself provide a revocation/status 5841 mechanism (though certificates may of course include OCSP responder 5842 information). Thus, certificate lifetimes should be chosen to 5843 balance the compromise window versus the cost of certificate renewal. 5844 Because RELOAD is already designed to operate in the face of some 5845 fraction of malicious peers, this form of compromise is not fatal. 5847 All implementations MUST implement certificate-based security. 5849 12.4. Shared-Secret Security 5851 RELOAD also supports a shared secret admission control scheme that 5852 relies on a single key that is shared among all members of the 5853 overlay. It is appropriate for small groups that wish to form a 5854 private network without complexity. In shared secret mode, all the 5855 peers share a single symmetric key which is used to key TLS-PSK 5856 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 5857 key cannot form TLS connections with any other peer and therefore 5858 cannot join the overlay. 5860 One natural approach to a shared-secret scheme is to use a user- 5861 entered password as the key. The difficulty with this is that in 5862 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 5864 If passwords are used as the source of shared-keys, then TLS-SRP is a 5865 superior choice because it is not subject to dictionary attacks. 5867 12.5. Storage Security 5869 When certificate-based security is used in RELOAD, any given 5870 Resource-ID/Kind-ID pair is bound to some small set of certificates. 5871 In order to write data, the writer must prove possession of the 5872 private key for one of those certificates. Moreover, all data is 5873 stored, signed with the same private key that was used to authorize 5874 the storage. This set of rules makes questions of authorization and 5875 data integrity - which have historically been thorny for overlays - 5876 relatively simple. 5878 12.5.1. Authorization 5880 When a client wants to store some value, it first digitally signs the 5881 value with its own private key. It then sends a Store request that 5882 contains both the value and the signature towards the storing peer 5883 (which is defined by the Resource Name construction algorithm for 5884 that particular kind of value). 5886 When the storing peer receives the request, it must determine whether 5887 the storing client is authorized to store at this Resource-ID/Kind-ID 5888 pair. Determining this requires comparing the user's identity to the 5889 requirements of the access control model (see Section 6.3). If it 5890 satisfies those requirements the user is authorized to write, pending 5891 quota checks as described in the next section. 5893 For example, consider the certificate with the following properties: 5895 User name: alice@dht.example.com 5896 Node-ID: 013456789abcdef 5897 Serial: 1234 5899 If Alice wishes to Store a value of the "SIP Location" kind, the 5900 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 5901 Resource-ID will be determined by hashing the Resource Name. Because 5902 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 5903 the user name in the certificate hashes to the requested Resource-ID. 5904 It then verifies that the node-id in the certificate matches the 5905 dictionary key being used for the store. If both of these checks 5906 succeed, the Store is authorized. Note that because the access 5907 control model is different for different kinds, the exact set of 5908 checks will vary. 5910 12.5.2. Distributed Quota 5912 Being a peer in an Overlay Instance carries with it the 5913 responsibility to store data for a given region of the Overlay 5914 Instance. However, allowing clients to store unlimited amounts of 5915 data would create unacceptable burdens on peers and would also enable 5916 trivial denial of service attacks. RELOAD addresses this issue by 5917 requiring configurations to define maximum sizes for each kind of 5918 stored data. Attempts to store values exceeding this size MUST be 5919 rejected (if peers are inconsistent about this, then strange 5920 artifacts will happen when the zone of responsibility shifts and a 5921 different peer becomes responsible for overlarge data). Because each 5922 Resource-ID/Kind-ID pair is bound to a small set of certificates, 5923 these size restrictions also create a distributed quota mechanism, 5924 with the quotas administered by the central enrollment server. 5926 Allowing different kinds of data to have different size restrictions 5927 allows new usages the flexibility to define limits that fit their 5928 needs without requiring all usages to have expansive limits. 5930 12.5.3. Correctness 5932 Because each stored value is signed, it is trivial for any retrieving 5933 peer to verify the integrity of the stored value. Some more care 5934 needs to be taken to prevent version rollback attacks. Rollback 5935 attacks on storage are prevented by the use of store times and 5936 lifetime values in each store. A lifetime represents the latest time 5937 at which the data is valid and thus limits (though does not 5938 completely prevent) the ability of the storing node to perform a 5939 rollback attack on retrievers. In order to prevent a rollback attack 5940 at the time of the Store request, we require that storage times be 5941 monotonically increasing. Storing peers MUST reject Store requests 5942 with storage times smaller than or equal to those they are currently 5943 storing. In addition, a fetching node which receives a data value 5944 with a storage time older than the result of the previous fetch knows 5945 a rollback has occurred. 5947 12.5.4. Residual Attacks 5949 The mechanisms described here provides a high degree of security, but 5950 some attacks remain possible. Most simply, it is possible for 5951 storing nodes to refuse to store a value (i.e., reject any request). 5952 In addition, a storing node can deny knowledge of values which it has 5953 previously accepted. To some extent these attacks can be ameliorated 5954 by attempting to store to/retrieve from replicas, but a retrieving 5955 client does not know whether it should try this or not, since there 5956 is a cost to doing so. 5958 The certificate-based authentication scheme prevents a single peer 5959 from being able to forge data owned by other peers. Furthermore, 5960 although a subversive peer can refuse to return data resources for 5961 which it is responsible, it cannot return forged data because it 5962 cannot provide authentication for such registrations. Therefore 5963 parallel searches for redundant registrations can mitigate most of 5964 the effects of a compromised peer. The ultimate reliability of such 5965 an overlay is a statistical question based on the replication factor 5966 and the percentage of compromised peers. 5968 In addition, when a kind is multivalued (e.g., an array data model), 5969 the storing node can return only some subset of the values, thus 5970 biasing its responses. This can be countered by using single values 5971 rather than sets, but that makes coordination between multiple 5972 storing agents much more difficult. This is a trade off that must be 5973 made when designing any usage. 5975 12.6. Routing Security 5977 Because the storage security system guarantees (within limits) the 5978 integrity of the stored data, routing security focuses on stopping 5979 the attacker from performing a DOS attack that misroutes requests in 5980 the overlay. There are a few obvious observations to make about 5981 this. First, it is easy to ensure that an attacker is at least a 5982 valid peer in the Overlay Instance. Second, this is a DOS attack 5983 only. Third, if a large percentage of the peers on the Overlay 5984 Instance are controlled by the attacker, it is probably impossible to 5985 perfectly secure against this. 5987 12.6.1. Background 5989 In general, attacks on DHT routing are mounted by the attacker 5990 arranging to route traffic through one or two nodes it controls. In 5991 the Eclipse attack [Eclipse] the attacker tampers with messages to 5992 and from nodes for which it is on-path with respect to a given victim 5993 node. This allows it to pretend to be all the nodes that are 5994 reachable through it. In the Sybil attack [Sybil], the attacker 5995 registers a large number of nodes and is therefore able to capture a 5996 large amount of the traffic through the DHT. 5998 Both the Eclipse and Sybil attacks require the attacker to be able to 5999 exercise control over her Peer-IDs. The Sybil attack requires the 6000 creation of a large number of peers. The Eclipse attack requires 6001 that the attacker be able to impersonate specific peers. In both 6002 cases, these attacks are limited by the use of centralized, 6003 certificate-based admission control. 6005 12.6.2. Admissions Control 6007 Admission to a RELOAD Overlay Instance is controlled by requiring 6008 that each peer have a certificate containing its Peer-ID. The 6009 requirement to have a certificate is enforced by using certificate- 6010 based mutual authentication on each connection. (Note: the 6011 following only applies when self-signed certificates are not used.) 6012 Whenever a peer connects to another peer, each side automatically 6013 checks that the other has a suitable certificate. These Peer-IDs are 6014 randomly assigned by the central enrollment server. This has two 6015 benefits: 6017 o It allows the enrollment server to limit the number of peer IDs 6018 issued to any individual user. 6019 o It prevents the attacker from choosing specific Peer-IDs. 6021 The first property allows protection against Sybil attacks (provided 6022 the enrollment server uses strict rate limiting policies). The 6023 second property deters but does not completely prevent Eclipse 6024 attacks. Because an Eclipse attacker must impersonate peers on the 6025 other side of the attacker, he must have a certificate for suitable 6026 Peer-IDs, which requires him to repeatedly query the enrollment 6027 server for new certificates, which will match only by chance. From 6028 the attacker's perspective, the difficulty is that if he only has a 6029 small number of certificates, the region of the Overlay Instance he 6030 is impersonating appears to be very sparsely populated by comparison 6031 to the victim's local region. 6033 12.6.3. Peer Identification and Authentication 6035 In general, whenever a peer engages in overlay activity that might 6036 affect the routing table it must establish its identity. This 6037 happens in two ways. First, whenever a peer establishes a direct 6038 connection to another peer it authenticates via certificate-based 6039 mutual authentication. All messages between peers are sent over this 6040 protected channel and therefore the peers can verify the data origin 6041 of the last hop peer for requests and responses without further 6042 cryptography. 6044 In some situations, however, it is desirable to be able to establish 6045 the identity of a peer with whom one is not directly connected. The 6046 most natural case is when a peer Updates its state. At this point, 6047 other peers may need to update their view of the overlay structure, 6048 but they need to verify that the Update message came from the actual 6049 peer rather than from an attacker. To prevent this, all overlay 6050 routing messages are signed by the peer that generated them. 6052 Replay is typically prevented for messages that impact the topology 6053 of the overlay by having the information come directly, or be 6054 verified by, the nodes that claimed to have generated the update. 6055 Data storage replay detection is done by signing time of the node 6056 that generated the signature on the store request thus providing a 6057 time based replay protection but the time synchronization is only 6058 needed between peers that can write to the same location. 6060 12.6.4. Protecting the Signaling 6062 The goal here is to stop an attacker from knowing who is signaling 6063 what to whom. An attacker is unlikely to be able to observe the 6064 activities of a specific individual given the randomization of IDs 6065 and routing based on the present peers discussed above. Furthermore, 6066 because messages can be routed using only the header information, the 6067 actual body of the RELOAD message can be encrypted during 6068 transmission. 6070 There are two lines of defense here. The first is the use of TLS or 6071 DTLS for each communications link between peers. This provides 6072 protection against attackers who are not members of the overlay. The 6073 second line of defense is to digitally sign each message. This 6074 prevents adversarial peers from modifying messages in flight, even if 6075 they are on the routing path. 6077 12.6.5. Residual Attacks 6079 The routing security mechanisms in RELOAD are designed to contain 6080 rather than eliminate attacks on routing. It is still possible for 6081 an attacker to mount a variety of attacks. In particular, if an 6082 attacker is able to take up a position on the overlay routing between 6083 A and B it can make it appear as if B does not exist or is 6084 disconnected. It can also advertise false network metrics in an 6085 attempt to reroute traffic. However, these are primarily DOS 6086 attacks. 6088 The certificate-based security scheme secures the namespace, but if 6089 an individual peer is compromised or if an attacker obtains a 6090 certificate from the CA, then a number of subversive peers can still 6091 appear in the overlay. While these peers cannot falsify responses to 6092 resource queries, they can respond with error messages, effecting a 6093 DoS attack on the resource registration. They can also subvert 6094 routing to other compromised peers. To defend against such attacks, 6095 a resource search must still consist of parallel searches for 6096 replicated registrations. 6098 13. IANA Considerations 6100 This section contains the new code points registered by this 6101 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6102 the RFC number for this specification in the following list.] 6104 13.1. Well-Known URI Registration 6106 IANA will make the following "Well Known URI" registration as 6107 described in [RFC5785]: 6109 [[Note to RFC Editor - this paragraph can be removed before 6110 publication. ]] A review request was sent to 6111 wellknown-uri-review@ietf.org on October 12, 2010. 6113 +----------------------------+----------------------+ 6114 | URI suffix: | p2psip-enroll | 6115 | Change controller: | IETF | 6116 | Specification document(s): | [RFC-AAAA] | 6117 | Related information: | None | 6118 +----------------------------+----------------------+ 6120 13.2. Port Registrations 6122 [[Note to RFC Editor - this paragraph can be removed before 6123 publication. ]] IANA has already allocated a TCP port for the main 6124 peer to peer protocol. This port has the name p2p-sip and the port 6125 number of 6084. IANA will update this registration to be defined for 6126 UDP as well as TCP. 6128 IANA will make the following port registration: 6130 +------------------------------+------------------------------------+ 6131 | Registration Technical | Cullen Jennings | 6132 | Contact | | 6133 | Registration Owner | IETF | 6134 | Transport Protocol | TCP | 6135 | Port Number | TBD | 6136 | Service Name | p2psip-enroll | 6137 | Description | Peer to Peer Infrastructure | 6138 | | Enrollment | 6139 | Reference | [RFC-AAAA] | 6140 +------------------------------+------------------------------------+ 6142 13.3. Overlay Algorithm Types 6144 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6145 Entries in this registry are strings denoting the names of overlay 6146 algorithms. The registration policy for this registry is RFC 5226 6147 IETF Review. The initial contents of this registry are: 6149 +----------------+----------+ 6150 | Algorithm Name | RFC | 6151 +----------------+----------+ 6152 | chord-reload | RFC-AAAA | 6153 +----------------+----------+ 6155 13.4. Access Control Policies 6157 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6158 in this registry are strings denoting access control policies, as 6159 described in Section 6.3. New entries in this registry SHALL be 6160 registered via RFC 5226 Standards Action. The initial contents of 6161 this registry are: 6163 +-----------------+----------+ 6164 | Access Policy | RFC | 6165 +-----------------+----------+ 6166 | USER-MATCH | RFC-AAAA | 6167 | NODE-MATCH | RFC-AAAA | 6168 | USER-NODE-MATCH | RFC-AAAA | 6169 | NODE-MULTIPLE | RFC-AAAA | 6170 +-----------------+----------+ 6172 13.5. Application-ID 6174 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6175 this registry are 16-bit integers denoting application kinds. Code 6176 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6177 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6178 registered via RFC 5226 Expert Review. Code points in the range 6179 0xf001 to 0xfffe are reserved for private use. The initial contents 6180 of this registry are: 6182 +-------------+----------------+-------------------------------+ 6183 | Application | Application-ID | Specification | 6184 +-------------+----------------+-------------------------------+ 6185 | INVALID | 0 | RFC-AAAA | 6186 | RELOAD | 1 | RFC-AAAA | 6187 | SIP | 5060 | Reserved for use by SIP Usage | 6188 | SIP | 5061 | Reserved for use by SIP Usage | 6189 | Reserved | 0xffff | RFC-AAAA | 6190 +-------------+----------------+-------------------------------+ 6192 13.6. Data Kind-ID 6194 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6195 registry are 32-bit integers denoting data kinds, as described in 6196 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 6197 SHALL be registered via RFC 5226 Standards Action. Code points in 6198 the range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 6199 Expert Review. Code points in the range 0xf0000001 to 0xfffffffe are 6200 reserved for private use via the kind description mechanism described 6201 in Section 10. The initial contents of this registry are: 6203 +---------------------+------------+----------+ 6204 | Kind | Kind-ID | RFC | 6205 +---------------------+------------+----------+ 6206 | INVALID | 0 | RFC-AAAA | 6207 | TURN_SERVICE | 2 | RFC-AAAA | 6208 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6209 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6210 | Reserved | 0x7fffffff | RFC-AAAA | 6211 | Reserved | 0xfffffffe | RFC-AAAA | 6212 +---------------------+------------+----------+ 6214 13.7. Data Model 6216 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6217 registry are 8-bit integers denoting data models, as described in 6218 Section 6.2. Code points in this registry SHALL be registered via 6219 RFC 5226 Standards Action. The initial contents of this registry 6220 are: 6222 +--------------+------+----------+ 6223 | Data Model | Code | RFC | 6224 +--------------+------+----------+ 6225 | INVALID | 0 | RFC-AAAA | 6226 | SINGLE_VALUE | 1 | RFC-AAAA | 6227 | ARRAY | 2 | RFC-AAAA | 6228 | DICTIONARY | 3 | RFC-AAAA | 6229 | RESERVED | 255 | RFC-AAAA | 6230 +--------------+------+----------+ 6232 13.8. Message Codes 6234 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6235 registry are 16-bit integers denoting method codes as described in 6236 Section 5.3.3. These codes SHALL be registered via RFC 5226 6237 Standards Action. The initial contents of this registry are: 6239 +---------------------------------+----------------+----------+ 6240 | Message Code Name | Code Value | RFC | 6241 +---------------------------------+----------------+----------+ 6242 | invalid | 0 | RFC-AAAA | 6243 | probe_req | 1 | RFC-AAAA | 6244 | probe_ans | 2 | RFC-AAAA | 6245 | attach_req | 3 | RFC-AAAA | 6246 | attach_ans | 4 | RFC-AAAA | 6247 | unused | 5 | | 6248 | unused | 6 | | 6249 | store_req | 7 | RFC-AAAA | 6250 | store_ans | 8 | RFC-AAAA | 6251 | fetch_req | 9 | RFC-AAAA | 6252 | fetch_ans | 10 | RFC-AAAA | 6253 | remove_req | 11 | RFC-AAAA | 6254 | remove_ans | 12 | RFC-AAAA | 6255 | find_req | 13 | RFC-AAAA | 6256 | find_ans | 14 | RFC-AAAA | 6257 | join_req | 15 | RFC-AAAA | 6258 | join_ans | 16 | RFC-AAAA | 6259 | leave_req | 17 | RFC-AAAA | 6260 | leave_ans | 18 | RFC-AAAA | 6261 | update_req | 19 | RFC-AAAA | 6262 | update_ans | 20 | RFC-AAAA | 6263 | route_query_req | 21 | RFC-AAAA | 6264 | route_query_ans | 22 | RFC-AAAA | 6265 | ping_req | 23 | RFC-AAAA | 6266 | ping_ans | 24 | RFC-AAAA | 6267 | stat_req | 25 | RFC-AAAA | 6268 | stat_ans | 26 | RFC-AAAA | 6269 | unused (was attachlite_req) | 27 | RFC-AAAA | 6270 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6271 | app_attach_req | 29 | RFC-AAAA | 6272 | app_attach_ans | 30 | RFC-AAAA | 6273 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6274 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6275 | reserved | 0x8000..0xfffe | RFC-AAAA | 6276 | error | 0xffff | RFC-AAAA | 6277 +---------------------------------+----------------+----------+ 6279 13.9. Error Codes 6281 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6282 registry are 16-bit integers denoting error codes. New entries SHALL 6283 be defined via RFC 5226 Standards Action. The initial contents of 6284 this registry are: 6286 +-------------------------------------+----------------+----------+ 6287 | Error Code Name | Code Value | RFC | 6288 +-------------------------------------+----------------+----------+ 6289 | invalid | 0 | RFC-AAAA | 6290 | Unused | 1 | RFC-AAAA | 6291 | Error_Forbidden | 2 | RFC-AAAA | 6292 | Error_Not_Found | 3 | RFC-AAAA | 6293 | Error_Request_Timeout | 4 | RFC-AAAA | 6294 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6295 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6296 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6297 | Error_Data_Too_Large | 8 | RFC-AAAA | 6298 | Error_Data_Too_Old | 9 | RFC-AAAA | 6299 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6300 | Error_Message_Too_Large | 11 | RFC-AAAA | 6301 | Error_Unknown_Kind | 12 | RFC-AAAA | 6302 | Error_Unknown_Extension | 13 | RFC-AAAA | 6303 | Error_Response_Too_Large | 14 | RFC-AAAA | 6304 | Error_Config_Too_Old | 15 | RFC-AAAA | 6305 | Error_Config_Too_New | 16 | RFC-AAAA | 6306 | reserved | 0x8000..0xfffe | RFC-AAAA | 6307 +-------------------------------------+----------------+----------+ 6309 13.10. Overlay Link Types 6311 IANA shall create a "RELOAD Overlay Link." New entries SHALL be 6312 defined via RFC 5226 Standards Action. This registry SHALL be 6313 initially populated with the following values: 6315 +--------------------+------+---------------+ 6316 | Protocol | Code | Specification | 6317 +--------------------+------+---------------+ 6318 | reserved | 0 | RFC-AAAA | 6319 | DTLS-UDP-SR | 1 | RFC-AAAA | 6320 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6321 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6322 | reserved | 255 | RFC-AAAA | 6323 +--------------------+------+---------------+ 6325 13.11. Overlay Link Protocols 6327 IANA shall create an "Overlay Link Protocol Registry". Entries in 6328 this registry SHALL be defined via RFC 5226 Standards Action. This 6329 registry SHALL be initially populated with the following value: 6330 "TLS". 6332 13.12. Forwarding Options 6334 IANA shall create a "Forwarding Option Registry". Entries in this 6335 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6336 Action. Entries in this registry between 128 and 254 SHALL be 6337 defined via RFC 5226 Specification Required. This registry SHALL be 6338 initially populated with the following values: 6340 +-------------------+------+---------------+ 6341 | Forwarding Option | Code | Specification | 6342 +-------------------+------+---------------+ 6343 | invalid | 0 | RFC-AAAA | 6344 | reserved | 255 | RFC-AAAA | 6345 +-------------------+------+---------------+ 6347 13.13. Probe Information Types 6349 IANA shall create a "RELOAD Probe Information Type Registry". 6350 Entries in this registry SHALL be defined via RFC 5226 Standards 6351 Action. This registry SHALL be initially populated with the 6352 following values: 6354 +-----------------+------+---------------+ 6355 | Probe Option | Code | Specification | 6356 +-----------------+------+---------------+ 6357 | invalid | 0 | RFC-AAAA | 6358 | responsible_set | 1 | RFC-AAAA | 6359 | num_resources | 2 | RFC-AAAA | 6360 | uptime | 3 | RFC-AAAA | 6361 | reserved | 255 | RFC-AAAA | 6362 +-----------------+------+---------------+ 6364 13.14. Message Extensions 6366 IANA shall create a "RELOAD Extensions Registry". Entries in this 6367 registry SHALL be defined via RFC 5226 Specification Required. This 6368 registry SHALL be initially populated with the following values: 6370 +-----------------+--------+---------------+ 6371 | Extensions Name | Code | Specification | 6372 +-----------------+--------+---------------+ 6373 | invalid | 0 | RFC-AAAA | 6374 | reserved | 0xFFFF | RFC-AAAA | 6375 +-----------------+--------+---------------+ 6377 13.15. reload URI Scheme 6379 This section describes the scheme for a reload URI, which can be used 6380 to refer to either: 6382 o A peer. 6383 o A resource inside a peer. 6385 The reload URI is defined using a subset of the URI schema specified 6386 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6387 [RFC4395] per the following ABNF syntax: 6389 RELOAD-URI = "reload://" destination "@" overlay "/" 6390 [specifier] 6392 destination = 1 * HEXDIG 6393 overlay = reg-name 6394 specifier = 1*HEXDIG 6396 The definitions of these productions are as follows: 6398 destination: a hex-encoded Destination List object. 6400 overlay: the name of the overlay. 6402 specifier : a hex-encoded StoredDataSpecifier indicating the data 6403 element. 6405 If no specifier is present then this URI addresses the peer which can 6406 be reached via the indicated destination list at the indicated 6407 overlay name. If a specifier is present, then the URI addresses the 6408 data value. 6410 13.15.1. URI Registration 6412 [[ Note to RFC Editor - please remove this paragraph before 6413 publication. ]] Review request was sent to uri-review@ietf.org on Oct 6414 7, 2010. 6416 The following summarizes the information necessary to register the 6417 reload URI. 6419 URI Scheme Name: reload 6420 Status: permanent 6421 URI Scheme Syntax: see Section 13.15 of RFC-AAAA 6422 URI Scheme Semantics: The reload URI is intended to be used as a 6423 reference to a RELOAD peer or resource. 6424 Encoding Considerations: The reload URI is not intended to be human- 6425 readable text, so it is encoded entirely in US-ASCII. 6426 Applications/protocols that use this URI scheme: The RELOAD protocol 6427 described in RFC-AAAA. 6428 Interoperability considerations: See RFC-AAAA. 6429 Security considerations: See RFC-AAAA 6430 Contact: Cullen Jennings 6431 Author/Change controller: IESG 6432 References: RFC-AAAA 6434 14. Acknowledgments 6436 This specification is a merge of the "REsource LOcation And Discovery 6437 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6438 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6439 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6440 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6441 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6442 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6443 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6444 Matuszewski. Thanks to the authors of RFC 5389 for text included 6445 from that. Vidya Narayanan provided many comments and improvements. 6447 The ideas and text for the Chord specific extension data to the Leave 6448 mechanisms was provided by J. Maenpaa, G. Camarillo, and J. 6449 Hautakorpi. 6451 Thanks to the many people who contributed including Ted Hardie, 6452 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6453 David Bryan, Dave Craig, and Julian Cain. Extensive working last 6454 call comments were provided by: Jouni Maenpaa, Roni Even, Ari 6455 Keranen, John Buford, Michael Chen, Frederic-Philippe Met, and David 6456 Bryan. 6458 15. References 6460 15.1. Normative References 6462 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6463 Requirement Levels", BCP 14, RFC 2119, March 1997. 6465 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 6466 (ICE): A Protocol for Network Address Translator (NAT) 6467 Traversal for Offer/Answer Protocols", RFC 5245, 6468 April 2010. 6470 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 6471 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 6472 October 2008. 6474 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 6475 Relays around NAT (TURN): Relay Extensions to Session 6476 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 6478 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6479 (CMC): Transport Protocols", RFC 5273, June 2008. 6481 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6482 (CMC)", RFC 5272, June 2008. 6484 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6485 for Transport Layer Security (TLS)", RFC 4279, 6486 December 2005. 6488 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6489 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6491 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6492 Security", RFC 4347, April 2006. 6494 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 6495 Friendly Rate Control (TFRC): Protocol Specification", 6496 RFC 5348, September 2008. 6498 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6499 Encodings", RFC 4648, October 2006. 6501 [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission 6502 Timer", RFC 2988, November 2000. 6504 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6505 Resource Identifier (URI): Generic Syntax", STD 66, 6506 RFC 3986, January 2005. 6508 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6509 Registration Procedures for New URI Schemes", BCP 35, 6510 RFC 4395, February 2006. 6512 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6514 [I-D.ietf-6man-text-addr-representation] 6515 Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 6516 Address Text Representation", 6517 draft-ietf-6man-text-addr-representation-07 (work in 6518 progress), February 2010. 6520 15.2. Informative References 6522 [I-D.ietf-mmusic-ice-tcp] 6523 Rosenberg, J., "TCP Candidates with Interactive 6524 Connectivity Establishment (ICE)", 6525 draft-ietf-mmusic-ice-tcp-07 (work in progress), 6526 July 2008. 6528 [I-D.maenpaa-p2psip-self-tuning] 6529 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 6530 tuning Distributed Hash Table (DHT) for REsource LOcation 6531 And Discovery (RELOAD)", 6532 draft-maenpaa-p2psip-self-tuning-01 (work in progress), 6533 October 2009. 6535 [I-D.baset-tsvwg-tcp-over-udp] 6536 Baset, S. and H. Schulzrinne, "TCP-over-UDP", 6537 draft-baset-tsvwg-tcp-over-udp-01 (work in progress), 6538 June 2009. 6540 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 6541 "Host Identity Protocol", RFC 5201, April 2008. 6543 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 6544 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 6545 April 2007. 6547 [I-D.ietf-p2psip-concepts] 6548 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 6549 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 6550 draft-ietf-p2psip-concepts-02 (work in progress), 6551 July 2008. 6553 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6554 Communication Layers", STD 3, RFC 1122, October 1989. 6556 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 6557 the Session Description Protocol (SDP)", RFC 4145, 6558 September 2005. 6560 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6561 Requirements for Security", BCP 106, RFC 4086, June 2005. 6563 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 6564 "Using the Secure Remote Password (SRP) Protocol for TLS 6565 Authentication", RFC 5054, November 2007. 6567 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6568 Housley, R., and W. Polk, "Internet X.509 Public Key 6569 Infrastructure Certificate and Certificate Revocation List 6570 (CRL) Profile", RFC 5280, May 2008. 6572 [I-D.pascual-p2psip-clients] 6573 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 6574 Yongchao, "P2PSIP Clients", 6575 draft-pascual-p2psip-clients-01 (work in progress), 6576 February 2008. 6578 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 6579 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 6580 RFC 4787, January 2007. 6582 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 6583 L. Repka, "S/MIME Version 2 Message Specification", 6584 RFC 2311, March 1998. 6586 [I-D.jiang-p2psip-sep] 6587 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 6588 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 6589 February 2008. 6591 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 6592 Uniform Resource Identifiers (URIs)", RFC 5785, 6593 April 2010. 6595 [I-D.ietf-p2psip-sip] 6596 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 6597 H. Schulzrinne, "A SIP Usage for RELOAD", 6598 draft-ietf-p2psip-sip-01 (work in progress), March 2009. 6600 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 6602 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 6603 "Eclipse Attacks on Overlay Networks: Threats and 6604 Defenses", INFOCOM 2006, April 2006. 6606 [non-transitive-dhts-worlds05] 6607 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 6608 Stoica, "Non-Transitive Connectivity and DHTs", 6609 WORLDS'05. 6611 [lookups-churn-p2p06] 6612 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 6613 Improving DHT Lookup Performance under Churn", IEEE 6614 P2P'06. 6616 [bryan-design-hotp2p08] 6617 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 6618 a Versatile, Secure P2PSIP Communications Architecture for 6619 the Public Internet", Hot-P2P'08. 6621 [opendht-sigcomm05] 6622 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 6623 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 6624 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 6626 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 6627 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 6628 Scalable Peer-to-peer Lookup Protocol for Internet 6629 Applications", IEEE/ACM Transactions on Networking Volume 6630 11, Issue 1, 17-32, Feb 2003. 6632 [vulnerabilities-acsac04] 6633 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 6634 Threats in Structured Peer-to-Peer Systems: A Quantitative 6635 Analysis", ACSAC 2004. 6637 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 6638 Issues and Solutions in Peer-to-Peer Systems for Realtime 6639 Communications", RFC 5765, February 2010. 6641 [handling-churn-usenix04] 6642 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 6643 "Handling Churn in a DHT", In Proc. of the USENIX Annual 6644 Technical Conference June 2004 USENIX 2004. 6646 [minimizing-churn-sigcomm06] 6647 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 6648 in Distributed Systems", SIGCOMM 2006. 6650 Appendix A. Routing Alternatives 6652 Significant discussion has been focused on the selection of a routing 6653 algorithm for P2PSIP. This section discusses the motivations for 6654 selecting symmetric recursive routing for RELOAD and describes the 6655 extensions that would be required to support additional routing 6656 algorithms. 6658 A.1. Iterative vs Recursive 6660 Iterative routing has a number of advantages. It is easier to debug, 6661 consumes fewer resources on intermediate peers, and allows the 6662 querying peer to identify and route around misbehaving peers 6663 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 6664 iterative routing is intolerably expensive because a new connection 6665 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 6667 Iterative routing is supported through the Route_Query mechanism and 6668 is primarily intended for debugging. It also allows the querying 6669 peer to evaluate the routing decisions made by the peers at each hop, 6670 consider alternatives, and perhaps detect at what point the 6671 forwarding path fails. 6673 A.2. Symmetric vs Forward response 6675 An alternative to the symmetric recursive routing method used by 6676 RELOAD is Forward-Only routing, where the response is routed to the 6677 requester as if it were a new message initiated by the responder (in 6678 the previous example, Z sends the response to A as if it were sending 6679 a request). Forward-only routing requires no state in either the 6680 message or intermediate peers. 6682 The drawback of forward-only routing is that it does not work when 6683 the overlay is unstable. For example, if A is in the process of 6684 joining the overlay and is sending a Join request to Z, it is not yet 6685 reachable via forward routing. Even if it is established in the 6686 overlay, if network failures produce temporary instability, A may not 6687 be reachable (and may be trying to stabilize its network connectivity 6688 via Attach messages). 6690 Furthermore, forward-only responses are less likely to reach the 6691 querying peer than symmetric recursive ones are, because the forward 6692 path is more likely to have a failed peer than is the request path 6693 (which was just tested to route the request) 6694 [non-transitive-dhts-worlds05]. 6696 An extension to RELOAD that supports forward-only routing but relies 6697 on symmetric responses as a fallback would be possible, but due to 6698 the complexities of determining when to use forward-only and when to 6699 fallback to symmetric, we have chosen not to include it as an option 6700 at this point. 6702 A.3. Direct Response 6704 Another routing option is Direct Response routing, in which the 6705 response is returned directly to the querying node. In the previous 6706 example, if A encodes its IP address in the request, then Z can 6707 simply deliver the response directly to A. In the absence of NATs or 6708 other connectivity issues, this is the optimal routing technique. 6710 The challenge of implementing direct response is the presence of 6711 NATs. There are a number of complexities that must be addressed. In 6712 this discussion, we will continue our assumption that A issued the 6713 request and Z is generating the response. 6715 o The IP address listed by A may be unreachable, either due to NAT 6716 or firewall rules. Therefore, a direct response technique must 6717 fallback to symmetric response [non-transitive-dhts-worlds05]. 6718 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 6719 received the message (and the TLS negotiation will provide earlier 6720 confirmation that A is reachable), but this fallback requires a 6721 timeout that will increase the response latency whenever A is not 6722 reachable from Z. 6723 o Whenever A is behind a NAT it will have multiple candidate IP 6724 addresses, each of which must be advertised to ensure 6725 connectivity; therefore Z will need to attempt multiple 6726 connections to deliver the response. 6727 o One (or all) of A's candidate addresses may route from Z to a 6728 different device on the Internet. In the worst case these nodes 6729 may actually be running RELOAD on the same port. Therefore, it is 6730 absolutely necessary to establish a secure connection to 6731 authenticate A before delivering the response. This step 6732 diminishes the efficiency of direct response because multiple 6733 roundtrips are required before the message can be delivered. 6734 o If A is behind a NAT and does not have a connection already 6735 established with Z, there are only two ways the direct response 6736 will work. The first is that A and Z both be behind the same NAT, 6737 in which case the NAT is not involved. In the more common case, 6738 when Z is outside A's NAT, the response will only be received if 6739 A's NAT implements endpoint-independent filtering. As the choice 6740 of filtering mode conflates application transparency with security 6741 [RFC4787], and no clear recommendation is available, the 6742 prevalence of this feature in future devices remains unclear. 6744 An extension to RELOAD that supports direct response routing but 6745 relies on symmetric responses as a fallback would be possible, but 6746 due to the complexities of determining when to use direct response 6747 and when to fallback to symmetric, and the reduced performance for 6748 responses to peers behind restrictive NATs, we have chosen not to 6749 include it as an option at this point. 6751 A.4. Relay Peers 6753 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 6754 response by having A identify a peer, Q, that will be directly 6755 reachable by any other peer. A uses Attach to establish a connection 6756 with Q and advertises Q's IP address in the request sent to Z. Z 6757 sends the response to Q, which relays it to A. This then reduces the 6758 latency to two hops, plus Z negotiating a secure connection to Q. 6760 This technique relies on the relative population of nodes such as A 6761 that require relay peers and peers such as Q that are capable of 6762 serving as a relay peer. It also requires nodes to be able to 6763 identify which category they are in. This identification problem has 6764 turned out to be hard to solve and is still an open area of 6765 exploration. 6767 An extension to RELOAD that supports relay peers is possible, but due 6768 to the complexities of implementing such an alternative, we have not 6769 added such a feature to RELOAD at this point. 6771 A concept similar to relay peers, essentially choosing a relay peer 6772 at random, has previously been suggested to solve problems of 6773 pairwise non-transitivity [non-transitive-dhts-worlds05], but 6774 deterministic filtering provided by NATs makes random relay peers no 6775 more likely to work than the responding peer. 6777 A.5. Symmetric Route Stability 6779 A common concern about symmetric recursive routing has been that one 6780 or more peers along the request path may fail before the response is 6781 received. The significance of this problem essentially depends on 6782 the response latency of the overlay. An overlay that produces slow 6783 responses will be vulnerable to churn, whereas responses that are 6784 delivered very quickly are vulnerable only to failures that occur 6785 over that small interval. 6787 The other aspect of this issue is whether the request itself can be 6788 successfully delivered. Assuming typical connection maintenance 6789 intervals, the time period between the last maintenance and the 6790 request being sent will be orders of magnitude greater than the delay 6791 between the request being forwarded and the response being received. 6792 Therefore, if the path was stable enough to be available to route the 6793 request, it is almost certainly going to remain available to route 6794 the response. 6796 An overlay that is unstable enough to suffer this type of failure 6797 frequently is unlikely to be able to support reliable functionality 6798 regardless of the routing mechanism. However, regardless of the 6799 stability of the return path, studies show that in the event of high 6800 churn, iterative routing is a better solution to ensure request 6801 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 6803 Finally, because RELOAD retries the end-to-end request, that retry 6804 will address the issues of churn that remain. 6806 Appendix B. Why Clients? 6808 There are a wide variety of reasons a node may act as a client rather 6809 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 6810 some of those scenarios and how the client's behavior changes based 6811 on its capabilities. 6813 B.1. Why Not Only Peers? 6815 For a number of reasons, a particular node may be forced to act as a 6816 client even though it is willing to act as a peer. These include: 6818 o The node does not have appropriate network connectivity, typically 6819 because it has a low-bandwidth network connection. 6820 o The node may not have sufficient resources, such as computing 6821 power, storage space, or battery power. 6822 o The overlay algorithm may dictate specific requirements for peer 6823 selection. These may include participating in the overlay to 6824 determine trustworthiness; controlling the number of peers in the 6825 overlay to reduce overly-long routing paths; or ensuring minimum 6826 application uptime before a node can join as a peer. 6828 The ultimate criteria for a node to become a peer are determined by 6829 the overlay algorithm and specific deployment. A node acting as a 6830 client that has a full implementation of RELOAD and the appropriate 6831 overlay algorithm is capable of locating its responsible peer in the 6832 overlay and using Attach to establish a direct connection to that 6833 peer. In that way, it may elect to be reachable under either of the 6834 routing approaches listed above. Particularly for overlay algorithms 6835 that elect nodes to serve as peers based on trustworthiness or 6836 population, the overlay algorithm may require such a client to locate 6837 itself at a particular place in the overlay. 6839 B.2. Clients as Application-Level Agents 6841 SIP defines an extensive protocol for registration and security 6842 between a client and its registrar/proxy server(s). Any SIP device 6843 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 6844 peer that implements the server-side functionality required by the 6845 SIP protocol. In this case, the peer would be acting as if it were 6846 the user's peer, and would need the appropriate credentials for that 6847 user. 6849 Application-level support for clients is defined by a usage. A usage 6850 offering support for application-level clients should specify how the 6851 security of the system is maintained when the data is moved between 6852 the application and RELOAD layers. 6854 Authors' Addresses 6856 Cullen Jennings 6857 Cisco 6858 170 West Tasman Drive 6859 MS: SJC-21/2 6860 San Jose, CA 95134 6861 USA 6863 Phone: +1 408 421-9990 6864 Email: fluffy@cisco.com 6866 Bruce B. Lowekamp (editor) 6867 Skype 6868 Palo Alto, CA 6869 USA 6871 Email: bbl@lowekamp.net 6873 Eric Rescorla 6874 Skype 6875 8000 Marina Blvd 6876 Brisbane, CA 94005 6877 USA 6879 Phone: +1 650 678 2350 6880 Email: ekr@skype.net 6882 Salman A. Baset 6883 Columbia University 6884 1214 Amsterdam Avenue 6885 New York, NY 6886 USA 6888 Email: salman@cs.columbia.edu 6889 Henning Schulzrinne 6890 Columbia University 6891 1214 Amsterdam Avenue 6892 New York, NY 6893 USA 6895 Email: hgs@cs.columbia.edu