idnits 2.17.1 draft-ietf-p2psip-base-09.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 1811 has weird spacing: '...Options optio...' == Line 2074 has weird spacing: '...hReqAns con...' == Line 2111 has weird spacing: '...ionType type;...' == Line 2253 has weird spacing: '...te_type typ...' == Line 2312 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 (July 12, 2010) is 5031 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) -- Looks like a reference, but probably isn't: '16' on line 1709 -- Looks like a reference, but probably isn't: '0' on line 4483 == Missing Reference: 'RFC-AAAA' is mentioned on line 6051, but not defined ** Obsolete normative reference: RFC 5245 (Obsoleted by RFC 8445, RFC 8839) ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) ** Obsolete normative reference: RFC 5766 (Obsoleted by RFC 8656) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) ** Obsolete normative reference: RFC 2988 (Obsoleted by RFC 6298) ** Obsolete normative reference: RFC 4395 (Obsoleted by RFC 7595) == Outdated reference: A later version (-16) exists of draft-ietf-mmusic-ice-tcp-07 -- Obsolete informational reference (is this intentional?): RFC 5201 (Obsoleted by RFC 7401) == Outdated reference: A later version (-09) exists of draft-ietf-p2psip-concepts-02 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-01 Summary: 7 errors (**), 0 flaws (~~), 11 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: January 13, 2011 Skype 6 E. Rescorla 7 Network Resonance 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 July 12, 2010 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-09 16 Abstract 18 In this document the term BCP 78 and BCP 79 refer to RFC 3978 and RFC 19 3979 respectively. They refer only to those RFCs and not to any 20 documents that update or supersede them. 22 This specification defines REsource LOcation And Discovery (RELOAD), 23 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 24 P2P signaling protocol provides its clients with an abstract storage 25 and messaging service between a set of cooperating peers that form 26 the overlay network. RELOAD is designed to support a P2P Session 27 Initiation Protocol (P2PSIP) network, but can be utilized by other 28 applications with similar requirements by defining new usages that 29 specify the kinds of data that must be stored for a particular 30 application. RELOAD defines a security model based on a certificate 31 enrollment service that provides unique identities. NAT traversal is 32 a fundamental service of the protocol. RELOAD also allows access 33 from "client" nodes that do not need to route traffic or store data 34 for others. 36 Legal 38 This documents and the information contained therein are provided on 39 an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE 40 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE 41 IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL 42 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY 43 WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE 44 ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS 45 FOR A PARTICULAR PURPOSE. 47 Status of this Memo 48 This Internet-Draft is submitted in full conformance with the 49 provisions of BCP 78 and BCP 79. 51 Internet-Drafts are working documents of the Internet Engineering 52 Task Force (IETF). Note that other groups may also distribute 53 working documents as Internet-Drafts. The list of current Internet- 54 Drafts is at http://datatracker.ietf.org/drafts/current/. 56 Internet-Drafts are draft documents valid for a maximum of six months 57 and may be updated, replaced, or obsoleted by other documents at any 58 time. It is inappropriate to use Internet-Drafts as reference 59 material or to cite them other than as "work in progress." 61 This Internet-Draft will expire on January 13, 2011. 63 Copyright Notice 65 Copyright (c) 2010 IETF Trust and the persons identified as the 66 document authors. All rights reserved. 68 This document is subject to BCP 78 and the IETF Trust's Legal 69 Provisions Relating to IETF Documents 70 (http://trustee.ietf.org/license-info) in effect on the date of 71 publication of this document. Please review these documents 72 carefully, as they describe your rights and restrictions with respect 73 to this document. Code Components extracted from this document must 74 include Simplified BSD License text as described in Section 4.e of 75 the Trust Legal Provisions and are provided without warranty as 76 described in the Simplified BSD License. 78 This document may contain material from IETF Documents or IETF 79 Contributions published or made publicly available before November 80 10, 2008. The person(s) controlling the copyright in some of this 81 material may not have granted the IETF Trust the right to allow 82 modifications of such material outside the IETF Standards Process. 83 Without obtaining an adequate license from the person(s) controlling 84 the copyright in such materials, this document may not be modified 85 outside the IETF Standards Process, and derivative works of it may 86 not be created outside the IETF Standards Process, except to format 87 it for publication as an RFC or to translate it into languages other 88 than English. 90 Table of Contents 92 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 93 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 94 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 95 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 96 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 97 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 14 98 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 99 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 100 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 16 101 1.4. Structure of This Document . . . . . . . . . . . . . . . 17 102 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 103 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 20 104 3.1. Security and Identification . . . . . . . . . . . . . . 20 105 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 21 106 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 21 107 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 22 108 3.2.2. Minimum Functionality Requirements for Clients . . . 22 109 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 23 110 3.4. Connectivity Management . . . . . . . . . . . . . . . . 25 111 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 26 112 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 26 113 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 26 114 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 28 115 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 28 116 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 28 117 4. Application Support Overview . . . . . . . . . . . . . . . . 29 118 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 29 119 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 30 120 4.1.2. Usages . . . . . . . . . . . . . . . . . . . . . . . 31 121 4.1.3. Replication . . . . . . . . . . . . . . . . . . . . 31 122 4.2. Service Discovery . . . . . . . . . . . . . . . . . . . 32 123 4.3. Application Connectivity . . . . . . . . . . . . . . . . 32 124 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 33 125 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 33 126 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 33 127 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 34 128 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 35 129 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 35 130 5.2.1. Request Origination . . . . . . . . . . . . . . . . 35 131 5.2.2. Response Origination . . . . . . . . . . . . . . . . 36 132 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 37 133 5.3.1. Presentation Language . . . . . . . . . . . . . . . 37 134 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 38 135 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 40 136 5.3.2.1. Processing Configuration Sequence Numbers . . . . 43 137 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 43 138 5.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 46 139 5.3.2.4. Direct Return Response Forwarding Options . . . . 47 140 5.3.3. Message Contents Format . . . . . . . . . . . . . . 48 141 5.3.3.1. Response Codes and Response Errors . . . . . . . 49 142 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 51 143 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 54 144 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 54 145 5.4.2. Methods and types for use by topology plugins . . . 54 146 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 54 147 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 55 148 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 56 149 5.4.2.4. Route_Query . . . . . . . . . . . . . . . . . . . 56 150 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 57 151 5.5. Forwarding and Link Management Layer . . . . . . . . . . 59 152 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 60 153 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 60 154 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 63 155 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 63 156 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 63 157 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 64 158 5.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 65 159 5.5.1.7. Encoding the Attach Message . . . . . . . . . . . 65 160 5.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 66 161 5.5.1.9. Role Determination . . . . . . . . . . . . . . . 66 162 5.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 66 163 5.5.1.11. No ICE . . . . . . . . . . . . . . . . . . . . . 67 164 5.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 67 165 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 67 166 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 68 167 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 68 168 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 68 169 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 69 170 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 69 171 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 69 172 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 69 173 5.5.4. Config_Update . . . . . . . . . . . . . . . . . . . 70 174 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 70 175 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 71 176 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 72 177 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 73 178 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . 73 182 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 74 183 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 75 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 . . . . . . . . . . . . . . . 80 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 . . . . . . . . . . . . . . . . . . . . . . . 91 206 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 92 207 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 94 208 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 94 209 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 95 210 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 95 211 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 97 212 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 97 213 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 97 214 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 98 215 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 99 216 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 100 217 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 101 218 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 102 219 9.2. Routing . . . . . . . . . . . . . . . . . . . . . . . . 103 220 9.3. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 103 221 9.4. Joining . . . . . . . . . . . . . . . . . . . . . . . . 104 222 9.5. Routing Attaches . . . . . . . . . . . . . . . . . . . . 104 223 9.6. Updates . . . . . . . . . . . . . . . . . . . . . . . . 105 224 9.6.1. Handling Neighbor Failures . . . . . . . . . . . . . 106 225 9.6.2. Handling Finger Table Entry Failure . . . . . . . . 107 226 9.6.3. Receiving Updates . . . . . . . . . . . . . . . . . 107 227 9.6.4. Stabilization . . . . . . . . . . . . . . . . . . . 108 228 9.6.4.1. Updating neighbor table . . . . . . . . . . . . . 108 229 9.6.4.2. Refreshing finger table . . . . . . . . . . . . . 108 230 9.6.4.3. Adjusting finger table size . . . . . . . . . . . 109 231 9.6.4.4. Detecting partitioning . . . . . . . . . . . . . 110 232 9.7. Route Query . . . . . . . . . . . . . . . . . . . . . . 110 233 9.8. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 111 235 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 112 236 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 112 237 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 117 238 10.2. Discovery Through Enrollment Server . . . . . . . . . . 119 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. Port Registrations . . . . . . . . . . . . . . . . . . . 136 262 13.2. Overlay Algorithm Types . . . . . . . . . . . . . . . . 136 263 13.3. Access Control Policies . . . . . . . . . . . . . . . . 136 264 13.4. Application-ID . . . . . . . . . . . . . . . . . . . . . 137 265 13.5. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 137 266 13.6. Data Model . . . . . . . . . . . . . . . . . . . . . . . 138 267 13.7. Message Codes . . . . . . . . . . . . . . . . . . . . . 138 268 13.8. Error Codes . . . . . . . . . . . . . . . . . . . . . . 139 269 13.9. Overlay Link Types . . . . . . . . . . . . . . . . . . . 140 270 13.10. Forwarding Options . . . . . . . . . . . . . . . . . . . 140 271 13.11. Probe Information Types . . . . . . . . . . . . . . . . 141 272 13.12. Message Extensions . . . . . . . . . . . . . . . . . . . 141 273 13.13. reload URI Scheme . . . . . . . . . . . . . . . . . . . 141 274 13.13.1. URI Registration . . . . . . . . . . . . . . . . . . 142 275 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 142 276 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 143 277 15.1. Normative References . . . . . . . . . . . . . . . . . . 143 278 15.2. Informative References . . . . . . . . . . . . . . . . . 144 279 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 147 280 A.1. Changes since draft-ietf-p2psip-reload-04 . . . . . . . 147 281 A.2. Changes since draft-ietf-p2psip-reload-01 . . . . . . . 147 282 A.3. Changes since draft-ietf-p2psip-reload-00 . . . . . . . 148 283 A.4. Changes since draft-ietf-p2psip-base-00 . . . . . . . . 148 284 A.5. Changes since draft-ietf-p2psip-base-01 . . . . . . . . 148 285 A.6. Changes since draft-ietf-p2psip-base-01a . . . . . . . . 148 286 A.7. Changes since draft-ietf-p2psip-base-02 . . . . . . . . 149 287 Appendix B. Routing Alternatives . . . . . . . . . . . . . . . . 149 288 B.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 149 289 B.2. Symmetric vs Forward response . . . . . . . . . . . . . 149 290 B.3. Direct Response . . . . . . . . . . . . . . . . . . . . 150 291 B.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 151 292 B.5. Symmetric Route Stability . . . . . . . . . . . . . . . 152 293 Appendix C. Why Clients? . . . . . . . . . . . . . . . . . . . . 152 294 C.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 152 295 C.2. Clients as Application-Level Agents . . . . . . . . . . 153 296 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 153 298 1. Introduction 300 This document defines REsource LOcation And Discovery (RELOAD), a 301 peer-to-peer (P2P) signaling protocol for use on the Internet. It 302 provides a generic, self-organizing overlay network service, allowing 303 nodes to efficiently route messages to other nodes and to efficiently 304 store and retrieve data in the overlay. RELOAD provides several 305 features that are critical for a successful P2P protocol for the 306 Internet: 308 Security Framework: A P2P network will often be established among a 309 set of peers that do not trust each other. RELOAD leverages a 310 central enrollment server to provide credentials for each peer 311 which can then be used to authenticate each operation. This 312 greatly reduces the possible attack surface. 314 Usage Model: RELOAD is designed to support a variety of 315 applications, including P2P multimedia communications with the 316 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 317 the definition of new application usages, each of which can define 318 its own data types, along with the rules for their use. This 319 allows RELOAD to be used with new applications through a simple 320 documentation process that supplies the details for each 321 application. 323 NAT Traversal: RELOAD is designed to function in environments where 324 many if not most of the nodes are behind NATs or firewalls. 325 Operations for NAT traversal are part of the base design, 326 including using ICE to establish new RELOAD or application 327 protocol connections. 329 High Performance Routing: The very nature of overlay algorithms 330 introduces a requirement that peers participating in the P2P 331 network route requests on behalf of other peers in the network. 332 This introduces a load on those other peers, in the form of 333 bandwidth and processing power. RELOAD has been defined with a 334 simple, lightweight forwarding header, thus minimizing the amount 335 of effort required by intermediate peers. 337 Pluggable Overlay Algorithms: RELOAD has been designed with an 338 abstract interface to the overlay layer to simplify implementing a 339 variety of structured (DHT) and unstructured overlay algorithms. 340 This specification also defines how RELOAD is used with Chord, 341 which is mandatory to implement. Specifying a default "must 342 implement" overlay algorithm promotes interoperability, while 343 extensibility allows selection of overlay algorithms optimized for 344 a particular application. 346 These properties were designed specifically to meet the requirements 347 for a P2P protocol to support SIP. This document defines the base 348 protocol for the distributed storage and location service, as well as 349 critical usages for NAT traversal and security. The SIP Usage itself 350 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 351 limited to usage by SIP and could serve as a tool for supporting 352 other P2P applications with similar needs. RELOAD is also based on 353 the concepts introduced in [I-D.ietf-p2psip-concepts]. 355 1.1. Basic Setting 357 In this section, we provide a brief overview of the operational 358 setting for RELOAD. See the concepts document for more details. A 359 RELOAD Overlay Instance consists of a set of nodes arranged in a 360 connected graph. Each node in the overlay is assigned a numeric 361 Node-ID which, together with the specific overlay algorithm in use, 362 determines its position in the graph and the set of nodes it connects 363 to. The figure below shows a trivial example which isn't drawn from 364 any particular overlay algorithm, but was chosen for convenience of 365 representation. 367 +--------+ +--------+ +--------+ 368 | Node 10|--------------| Node 20|--------------| Node 30| 369 +--------+ +--------+ +--------+ 370 | | | 371 | | | 372 +--------+ +--------+ +--------+ 373 | Node 40|--------------| Node 50|--------------| Node 60| 374 +--------+ +--------+ +--------+ 375 | | | 376 | | | 377 +--------+ +--------+ +--------+ 378 | Node 70|--------------| Node 80|--------------| Node 90| 379 +--------+ +--------+ +--------+ 380 | 381 | 382 +--------+ 383 | Node 85| 384 |(Client)| 385 +--------+ 387 Because the graph is not fully connected, when a node wants to send a 388 message to another node, it may need to route it through the network. 389 For instance, Node 10 can talk directly to nodes 20 and 40, but not 390 to Node 70. In order to send a message to Node 70, it would first 391 send it to Node 40 with instructions to pass it along to Node 70. 392 Different overlay algorithms will have different connectivity graphs, 393 but the general idea behind all of them is to allow any node in the 394 graph to efficiently reach every other node within a small number of 395 hops. 397 The RELOAD network is not only a messaging network. It is also a 398 storage network. Records are stored under numeric addresses which 399 occupy the same space as node identifiers. Peers are responsible for 400 storing the data associated with some set of addresses as determined 401 by their Node-ID. For instance, we might say that every peer is 402 responsible for storing any data value which has an address less than 403 or equal to its own Node-ID, but greater than the next lowest 404 Node-ID. Thus, Node-20 would be responsible for storing values 405 11-20. 407 RELOAD also supports clients. These are nodes which have Node-IDs 408 but do not participate in routing or storage. For instance, in the 409 figure above Node 85 is a client. It can route to the rest of the 410 RELOAD network via Node 80, but no other node will route through it 411 and Node 90 is still responsible for all addresses between 81-90. We 412 refer to non-client nodes as peers. 414 Other applications (for instance, SIP) can be defined on top of 415 RELOAD and use these two basic RELOAD services to provide their own 416 services. 418 1.2. Architecture 420 RELOAD is fundamentally an overlay network. Therefore, it can be 421 divided into components that mimic the layering of the Internet 422 model[RFC1122]. 424 Application 426 +-------+ +-------+ 427 | SIP | | XMPP | ... 428 | Usage | | Usage | 429 +-------+ +-------+ 430 -------------------------------------- Messaging API 431 +------------------+ +---------+ 432 | Message |<--->| Storage | 433 | Transport | +---------+ 434 +------------------+ ^ 435 ^ ^ | 436 | v v 437 | +-------------------+ 438 | | Topology | 439 | | Plugin | 440 | +-------------------+ 441 | ^ 442 v v 443 +------------------+ 444 | Forwarding & | 445 | Link Management | 446 +------------------+ 447 -------------------------------------- Overlay Link API 448 +-------+ +------+ 449 |TLS | |DTLS | ... 450 +-------+ +------+ 452 The major components of RELOAD are: 454 Usage Layer: Each application defines a RELOAD usage; a set of data 455 kinds and behaviors which describe how to use the services 456 provided by RELOAD. These usages all talk to RELOAD through a 457 common Message Transport API. 459 Message Transport: Handles end-to-end reliability, manages request 460 state for the usages, and forwards Store and Fetch operations to 461 the Storage component. Delivers message responses to the 462 component initiating the request. 464 Storage: The Storage component is responsible for processing 465 messages relating to the storage and retrieval of data. It talks 466 directly to the Topology Plugin to manage data replication and 467 migration, and it talks to the Message Transport component to send 468 and receive messages. 470 Topology Plugin: The Topology Plugin is responsible for implementing 471 the specific overlay algorithm being used. It uses the Message 472 Transport component to send and receive overlay management 473 messages, to the Storage component to manage data replication, and 474 directly to the Forwarding Layer to control hop-by-hop message 475 forwarding. This component closely parallels conventional routing 476 algorithms, but is more tightly coupled to the Forwarding Layer 477 because there is no single "routing table" equivalent used by all 478 overlay algorithms. 480 Forwarding and Link Management Layer: Stores and implements the 481 routing table by providing packet forwarding services between 482 nodes. It also handles establishing new links between nodes, 483 including setting up connections across NATs using ICE. 485 Overlay Link Layer: TLS [RFC5246] and DTLS [RFC4347] are the "link 486 layer" protocols used by RELOAD for hop-by-hop communication. 487 Each such protocol includes the appropriate provisions for per-hop 488 framing or hop-by-hop ACKs required by unreliable transports. 490 To further clarify the roles of the various layers, this figure 491 parallels the architecture with each layer's role from an overlay 492 perspective and implementation layer in the internet: 494 | Internet Model | 495 Real | Equivalent | Reload 496 Internet | in Overlay | Architecture 497 -------------+-----------------+------------------------------------ 498 | | +-------+ +-------+ 499 | Application | | SIP | | XMPP | ... 500 | | | Usage | | Usage | 501 | | +-------+ +-------+ 502 | | ---------------------------------- 503 | |+------------------+ +---------+ 504 | Transport || Message |<--->| Storage | 505 | || Transport | +---------+ 506 | |+------------------+ ^ 507 | | ^ ^ | 508 | | | v v 509 Application | | | +-------------------+ 510 | (Routing) | | | Topology | 511 | | | | Plugin | 512 | | | +-------------------+ 513 | | | ^ 514 | | v v 515 | Network | +------------------+ 516 | | | Forwarding & | 517 | | | Link Management | 518 | | +------------------+ 519 | | ---------------------------------- 520 Transport | Link | +-------+ +------+ 521 | | |TLS | |DTLS | ... 522 | | +-------+ +------+ 523 -------------+-----------------+------------------------------------ 524 Network | 525 | 526 Link | 528 1.2.1. Usage Layer 530 The top layer, called the Usage Layer, has application usages, such 531 as the SIP Location Usage, that use the abstract Message Transport 532 API provided by RELOAD. The goal of this layer is to implement 533 application-specific usages of the generic overlay services provided 534 by RELOAD. The usage defines how a specific application maps its 535 data into something that can be stored in the overlay, where to store 536 the data, how to secure the data, and finally how applications can 537 retrieve and use the data. 539 The architecture diagram shows both a SIP usage and an XMPP usage. A 540 single application may require multiple usages; for example a SIP 541 application may also require a voicemail usage. A usage may define 542 multiple kinds of data that are stored in the overlay and may also 543 rely on kinds originally defined by other usages. 545 Because the security and storage policies for each kind are dictated 546 by the usage defining the kind, the usages may be coupled with the 547 Storage component to provide security policy enforcement and to 548 implement appropriate storage strategies according to the needs of 549 the usage. The exact implementation of such an interface is outside 550 the scope of this specification. 552 1.2.2. Message Transport 554 The Message Transport component provides a generic message routing 555 service for the overlay. The Message Transport layer is responsible 556 for end-to-end message transactions, including retransmissions. Each 557 peer is identified by its location in the overlay as determined by 558 its Node-ID. A component that is a client of the Message Transport 559 can perform two basic functions: 561 o Send a message to a given peer specified by Node-ID or to the peer 562 responsible for a particular Resource-ID. 563 o Receive messages that other peers send to a Node-ID or Resource-ID 564 for which the receiving peer is responsible. 566 All usages rely on the Message Transport component to send and 567 receive messages from peers. For instance, when a usage wants to 568 store data, it does so by sending Store requests. Note that the 569 Storage component and the Topology Plugin are themselves clients of 570 the Message Transport, because they need to send and receive messages 571 from other peers. 573 The Message Transport API is similar to those described as providing 574 "Key based routing" (KBR), although as RELOAD supports different 575 overlay algorithms (including non-DHT overlay algorithms) that 576 calculate keys in different ways, the actual interface must accept 577 Resource Names rather than actual keys. 579 1.2.3. Storage 581 One of the major functions of RELOAD is to allow nodes to store data 582 in the overlay and to retrieve data stored by other nodes or by 583 themselves. The Storage component is responsible for processing data 584 storage and retrieval messages. For instance, the Storage component 585 might receive a Store request for a given resource from the Message 586 Transport. It would then query the appropriate usage before storing 587 the data value(s) in its local data store and sending a response to 588 the Message Transport for delivery to the requesting node. 589 Typically, these messages will come from other nodes, but depending 590 on the overlay topology, a node might be responsible for storing data 591 for itself as well, especially if the overlay is small. 593 A peer's Node-ID determines the set of resources that it will be 594 responsible for storing. However, the exact mapping between these is 595 determined by the overlay algorithm in use. The Storage component 596 will only receive a Store request from the Message Transport if this 597 peer is responsible for that Resource-ID. The Storage component is 598 notified by the Topology Plugin when the Resource-IDs for which it is 599 responsible change, and the Storage component is then responsible for 600 migrating resources to other peers, as required. 602 1.2.4. Topology Plugin 604 RELOAD is explicitly designed to work with a variety of overlay 605 algorithms. In order to facilitate this, the overlay algorithm 606 implementation is provided by a Topology Plugin so that each overlay 607 can select an appropriate overlay algorithm that relies on the common 608 RELOAD core protocols and code. 610 The Topology Plugin is responsible for maintaining the overlay 611 algorithm Routing Table, which is consulted by the Forwarding and 612 Link Management Layer before routing a message. When connections are 613 made or broken, the Forwarding and Link Management Layer notifies the 614 Topology Plugin, which adjusts the routing table as appropriate. The 615 Topology Plugin will also instruct the Forwarding and Link Management 616 Layer to form new connections as dictated by the requirements of the 617 overlay algorithm Topology. The Topology Plugin issues periodic 618 update requests through Message Transport to maintain and update its 619 Routing Table. 621 As peers enter and leave, resources may be stored on different peers, 622 so the Topology Plugin also keeps track of which peers are 623 responsible for which resources. As peers join and leave, the 624 Topology Plugin instructs the Storage component to issue resource 625 migration requests as appropriate, in order to ensure that other 626 peers have whatever resources they are now responsible for. The 627 Topology Plugin is also responsible for providing for redundant data 628 storage to protect against loss of information in the event of a peer 629 failure and to protect against compromised or subversive peers. 631 1.2.5. Forwarding and Link Management Layer 633 The Forwarding and Link Management Layer is responsible for getting a 634 message to the next peer, as determined by the Topology Plugin. This 635 Layer establishes and maintains the network connections as required 636 by the Topology Plugin. This layer is also responsible for setting 637 up connections to other peers through NATs and firewalls using ICE, 638 and it can elect to forward traffic using relays for NAT and firewall 639 traversal. 641 This layer provides a generic interface that allows the topology 642 plugin to control the overlay and resource operations and messages. 643 Since each overlay algorithm is defined and functions differently, we 644 generically refer to the table of other peers that the overlay 645 algorithm maintains and uses to route requests (neighbors) as a 646 Routing Table. The Topology Plugin actually owns the Routing Table, 647 and forwarding decisions are made by querying the Topology Plugin for 648 the next hop for a particular Node-ID or Resource-ID. If this node 649 is the destination of the message, the message is delivered to the 650 Message Transport. 652 This layer may also utilize a framing header to encapsulate messages 653 as they are forwarding along each hop. Such a header may be used to 654 aid reliability, congestion control, flow control, etc. Any such 655 header has meaning only in the context of that individual link. 657 The Forwarding and Link Management Layer sits on top of the Overlay 658 Link Layer protocols that carry the actual traffic. This 659 specification defines how to use DTLS and TLS protocols to carry 660 RELOAD messages. 662 1.3. Security 664 RELOAD's security model is based on each node having one or more 665 public key certificates. In general, these certificates will be 666 assigned by a central server which also assigns Node-IDs, although 667 self-signed certificates can be used in closed networks. These 668 credentials can be leveraged to provide communications security for 669 RELOAD messages. RELOAD provides communications security at three 670 levels: 672 Connection Level: Connections between peers are secured with TLS 673 or DTLS. 674 Message Level: Each RELOAD message must be signed. 675 Object Level: Stored objects must be signed by the storing peer. 677 These three levels of security work together to allow peers to verify 678 the origin and correctness of data they receive from other peers, 679 even in the face of malicious activity by other peers in the overlay. 680 RELOAD also provides access control built on top of these 681 communications security features. Because the peer responsible for 682 storing a piece of data can validate the signature on the data being 683 stored, the responsible peer can determine whether a given operation 684 is permitted or not. 686 RELOAD also provides an optional shared secret based admission 687 control feature using shared secrets and TLS-PSK. This mode is 688 typically used when self-signed certificates are being used but would 689 generally not be used when the certificates were all signed by an 690 enrollment server. In order to form a TLS connection to any node in 691 the overlay, a new node needs to know the shared overlay key, thus 692 restricting access to authorized users only. This feature is used 693 together with certificate-based access control, not as a replacement 694 for it. 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 defined 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 identied iwht a unique IANA assinged intereger 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 128-bit value that uniquely identifies a node. Node-IDs 765 0 and 2^128 - 1 are reserved and are invalid Node-IDs. A value of 766 zero is not used in the wire protocol but can be used to indicate 767 an invalid node in implementations and APIs. The Node-ID of 768 2^128-1 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 globally unique. 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 and 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 C. 928 3.2.1. Client Routing 930 There are two routing options by which a client may be located in an 931 overlay. 933 o Establish a connection to the peer responsible for the client's 934 Node-ID in the overlay. Then requests may be sent from/to the 935 client using its Node-ID in the same manner as if it were a peer, 936 because the responsible peer in the overlay will handle the final 937 step of routing to the client. This may require a TURN relay in 938 cases where NATs or firewalls prevent a client from forming a 939 direct connections with its responsible peer. Note that clients 940 that choose this option MUST process Update messages from the 941 peer. Those updates can indicate that the peer no longer owns the 942 Client's Node-ID. The client then forms a connection to the 943 appropriate peer. Failure to do so will result in the client no 944 longer receiving messages. 945 o Establish a connection with an arbitrary peer in the overlay 946 (perhaps based on network proximity or an inability to establish a 947 direct connection with the responsible peer). In this case, the 948 client will rely on RELOAD's Destination List feature to ensure 949 reachability. The client can initiate requests, and any node in 950 the overlay that knows the Destination List to its current 951 location can reach it, but the client is not directly reachable 952 using only its Node-ID. The Destination List required to reach it 953 must be learnable via other mechanisms, such as being stored in 954 the overlay by a usage, if the client is to receive incoming 955 requests from other members of the overlay. 957 3.2.2. Minimum Functionality Requirements for Clients 959 A node may act as a client simply because it does not have the 960 resources or even an implementation of the topology plugin required 961 to act as a peer in the overlay. In order to exchange RELOAD 962 messages with a peer, a client must meet a minimum level of 963 functionality. Such a client must: 965 o Implement RELOAD's connection-management operations that are used 966 to establish the connection with the peer. 967 o Implement RELOAD's data retrieval methods (with client 968 functionality). 969 o Be able to calculate Resource-IDs used by the overlay. 970 o Possess security credentials required by the overlay it is 971 implementing. 973 A client speaks the same protocol as the peers, knows how to 974 calculate Resource-IDs, and signs its requests in the same manner as 975 peers. While a client does not necessarily require a full 976 implementation of the overlay algorithm, calculating the Resource-ID 977 requires an implementation of the appropriate algorithm for the 978 overlay. 980 3.3. Routing 982 This section will discuss the requirements RELOAD's routing 983 capabilities must meet, then describe the routing features in the 984 protocol, and then provide a brief overview of how they are used. 985 Appendix B discusses some alternative designs and the tradeoffs that 986 would be necessary to support them. 988 RELOAD's routing capabilities must meet the following requirements: 990 NAT Traversal: RELOAD must support establishing and using 991 connections between nodes separated by one or more NATs, including 992 locating peers behind NATs for those overlays allowing/requiring 993 it. 994 Clients: RELOAD must support requests from and to clients that do 995 not participate in overlay routing. 996 Client promotion: RELOAD must support clients that become peers at a 997 later point as determined by the overlay algorithm and deployment. 998 Low state: RELOAD's routing algorithms must not require 999 significant state to be stored on intermediate peers. 1000 Return routability in unstable topologies: At some points in 1001 times, different nodes may have inconsistent information about the 1002 connectivity of the routing graph. In all cases, the response to 1003 a request needs to delivered to the node that sent the request and 1004 not to some other node. 1006 To meet these requirements, RELOAD's routing relies on two basic 1007 mechanisms: 1009 Via Lists: The forwarding header used by all RELOAD messages 1010 contains both a Via List (built hop-by-hop as the message is 1011 routed through the overlay) and a Destination List (providing 1012 source-routing capabilities for requests and return-path routing 1013 for responses). 1014 Route_Query: The Route_Query method allows a node to query a peer 1015 for the next hop it will use to route a message. This method is 1016 useful for diagnostics and for iterative routing. 1018 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1019 We will first describe symmetric routing and then discuss its 1020 advantages in terms of the requirements discussed above. 1022 Symmetric recursive routing requires that a message follow the path 1023 through the overlay to the destination without returning to the 1024 originating node: each peer forwards the message closer to its 1025 destination. The return path of the response is then the same path 1026 followed in reverse. For example, a message following a route from A 1027 to Z through B and X: 1029 A B X Z 1030 ------------------------------- 1032 ----------> 1033 Dest=Z 1034 ----------> 1035 Via=A 1036 Dest=Z 1037 ----------> 1038 Via=A, B 1039 Dest=Z 1041 <---------- 1042 Dest=X, B, A 1043 <---------- 1044 Dest=B, A 1045 <---------- 1046 Dest=A 1048 Note that the preceding Figure does not indicate whether A is a 1049 client or peer: A forwards its request to B and the response is 1050 returned to A in the same manner regardless of A's role in the 1051 overlay. 1053 This figure shows use of full via-lists by intermediate peers B and 1054 X. However, if B and/or X are willing to store state, then they may 1055 elect to truncate the lists, save that information internally (keyed 1056 by the transaction id), and return the response message along the 1057 path from which it was received when the response is received. This 1058 option requires greater state to be stored on intermediate peers but 1059 saves a small amount of bandwidth and reduces the need for modifying 1060 the message en route. Selection of this mode of operation is a 1061 choice for the individual peer; the techniques are interoperable even 1062 on a single message. The figure below shows B using full via lists 1063 but X truncating them and saving the state internally. 1065 A B X Z 1066 ------------------------------- 1068 ----------> 1069 Dest=Z 1070 ----------> 1071 Via=A 1072 Dest=Z 1073 ----------> 1074 Dest=Z 1076 <---------- 1077 Dest=X 1078 <---------- 1079 Dest=B, A 1080 <---------- 1081 Dest=A 1083 RELOAD also supports a basic Iterative routing mode (where the 1084 intermediate peers merely return a response indicating the next hop, 1085 but do not actually forward the message to that next hop themselves). 1086 Iterative routing is implemented using the Route_Query method, which 1087 requests this behavior. Note that iterative routing is selected only 1088 by the initiating node. 1090 3.4. Connectivity Management 1092 In order to provide efficient routing, a peer needs to maintain a set 1093 of direct connections to other peers in the Overlay Instance. Due to 1094 the presence of NATs, these connections often cannot be formed 1095 directly. Instead, we use the Attach request to establish a 1096 connection. Attach uses ICE [RFC5245] to establish the connection. 1097 It is assumed that the reader is familiar with ICE. 1099 Say that peer A wishes to form a direct connection to peer B. It 1100 gathers ICE candidates and packages them up in an Attach request 1101 which it sends to B through usual overlay routing procedures. B does 1102 its own candidate gathering and sends back a response with its 1103 candidates. A and B then do ICE connectivity checks on the candidate 1104 pairs. The result is a connection between A and B. At this point, A 1105 and B can add each other to their routing tables and send messages 1106 directly between themselves without going through other overlay 1107 peers. 1109 There is one special case in which Attach cannot be used: when a 1110 peer is joining the overlay and is not connected to any peers. In 1111 order to support this case, some small number of "bootstrap nodes" 1112 typically need to be publicly accessible so that new peers can 1113 directly connect to them. Section 10 contains more detail on this. 1115 In general, a peer needs to maintain connections to all of the peers 1116 near it in the Overlay Instance and to enough other peers to have 1117 efficient routing (the details depend on the specific overlay). If a 1118 peer cannot form a connection to some other peer, this isn't 1119 necessarily a disaster; overlays can route correctly even without 1120 fully connected links. However, a peer should try to maintain the 1121 specified link set and if it detects that it has fewer direct 1122 connections, should form more as required. This also implies that 1123 peers need to periodically verify that the connected peers are still 1124 alive and if not try to reform the connection or form an alternate 1125 one. 1127 3.5. Overlay Algorithm Support 1129 The Topology Plugin allows RELOAD to support a variety of overlay 1130 algorithms. This specification defines a DHT based on Chord [Chord], 1131 which is mandatory to implement, but the base RELOAD protocol is 1132 designed to support a variety of overlay algorithms. 1134 3.5.1. Support for Pluggable Overlay Algorithms 1136 RELOAD defines three methods for overlay maintenance: Join, Update, 1137 and Leave. However, the contents of those messages, when they are 1138 sent, and their precise semantics are specified by the actual overlay 1139 algorithm; RELOAD merely provides a framework of commonly-needed 1140 methods that provides uniformity of notation (and ease of debugging) 1141 for a variety of overlay algorithms. 1143 3.5.2. Joining, Leaving, and Maintenance Overview 1145 When a new peer wishes to join the Overlay Instance, it must have a 1146 Node-ID that it is allowed to use. When an enrollment server is used 1147 that Node-ID will be in the certificate the node received from the 1148 enrollment server. The details of the joining procedure are defined 1149 by the overlay algorithm, but the general steps for joining an 1150 Overlay Instance are: 1152 o Forming connections to some other peers. 1153 o Acquiring the data values this peer is responsible for storing. 1154 o Informing the other peers which were previously responsible for 1155 that data that this peer has taken over responsibility. 1157 The first thing the peer needs to do is to form a connection to some 1158 "bootstrap node". Because this is the first connection the peer 1159 makes, these nodes must have public IP addresses so that they can be 1160 connected to directly. Once a peer has connected to one or more 1161 bootstrap nodes, it can form connections in the usual way by routing 1162 Attach messages through the overlay to other nodes. Once a peer has 1163 connected to the overlay for the first time, it can cache the set of 1164 nodes it has connected to with public IP addresses for use as future 1165 bootstrap nodes. 1167 Once a peer has connected to a bootstrap node, it then needs to take 1168 up its appropriate place in the overlay. This requires two major 1169 operations: 1171 o Forming connections to other peers in the overlay to populate its 1172 Routing Table. 1173 o Getting a copy of the data it is now responsible for storing and 1174 assuming responsibility for that data. 1176 The second operation is performed by contacting the Admitting Peer 1177 (AP), the node which is currently responsible for that section of the 1178 overlay. 1180 The details of this operation depend mostly on the overlay algorithm 1181 involved, but a typical case would be: 1183 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1184 announcing its intention to join. 1185 2. AP sends a Join response. 1186 3. AP does a sequence of Stores to JP to give it the data it will 1187 need. 1188 4. AP does Updates to JP and to other peers to tell it about its own 1189 routing table. At this point, both JP and AP consider JP 1190 responsible for some section of the Overlay Instance. 1191 5. JP makes its own connections to the appropriate peers in the 1192 Overlay Instance. 1194 After this process is completed, JP is a full member of the Overlay 1195 Instance and can process Store/Fetch requests. 1197 Note that the first node is a special case. When ordinary nodes 1198 cannot form connections to the bootstrap nodes, then they are not 1199 part of the overlay. However, the first node in the overlay can 1200 obviously not connect to others nodes. In order to support this 1201 case, potential first nodes (which must also serve as bootstrap nodes 1202 initially) must somehow be instructed (perhaps by configuration 1203 settings) that they are the entire overlay, rather than not part of 1204 it. 1206 Note that clients do not perfom either of these operations. 1208 3.6. First-Time Setup 1210 Previous sections addressed how RELOAD works once a node has 1211 connected. This section provides an overview of how users get 1212 connected to the overlay for the first time. RELOAD is designed so 1213 that users can start with the name of the overlay they wish to join 1214 and perhaps a username and password, and leverage that into having a 1215 working peer with minimal user intervention. This helps avoid the 1216 problems that have been experienced with conventional SIP clients 1217 where users are required to manually configure a large number of 1218 settings. 1220 3.6.1. Initial Configuration 1222 In the first phase of the process, the user starts out with the name 1223 of the overlay and uses this to download an initial set of overlay 1224 configuration parameters. The node does a DNS SRV lookup on the 1225 overlay name to get the address of a configuration server. It can 1226 then connect to this server with HTTPS to download a configuration 1227 document which contains the basic overlay configuration parameters as 1228 well as a set of bootstrap nodes which can be used to join the 1229 overlay. 1231 If a node already has the valid configuration document that it 1232 received by some out of band method, this step can be skipped. 1234 3.6.2. Enrollment 1236 If the overlay is using centralized enrollment, then a user needs to 1237 acquire a certificate before joining the overlay. The certificate 1238 attests both to the user's name within the overlay and to the Node- 1239 IDs which they are permitted to operate. In that case, the 1240 configuration document will contain the address of an enrollment 1241 server which can be used to obtain such a certificate. The 1242 enrollment server may (and probably will) require some sort of 1243 username and password before issuing the certificate. The enrollment 1244 server's ability to restrict attackers' access to certificates in the 1245 overlay is one of the cornerstones of RELOAD's security. 1247 4. Application Support Overview 1249 RELOAD is not intended to be used alone, but rather as a substrate 1250 for other applications. These applications can use RELOAD for a 1251 variety of purposes: 1253 o To store data in the overlay and retrieve data stored by other 1254 nodes. 1255 o As a discovery mechanism for services such as TURN. 1256 o To form direct connections which can be used to transmit 1257 application-level messages without using the overlay. 1259 This section provides an overview of these services. 1261 4.1. Data Storage 1263 RELOAD provides operations to Store and Fetch data. Each location in 1264 the Overlay Instance is referenced by a Resource-ID. However, each 1265 location may contain data elements corresponding to multiple kinds 1266 (e.g., certificate, SIP registration). Similarly, there may be 1267 multiple elements of a given kind, as shown below: 1269 +--------------------------------+ 1270 | Resource-ID | 1271 | | 1272 | +------------+ +------------+ | 1273 | | Kind 1 | | Kind 2 | | 1274 | | | | | | 1275 | | +--------+ | | +--------+ | | 1276 | | | Value | | | | Value | | | 1277 | | +--------+ | | +--------+ | | 1278 | | | | | | 1279 | | +--------+ | | +--------+ | | 1280 | | | Value | | | | Value | | | 1281 | | +--------+ | | +--------+ | | 1282 | | | +------------+ | 1283 | | +--------+ | | 1284 | | | Value | | | 1285 | | +--------+ | | 1286 | +------------+ | 1287 +--------------------------------+ 1289 Each kind is identified by a Kind-ID, which is a code point assigned 1290 by IANA. As part of the kind definition, protocol designers may 1291 define constraints, such as limits on size, on the values which may 1292 be stored. For many kinds, the set may be restricted to a single 1293 value; some sets may be allowed to contain multiple identical items 1294 while others may only have unique items. Note that a kind may be 1295 employed by multiple usages and new usages are encouraged to use 1296 previously defined kinds where possible. We define the following 1297 data models in this document, though other usages can define their 1298 own structures: 1300 single value: There can be at most one item in the set and any value 1301 overwrites the previous item. 1303 array: Many values can be stored and addressed by a numeric index. 1305 dictionary: The values stored are indexed by a key. Often this key 1306 is one of the values from the certificate of the peer sending the 1307 Store request. 1309 In order to protect stored data from tampering, by other nodes, each 1310 stored value is digitally signed by the node which created it. When 1311 a value is retrieved, the digital signature can be verified to detect 1312 tampering. 1314 4.1.1. Storage Permissions 1316 A major issue in peer-to-peer storage networks is minimizing the 1317 burden of becoming a peer, and in particular minimizing the amount of 1318 data which any peer is required to store for other nodes. RELOAD 1319 addresses this issue by only allowing any given node to store data at 1320 a small number of locations in the overlay, with those locations 1321 being determined by the node's certificate. When a peer uses a Store 1322 request to place data at a location authorized by its certificate, it 1323 signs that data with the private key that corresponds to its 1324 certificate. Then the peer responsible for storing the data is able 1325 to verify that the peer issuing the request is authorized to make 1326 that request. Each data kind defines the exact rules for determining 1327 what certificate is appropriate. 1329 The most natural rule is that a certificate authorizes a user to 1330 store data keyed with their user name X. This rule is used for all 1331 the kinds defined in this specification. Thus, only a user with a 1332 certificate for "alice@example.org" could write to that location in 1333 the overlay. However, other usages can define any rules they choose, 1334 including publicly writable values. 1336 The digital signature over the data serves two purposes. First, it 1337 allows the peer responsible for storing the data to verify that this 1338 Store is authorized. Second, it provides integrity for the data. 1339 The signature is saved along with the data value (or values) so that 1340 any reader can verify the integrity of the data. Of course, the 1341 responsible peer can "lose" the value but it cannot undetectably 1342 modify it. 1344 The size requirements of the data being stored in the overlay are 1345 variable. For instance, a SIP AoR and voicemail differ widely in the 1346 storage size. RELOAD leaves it to the Usage and overlay 1347 configuration to limit size imbalance of various kinds. 1349 4.1.2. Usages 1351 By itself, the distributed storage layer just provides infrastructure 1352 on which applications are built. In order to do anything useful, a 1353 usage must be defined. Each Usage specifies several things: 1355 o Registers Kind-ID code points for any kinds that the Usage 1356 defines. 1357 o Defines the data structure for each of the kinds. 1358 o Defines access control rules for each of the kinds. 1359 o Defines how the Resource Name is formed that is hashed to form the 1360 Resource-ID where each kind is stored. 1361 o Describes how values will be merged after a network partition. 1362 Unless otherwise specified, the default merging rule is to act as 1363 if all the values that need to be merged were stored and as if the 1364 order they were stored in corresponds to the stored time values 1365 associated with (and carried in) their values. Because the stored 1366 time values are those associated with the peer which did the 1367 writing, clock skew is generally not an issue. If two nodes are 1368 on different partitions, write to the same location, and have 1369 clock skew, this can create merge conflicts. However because 1370 RELOAD deliberately segregates storage so that data from different 1371 users and peers is stored in different locations, and a single 1372 peer will typically only be in a single network partition, this 1373 case will generally not arise. 1374 o Defines the types of connections that can be initiated using 1375 AppAttach. 1377 The kinds defined by a usage may also be applied to other usages. 1378 However, a need for different parameters, such as different size 1379 limits, would imply the need to create a new kind. 1381 4.1.3. Replication 1383 Replication in P2P overlays can be used to provide: 1385 persistence: if the responsible peer crashes and/or if the storing 1386 peer leaves the overlay 1388 security: to guard against DoS attacks by the responsible peer or 1389 routing attacks to that responsible peer 1390 load balancing: to balance the load of queries for popular 1391 resources. 1393 A variety of schemes are used in P2P overlays to achieve some of 1394 these goals. Common techniques include replicating on neighbors of 1395 the responsible peer, randomly locating replicas around the overlay, 1396 or replicating along the path to the responsible peer. 1398 The core RELOAD specification does not specify a particular 1399 replication strategy. Instead, the first level of replication 1400 strategies are determined by the overlay algorithm, which can base 1401 the replication strategy on its particular topology. For example, 1402 Chord places replicas on successor peers, which will take over 1403 responsibility should the responsible peer fail [Chord]. 1405 If additional replication is needed, for example if data persistence 1406 is particularly important for a particular usage, then that usage may 1407 specify additional replication, such as implementing random 1408 replications by inserting a different well known constant into the 1409 Resource Name used to store each replicated copy of the resource. 1410 Such replication strategies can be added independent of the 1411 underlying algorithm, and their usage can be determined based on the 1412 needs of the particular usage. 1414 4.2. Service Discovery 1416 RELOAD does not currently define a generic service discovery 1417 algorithm as part of the base protocol, although a simplistic TURN- 1418 specific discovery mechanism is provided. A variety of service 1419 discovery algorithms can be implemented as extensions to the base 1420 protocol, such as the service discovery algorithm ReDIR 1421 [opendht-sigcomm05] . 1423 4.3. Application Connectivity 1425 There is no requirement that a RELOAD usage must use RELOAD's 1426 primitives for establishing its own communication if it already 1427 possesses its own means of establishing connections. For example, 1428 one could design a RELOAD-based resource discovery protocol which 1429 used HTTP to retrieve the actual data. 1431 For more common situations, however, it is the overlay itself - 1432 rather than an external authority such as DNS - which is used to 1433 establish a connection. RELOAD provides connectivity to applications 1434 using the AppAttach method. For example, if a P2PSIP node wishes to 1435 establish a SIP dialog with another P2PSIP node, it will use 1436 AppAttach to establish a direct connection with the other node. This 1437 new connection is separate from the peer protocol connection. It is 1438 a dedicated UDP or TCP flow used only for the SIP dialog. Each usage 1439 specifies which types of connections can be initiated using 1440 AppAttach. 1442 5. Overlay Management Protocol 1444 This section defines the basic protocols used to create, maintain, 1445 and use the RELOAD overlay network. We start by defining the basic 1446 concept of how message destinations are interpreted when routing 1447 messages. We then describe the symmetric recursive routing model, 1448 which is RELOAD's default routing algorithm. We then define the 1449 message structure and then finally define the messages used to join 1450 and maintain the overlay. 1452 5.1. Message Receipt and Forwarding 1454 When a peer receives a message, it first examines the overlay, 1455 version, and other header fields to determine whether the message is 1456 one it can process. If any of these are incorrect (e.g., the message 1457 is for an overlay in which the peer does not participate) it is an 1458 error. The peer SHOULD generate an appropriate error but local 1459 policy can override this and cause the messages to be silently 1460 dropped. 1462 Once the peer has determined that the message is correctly formatted, 1463 it examines the first entry on the destination list. There are three 1464 possible cases here: 1466 o The first entry on the destination list is an ID for which the 1467 peer is responsible. 1468 o The first entry on the destination list is an ID for which another 1469 peer is responsible. 1470 o The first entry on the destination list is a private ID that is 1471 being used for destination list compression. This is described 1472 later. 1474 These cases are handled as discussed below. 1476 5.1.1. Responsible ID 1478 If the first entry on the destination list is an ID for which the 1479 node is responsible, there are several sub-cases. 1480 o If the entry is a Resource-ID, then it MUST be the only entry on 1481 the destination list. If there are other entries, the message 1482 MUST be silently dropped. Otherwise, the message is destined for 1483 this node and it passes it up to the upper layers. 1484 o If the entry is a Node-ID which equals this node's Node-ID, then 1485 the message is destined for this node. If this is the only entry 1486 on the destination list, the message is destined for this node and 1487 is passed up to the upper layers. Otherwise the entry is removed 1488 from the destination list and the message is passed to the Message 1489 Transport. If the message is a response and there is state for 1490 the transaction ID, the state is reinserted into the destination 1491 list before the message is further processed. 1492 o If the entry is a Node-ID which is not equal to this node, then 1493 the node MUST drop the message silently unless the Node-ID 1494 corresponds to a node which is directly connected to this node 1495 (i.e., a client). In that case, it MUST forward the message to 1496 the destination node as described in the next section. 1498 Note that this implies that in order to address a message to "the 1499 peer that controls region X", a sender sends to Resource-ID X, not 1500 Node-ID X. 1502 5.1.2. Other ID 1504 If neither of the other three cases applies, then the peer MUST 1505 forward the message towards the first entry on the destination list. 1506 This means that it MUST select one of the peers to which it is 1507 connected and which is likely to be responsible for the first entry 1508 on the destination list. If the first entry on the destination list 1509 is in the peer's connection table, then it SHOULD forward the message 1510 to that peer directly. Otherwise, the peer consults the routing 1511 table to forward the message. 1513 Any intermediate peer which forwards a RELOAD message MUST arrange 1514 that if it receives a response to that message the response can be 1515 routed back through the set of nodes through which the request 1516 passed. This may be arranged in one of two ways: 1518 o The peer MAY add an entry to the via list in the forwarding header 1519 that will enable it to determine the correct node. 1520 o The peer MAY keep per-transaction state which will allow it to 1521 determine the correct node. 1523 As an example of the first strategy, if node D receives a message 1524 from node C with via list (A, B), then D would forward to the next 1525 node (E) with via list (A, B, C). Now, if E wants to respond to the 1526 message, it reverses the via list to produce the destination list, 1527 resulting in (D, C, B, A). When D forwards the response to C, the 1528 destination list will contain (C, B, A). 1530 As an example of the second strategy, if node D receives a message 1531 from node C with transaction ID X and via list (A, B), it could store 1532 (X, C) in its state database and forward the message with the via 1533 list unchanged. When D receives the response, it consults its state 1534 database for transaction id X, determines that the request came from 1535 C, and forwards the response to C. 1537 Intermediate peers which modify the via list are not required to 1538 simply add entries. The only requirement is that the peer be able to 1539 reconstruct the correct destination list on the return route. RELOAD 1540 provides explicit support for this functionality in the form of 1541 private IDs, which can replace any number of via list entries. For 1542 instance, in the above example, Node D might send E a via list 1543 containing only the private ID (I). E would then use the destination 1544 list (D, I) to send its return message. When D processes this 1545 destination list, it would detect that I is a private ID, recover the 1546 via list (A, B, C), and reverse that to produce the correct 1547 destination list (C, B, A) before sending it to C. This feature is 1548 called List Compression. I MAY either be a compressed version of the 1549 original via list or an index into a state database containing the 1550 original via list. 1552 Note that if an intermediate peer exits the overlay, then on the 1553 return trip the message cannot be forwarded and will be dropped. The 1554 ordinary timeout and retransmission mechanisms provide stability over 1555 this type of failure. 1557 5.1.3. Private ID 1559 If the first entry in the destination list is a private id (e.g., a 1560 compressed via list), the peer MUST replace that entry with the 1561 original via list that it replaced and then re-examine the 1562 destination list to determine which of the above cases now applies. 1564 5.2. Symmetric Recursive Routing 1566 This Section defines RELOAD's symmetric recursive routing algorithm, 1567 which is the default algorithm used by nodes to route messages 1568 through the overlay. All implementations MUST implement this routing 1569 algorithm. An overlay may be configured to use alternative routing 1570 algorithms, and alternative routing algorithms may be selected on a 1571 per-message basis. 1573 5.2.1. Request Origination 1575 In order to originate a message to a given Node-ID or Resource-ID, a 1576 node constructs an appropriate destination list. The simplest such 1577 destination list is a single entry containing the Node-ID or 1578 Resource-ID. The resulting message will use the normal overlay 1579 routing mechanisms to forward the message to that destination. The 1580 node can also construct a more complicated destination list for 1581 source routing. 1583 Once the message is constructed, the node sends the message to some 1584 adjacent peer. If the first entry on the destination list is 1585 directly connected, then the message MUST be routed down that 1586 connection. Otherwise, the topology plugin MUST be consulted to 1587 determine the appropriate next hop. 1589 Parallel searches for the resource are a common solution to improve 1590 reliability in the face of churn or of subversive peers. Parallel 1591 searches for usage-specified replicas are managed by the usage layer. 1592 However, a single request can also be routed through multiple 1593 adjacent peers, even when known to be sub-optimal, to improve 1594 reliability [vulnerabilities-acsac04]. Such parallel searches MAY BE 1595 specified by the topology plugin. 1597 Because messages may be lost in transit through the overlay, RELOAD 1598 incorporates an end-to-end reliability mechanism. When an 1599 originating node transmits a request it MUST set a 3 second timer. 1600 If a response has not been received when the timer fires, the request 1601 is retransmitted with the same transaction identifier. The request 1602 MAY be retransmitted up to 4 times (for a total of 5 messages). 1603 After the timer for the fifth transmission fires, the message SHALL 1604 be considered to have failed. Note that this retransmission 1605 procedure is not followed by intermediate nodes. They follow the 1606 hop-by-hop reliability procedure described in Section 5.6.3. 1608 The above algorithm can result in multiple requests being delivered 1609 to a node. Receiving nodes MUST generate semantically equivalent 1610 responses to retransmissions of the same request (this can be 1611 determined by transaction id) if the request is received within the 1612 maximum request lifetime (15 seconds). For some requests (e.g., 1613 Fetch) this can be accomplished merely by processing the request 1614 again. For other requests, (e.g., Store) it may be necessary to 1615 maintain state for the duration of the request lifetime. 1617 5.2.2. Response Origination 1619 When a peer sends a response to a request using this routing 1620 algorithm, it MUST construct the destination list by reversing the 1621 order of the entries on the via list. This has the result that the 1622 response traverses the same peers as the request traversed, except in 1623 reverse order (symmetric routing). 1625 5.3. Message Structure 1627 RELOAD is a message-oriented request/response protocol. The messages 1628 are encoded using binary fields. All integers are represented in 1629 network byte order. The general philosophy behind the design was to 1630 use Type, Length, Value fields to allow for extensibility. However, 1631 for the parts of a structure that were required in all messages, we 1632 just define these in a fixed position, as adding a type and length 1633 for them is unnecessary and would simply increase bandwidth and 1634 introduces new potential for interoperability issues. 1636 Each message has three parts, concatenated as shown below: 1638 +-------------------------+ 1639 | Forwarding Header | 1640 +-------------------------+ 1641 | Message Contents | 1642 +-------------------------+ 1643 | Security Block | 1644 +-------------------------+ 1646 The contents of these parts are as follows: 1648 Forwarding Header: Each message has a generic header which is used 1649 to forward the message between peers and to its final destination. 1650 This header is the only information that an intermediate peer 1651 (i.e., one that is not the target of a message) needs to examine. 1653 Message Contents: The message being delivered between the peers. 1654 From the perspective of the forwarding layer, the contents are 1655 opaque, however, they are interpreted by the higher layers. 1657 Security Block: A security block containing certificates and a 1658 digital signature over the message. Note that this signature can 1659 be computed without parsing the message contents. All messages 1660 MUST be signed by their originator. 1662 The following sections describe the format of each part of the 1663 message. 1665 5.3.1. Presentation Language 1667 The structures defined in this document are defined using a C-like 1668 syntax based on the presentation language used to define TLS. 1669 Advantages of this style include: 1671 o It is easy to write and familiar enough looking that most readers 1672 can grasp it quickly. 1673 o The ability to define nested structures allows a separation 1674 between high-level and low-level message structures. 1675 o It has a straightforward wire encoding that allows quick 1676 implementation, but the structures can be comprehended without 1677 knowing the encoding. 1678 o The ability to mechanically compile encoders and decoders. 1680 Several idiosyncrasies of this language are worth noting. 1682 o All lengths are denoted in bytes, not objects. 1683 o Variable length values are denoted like arrays with angle 1684 brackets. 1685 o "select" is used to indicate variant structures. 1687 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1688 but only up to 127 values of two bytes (16 bits) each. 1690 5.3.1.1. Common Definitions 1692 The following definitions are used throughout RELOAD and so are 1693 defined here. They also provide a convenient introduction to how to 1694 read the presentation language. 1696 An enum represents an enumerated type. The values associated with 1697 each possibility are represented in parentheses and the maximum value 1698 is represented as a nameless value, for purposes of describing the 1699 width of the containing integral type. For instance, Boolean 1700 represents a true or false: 1702 enum { false (0), true(1), (255)} Boolean; 1704 A boolean value is either a 1 or a 0 and is represented as a single 1705 byte on the wire. 1707 The NodeId, shown below, represents a single Node-ID. 1709 typedef opaque NodeId[16]; 1711 A NodeId is a fixed-length 128-bit structure represented as a series 1712 of bytes, with the most significant byte first. Note: the use of 1713 "typedef" here is an extension to the TLS language, but its meaning 1714 should be relatively obvious. Note the [ size ] syntax defines a 1715 fixed length element that does not include the length of the element 1716 in the on the wire encoding. 1718 A ResourceId, shown below, represents a single Resource-ID. 1720 typedef opaque ResourceId<0..2^8-1>; 1722 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1723 NodeIds, ResourceIds are variable length, up to 255 bytes (2048 bits) 1724 in length. On the wire, each ResourceId is preceded by a single 1725 length byte (allowing lengths up to 255). Thus, the 3-byte value 1726 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1727 defines a variable length element that does include the length of the 1728 element in the on the wire encoding. The number of bytes to encode 1729 the length on the wire is derived by range. 1731 A more complicated example is IpAddressPort, which represents a 1732 network address and can be used to carry either an IPv6 or IPv4 1733 address: 1735 enum {reserved_addr(0), ipv4_address (1), ipv6_address (2), 1736 (255)} AddressType; 1738 struct { 1739 uint32 addr; 1740 uint16 port; 1741 } IPv4AddrPort; 1743 struct { 1744 uint128 addr; 1745 uint16 port; 1746 } IPv6AddrPort; 1748 struct { 1749 AddressType type; 1750 uint8 length; 1752 select (type) { 1753 case ipv4_address: 1754 IPv4AddrPort v4addr_port; 1756 case ipv6_address: 1757 IPv6AddrPort v6addr_port; 1759 /* This structure can be extended */ 1761 } IpAddressPort; 1763 The first two fields in the structure are the same no matter what 1764 kind of address is being represented: 1766 type: the type of address (v4 or v6). 1767 length: the length of the rest of the structure. 1769 By having the type and the length appear at the beginning of the 1770 structure regardless of the kind of address being represented, an 1771 implementation which does not understand new address type X can still 1772 parse the IpAddressPort field and then discard it if it is not 1773 needed. 1775 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1776 an IPv6AddrPort. Both of these simply consist of an address 1777 represented as an integer and a 16-bit port. As an example, here is 1778 the wire representation of the IPv4 address "192.0.2.1" with port 1779 "6100". 1781 01 ; type = IPv4 1782 06 ; length = 6 1783 c0 00 02 01 ; address = 192.0.2.1 1784 17 d4 ; port = 6100 1786 Unless a given structure that uses a select explicitly allows for 1787 unknown types in the select, any unknown type SHOULD be treated as an 1788 parsing error and the whole message discarded with no response. 1790 5.3.2. Forwarding Header 1792 The forwarding header is defined as a ForwardingHeader structure, as 1793 shown below. 1795 struct { 1796 uint32 relo_token; 1797 uint32 overlay; 1798 uint16 configuration_sequence; 1799 uint8 version; 1800 uint8 ttl; 1801 uint32 fragment; 1802 uint32 length; 1803 uint64 transaction_id; 1804 uint32 max_response_length; 1805 uint16 via_list_length; 1806 uint16 destination_list_length; 1807 uint16 options_length; 1808 Destination via_list[via_list_length]; 1809 Destination destination_list 1810 [destination_list_length]; 1811 ForwardingOptions options[options_length]; 1812 } ForwardingHeader; 1814 The contents of the structure are: 1816 relo_token: The first four bytes identify this message as a RELOAD 1817 message. The message is easy to demultiplex from STUN messages by 1818 looking at the first bit. This field MUST contain the value 1819 0xd2454c4f (the string 'RELO' with the high bit of the first byte 1820 set.). 1822 overlay: The 32 bit checksum/hash of the overlay being used. The 1823 variable length string representing the overlay name is hashed 1824 with SHA-1 and the low order 32 bits are used. The purpose of 1825 this field is to allow nodes to participate in multiple overlays 1826 and to detect accidental misconfiguration. This is not a security 1827 critical function. 1829 configuration_sequence: The sequence number of the configuration 1830 file. 1832 version: The version of the RELOAD protocol being used. This is a 1833 fixed point interger between 0.1 and 25.4. This document 1834 describes version 0.1, with a value of 0x01. [[ Note to RFC 1835 Editor: Please update this to version 1.0 with value of 0x0a and 1836 remove this note. ]] 1838 ttl: An 8 bit field indicating the number of iterations, or hops, a 1839 message can experience before it is discarded. The TTL value MUST 1840 be decremented by one at every hop along the route the message 1841 traverses. If the TTL is 0, the message MUST NOT be propagated 1842 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1843 should be generated. The initial value of the TTL SHOULD be 100 1844 unless defined otherwise by the overlay configuration. 1846 fragment: This field is used to handle fragmentation. The high 1847 order two bits are used to indicate the fragmentation status: If 1848 the high bit (0x80000000) is set, it indicates that the message is 1849 a fragment. If the next bit (0x40000000) is set, it indicates 1850 that this is the last fragment. The next six bits (0x20000000 to 1851 0x01000000) are reserved and SHOULD be set to zero. The remainder 1852 of the field is used to indicate the fragment offset; see 1853 Section 5.7 1855 length: The count in bytes of the size of the message, including the 1856 header. 1858 transaction_id: A unique 64 bit number that identifies this 1859 transaction and also allows receivers to disambiguate transactions 1860 which are otherwise identical. Responses use the same Transaction 1861 ID as the request they correspond to. Transaction IDs are also 1862 used for fragment reassembly. 1864 max_response_length: The maximum size in bytes of a response. Used 1865 by requesting nodes to avoid receiving (unexpected) very large 1866 responses. If this value is non-zero, responding peers MUST check 1867 that any response would not exceed it and if so generate an 1868 Error_Response_Too_Large value. This value SHOULD be set to zero 1869 for responses. 1871 via_list_length: The length of the via list in bytes. Note that in 1872 this field and the following two length fields we depart from the 1873 usual variable-length convention of having the length immediately 1874 precede the value in order to make it easier for hardware decoding 1875 engines to quickly determine the length of the header. 1877 destination_list_length: The length of the destination list in 1878 bytes. 1880 options_length: The length of the header options in bytes. 1882 via_list: The via_list contains the sequence of destinations through 1883 which the message has passed. The via_list starts out empty and 1884 grows as the message traverses each peer. 1886 destination_list: The destination_list contains a sequence of 1887 destinations which the message should pass through. The 1888 destination list is constructed by the message originator. The 1889 first element in the destination list is where the message goes 1890 next. The list shrinks as the message traverses each listed peer. 1892 options: Contains a series of ForwardingOptions entries. See 1893 Section 5.3.2.3. 1895 5.3.2.1. Processing Configuration Sequence Numbers 1897 In order to be part of the overlay, a node MUST have a copy of the 1898 overlay configuration document. In order to allow for configuration 1899 document changes, each version of the configuration document has a 1900 sequence number which is monotonically increasing mod 65536. Because 1901 the sequence number may in principle wrap, greater than or less than 1902 are interpreted by modulo arithmetic as in TCP. 1904 When a destination node receives a request, it MUST check that the 1905 configuration_sequence field is equal to its own configuration 1906 sequence number. If they do not match, it MUST generate an error, 1907 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1908 the configuration file in the request is too old, it MUST generate a 1909 Config_Update message to update the requesting node. This allows new 1910 configuration documents to propagate quickly throughout the system. 1911 The one exception to this rule is that if the configuration_sequence 1912 field is equal to 0xffff, and the message type is Config_Update, then 1913 the message MUST be accepted regardless of the receiving node's 1914 configuration sequence number. 1916 5.3.2.2. Destination and Via Lists 1918 The destination list and via lists are sequences of Destination 1919 values: 1921 enum {reserved(0), node(1), resource(2), compressed(3), 1922 /* 128-255 not allowed */ (255) } 1923 DestinationType; 1925 select (destination_type) { 1926 case node: 1927 NodeId node_id; 1929 case resource: 1930 ResourceId resource_id; 1932 case compressed: 1933 opaque compressed_id<0..2^8-1>; 1935 /* This structure may be extended with new types */ 1937 } DestinationData; 1939 struct { 1940 DestinationType type; 1941 uint8 length; 1942 DestinationData destination_data; 1943 } Destination; 1945 struct { 1946 uint16 compressed_id; /* top bit MUST be 1 */ 1947 } Destination; 1949 If destination structure has its first bit set to 1, then it is a 16 1950 bit integer. If the first bit is not set, then it is a structure 1951 starting with DestinationType. If it is a 16 bit integer, it is 1952 treated as if it were a full structure with a DestinationType of 1953 compressed and a compressed_id that was 2 bytes long with the value 1954 of the 16 bit integer. When the destination structure is not a 16 1955 bit integer, it is the TLV structure with the following contents: 1957 type 1958 The type of the DestinationData Payload Data Unit (PDU). This may 1959 be one of "node", "resource", or "compressed". 1961 length 1962 The length of the destination_data. 1964 destination_value 1965 The destination value itself, which is an encoded DestinationData 1966 structure, depending on the value of "type". 1968 Note: This structure encodes a type, length, value. The length 1969 field specifies the length of the DestinationData values, which 1970 allows the addition of new DestinationTypes. This allows an 1971 implementation which does not understand a given DestinationType 1972 to skip over it. 1974 A DestinationData can be one of three types: 1976 node 1977 A Node-ID. 1979 compressed 1980 A compressed list of Node-IDs and/or resources. Because this 1981 value was compressed by one of the peers, it is only meaningful to 1982 that peer and cannot be decoded by other peers. Thus, it is 1983 represented as an opaque string. 1985 resource 1986 The Resource-ID of the resource which is desired. This type MUST 1987 only appear in the final location of a destination list and MUST 1988 NOT appear in a via list. It is meaningless to try to route 1989 through a resource. 1991 One possible encoding of the 16 bit integer version as an opaque 1992 identifier is to encode an index into a connection table. To avoid 1993 misrouting responses in the event a response is delayed and the 1994 connection table entry has changed, the identifier should be split 1995 between an index and a generation counter for that index. At 1996 startup, the generation counters should be initialized to random 1997 values. An implementation could use 12 bits for the connection table 1998 index and 3 bits for the generation counter. (Note that this does 1999 not suggest a 4096 entry connection table for every node, only the 2000 ability to encode for a larger connection table.) When a connection 2001 table slot is used for a new connection, the generation counter is 2002 incremented (with wrapping). Connection table slots are used on a 2003 rotating basis to maximize the time interval between uses of the same 2004 slot for different connections. When routing a message to an entry 2005 in the destination list encoding a connection table entry, the node 2006 confirms that the generation counter matches the current generation 2007 counter of that index before forwarding the message. If it does not 2008 match, the message is silently dropped. 2010 Regardless of how the 16 bit integer field or opaque DestinationType 2011 is used, the encoding MUST include a generation counter designed to 2012 prevent misrouting of responses due to the connection table entry 2013 having changed since the request message was originally forwarded. 2015 5.3.2.3. Forwarding Options 2017 The Forwarding header can be extended with forwarding header options, 2018 which are a series of ForwardingOptions structures: 2020 enum { directResponseForwarding(1), (255) } ForwardingOptionsType; 2022 struct { 2023 ForwardingOptionsType type; 2024 uint8 flags; 2025 uint16 length; 2026 select (type) { 2027 case directResponseForwarding: 2028 DirectResponseForwardingOption directResponseForwardingOption; 2029 /* This type may be extended */ 2030 } option; 2031 } ForwardingOption; 2033 Each ForwardingOption consists of the following values: 2035 type 2036 The type of the option. This structure allows for unknown options 2037 types. 2039 length 2040 The length of the rest of the structure. 2042 flags 2043 Three flags are defined FORWARD_CRITICAL(0x01), 2044 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2045 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2046 set, any node that would forward the message but does not 2047 understand this options MUST reject the request with an 2048 Error_Unsupported_Forwarding_Option error response. If the 2049 DESTINATION_CRITICAL flag is set, any node that generates a 2050 response to the message but does not understand the forwarding 2051 option MUST reject the request with an 2052 Error_Unsupported_Forwarding_Option error response. If the 2053 RESPONSE_COPY flag is set, any node generating a response MUST 2054 copy the option from the request to the response and clear the 2055 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags. 2057 option 2058 The option value. 2060 5.3.2.4. Direct Return Response Forwarding Options 2062 NOTE: This section does not have working group consensus but to help 2063 facilitate discussion of the topic, the authors have included it in 2064 the text. This section will be adjusted or removed in the next 2065 version to represent working group consensus. 2067 This section defines an OPTIONAL forwarding option that allows the 2068 originator of a request to signal that the node responsindg to the 2069 request should try to route the response directly to the node that 2070 made the request instead of having the responses traverse the 2071 overlay. : 2073 struct { 2074 AttachReqAns connection_information; 2075 NodeID requesting_node; 2076 } DirectResponseForwardingOption; 2078 Each ForwardingOption consists of the following values: 2080 connection_information 2081 All of the information needed to initiate a new connection to the 2082 requesting node. 2084 requesting_node 2085 The NodeID of the node that originated the request. This is used 2086 to match the TLS certificate. 2088 This option can only be used if the 2089 DirecteRetrurnResonsoseRoutingAllowed flag in the configuration for 2090 the overlay is set to true. The RESPONSE_COPY flag SHOULD be set to 2091 false while the FORWARD_CRITICAL and DESTINATION_CRITICAL SHOULD be 2092 set to true. When a node that supports this forwarding options 2093 receives a request with it, it acts as if it had send an Attache 2094 request to the the requesting_node and it had received the 2095 connection_information in the answer. This cases it to form a new 2096 connection directly to that node. Once that is complete the response 2097 to this request is sent over that connection. If a connection 2098 already exists directly to that node, it is used instead of a a new 2099 connection being formed. The connection MAY be closed at any point 2100 but is typically kept open until TODO (need WG input). [ TODO - add 2101 appropriate text to configuration file ] 2103 5.3.3. Message Contents Format 2105 The second major part of a RELOAD message is the contents part, which 2106 is defined by MessageContents: 2108 enum { (2^16-1) } MessageExtensionType; 2110 struct { 2111 MessageExtensionType type; 2112 Boolean critical; 2113 opaque extension_contents<0..2^32-1>; 2114 } MessageExtension; 2116 struct { 2117 uint16 message_code; 2118 opaque message_body<0..2^32-1>; 2119 MessageExtensions extensions<0..2^32-1>; 2120 } MessageContents; 2122 The contents of this structure are as follows: 2124 message_code 2125 This indicates the message that is being sent. The code space is 2126 broken up as follows. 2128 0 Reserved 2130 1 .. 0x7fff Requests and responses. These code points are always 2131 paired, with requests being odd and the corresponding response 2132 being the request code plus 1. Thus, "probe_request" (the 2133 Probe request) has value 1 and "probe_answer" (the Probe 2134 response) has value 2 2136 0xffff Error 2138 message_body 2139 The message body itself, represented as a variable-length string 2140 of bytes. The bytes themselves are dependent on the code value. 2141 See the sections describing the various RELOAD methods (Join, 2142 Update, Attach, Store, Fetch, etc.) for the definitions of the 2143 payload contents. 2144 extensions 2145 Extensions to the message. Currently no extensions are defined, 2146 but new extensions can be defined by the process described in 2147 Section 13.12. 2149 All extensions have the following form: 2151 type 2152 The extension type. 2154 critical 2155 Whether this extension must be understood in order to process the 2156 message. If critical = True and the recipient does not understand 2157 the message, it MUST generate an Error_Unknown_Extension error. 2158 If critical = False, the recipient SHOULD choose to process the 2159 message even if it does not understand the extension. 2161 extension_contents 2162 The contents of the extension (extension-dependent). 2164 5.3.3.1. Response Codes and Response Errors 2166 A peer processing a request returns its status in the message_code 2167 field. If the request was a success, then the message code is the 2168 response code that matches the request (i.e., the next code up). The 2169 response payload is then as defined in the request/response 2170 descriptions. 2172 If the request has failed, then the message code is set to 0xffff 2173 (error) and the payload MUST be an error_response PDU, as shown 2174 below. 2176 When the message code is 0xffff, the payload MUST be an 2177 ErrorResponse. 2179 public struct { 2180 uint16 error_code; 2181 opaque error_info<0..2^16-1>; 2182 } ErrorResponse; 2184 The contents of this structure are as follows: 2186 error_code 2187 A numeric error code indicating the error that occurred. 2189 error_info 2190 An optional arbitrary byte string. Unless otherwise specified, 2191 this will be a UTF-8 text string providing further information 2192 about what went wrong. 2194 The following error code values are defined. The numeric values for 2195 these are defined in Section 13.8. 2197 Error_Forbidden: The requesting node does not have permission to 2198 make this request. 2200 Error_Not_Found: The resource or peer cannot be found or does not 2201 exist. 2203 Error_Request_Timeout: A response to the request has not been 2204 received in a suitable amount of time. The requesting node MAY 2205 resend the request at a later time. 2207 Error_Data_Too_Old: A store cannot be completed because the 2208 storage_time precedes the existing value. 2210 Error_Generation_Counter_Too_Low: A store cannot be completed 2211 because the generation counter precedes the existing value. 2213 Error_Incompatible_with_Overlay: A peer receiving the request is 2214 using a different overlay, overlayalgorithm, or hash algorithm. 2216 Error_Unsupported_Forwarding_Option: A peer receiving the request 2217 with a forwarding options flagged as critical but the peer does 2218 not support this option. See section Section 5.3.2.3. 2220 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2221 decremented to zero. See section Section 5.3.2. 2223 Error_Message_Too_Large: A peer receiving the request that was too 2224 large. See section Section 5.6. 2226 Error_Response_Too_Large: A peer would have generated a response 2227 that is too large per the max_response_length field. 2229 Error_Config_Too_Old: A destination peer received a request with a 2230 configuration sequence that's too old. 2232 Error_Config_Too_New: A destination node received a request with a 2233 configuration sequence that's too new. A node which receives this 2234 error MUST generate a Config_Update message to send a new copy of 2235 the configuration document to the node which generated the error. 2237 Error_Unknown_Kind: A destination node received a request with an 2238 unknown kind-id. A node which receives this error MUST generate a 2239 Config_Update message which contains the appropriate kind 2240 definition. 2242 Error_Unknown_Extension: A destination node received a request with 2243 an unknown extension. 2245 5.3.4. Security Block 2247 The third part of a RELOAD message is the security block. The 2248 security block is represented by a SecurityBlock structure: 2250 enum { x509(0), (255) } certificate_type; 2252 struct { 2253 certificate_type type; 2254 opaque certificate<0..2^16-1>; 2255 } GenericCertificate; 2257 struct { 2258 GenericCertificate certificates<0..2^16-1>; 2259 Signature signature; 2260 } SecurityBlock; 2262 The contents of this structure are: 2264 certificates 2265 A bucket of certificates. 2267 signature 2268 A signature over the message contents. 2270 The certificates bucket SHOULD contain all the certificates necessary 2271 to verify every signature in both the message and the internal 2272 message objects. This is the only location in the message which 2273 contains certificates, thus allowing for only a single copy of each 2274 certificate to be sent. In systems which have some alternate 2275 certificate distribution mechanism, some certificates MAY be omitted. 2276 However, implementors should note that this creates the possibility 2277 that messages may not be immediately verifiable because certificates 2278 must first be retrieved. 2280 Each certificate is represented by a GenericCertificate structure, 2281 which has the following contents: 2283 type 2284 The type of the certificate. Only one type is defined: x509 2285 representing an X.509 certificate. 2287 certificate 2288 The encoded version of the certificate. For X.509 certificates, 2289 it is the DER form. 2291 The signature is computed over the payload and parts of the 2292 forwarding header. The payload, in case of a Store, may contain an 2293 additional signature computed over a StoreReq structure. All 2294 signatures are formatted using the Signature element. This element 2295 is also used in other contexts where signatures are needed. The 2296 input structure to the signature computation varies depending on the 2297 data element being signed. 2299 enum {reserved(0), cert_hash(1), (255)} SignerIdentityType; 2301 select (identity_type) { 2302 case cert_hash; 2303 HashAlgorithm hash_alg; 2304 opaque certificate_hash<0..2^8-1>; 2306 /* This structure may be extended with new types if necessary*/ 2307 } SignerIdentityValue; 2309 struct { 2310 SignerIdentityType identity_type; 2311 uint16 length; 2312 SignerIdentityValue identity[SignerIdentity.length]; 2313 } SignerIdentity; 2315 struct { 2316 SignatureAndHashAlgorithm algorithm; 2317 SignerIdentity identity; 2318 opaque signature_value<0..2^16-1>; 2319 } Signature; 2321 The signature construct contains the following values: 2323 algorithm 2324 The signature algorithm in use. The algorithm definitions are 2325 found in the IANA TLS SignatureAlgorithm Registry. 2327 identity 2328 The identity used to form the signature. 2330 signature_value 2331 The value of the signature. 2333 The only currently permitted identity format is a hash of the 2334 signer's certificate. The hash_alg field is used to indicate the 2335 algorithm used to produce the hash. The certificate_hash contains 2336 the hash of the certificate object. The SignerIdentity structure is 2337 typed purely to allow for future (unanticipated) extensibility. 2339 For signatures over messages the input to the signature is computed 2340 over: 2342 overlay + transaction_id + MessageContents + SignerIdentity 2344 where overlay and transaction_id come from the forwarding header and 2345 + indicates concatenation. 2347 The input to signatures over data values is different, and is 2348 described in Section 6.1. 2350 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2351 MUST verify the signature and the authorizing certificate. This 2352 check provides a minimal level of assurance that the sending node is 2353 a valid part of the overlay as well as cryptographic authentication 2354 of the sending node. In addition, responses MUST be checked as 2355 follows: 2357 1. The response to a message sent to a specific Node-ID MUST have 2358 been sent by that Node-ID. 2359 2. The response to a message sent to a Resource-Id MUST have been 2360 sent by a Node-ID which is as close to or closer to the target 2361 Resource-Id than any node in the requesting node's neighbor 2362 table. 2364 The second condition serves as a primitive check for responses from 2365 wildly wrong nodes but is not a complete check. Note that in periods 2366 of churn, it is possible for the requesting node to obtain a closer 2367 neighbor while the request is outstanding. This will cause the 2368 response to be rejected and the request to be retransmitted. 2370 In addition, some methods (especially Store) have additional 2371 authentication requirements, which are described in the sections 2372 covering those methods. 2374 5.4. Overlay Topology 2376 As discussed in previous sections, RELOAD does not itself implement 2377 any overlay topology. Rather, it relies on Topology Plugins, which 2378 allow a variety of overlay algorithms to be used while maintaining 2379 the same RELOAD core. This section describes the requirements for 2380 new topology plugins and the methods that RELOAD provides for overlay 2381 topology maintenance. 2383 5.4.1. Topology Plugin Requirements 2385 When specifying a new overlay algorithm, at least the following need 2386 to be described: 2388 o Joining procedures, including the contents of the Join message. 2389 o Stabilization procedures, including the contents of the Update 2390 message, the frequency of topology probes and keepalives, and the 2391 mechanism used to detect when peers have disconnected. 2392 o Exit procedures, including the contents of the Leave message. 2393 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2394 compute the hash of an identifier. 2395 o The procedures that peers use to route messages. 2396 o The replication strategy used to ensure data redundancy. 2398 All overlay algorithms MUST specify maintenance procedures that send 2399 Updates to clients and peers that have established connections to the 2400 peer responsible for a particular ID when the responsibility for that 2401 ID changes. Because tracking this information is difficult, overlay 2402 algorithms MAY simply specify that an Update is sent to all members 2403 of the Connection Table whenever the range of IDs for which the peer 2404 is responsible changes. 2406 5.4.2. Methods and types for use by topology plugins 2408 This section describes the methods that topology plugins use to join, 2409 leave, and maintain the overlay. 2411 5.4.2.1. Join 2413 A new peer (but one that already has credentials) uses the JoinReq 2414 message to join the overlay. The JoinReq is sent to the responsible 2415 peer depending on the routing mechanism described in the topology 2416 plugin. This notifies the responsible peer that the new peer is 2417 taking over some of the overlay and it needs to synchronize its 2418 state. 2420 struct { 2421 NodeId joining_peer_id; 2422 opaque overlay_specific_data<0..2^16-1>; 2423 } JoinReq; 2425 The minimal JoinReq contains only the Node-ID which the sending peer 2426 wishes to assume. Overlay algorithms MAY specify other data to 2427 appear in this request. 2429 If the request succeeds, the responding peer responds with a JoinAns 2430 message, as defined below: 2432 struct { 2433 opaque overlay_specific_data<0..2^16-1>; 2434 } JoinAns; 2436 If the request succeeds, the responding peer MUST follow up by 2437 executing the right sequence of Stores and Updates to transfer the 2438 appropriate section of the overlay space to the joining peer. In 2439 addition, overlay algorithms MAY define data to appear in the 2440 response payload that provides additional info. 2442 In general, nodes which cannot form connections SHOULD report an 2443 error. However, implementations MUST provide some mechanism whereby 2444 nodes can determine that they are potentially the first node and take 2445 responsibility for the overlay. This specification does not mandate 2446 any particular mechanism, but a configuration flag or setting seems 2447 appropriate. 2449 5.4.2.2. Leave 2451 The LeaveReq message is used to indicate that a node is exiting the 2452 overlay. A node SHOULD send this message to each peer with which it 2453 is directly connected prior to exiting the overlay. 2455 public struct { 2456 NodeId leaving_peer_id; 2457 opaque overlay_specific_data<0..2^16-1>; 2458 } LeaveReq; 2460 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2461 algorithms MAY specify other data to appear in this request. 2463 Upon receiving a Leave request, a peer MUST update its own routing 2464 table, and send the appropriate Store/Update sequences to re- 2465 stabilize the overlay. 2467 5.4.2.3. Update 2469 Update is the primary overlay-specific maintenance message. It is 2470 used by the sender to notify the recipient of the sender's view of 2471 the current state of the overlay (its routing state), and it is up to 2472 the recipient to take whatever actions are appropriate to deal with 2473 the state change. In general, peers send Update messages to all 2474 their adjacencies whenever they detect a topology shift. 2476 When a peer detects through an Update that it is no longer 2477 responsible for any data value it is storing, it MUST attempt to 2478 Store a copy to the correct node unless it knows the the newly 2479 responsible node already has a copy of the data. This prevents data 2480 loss during large-scale topology shifts such as the merging of 2481 partitioned overlays. 2483 The contents of the UpdateReq message are completely overlay- 2484 specific. The UpdateAns response is expected to be either success or 2485 an error. 2487 5.4.2.4. Route_Query 2489 The Route_Query request allows the sender to ask a peer where they 2490 would route a message directed to a given destination. In other 2491 words, a RouteQuery for a destination X requests the Node-ID for the 2492 node that the receiving peer would next route to in order to get to 2493 X. A RouteQuery can also request that the receiving peer initiate an 2494 Update request to transfer the receiving peer's routing table. 2496 One important use of the RouteQuery request is to support iterative 2497 routing. The sender selects one of the peers in its routing table 2498 and sends it a RouteQuery message with the destination_object set to 2499 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2500 responds with information about the peers to which the request would 2501 be routed. The sending peer MAY then use the Attach method to attach 2502 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2503 gets a response from a peer that is closest to the identifier in the 2504 destination_object as determined by the topology plugin. At that 2505 point, the sender can send messages directly to that peer. 2507 5.4.2.4.1. Request Definition 2509 A RouteQueryReq message indicates the peer or resource that the 2510 requesting node is interested in. It also contains a "send_update" 2511 option allowing the requesting node to request a full copy of the 2512 other peer's routing table. 2514 struct { 2515 Boolean send_update; 2516 Destination destination; 2517 opaque overlay_specific_data<0..2^16-1>; 2518 } RouteQueryReq; 2520 The contents of the RouteQueryReq message are as follows: 2522 send_update 2523 A single byte. This may be set to "true" to indicate that the 2524 requester wishes the responder to initiate an Update request 2525 immediately. Otherwise, this value MUST be set to "false". 2527 destination 2528 The destination which the requester is interested in. This may be 2529 any valid destination object, including a Node-ID, compressed ids, 2530 or Resource-ID. 2532 overlay_specific_data 2533 Other data as appropriate for the overlay. 2535 5.4.2.4.2. Response Definition 2537 A response to a successful RouteQueryReq request is a RouteQueryAns 2538 message. This is completely overlay specific. 2540 5.4.2.5. Probe 2542 Probe provides primitive "exploration" services: it allows node to 2543 determine which resources another node is responsible for; and it 2544 allows some discovery services using multicast, anycast, or 2545 broadcast. A probe can be addressed to a specific Node-ID, or the 2546 peer controlling a given location (by using a resource ID). In 2547 either case, the target Node-IDs respond with a simple response 2548 containing some status information. 2550 5.4.2.5.1. Request Definition 2552 The ProbeReq message contains a list (potentially empty) of the 2553 pieces of status information that the requester would like the 2554 responder to provide. 2556 enum { responsible_set(1), num_resources(2), uptime(3), (255)} 2557 ProbeInformationType; 2559 struct { 2560 ProbeInformationType requested_info<0..2^8-1>; 2561 } ProbeReq 2563 The currently defined values for ProbeInformation are: 2565 responsible_set 2566 indicates that the peer should Respond with the fraction of the 2567 overlay for which the responding peer is responsible. 2569 num_resources 2570 indicates that the peer should Respond with the number of 2571 resources currently being stored by the peer. 2573 uptime 2574 indicates that the peer should Respond with how long the peer has 2575 been up in seconds. 2577 5.4.2.5.2. Response Definition 2579 A successful ProbeAns response contains the information elements 2580 requested by the peer. 2582 struct { 2583 select (type) { 2584 case responsible_set: 2585 uint32 responsible_ppb; 2587 case num_resources: 2588 uint32 num_resources; 2590 case uptime: 2591 uint32 uptime; 2592 /* This type may be extended */ 2594 }; 2595 } ProbeInformationData; 2597 struct { 2598 ProbeInformationType type; 2599 uint8 length; 2600 ProbeInformationData value; 2601 } ProbeInformation; 2603 struct { 2604 ProbeInformation probe_info<0..2^16-1>; 2605 } ProbeAns; 2607 A ProbeAns message contains a sequence of ProbeInformation 2608 structures. Each has a "length" indicating the length of the 2609 following value field. This structure allows for unknown options 2610 types. 2612 Each of the current possible Probe information types is a 32-bit 2613 unsigned integer. For type "responsible_ppb", it is the fraction of 2614 the overlay for which the peer is responsible in parts per billion. 2615 For type "num_resources", it is the number of resources the peer is 2616 storing. For the type "uptime" it is the number of seconds the peer 2617 has been up. 2619 The responding peer SHOULD include any values that the requesting 2620 node requested and that it recognizes. They SHOULD be returned in 2621 the requested order. Any other values MUST NOT be returned. 2623 5.5. Forwarding and Link Management Layer 2625 Each node maintains connections to a set of other nodes defined by 2626 the topology plugin. This section defines the methods RELOAD uses to 2627 form and maintain connections between nodes in the overlay. Three 2628 methods are defined: 2630 Attach: used to form RELOAD connections between nodes. When node 2631 A wants to connect to node B, it sends an Attach message to node B 2632 through the overlay. The Attach contains A's ICE parameters. B 2633 responds with its ICE parameters and the two nodes perform ICE to 2634 form connection. Attach also allows two nodes to connect via No- 2635 ICE instead of full ICE. 2636 AppAttach: used to form application layer connections between 2637 nodes. 2638 Ping: is a simple request/response which is used to verify 2639 connectivity of the target peer. 2641 5.5.1. Attach 2643 A node sends an Attach request when it wishes to establish a direct 2644 TCP or UDP connection to another node for the purpose of sending 2645 RELOAD messages. 2647 As described in Section 5.1, an Attach may be routed to either a 2648 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2649 will fail if that node is not reached. An Attach routed to a 2650 Resource-ID will establish a connection with the peer currently 2651 responsible for that Resource-ID, which may be useful in establishing 2652 a direct connection to the responsible peer for use with frequent or 2653 large resource updates. 2655 An Attach in and of itself does not result in updating the routing 2656 table of either node. That function is performed by Updates. If 2657 node A has Attached to node B, but not received any Updates from B, 2658 it MAY route messages which are directly addressed to B through that 2659 channel but MUST NOT route messages through B to other peers via that 2660 channel. The process of Attaching is separate from the process of 2661 becoming a peer (using Join and Update), to prevent half-open states 2662 where a node has started to form connections but is not really ready 2663 to act as a peer. Thus, clients (unlike peers) can simply Attach 2664 without sending Join or Update. 2666 5.5.1.1. Request Definition 2668 An Attach request message contains the requesting node ICE connection 2669 parameters formatted into a binary structure. 2671 enum { reserved(0), DTLS-UDP-SR(1), 2672 DLTS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2673 (255) } OverlayLink; 2675 enum { reserved(0), host(1), srflx(2), prflx(3), relay(4), 2676 (255) } CandType; 2678 struct { 2679 opaque name<2^16-1>; 2680 opaque value<2^16-1>; 2681 } IceExtension; 2683 struct { 2684 IpAddressPort addr_port; 2685 OverlayLink overlay_link; 2686 opaque foundation<0..255>; 2687 uint32 priority; 2688 CandType type; 2689 select (type){ 2690 case host: 2691 ; /* Nothing */ 2692 case srflx: 2693 case prflx: 2694 case relay: 2695 IpAddressPort rel_addr_port; 2696 } 2697 IceExtension extensions<0..2^16-1>; 2698 } IceCandidate; 2700 struct { 2701 opaque ufrag<0..2^8-1>; 2702 opaque password<0..2^8-1>; 2703 opaque role<0..2^8-1>; 2704 IceCandidate candidates<0..2^16-1>; 2705 } AttachReqAns; 2707 The values contained in AttachReqAns are: 2709 ufrag 2710 The username fragment (from ICE). 2712 password 2713 The ICE password. 2715 role 2716 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2717 value MUST be 'passive' for the offerer (the peer sending the 2718 Attach request) and 'active' for the answerer (the peer sending 2719 the Attach response). 2721 candidates 2722 One or more ICE candidate values, as described below. 2724 Each ICE candidate is represented as an IceCandidate structure, which 2725 is a direct translation of the information from the ICE string 2726 structures, with the exception of the component ID. Since there is 2727 only one component, it is always 1, and thus left out of the PDU. 2728 The remaining values are specified as follows: 2730 addr_port 2731 corresponds to the connection-address and port productions. 2733 overlay_link 2734 corresponds to the OverlayLink production, Overlay Link protocols 2735 used with No ICE MUST specify "no ICE" in their description. 2736 Future overlay link values can be added be defining new 2737 OverlayLink values in the IANA registry in Section 13.9. Future 2738 extensions to the encapsulation or framing that provide for 2739 backward compatibility with that specified by a previously defined 2740 OverlayLink values MUST use that previous value. OverlayLink 2741 protocols are defined in Section 5.6 2742 A single AttachReqAns MUST NOT include both candidates whose 2743 OverlayLink protocols use ICE (the default) and candidates that 2744 specify "no ICE". 2746 foundation 2747 corresponds to the foundation production. 2749 priority 2750 corresponds to the priority production. 2752 type 2753 corresponds to the cand-type production. 2755 rel_addr_port 2756 corresponds to the rel-addr and rel-port productions. Only 2757 present for type "relay". 2759 extensions 2760 ICE extensions. The name and value fields correspond to binary 2761 translations of the equivalent fields in the ICE extensions. 2763 These values should be generated using the procedures described in 2764 Section 5.5.1.3. 2766 5.5.1.2. Response Definition 2768 If a peer receives an Attach request, it SHOULD process the request 2769 and generate its own response with a AttachReqAns. It should then 2770 begin ICE checks. When a peer receives an Attach response, it SHOULD 2771 parse the response and begin its own ICE checks. 2773 5.5.1.3. Using ICE With RELOAD 2775 This section describes the profile of ICE that is used with RELOAD. 2776 RELOAD implementations MUST implement full ICE. 2778 In ICE as defined by [RFC5245], SDP is used to carry the ICE 2779 parameters. In RELOAD, this function is performed by a binary 2780 encoding in the Attach method. This encoding is more restricted than 2781 the SDP encoding because the RELOAD environment is simpler: 2783 o Only a single media stream is supported. 2784 o In this case, the "stream" refers not to RTP or other types of 2785 media, but rather to a connection for RELOAD itself or for SIP 2786 signaling. 2787 o RELOAD only allows for a single offer/answer exchange. Unlike the 2788 usage of ICE within SIP, there is never a need to send a 2789 subsequent offer to update the default candidates to match the 2790 ones selected by ICE. 2792 An agent follows the ICE specification as described in [RFC5245] with 2793 the changes and additional procedures described in the subsections 2794 below. 2796 5.5.1.4. Collecting STUN Servers 2798 ICE relies on the node having one or more STUN servers to use. In 2799 conventional ICE, it is assumed that nodes are configured with one or 2800 more STUN servers through some out-of-band mechanism. This is still 2801 possible in RELOAD but RELOAD also learns STUN servers as it connects 2802 to other peers. Because all RELOAD peers implement ICE and use STUN 2803 keepalives, every peer is a STUN server [RFC5389]. Accordingly, any 2804 peer a node knows will be willing to be a STUN server -- though of 2805 course it may be behind a NAT. 2807 A peer on a well-provisioned wide-area overlay will be configured 2808 with one or more bootstrap nodes. These nodes make an initial list 2809 of STUN servers. However, as the peer forms connections with 2810 additional peers, it builds more peers it can use as STUN servers. 2812 Because complicated NAT topologies are possible, a peer may need more 2813 than one STUN server. Specifically, a peer that is behind a single 2814 NAT will typically observe only two IP addresses in its STUN checks: 2815 its local address and its server reflexive address from a STUN server 2816 outside its NAT. However, if there are more NATs involved, it may 2817 learn additional server reflexive addresses (which vary based on 2818 where in the topology the STUN server is). To maximize the chance of 2819 achieving a direct connection, a peer SHOULD group other peers by the 2820 peer-reflexive addresses it discovers through them. It SHOULD then 2821 select one peer from each group to use as a STUN server for future 2822 connections. 2824 Only peers to which the peer currently has connections may be used. 2825 If the connection to that host is lost, it MUST be removed from the 2826 list of stun servers and a new server from the same group SHOULD be 2827 selected. 2829 5.5.1.5. Gathering Candidates 2831 When a node wishes to establish a connection for the purposes of 2832 RELOAD signaling or application signaling, it follows the process of 2833 gathering candidates as described in Section 4 of ICE [RFC5245]. 2834 RELOAD utilizes a single component. Consequently, gathering for 2835 these "streams" requires a single component. In the case where a 2836 node has not yet found a TURN server, the agent would not include a 2837 relayed candidate. 2839 The ICE specification assumes that an ICE agent is configured with, 2840 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2841 for an agent to learn these by querying the overlay, as described in 2842 Section 5.5.1.4 and Section 8. 2844 The default candidate selection described in Section 4.1.4 of ICE is 2845 ignored; defaults are not signaled or utilized by RELOAD. 2847 An alternative to using the full ICE supported by the Attach request 2848 is to use No-ICE mechanism by providing candidates with "no ICE" 2849 Overlay Link protocols. Configuration for the overlay indicates 2850 whether or not these Overlay Link protocols can be used. A node MUST 2851 only use ICE or No-ICE candidates within one AttachReqAns. No-ICE 2852 will not work in all of the scenarios where ICE would work, but in 2853 some cases, particularly those with no NATs or firewalls, it will 2854 work. It is RECOMMENDED that full ICE be used even for a node that 2855 has a public, unfiltered IP address, to take advantage of STUN 2856 connectivity checks, etc. 2858 5.5.1.6. Prioritizing Candidates 2860 At the time of writing, UDP is the only transport protocol specified 2861 to work with ICE. However, standardization of additional protocols 2862 for use with ICE is expected, including TCP and datagram-oriented 2863 protocols such as SCTP and DCCP. In particular, UDP encapsulations 2864 for SCTP and DCCP are expected to be standardized in the near future, 2865 greatly expanding the available Overlay Link protocols available for 2866 RELOAD. When additional protocols are available, the following 2867 prioritization is RECOMMENDED: 2869 o Highest priority is assigned to message-oriented protocols that 2870 offer well-understood congestion and flow control without head-of- 2871 line blocking. For example, SCTP without message ordering, DCCP, 2872 or those protocols encapsulated using UDP. 2873 o Second highest priority is assigned to stream-oriented protocols, 2874 e.g. TCP. 2875 o Lowest priority is assigned to protocols encapsulated over UDP 2876 that do not implement well-established congestion control 2877 algorithms. For example, the DTLS/UDP with SR overlay link 2878 protocol. 2880 5.5.1.7. Encoding the Attach Message 2882 Section 4.3 of ICE describes procedures for encoding the SDP for 2883 conveying RELOAD candidates. Instead of actually encoding an SDP, 2884 the candidate information (IP address and port and transport 2885 protocol, priority, foundation, type and related address) is carried 2886 within the attributes of the Attach request or its response. 2887 Similarly, the username fragment and password are carried in the 2888 Attach message or its response. Section 5.5.1 describes the detailed 2889 attribute encoding for Attach. The Attach request and its response 2890 do not contain any default candidates or the ice-lite attribute, as 2891 these features of ICE are not used by RELOAD. 2893 Since the Attach request contains the candidate information and short 2894 term credentials, it is considered as an offer for a single media 2895 stream that happens to be encoded in a format different than SDP, but 2896 is otherwise considered a valid offer for the purposes of following 2897 the ICE specification. Similarly, the Attach response is considered 2898 a valid answer for the purposes of following the ICE specification. 2900 5.5.1.8. Verifying ICE Support 2902 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2903 of ICE. Since RELOAD requires full ICE from all agents, this check 2904 is not required. 2906 5.5.1.9. Role Determination 2908 The roles of controlling and controlled as described in Section 5.2 2909 of ICE are still utilized with RELOAD. However, the offerer (the 2910 entity sending the Attach request) will always be controlling, and 2911 the answerer (the entity sending the Attach response) will always be 2912 controlled. The connectivity checks MUST still contain the ICE- 2913 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 2914 role reversal capability for which they are defined will never be 2915 needed with RELOAD. This is to allow for a common codebase between 2916 ICE for RELOAD and ICE for SDP. 2918 5.5.1.10. Full ICE 2920 When neither side has provided an No-ICE candidate, connectivity 2921 checks and nominations are used as in regular ICE. 2923 5.5.1.10.1. Connectivity Checks 2925 The processes of forming check lists in Section 5.7 of ICE, 2926 scheduling checks in Section 5.8, and checking connectivity checks in 2927 Section 7 are used with RELOAD without change. 2929 5.5.1.10.2. Concluding ICE 2931 The controlling agent MUST utilize regular nomination. This is to 2932 ensure consistent state on the final selected pairs without the need 2933 for an updated offer, as RELOAD does not generate additional offer/ 2934 answer exchanges. 2936 The procedures in Section 8 of ICE are followed to conclude ICE, with 2937 the following exceptions: 2939 o The controlling agent MUST NOT attempt to send an updated offer 2940 once the state of its single media stream reaches Completed. 2941 o Once the state of ICE reaches Completed, the agent can immediately 2942 free all unused candidates. This is because RELOAD does not have 2943 the concept of forking, and thus the three second delay in Section 2944 8.3 of ICE does not apply. 2946 5.5.1.10.3. Media Keepalives 2948 STUN MUST be utilized for the keepalives described in Section 10 of 2949 ICE. 2951 5.5.1.11. No ICE 2953 No-ICE is selected when either side has provided "no ICE" Overlay 2954 Link candidates. STUN is not used for connectivity checks when doing 2955 No-ICE; instead the DTLS or TLS handshake (or similar security layer 2956 of future overlay link protocols) forms the connectivity check. The 2957 certificate exchanged during the (D)TLS handshake must match the node 2958 that sent the AttachReqAns and if it does not, the connection MUST be 2959 closed. 2961 5.5.1.11.1. Implementation Notes for No-ICE 2963 This is a non-normative section to help implementors. 2965 At times ICE can seem a bit daunting to get one's head around. For a 2966 simple IPv4 only peer, a simple implementation of No-ICE could be 2967 done by doing the following: 2968 o When sending an AttachReqAns, form one candidate with a priority 2969 value of (2^24)*(126)+(2^8)*(65535)+(2^0)*(256-1) that specifies 2970 the UDP port being listened to and another one with the TCP port. 2971 o Check the certificate received in the TLS handshake has the same 2972 Node-ID as the node that has sent the AttachReqAns. If multiple 2973 connections succeed, close all but the one with highest priority. 2974 o Do normal TLS and DTLS with no need for any special framing or 2975 STUN processing. 2977 5.5.1.12. Subsequent Offers and Answers 2979 An agent MUST NOT send a subsequent offer or answer. Thus, the 2980 procedures in Section 9 of ICE MUST be ignored. 2982 5.5.1.13. Sending Media 2984 The procedures of Section 11 apply to RELOAD as well. However, in 2985 this case, the "media" takes the form of application layer protocols 2986 (RELOAD or SIP for example) over TLS or DTLS. Consequently, once ICE 2987 processing completes, the agent will begin TLS or DTLS procedures to 2988 establish a secure connection. The node which sent the Attach 2989 request MUST be the TLS server. The other node MUST be the TLS 2990 client. The server MUST request TLS client authentication. The 2991 nodes MUST verify that the certificate presented in the handshake 2992 matches the identity of the other peer as found in the Attach 2993 message. Once the TLS or DTLS signaling is complete, the application 2994 protocol is free to use the connection. 2996 The concept of a previous selected pair for a component does not 2997 apply to RELOAD, since ICE restarts are not possible with RELOAD. 2999 5.5.1.14. Receiving Media 3001 An agent MUST be prepared to receive packets for the application 3002 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3003 time. The jitter and RTP considerations in Section 11 of ICE do not 3004 apply to RELOAD. 3006 5.5.2. AppAttach 3008 A node sends an AppAttach request when it wishes to establish a 3009 direct connection to another node for the purposes of sending 3010 application layer messages. AppAttach is basically like Attach, 3011 except for the purpose of the connection. A separate request is used 3012 to avoid implementor confusion between the two methods (this was 3013 found to be a real problem with initial implementations). The 3014 AppAttach request and its response contain an application attribute, 3015 which indicates what protocol is to be run over the connection. 3017 5.5.2.1. Request Definition 3019 An AppAttachReqAns message contains the requesting node's ICE 3020 connection parameters formatted into a binary structure. 3022 struct { 3023 opaque ufrag<0..2^8-1>; 3024 opaque password<0..2^8-1>; 3025 uint16 application; 3026 opaque role<0..2^8-1>; 3027 IceCandidate candidates<0..2^16-1>; 3028 } AppAttachReqAns; 3030 The values contained in AppAttachReqAns are: 3032 ufrag 3033 The username fragment (from ICE) 3035 password 3036 The ICE password. 3038 application 3039 A 16-bit application-id as defined in the Section 13.4. This 3040 number represents the IANA registered applications that is going 3041 to be sent data on this connection. For SIP, this is 5060 or 3042 5061. 3044 role 3045 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3047 candidates 3048 One or more ICE candidate values 3050 5.5.2.2. Response Definition 3052 If a peer receives an AppAttach request, it SHOULD process the 3053 request and generate its own response with a AppAttachReqAns. It 3054 should then begin ICE checks. When a peer receives an AppAttach 3055 response, it SHOULD parse the response and begin its own ICE checks. 3057 5.5.3. Ping 3059 Ping is used to test connectivity along a path. A ping can be 3060 addressed to a specific Node-ID, to the peer controlling a given 3061 location (by using a resource ID), or to the broadcast Node-ID 3062 (2^128-1). 3064 5.5.3.1. Request Definition 3066 struct { 3067 } PingReq 3069 5.5.3.2. Response Definition 3071 A successful PingAns response contains the information elements 3072 requested by the peer. 3074 struct { 3075 uint64 response_id; 3076 uint64 time; 3077 } PingAns; 3079 A PingAns message contains the following elements: 3081 response_id 3082 A randomly generated 64-bit response ID. This is used to 3083 distinguish Ping responses. 3085 time 3086 The time when the ping responses was created in absolute time, 3087 represented in milliseconds since midnight Jan 1, 1970 which is 3088 the UNIX epoch. 3090 5.5.4. Config_Update 3092 The Config_Update method is used to push updated configuration data 3093 across the overlay. Whenever a node detects that another node has 3094 old configuration data, it MUST generate a Config_Update request. 3095 The Config_Update request allows updating of two kinds of data: the 3096 configuration data (Section 5.3.2.1) and kind information 3097 (Section 6.4.1.1). 3099 5.5.4.1. Request Definition 3101 enum { reserved(0), config(1), kind(2), (255) } 3102 Config_UpdateType; 3104 typedef opaque KindDescription<2^16-1>; 3106 struct { 3107 Config_UpdateType type; 3108 uint32 length; 3110 select (type) { 3111 case config: 3112 opaque config_data<2^24-1>; 3114 case kind: 3115 KindDescription kinds<2^24-1>; 3117 /* This structure may be extended with new types*/ 3118 }; 3119 } Config_UpdateReq; 3121 The Config_UpdateReq message contains the following elements: 3123 type 3124 The type of the contents of the message. This structure allows 3125 for unknown content types. 3126 length 3127 The length of the remainder of the message. This is included to 3128 preserve backward compatibility and is 32 bits instead of 24 to 3129 facilitate easy conversion between network and host byte order. 3130 config_data (type==config) 3131 The contents of the configuration document. 3132 kinds (type==kind) 3133 One or more XML kind-block productions (see Section 10.1). These 3134 MUST be encoded with UTF-8 and assume a default namespace of 3135 "urn:ietf:params:xml:ns:p2p:config-base". 3137 5.5.4.2. Response Definition 3139 struct { 3140 } Config_UpdateReq 3142 If the Config_UpdateReq is of type "config" it MUST only be processed 3143 if all the following are true: 3144 o The sequence number in the document is greater than the current 3145 configuration sequence number. 3146 o The configuration document is correctly digitally signed (see 3147 Section 10 for details on signatures. 3148 Otherwise appropriate errors MUST be generated. 3150 If the Config_UpdateReq is of type "kind" it MUST only be processed 3151 if it is correctly digitally signed by an acceptable kind signer as 3152 specified in the configuraton file. Details on kind-signer field in 3153 the configuration file is described in Section 10.1. In addition, if 3154 the kind update conflicts with an existing known kind (i.e., it is 3155 signed by a different signer), then it should be rejected with 3156 "Error_Forbidden". This should not happen in correctly functioning 3157 overlays. 3159 If the update is acceptable, then the node MUST reconfigure itself to 3160 match the new information. This may include adding permissions for 3161 new kinds, deleting old kinds, or even, in extreme circumstances, 3162 exiting and reentering the overlay, if, for instance, the DHT 3163 algorithm has changed. 3165 The response for Config_Update is empty. 3167 5.6. Overlay Link Layer 3169 RELOAD can use multiple Overlay Link protocols to send its messages. 3170 Because ICE is used to establish connections (see Section 5.5.1.3), 3171 RELOAD nodes are able to detect which Overlay Link protocols are 3172 offered by other nodes and establish connections between them. Any 3173 link protocol needs to be able to establish a secure, authenticated 3174 connection and to provide data origin authentication and message 3175 integrity for individual data elements. RELOAD currently supports 3176 three Overlay Link protocols: 3178 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3179 o TLS [RFC5246] over TCP with Framing Header, no ICE 3180 o DTLS [RFC4347] over UDP with SR, no ICE 3182 Note that although UDP does not properly have "connections", both TLS 3183 and DTLS have a handshake which establishes a similar, stateful 3184 association, and we simply refer to these as "connections" for the 3185 purposes of this document. 3187 If a peer receives a message that is larger than value of max- 3188 message-size defined in the overlay configuration, the peer SHOULD 3189 send an Error_Message_Too_Large error and then close the TLS or DTLS 3190 session from which the message was received. Note that this error 3191 can be sent and the session closed before receiving the complete 3192 message. If the forwarding header is larger than the max-message- 3193 size, the receiver SHOULD close the TLS or DTLS session without 3194 sending an error. 3196 The Framing Header (FH) is used to frame messages and provide timing 3197 when used on a reliable stream-based transport protocol. Simple 3198 Reliability (SR) makes use of the FH to provide congestion control 3199 and semi-reliability when using unreliable message-oriented transport 3200 protocols. We will first define each of these algorithms, then 3201 define overlay link protocols that use them. 3203 Note: We expect future Overlay Link protocols to define replacements 3204 for all components of these protocols, including the framing header. 3205 These protocols have been chosen for simplicity of implementation and 3206 reasonable performance. 3208 Note to implementers: There are inherent tradeoffs in utilizing 3209 short timeouts to determine when a link has failed. To balance the 3210 tradeoffs, an implementation should be able to quickly act to remove 3211 entries from the routing table when there is reason to suspect the 3212 link has failed. For example, in a Chord-derived overlay algorithm, 3213 a closer finger table entry could be substituted for an entry in the 3214 finger table that has experienced a timeout. That entry can be 3215 restored if it proves to resume functioning, or replaced at some 3216 point in the future if necessary. End-to-end retransmissions will 3217 handle any lost messages, but only if the failing entries do not 3218 remain in the finger table for subsequent retransmissions. 3220 5.6.1. Future Overlay Link Protocols 3222 5.6.1.1. HIP 3224 The P2PSIP Working Group has expressed interest in supporting a HIP- 3225 based link protocol [RFC5201]. Such support would require specifying 3226 such details as: 3228 o How to issue certificates which provided identities meaningful to 3229 the HIP base exchange. We anticipate that this would require a 3230 mapping between ORCHIDs and NodeIds. 3231 o How to carry the HIP I1 and I2 messages. We anticipate that this 3232 would require defining a HIP Tunnel usage. 3233 o How to carry RELOAD messages over HIP. 3235 5.6.1.2. ICE-TCP 3237 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] should allow TCP to be 3238 supported as an Overlay Link protocol that can be added using ICE. 3239 However, as of the time of this writing, the draft is not making 3240 significant progress toward approval. 3242 5.6.1.3. Message-oriented Transports 3244 Modern message-oriented transports offer high performance, good 3245 congestion control, and avoid head-of-line blocking in case of lost 3246 data. These characteristics make them preferable as underlying 3247 transport protocols for RELOAD links. SCTP without message ordering 3248 and DCCP are two examples of such protocols. However, currently they 3249 are not well-supported by commonly available NATs, and specifications 3250 for ICE session establishment are not available. 3252 5.6.1.4. Tunneled Transports 3254 As of the time of this writing, there is significant interest in the 3255 IETF community in tunneling other transports over UDP, motivated by 3256 the situation that UDP is well-supported by modern NAT hardware, and 3257 similar performance can be achieved to native implementation. 3258 Currently SCTP, DCCP, and a generic tunneling extension are being 3259 proposed for message-oriented protocols. Baset et al. have proposed 3260 tunneling TCP over UDP for similar reasons 3261 [I-D.baset-tsvwg-tcp-over-udp]. Once ICE traversal has been 3262 specified for these tunneled protocols, they should be easily 3263 supported as an overlay link protocol. 3265 5.6.2. Framing Header 3267 In order to support unreliable links and to allow for quick detection 3268 of link failures when using reliable end-to-end transports, each 3269 message is wrapped in a very simple framing layer (FramedMessage) 3270 which is only used for each hop. This layer contains a sequence 3271 number which can then be used for ACKs. The same header is used for 3272 both reliable and unreliable transports for simplicity of 3273 implementation---not all aspects of the header apply to both types of 3274 transports. 3276 The definition of FramedMessage is: 3278 enum {data (128), ack (129), (255)} FramedMessageType; 3280 struct { 3281 FramedMessageType type; 3283 select (type) { 3284 case data: 3285 uint32 sequence; 3286 opaque message<0..2^24-1>; 3288 case ack: 3289 uint32 ack_sequence; 3290 uint32 received; 3291 }; 3292 } FramedMessage; 3294 The type field of the PDU is set to indicate whether the message is 3295 data or an acknowledgement. 3297 If the message is of type "data", then the remainder of the PDU is as 3298 follows: 3300 sequence 3301 the sequence number. This increments by 1 for each framed message 3302 sent over this transport session. 3304 message 3305 the message that is being transmitted. 3307 Each connection has it own sequence number space. Initially the 3308 value is zero and it increments by exactly one for each message sent 3309 over that connection. 3311 When the receiver receives a message, it SHOULD immediately send an 3312 ACK message. The receiver MUST keep track of the 32 most recent 3313 sequence numbers received on this association in order to generate 3314 the appropriate ack. 3316 If the PDU is of type "ack", the contents are as follows: 3318 ack_sequence 3319 The sequence number of the message being acknowledged. 3321 received 3322 A bitmask indicating if each of the previous 32 sequence numbers 3323 before this packet has been among the 32 packets most recently 3324 received on this connection. When a packet is received with a 3325 sequence number N, the receiver looks at the sequence number of 3326 the previously 32 packets received on this connection. Call the 3327 previously received packet number M. For each of the previous 32 3328 packets, if the sequence number M is less than N but greater than 3329 N-32, the N-M bit of the received bitmask is set to one; otherwise 3330 it is zero. Note that a bit being set to one indicates positively 3331 that a particular packet was received, but a bit being set to zero 3332 means only that it is unknown whether or not the packet has been 3333 received, because it might have been received before the 32 most 3334 recently received packets. 3336 The received field bits in the ACK provide a very high degree of 3337 redundancy so that the sender can figure out which packets the 3338 receiver has received and can then estimate packet loss rates. If 3339 the sender also keeps track of the time at which recent sequence 3340 numbers have been sent, the RTT can be estimated. 3342 5.6.3. Simple Reliability 3344 When RELOAD is carried over DTLS or another unreliable link protocol, 3345 it needs to be used with a reliability and congestion control 3346 mechanism, which is provided on a hop-by-hop basis. The basic 3347 principle is that each message, regardless of whether or not it 3348 carries a request or response, will get an ACK and be reliably 3349 retransmitted. The receiver's job is very simple, limited to just 3350 sending ACKs. All the complexity is at the sender side. This allows 3351 the sending implementation to trade off performance versus 3352 implementation complexity without affecting the wire protocol. 3354 5.6.3.1. Retransmission and Flow Control 3356 Because the receiver's role is limited to providing packet 3357 acknowledgements, a wide variety of congestion control algorithms can 3358 be implemented on the sender side while using the same basic wire 3359 protocol. Senders MUST implement a retransmission and congestion 3360 control scheme no more aggressive then TFRC[RFC5348]. One way to do 3361 that is for senders to implement the scheme in the following section. 3362 Another alternative would be TFRC-SP [RFC4828] and use the received 3363 bitmask to allow the sender to compute packet loss event rates. 3365 5.6.3.1.1. Trivial Retransmission 3367 A peer SHOULD retransmit a message if it has not received an ACK 3368 after an interval of RTO ("Retransmission TimeOut"). The peer MUST 3369 double the time to wait after each retransmission. In each 3370 retransmission, the sequence number is incremented. 3372 The RTO is an estimate of the round-trip time (RTT). Implementations 3373 can use a static value for RTO or a dynamic estimate which will 3374 result in better performance. For implementations that use a static 3375 value, the default value for RTO is 500 ms. Nodes MAY use smaller 3376 values of RTO if it is known that all nodes are within the local 3377 network. The default RTO MAY be chosen larger, and this is 3378 RECOMMENDED if it is known in advance (such as on high latency access 3379 links) that the round-trip time is larger. 3381 Implementations that use a dynamic estimate to compute the RTO MUST 3382 use the algorithm described in RFC 2988[RFC2988], with the exception 3383 that the value of RTO SHOULD NOT be rounded up to the nearest second 3384 but instead rounded up to the nearest millisecond. The RTT of a 3385 successful STUN transaction from the ICE stage is used as the initial 3386 measurement for formula 2.2 of RFC 2988. The sender keeps track of 3387 the time each message was sent for all recently sent messages. Any 3388 time an ACK is received, the sender can compute the RTT for that 3389 message by looking at the time the ACK was received and the time when 3390 the message was sent. This is used as a subsequent RTT measurement 3391 for formula 2.3 of RFC 2988 to update the RTO estimate. (Note that 3392 because retransmissions receive new sequence numbers, all received 3393 ACKs are used.) 3395 The value for RTO is calculated separately for each DTLS session. 3397 Retransmissions continue until a response is received, or until a 3398 total of 5 requests have been sent or there has been a hard ICMP 3399 error [RFC1122]. The sender knows a response was received when it 3400 receives an ACK with a sequence number that indicates it is a 3401 response to one of the transmissions of this messages. For example, 3402 assuming an RTO of 500 ms, requests would be sent at times 0 ms, 500 3403 ms, 1500 ms, 3500 ms, and 7500 ms. If all retransmissions for a 3404 message fail, then the sending node SHOULD close the connection 3405 routing the message. 3407 To determine when a link may be failing without waiting for the final 3408 timeout, observe when no ACKs have been received for an entire RTO 3409 interval, and then wait for three retransmissions to occur beyond 3410 that point. If no ACKs have been received by the time the third 3411 retransmission occurs, it is RECOMMENDED that the link be removed 3412 from the routing table. The link MAY be restored to the routing 3413 table if ACKs resume before the connection is closed, as described 3414 above. 3416 Once an ACK has been received for a message, the next message can be 3417 sent, but the peer SHOULD ensure that there is at least 10 ms between 3418 sending any two messages. The only time a value less than 10 ms can 3419 be used is when it is known that all nodes are on a network that can 3420 support retransmissions faster than 10 ms with no congestion issues. 3422 5.6.4. DTLS/UDP with SR 3424 This overlay link protocol consists of DTLS over UDP while 3425 implementing the Simple Reliability protocol. STUN Connectivity 3426 checks and keepalives are used. 3428 5.6.5. TLS/TCP with FH, no ICE 3430 This overlay link protocol consists of TLS over TCP with the framing 3431 header. Because ICE is not used, STUN connectivity checks are not 3432 used upon establishing the TCP connection, nor are they used for 3433 keepalives. 3435 Because the TCP layer's application-level timeout is too slow to be 3436 useful for overlay routing, the Overlay Link implementation MUST 3437 using the framing header to measure the RTT of the connection and 3438 calculate an RTO as specified in Section 2 of [RFC2988]. The 3439 resulting RTO is not used for retransmissions, but as a timeout to 3440 indicate when the link SHOULD be removed from the routing table. It 3441 is RECOMMENDED that such a connection be retained for 30s to 3442 determine if the failure was transient before concluding the link has 3443 failed permanently. 3445 When sending candidates for TLS/TCP with FH, no ICE, a passive 3446 candidate MUST be provided. The following table shows which side of 3447 the exchange initiates the connection depending on whether they 3448 provided ICE or No-ICE candidates. Note that the active TCP role 3449 does not alter the TLS server/client determination. 3451 +----------------------+----------+-----------------+ 3452 | Offeror | Answerer | TCP Active Role | 3453 +----------------------+----------+-----------------+ 3454 | ICE | No-ICE | Offeror | 3455 | No-ICE | ICE | Answerer | 3456 | No-ICE | No-ICE | Offeror | 3457 +----------------------+----------+-----------------+ 3459 Table 1: Determining Active Role for No-ICE 3461 5.6.6. DTLS/UDP with SR, no ICE 3463 This overlay link protocol consists of DTLS over UDP while 3464 implementing the Simple Reliability protocol. Because ICE is not 3465 used, no STUN connectivity checks or keepalives are used. 3467 5.7. Fragmentation and Reassembly 3469 In order to allow transmission over datagram protocols such as DTLS, 3470 RELOAD messages may be fragmented. 3472 Any node along the path can fragment the message but only the final 3473 destination reassembles the fragments. When a node takes a packet 3474 and fragments it, each fragment has a full copy of the Forwarding 3475 Header but the data after the Forwarding Header is broken up in 3476 appropriate sized chunks. The size of the payload chunks needs to 3477 take into account space to allow the via and destination lists to 3478 grow. Each fragment MUST contain a full copy of the via and 3479 destination list and MUST contain at least 256 bytes of the message 3480 body. If the via and destination list are so large that this is not 3481 possible, RELOAD fragmentation is not performed and IP-layer 3482 fragmentation is allowed to occur. When a message must be 3483 fragmented, it SHOULD be split into equal-sized fragments that are no 3484 larger than the PMTU of the next overlay link minus 32 bytes. This 3485 is to allow the via list to grow before further fragmentation is 3486 required. 3488 Note that this fragmentation is not optimal for the end-to-end path - 3489 a message may be refragmented multiple times as it traverses the 3490 overlay. This option has been chosen as it is far easier to 3491 implement than e2e PMTU discovery across an ever-changing overlay, 3492 and it effectively addresses the reliability issues of relying on IP- 3493 layer fragmentation. However, PING can be used to allow e2e PMTU to 3494 be implemented if desired. 3496 Upon receipt of a fragmented message by the intended peer, the peer 3497 holds the fragments in a holding buffer until the entire message has 3498 been received. The message is then reassembled into a single message 3499 and processed. In order to mitigate denial of service attacks, 3500 receivers SHOULD time out incomplete fragments after maximum request 3501 lifetime (15 seconds). Note this time was derived from looking at 3502 the end to end retransmission time and saving fragments long enough 3503 for the full end to end retransmissions to take place. Ideally the 3504 receiver would have enough buffer space to deal with as many 3505 fragments as can arrive in the maximum request lifetime. However, if 3506 the receiver runs out of buffer space to reassemble the messages it 3507 MUST drop the message. 3509 When a message is fragmented, the fragment offset value is stored in 3510 the lower 24 bits of the fragment field of the forwarding header. 3511 The offset is the number of bytes between the end of the forwarding 3512 header and the start of the data. The first fragment therefore has 3513 an offset of 0. The first and last bit indicators MUST be 3514 appropriately set. If the message is not fragmented, then both the 3515 first and last fragment are set to 1 and the offset is 0 resulting in 3516 a fragment value of 0xC0000000. 3518 6. Data Storage Protocol 3520 RELOAD provides a set of generic mechanisms for storing and 3521 retrieving data in the Overlay Instance. These mechanisms can be 3522 used for new applications simply by defining new code points and a 3523 small set of rules. No new protocol mechanisms are required. 3525 The basic unit of stored data is a single StoredData structure: 3527 struct { 3528 uint32 length; 3529 uint64 storage_time; 3530 uint32 lifetime; 3531 StoredDataValue value; 3532 Signature signature; 3533 } StoredData; 3535 The contents of this structure are as follows: 3537 length 3538 The size of the StoredData structure in octets excluding the size 3539 of length itself. 3541 storage_time 3542 The time when the data was stored in absolute time, represented in 3543 milliseconds since the Unix epoch of midnight Jan 1, 1970. Any 3544 attempt to store a data value with a storage time before that of a 3545 value already stored at this location MUST generate a 3546 Error_Data_Too_Old error. This prevents rollback attacks. Note 3547 that this does not require synchronized clocks: the receiving 3548 peer uses the storage time in the previous store, not its own 3549 clock. 3550 A node that is attempting to store new data in response to a user 3551 request (rather than as an overlay maintenance operation such as 3552 occurs during unpartitioning) is rejected with an 3553 Error_Data_Too_Old error, the node MAY elect to perform its store 3554 using a storage_time that increments the value used with the 3555 previous store. This situation may occur when the clocks of nodes 3556 storing to this location are not properly synchronized. 3558 lifetime 3559 The validity period for the data, in seconds, starting from the 3560 time of store. 3562 value 3563 The data value itself, as described in Section 6.2. 3565 signature 3566 A signature as defined in Section 6.1. 3568 Each Resource-ID specifies a single location in the Overlay Instance. 3569 However, each location may contain multiple StoredData values 3570 distinguished by Kind-ID. The definition of a kind describes both 3571 the data values which may be stored and the data model of the data. 3572 Some data models allow multiple values to be stored under the same 3573 Kind-ID. Section Section 6.2 describes the available data models. 3574 Thus, for instance, a given Resource-ID might contain a single-value 3575 element stored under Kind-ID X and an array containing multiple 3576 values stored under Kind-ID Y. 3578 6.1. Data Signature Computation 3580 Each StoredData element is individually signed. However, the 3581 signature also must be self-contained and cover the Kind-ID and 3582 Resource-ID even though they are not present in the StoredData 3583 structure. The input to the signature algorithm is: 3585 resource_id + kind + storage_time + StoredDataValue + 3586 SignerIdentity 3588 Where these values are: 3590 resource 3591 The resource ID where this data is stored. 3593 kind 3594 The Kind-ID for this data. 3596 storage_time 3597 The contents of the storage_time data value. 3598 StoredDataValue 3599 The contents of the stored data value, as described in the 3600 previous sections. 3602 SignerIdentity 3603 The signer identity as defined in Section 5.3.4. 3605 Once the signature has been computed, the signature is represented 3606 using a signature element, as described in Section 5.3.4. 3608 6.2. Data Models 3610 The protocol currently defines the following data models: 3612 o single value 3613 o array 3614 o dictionary 3616 These are represented with the StoredDataValue structure: 3618 enum { reserved(0), single_value(1), array(2), 3619 dictionary(3), (255)} DataModel; 3621 struct { 3622 Boolean exists; 3623 opaque value<0..2^32-1>; 3624 } DataValue; 3626 struct { 3627 select (DataModel) { 3628 case single_value: 3629 DataValue single_value_entry; 3631 case array: 3632 ArrayEntry array_entry; 3634 case dictionary: 3635 DictionaryEntry dictionary_entry; 3637 /* This structure may be extended */ 3638 } ; 3639 } StoredDataValue; 3641 We now discuss the properties of each data model in turn: 3643 6.2.1. Single Value 3645 A single-value element is a simple sequence of bytes. There may be 3646 only one single-value element for each Resource-ID, Kind-ID pair. 3648 A single value element is represented as a DataValue, which contains 3649 the following two elements: 3651 exists 3652 This value indicates whether the value exists at all. If it is 3653 set to False, it means that no value is present. If it is True, 3654 that means that a value is present. This gives the protocol a 3655 mechanism for indicating nonexistence as opposed to emptiness. 3657 value 3658 The stored data. 3660 6.2.2. Array 3662 An array is a set of opaque values addressed by an integer index. 3663 Arrays are zero based. Note that arrays can be sparse. For 3664 instance, a Store of "X" at index 2 in an empty array produces an 3665 array with the values [ NA, NA, "X"]. Future attempts to fetch 3666 elements at index 0 or 1 will return values with "exists" set to 3667 False. 3669 A array element is represented as an ArrayEntry: 3671 struct { 3672 uint32 index; 3673 DataValue value; 3674 } ArrayEntry; 3676 The contents of this structure are: 3678 index 3679 The index of the data element in the array. 3681 value 3682 The stored data. 3684 6.2.3. Dictionary 3686 A dictionary is a set of opaque values indexed by an opaque key with 3687 one value for each key. A single dictionary entry is represented as 3688 follows: 3690 A dictionary element is represented as a DictionaryEntry: 3692 typedef opaque DictionaryKey<0..2^16-1>; 3694 struct { 3695 DictionaryKey key; 3696 DataValue value; 3697 } DictionaryEntry; 3699 The contents of this structure are: 3701 key 3702 The dictionary key for this value. 3704 value 3705 The stored data. 3707 6.3. Access Control Policies 3709 Every kind which is storable in an overlay MUST be associated with an 3710 access control policy. This policy defines whether a request from a 3711 given node to operate on a given value should succeed or fail. It is 3712 anticipated that only a small number of generic access control 3713 policies are required. To that end, this section describes a small 3714 set of such policies and Section 13.3 establishes a registry for new 3715 policies if required. Each policy has a short string identifier 3716 which is used to reference it in the configuration document. 3718 6.3.1. USER-MATCH 3720 In the USER-MATCH policy, a given value MUST be written (or 3721 overwritten) if and only if the request is signed with a key 3722 associated with a certificate whose user name hashes (using the hash 3723 function for the overlay) to the Resource-ID for the resource. 3724 Recall that the certificate may, depending on the overlay 3725 configuration, be self-signed. 3727 6.3.2. NODE-MATCH 3729 In the NODE-MATCH policy, a given value MUST be written (or 3730 overwritten) if and only if the request is signed with a key 3731 associated with a certificate whose Node-ID hashes (using the hash 3732 function for the overlay) to the Resource-ID for the resource. 3734 6.3.3. USER-NODE-MATCH 3736 The USER-NODE-MATCH policy may only be used with dictionary types. 3737 In the USER-NODE-MATCH policy, a given value MUST be written (or 3738 overwritten) if and only if the request is signed with a key 3739 associated with a certificate whose user name hashes (using the hash 3740 function for the overlay) to the Resource-ID for the resource. In 3741 addition, the dictionary key MUST be equal to the Node-ID in the 3742 certificate. 3744 6.3.4. NODE-MULTIPLE 3746 In the NODE-MULTIPLE policy, a given value MUST be written (or 3747 overwritten) if and only if the request is signed with a key 3748 associated with a certificate containing a Node-ID such that 3749 H(Node-ID || i) is equal to the Resource-ID for some small integer 3750 value of i. When this policy is in use, the maximum value of i MUST 3751 be specified in the kind definition. 3753 6.4. Data Storage Methods 3755 RELOAD provides several methods for storing and retrieving data: 3757 o Store values in the overlay 3758 o Fetch values from the overlay 3759 o Stat: get metadata about values in the overlay 3760 o Find the values stored at an individual peer 3762 These methods are each described in the following sections. 3764 6.4.1. Store 3766 The Store method is used to store data in the overlay. The format of 3767 the Store request depends on the data model which is determined by 3768 the kind. 3770 6.4.1.1. Request Definition 3772 A StoreReq message is a sequence of StoreKindData values, each of 3773 which represents a sequence of stored values for a given kind. The 3774 same Kind-ID MUST NOT be used twice in a given store request. Each 3775 value is then processed in turn. These operations MUST be atomic. 3776 If any operation fails, the state MUST be rolled back to before the 3777 request was received. 3779 The store request is defined by the StoreReq structure: 3781 struct { 3782 KindId kind; 3783 uint64 generation_counter; 3784 StoredData values<0..2^32-1>; 3785 } StoreKindData; 3787 struct { 3788 ResourceId resource; 3789 uint8 replica_number; 3790 StoreKindData kind_data<0..2^32-1>; 3791 } StoreReq; 3793 A single Store request stores data of a number of kinds to a single 3794 resource location. The contents of the structure are: 3796 resource 3797 The resource to store at. 3799 replica_number 3800 The number of this replica. When a storing peer saves replicas to 3801 other peers each peer is assigned a replica number starting from 1 3802 and sent in the Store message. This field is set to 0 when a node 3803 is storing its own data. This allows peers to distinguish replica 3804 writes from original writes. 3806 kind_data 3807 A series of elements, one for each kind of data to be stored. 3809 If the replica number is zero, then the peer MUST check that it is 3810 responsible for the resource and, if not, reject the request. If the 3811 replica number is nonzero, then the peer MUST check that it expects 3812 to be a replica for the resource and that the request sender is 3813 consistent with being the responsible node (i.e., that the receiving 3814 peer does not know of a better node) and, if not, reject the request. 3816 Each StoreKindData element represents the data to be stored for a 3817 single Kind-ID. The contents of the element are: 3819 kind 3820 The Kind-ID. Implementations MUST reject requests corresponding 3821 to unknown kinds. 3823 generation 3824 The expected current state of the generation counter 3825 (approximately the number of times this object has been written; 3826 see below for details). 3828 values 3829 The value or values to be stored. This may contain one or more 3830 stored_data values depending on the data model associated with 3831 each kind. 3833 The peer MUST perform the following checks: 3835 o The kind_id is known and supported. 3836 o The signatures over each individual data element (if any) are 3837 valid. If this check fails, the request MUST be rejected with an 3838 Error_Forbidden error. 3839 o Each element is signed by a credential which is authorized to 3840 write this kind at this Resource-ID. If this check fails, the 3841 request MUST be rejected with an Error_Forbidden error. 3843 o For original (non-replica) stores, the peer MUST check that if the 3844 generation-counter is non-zero, it equals the current value of the 3845 generation-counter for this kind. This feature allows the 3846 generation counter to be used in a way similar to the HTTP Etag 3847 feature. 3848 o The storage time values are greater than that of any value which 3849 would be replaced by this Store. 3850 o The size and number of the stored values is consistent with the 3851 limits specified in the overlay configuration. 3853 If all these checks succeed, the peer MUST attempt to store the data 3854 values. For non-replica stores, if the store succeeds and the data 3855 is changed, then the peer must increase the generation counter by at 3856 least one. If there are multiple stored values in a single 3857 StoreKindData, it is permissible for the peer to increase the 3858 generation counter by only 1 for the entire Kind-ID, or by 1 or more 3859 than one for each value. Accordingly, all stored data values must 3860 have a generation counter of 1 or greater. 0 is used in the Store 3861 request to indicate that the generation counter should be ignored for 3862 processing this request; however the responsible peer should increase 3863 the stored generation counter and should return the correct 3864 generation counter in the response. 3866 For replica Stores, the peer MUST set the generation counter to match 3867 the generation_counter in the message, and MUST NOT check the 3868 generation counter against the current value. Replica Stores MUST 3869 NOT use a generation counter of 0. 3871 When a peer stores data previously stored by another node (e.g., for 3872 replicas or topology shifts) it MUST adjust the lifetime value 3873 downward to reflect the amount of time the value was stored at the 3874 peer. 3876 Unless otherwise specified by the usage, if a peer attempts to store 3877 data previously stored by another node (e.g., for replicas or 3878 topology shifts) and that store fails with either an 3879 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 3880 peer MUST fetch the newer data from the the peer generating the error 3881 and use that to replace its own copy. This rule allows 3882 resynchronization after partitions heal. 3884 The properties of stores for each data model are as follows: 3886 Single-value: 3888 A store of a new single-value element creates the element if it 3889 does not exist and overwrites any existing value with the new 3890 value. 3892 Array: 3893 A store of an array entry replaces (or inserts) the given value at 3894 the location specified by the index. Because arrays are sparse, a 3895 store past the end of the array extends it with nonexistent values 3896 (exists=False) as required. A store at index 0xffffffff places 3897 the new value at the end of the array regardless of the length of 3898 the array. The resulting StoredData has the correct index value 3899 when it is subsequently fetched. 3901 Dictionary: 3902 A store of a dictionary entry replaces (or inserts) the given 3903 value at the location specified by the dictionary key. 3905 The following figure shows the relationship between these structures 3906 for an example store which stores the following values at resource 3907 "1234" 3909 o The value "abc" in the single value location for kind X 3910 o The value "foo" at index 0 in the array for kind Y 3911 o The value "bar" at index 1 in the array for kind Y 3912 Store 3913 resource=1234 3914 replica_number = 0 3915 / \ 3916 / \ 3917 StoreKindData StoreKindData 3918 kind=X (Single-Value) kind=Y (Array) 3919 generation_counter = 99 generation_counter = 107 3920 | /\ 3921 | / \ 3922 StoredData / \ 3923 storage_time = xxxxxxx / \ 3924 lifetime = 86400 / \ 3925 signature = XXXX / \ 3926 | | | 3927 | StoredData StoredData 3928 | storage_time = storage_time = 3929 | yyyyyyyy zzzzzzz 3930 | lifetime = 86400 lifetime = 33200 3931 | signature = YYYY signature = ZZZZ 3932 | | | 3933 StoredDataValue | | 3934 value="abc" | | 3935 | | 3936 StoredDataValue StoredDataValue 3937 index=0 index=1 3938 value="foo" value="bar" 3940 6.4.1.2. Response Definition 3942 In response to a successful Store request the peer MUST return a 3943 StoreAns message containing a series of StoreKindResponse elements 3944 containing the current value of the generation counter for each 3945 Kind-ID, as well as a list of the peers where the data will be 3946 replicated. 3948 struct { 3949 KindId kind; 3950 uint64 generation_counter; 3951 NodeId replicas<0..2^16-1>; 3952 } StoreKindResponse; 3954 struct { 3955 StoreKindResponse kind_responses<0..2^16-1>; 3956 } StoreAns; 3958 The contents of each StoreKindResponse are: 3960 kind 3961 The Kind-ID being represented. 3963 generation 3964 The current value of the generation counter for that Kind-ID. 3966 replicas 3967 The list of other peers at which the data was/will be replicated. 3968 In overlays and applications where the responsible peer is 3969 intended to store redundant copies, this allows the storing peer 3970 to independently verify that the replicas have in fact been 3971 stored. It does this verification by using the Stat method. Note 3972 that the storing peer is not require to perform this verification. 3974 The response itself is just StoreKindResponse values packed end-to- 3975 end. 3977 If any of the generation counters in the request precede the 3978 corresponding stored generation counter, then the peer MUST fail the 3979 entire request and respond with an Error_Generation_Counter_Too_Low 3980 error. The error_info in the ErrorResponse MUST be a StoreAns 3981 response containing the correct generation counter for each kind and 3982 the replica list, which will be empty. For original (non-replica) 3983 stores, a node which receives such an error SHOULD attempt to fetch 3984 the data and, if the storage_time value is newer, replace its own 3985 data with that newer data. This rule improves data consistency in 3986 the case of partitions and merges. 3988 If the data being stored is too large for the allowed limit by the 3989 given usage, then the peer MUST fail the request and generate an 3990 Error_Data_Too_Large error. 3992 If any type of request tries to access a data kind that the node does 3993 not know about, an Error_Unknown_Kind MUST be generated. The 3994 error_info in the Error_Response is: 3996 KindId unknown_kinds<2^8-1>; 3998 which lists all the kinds that were unrecognized. 4000 6.4.1.3. Removing Values 4002 This version of RELOAD (unlike previous versions) does not have an 4003 explicit Remove operation. Rather, values are Removed by storing 4004 "nonexistent" values in their place. Each DataValue contains a 4005 boolean value called "exists" which indicates whether a value is 4006 present at that location. In order to effectively remove a value, 4007 the owner stores a new DataValue with: 4009 exists = false 4010 value = {} (0 length) 4012 Storing nodes MUST treat these nonexistent values the same way they 4013 treat any other stored value, including overwriting the existing 4014 value, replicating them, and aging them out as necessary when 4015 lifetime expires. When a stored nonexistent value's lifetime 4016 expires, it is simply removed from the storing node like any other 4017 stored value expiration. Note that in the case of arrays and 4018 dictionaries, this may create an implicit, unsigned "nonexistent" 4019 value to represent a gap in the data structure. However, this value 4020 isn't persistent nor is it replicated. It is simply synthesized by 4021 the storing node. 4023 6.4.2. Fetch 4025 The Fetch request retrieves one or more data elements stored at a 4026 given Resource-ID. A single Fetch request can retrieve multiple 4027 different kinds. 4029 6.4.2.1. Request Definition 4031 struct { 4032 int32 first; 4033 int32 last; 4034 } ArrayRange; 4036 struct { 4037 KindId kind; 4038 uint64 generation; 4039 uint16 length; 4041 select (model) { 4042 case single_value: ; /* Empty */ 4044 case array: 4045 ArrayRange indices<0..2^16-1>; 4047 case dictionary: 4048 DictionaryKey keys<0..2^16-1>; 4050 /* This structure may be extended */ 4052 } model_specifier; 4053 } StoredDataSpecifier; 4055 struct { 4056 ResourceId resource; 4057 StoredDataSpecifier specifiers<0..2^16-1>; 4058 } FetchReq; 4060 The contents of the Fetch requests are as follows: 4062 resource 4063 The resource ID to fetch from. 4065 specifiers 4066 A sequence of StoredDataSpecifier values, each specifying some of 4067 the data values to retrieve. 4069 Each StoredDataSpecifier specifies a single kind of data to retrieve 4070 and (if appropriate) the subset of values that are to be retrieved. 4071 The contents of the StoredDataSpecifier structure are as follows: 4073 kind 4074 The Kind-ID of the data being fetched. Implementations SHOULD 4075 reject requests corresponding to unknown kinds unless specifically 4076 configured otherwise. 4078 model 4079 The data model of the data. This must be checked against the 4080 Kind-ID. 4082 generation 4083 The last generation counter that the requesting node saw. This 4084 may be used to avoid unnecessary fetches or it may be set to zero. 4086 length 4087 The length of the rest of the structure, thus allowing 4088 extensibility. 4090 model_specifier 4091 A reference to the data value being requested within the data 4092 model specified for the kind. For instance, if the data model is 4093 "array", it might specify some subset of the values. 4095 The model_specifier is as follows: 4097 o If the data model is single value, the specifier is empty. 4098 o If the data model is array, the specifier contains a list of 4099 ArrayRange elements, each of which contains two integers. The 4100 first integer is the beginning of the range and the second is the 4101 end of the range. 0 is used to indicate the first element and 4102 0xffffffff is used to indicate the final element. The first 4103 integer must be less than the second. The ranges MUST NOT 4104 overlap. 4105 o If the data model is dictionary then the specifier contains a list 4106 of the dictionary keys being requested. If no keys are specified, 4107 than this is a wildcard fetch and all key-value pairs are 4108 returned. 4110 The generation-counter is used to indicate the requester's expected 4111 state of the storing peer. If the generation-counter in the request 4112 matches the stored counter, then the storing peer returns a response 4113 with no StoredData values. 4115 Note that because the certificate for a user is typically stored at 4116 the same location as any data stored for that user, a requesting node 4117 that does not already have the user's certificate should request the 4118 certificate in the Fetch as an optimization. 4120 6.4.2.2. Response Definition 4122 The response to a successful Fetch request is a FetchAns message 4123 containing the data requested by the requester. 4125 struct { 4126 KindId kind; 4127 uint64 generation; 4128 StoredData values<0..2^32-1>; 4129 } FetchKindResponse; 4131 struct { 4132 FetchKindResponse kind_responses<0..2^32-1>; 4133 } FetchAns; 4135 The FetchAns structure contains a series of FetchKindResponse 4136 structures. There MUST be one FetchKindResponse element for each 4137 Kind-ID in the request. 4139 The contents of the FetchKindResponse structure are as follows: 4141 kind 4142 the kind that this structure is for. 4144 generation 4145 the generation counter for this kind. 4147 values 4148 the relevant values. If the generation counter in the request 4149 matches the generation-counter in the stored data, then no 4150 StoredData values are returned. Otherwise, all relevant data 4151 values MUST be returned. A nonexistent value is represented with 4152 "exists" set to False. 4154 There is one subtle point about signature computation on arrays. If 4155 the storing node uses the append feature (where the 4156 index=0xffffffff), then the index in the StoredData that is returned 4157 will not match that used by the storing node, which would break the 4158 signature. In order to avoid this issue, the index value in the 4159 array is set to zero before the signature is computed. This implies 4160 that malicious storing nodes can reorder array entries without being 4161 detected. 4163 6.4.3. Stat 4165 The Stat request is used to get metadata (length, generation counter, 4166 digest, etc.) for a stored element without retrieving the element 4167 itself. The name is from the UNIX stat(2) system call which performs 4168 a similar function for files in a filesystem. It also allows the 4169 requesting node to get a list of matching elements without requesting 4170 the entire element. 4172 6.4.3.1. Request Definition 4174 The Stat request is identical to the Fetch request. It simply 4175 specifies the elements to get metadata about. 4177 struct { 4178 ResourceId resource; 4179 StoredDataSpecifier specifiers<0..2^16-1>; 4180 } StatReq; 4182 6.4.3.2. Response Definition 4184 The Stat response contains the same sort of entries that a Fetch 4185 response would contain; however, instead of containing the element 4186 data it contains metadata. 4188 struct { 4189 Boolean exists; 4190 uint32 value_length; 4191 HashAlgorithm hash_algorithm; 4192 opaque hash_value<0..255>; 4193 } MetaData; 4195 struct { 4196 uint32 index; 4197 MetaData value; 4198 } ArrayEntryMeta; 4200 struct { 4201 DictionaryKey key; 4202 MetaData value; 4203 } DictionaryEntryMeta; 4205 struct { 4206 select (model) { 4207 case single_value: 4208 MetaData single_value_entry; 4210 case array: 4212 ArrayEntryMeta array_entry; 4214 case dictionary: 4215 DictionaryEntryMeta dictionary_entry; 4217 /* This structure may be extended */ 4218 } ; 4219 } MetaDataValue; 4221 struct { 4222 uint32 value_length; 4223 uint64 storage_time; 4224 uint32 lifetime; 4225 MetaDataValue metadata; 4226 } StoredMetaData; 4228 struct { 4229 KindId kind; 4230 uint64 generation; 4231 StoredMetaData values<0..2^32-1>; 4232 } StatKindResponse; 4234 struct { 4235 StatKindResponse kind_responses<0..2^32-1>; 4236 } StatAns; 4238 The structures used in StatAns parallel those used in FetchAns: a 4239 response consists of multiple StatKindResponse values, one for each 4240 kind that was in the request. The contents of the StatKindResponse 4241 are the same as those in the FetchKindResponse, except that the 4242 values list contains StoredMetaData entries instead of StoredData 4243 entries. 4245 The contents of the StoredMetaData structure are the same as the 4246 corresponding fields in StoredData except that there is no signature 4247 field and the value is a MetaDataValue rather than a StoredDataValue. 4249 A MetaDataValue is a variant structure, like a StoredDataValue, 4250 except for the types of each arm, which replace DataValue with 4251 MetaData. 4253 The only really new structure is MetaData, which has the following 4254 contents: 4256 exists 4257 Same as in DataValue 4259 value_length 4260 The length of the stored value. 4262 hash_algorithm 4263 The hash algorithm used to perform the digest of the value. 4265 hash_value 4266 A digest of the value using hash_algorithm. 4268 6.4.4. Find 4270 The Find request can be used to explore the Overlay Instance. A Find 4271 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4272 (if any) of the resource of kind T known to the target peer which is 4273 closest to R. This method can be used to walk the Overlay Instance by 4274 interactively fetching R_n+1=nearest(1 + R_n). 4276 6.4.4.1. Request Definition 4278 The FindReq message contains a series of Resource-IDs and Kind-IDs 4279 identifying the resource the peer is interested in. 4281 struct { 4282 ResourceId resource; 4283 KindId kinds<0..2^8-1>; 4284 } FindReq; 4286 The request contains a list of Kind-IDs which the Find is for, as 4287 indicated below: 4289 resource 4290 The desired Resource-ID 4292 kinds 4293 The desired Kind-IDs. Each value MUST only appear once. 4295 6.4.4.2. Response Definition 4297 A response to a successful Find request is a FindAns message 4298 containing the closest Resource-ID on the peer for each kind 4299 specified in the request. 4301 struct { 4302 KindId kind; 4303 ResourceId closest; 4304 } FindKindData; 4306 struct { 4307 FindKindData results<0..2^16-1>; 4308 } FindAns; 4310 If the processing peer is not responsible for the specified 4311 Resource-ID, it SHOULD return a 404 RELOAD error code. 4313 For each Kind-ID in the request the response MUST contain a 4314 FindKindData indicating the closest Resource-ID for that Kind-ID, 4315 unless the kind is not allowed to be used with Find in which case a 4316 FindKindData for that Kind-ID MUST NOT be included in the response. 4317 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4318 0. Note that different Kind-IDs may have different closest Resource- 4319 IDs. 4321 The response is simply a series of FindKindData elements, one per 4322 kind, concatenated end-to-end. The contents of each element are: 4324 kind 4325 The Kind-ID. 4327 closest 4328 The closest resource ID to the specified resource ID. This is 0 4329 if no resource ID is known. 4331 Note that the response does not contain the contents of the data 4332 stored at these Resource-IDs. If the requester wants this, it must 4333 retrieve it using Fetch. 4335 6.4.5. Defining New Kinds 4337 There are two ways to define a new kind. The first is by writing a 4338 document and registering the kind-id with IANA. This is the 4339 preferred method for kinds which may be widely used and reused. The 4340 second method is to simply define the kind and its parameters in the 4341 configuration document using the section of kind-id space set aside 4342 for private use. This method MAY be used to define ad hoc kinds in 4343 new overlays. 4345 However a kind is defined, the definition must include: 4347 o The meaning of the data to be stored (in some textual form). 4348 o The Kind-ID. 4349 o The data model (single value, array, dictionary, etc). 4350 o The access control model. 4352 In addition, when kinds are registered with IANA, each kind is 4353 assigned a short string name which is used to refer to it in 4354 configuration documents. 4356 While each kind needs to define what data model is used for its data, 4357 that does not mean that it must define new data models. Where 4358 practical, kinds should use the existing data models. The intention 4359 is that the basic data model set be sufficient for most applications/ 4360 usages. 4362 7. Certificate Store Usage 4364 The Certificate Store usage allows a peer to store its certificate in 4365 the overlay, thus avoiding the need to send a certificate in each 4366 message - a reference may be sent instead. 4368 A user/peer MUST store its certificate at Resource-IDs derived from 4369 two Resource Names: 4371 o The user name in the certificate. 4372 o The Node-ID in the certificate. 4374 Note that in the second case the certificate is not stored at the 4375 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4376 intention here (as is common throughout RELOAD) is to avoid making a 4377 peer responsible for its own data. 4379 A peer MUST ensure that the user's certificates are stored in the 4380 Overlay Instance. New certificates are stored at the end of the 4381 list. This structure allows users to store an old and a new 4382 certificate that both have the same Node-ID, which allows for 4383 migration of certificates when they are renewed. 4385 This usage defines the following kinds: 4387 Name: CERTIFICATE_BY_NODE 4388 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4390 Access Control: NODE-MATCH. 4392 Name: CERTIFICATE_BY_USER 4394 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4396 Access Control: USER-MATCH. 4398 8. TURN Server Usage 4400 The TURN server usage allows a RELOAD peer to advertise that it is 4401 prepared to be a TURN server as defined in [RFC5766]. When a node 4402 starts up, it joins the overlay network and forms several connections 4403 in the process. If the ICE stage in any of these connections returns 4404 a reflexive address that is not the same as the peer's perceived 4405 address, then the peer is behind a NAT and not a candidate for a TURN 4406 server. Additionally, if the peer's IP address is in the private 4407 address space range, then it is also not a candidate for a TURN 4408 server. Otherwise, the peer SHOULD assume it is a potential TURN 4409 server and follow the procedures below. 4411 If the node is a candidate for a TURN server it will insert some 4412 pointers in the overlay so that other peers can find it. The overlay 4413 configuration file specifies a turnDensity parameter that indicates 4414 how many times each TURN server should record itself in the overlay. 4415 Typically this should be set to the reciprocal of the estimate of 4416 what percentage of peers will act as TURN servers. For each value, 4417 called d, between 1 and turnDensity, the peer forms a Resource Name 4418 by concatenating its Peer-ID and the value d. This Resource Name is 4419 hashed to form a Resource-ID. The address of the peer is stored at 4420 that Resource-ID using type TURN-SERVICE and the TurnServer object: 4422 struct { 4423 uint8 iteration; 4424 IpAddressAndPort server_address; 4425 } TurnServer; 4427 The contents of this structure are as follows: 4429 iteration 4430 the d value 4432 server_address 4433 the address at which the TURN server can be contacted. 4435 Note: Correct functioning of this algorithm depends critically on 4436 having turnDensity be an accurate estimate of the true density of 4437 TURN servers. If turnDensity is too high, then the process of 4438 finding TURN servers becomes extremely expensive as multiple 4439 candidate Resource-IDs must be probed. 4441 Peers that provide this service need to support the TURN extensions 4442 to STUN for media relay of both UDP and TCP traffic as defined in 4443 [RFC5766] and [RFC5382]. 4445 This usage defines the following kind to indicate that a peer is 4446 willing to act as a TURN server: 4448 Name TURN-SERVICE 4449 Data Model The TURN-SERVICE kind stores a single value for each 4450 Resource-ID. 4451 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4453 Peers can find other servers by selecting a random Resource-ID and 4454 then doing a Find request for the appropriate server type with that 4455 Resource-ID. The Find request gets routed to a random peer based on 4456 the Resource-ID. If that peer knows of any servers, they will be 4457 returned. The returned response may be empty if the peer does not 4458 know of any servers, in which case the process gets repeated with 4459 some other random Resource-ID. As long as the ratio of servers 4460 relative to peers is not too low, this approach will result in 4461 finding a server relatively quickly. 4463 9. Chord Algorithm 4465 This algorithm is assigned the name chord-reload to indicate it is an 4466 adaptation of the basic Chord DHT algorithm. 4468 This algorithm differs from the originally presented Chord algorithm 4469 [Chord]. It has been updated based on more recent research results 4470 and implementation experiences, and to adapt it to the RELOAD 4471 protocol. A short list of differences: 4472 o The original Chord algorithm specified that a single predecessor 4473 and a successor list be stored. The chord-reload algorithm 4474 attempts to have more than one predecessor and successor. The 4475 predecessor sets help other neighbors learn their successor list. 4477 o The original Chord specification and analysis called for iterative 4478 routing. RELOAD specifies recursive routing. In addition to the 4479 performance implications, the cost of NAT traversal dictates 4480 recursive routing. 4481 o Finger table entries are indexed in opposite order. Original 4482 Chord specifies finger[0] as the immediate successor of the peer. 4483 chord-reload specifies finger[0] as the peer 180 degrees around 4484 the ring from the peer. This change was made to simplify 4485 discussion and implementation of variable sized finger tables. 4486 However, with either approach no more than O(log N) entries should 4487 typically be stored in a finger table. 4488 o The stabilize() and fix_fingers() algorithms in the original Chord 4489 algorithm are merged into a single periodic process. 4490 Stabilization is implemented slightly differently because of the 4491 larger neighborhood, and fix_fingers is not as aggressive to 4492 reduce load, nor does it search for optimal matches of the finger 4493 table entries. 4494 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4495 not designed to be used in networks with close to or more than 4496 2^128 nodes. 4497 o RELOAD uses randomized finger entries as described in 4498 Section 9.6.4.2. 4499 o This algorithm allows the use of either reactive or periodic 4500 recovery. The original Chord paper used periodic recovery. 4501 Reactive recovery provides better performance in small overlays, 4502 but is believed to be unstable in large (>1000) overlays with high 4503 levels of churn [handling-churn-usenix04]. The overlay 4504 configuration file specifies a "chord-reload-reactive" element 4505 that indicates whether reactive recovery should be used. 4507 9.1. Overview 4509 The algorithm described here is a modified version of the Chord 4510 algorithm. Each peer keeps track of a finger table and a neighbor 4511 table. The neighbor table contains at least the three peers before 4512 and after this peer in the DHT ring. There may not be three entries 4513 in all cases such as small rings or while the ring topology is 4514 changing. The first entry in the finger table contains the peer 4515 half-way around the ring from this peer; the second entry contains 4516 the peer that is 1/4 of the way around; the third entry contains the 4517 peer that is 1/8th of the way around, and so on. Fundamentally, the 4518 chord data structure can be thought of a doubly-linked list formed by 4519 knowing the successors and predecessor peers in the neighbor table, 4520 sorted by the Node-ID. As long as the successor peers are correct, 4521 the DHT will return the correct result. The pointers to the prior 4522 peers are kept to enable the insertion of new peers into the list 4523 structure. Keeping multiple predecessor and successor pointers makes 4524 it possible to maintain the integrity of the data structure even when 4525 consecutive peers simultaneously fail. The finger table forms a skip 4526 list, so that entries in the linked list can be found in O(log(N)) 4527 time instead of the typical O(N) time that a linked list would 4528 provide. 4530 A peer, n, is responsible for a particular Resource-ID k if k is less 4531 than or equal to n and k is greater than p, where p is the peer id of 4532 the previous peer in the neighbor table. Care must be taken when 4533 computing to note that all math is modulo 2^128. 4535 9.2. Routing 4537 The routing table is the union of the neighbor table and the finger 4538 table. 4540 If a peer is not responsible for a Resource-ID k, but is directly 4541 connected to a node with Node-ID k, then it routes the message to 4542 that node. Otherwise, it routes the request to the peer in the 4543 routing table that has the largest Node-ID that is in the interval 4544 between the peer and k. If no such node is found, it finds the 4545 smallest node id that is greater than k and routes the message to 4546 that node. 4548 9.3. Redundancy 4550 When a peer receives a Store request for Resource-ID k, and it is 4551 responsible for Resource-ID k, it stores the data and returns a 4552 success response. It then sends a Store request to its successor in 4553 the neighbor table and to that peer's successor. Note that these 4554 Store requests are addressed to those specific peers, even though the 4555 Resource-ID they are being asked to store is outside the range that 4556 they are responsible for. The peers receiving these check they came 4557 from an appropriate predecessor in their neighbor table and that they 4558 are in a range that this predecessor is responsible for, and then 4559 they store the data. They do not themselves perform further Stores 4560 because they can determine that they are not responsible for the 4561 Resource-ID. 4563 Managing replicas as the overlay changes is described in 4564 Section 9.6.3. 4566 The sequential replicas used in this overlay algorithm protect 4567 against peer failure but not against malicious peers. Additional 4568 replication from the Usage is required to protect resources from such 4569 attacks, as discussed in Section 12.5.4. 4571 9.4. Joining 4573 The join process for a joining party (JP) with Node-ID n is as 4574 follows. 4576 1. JP MUST connect to its chosen bootstrap node. 4577 2. JP SHOULD use a series of Pings to populate its routing table. 4578 3. JP SHOULD send Attach requests to initiate connections to each of 4579 the peers in the neighbor table as well as to the desired finger 4580 table entries. Note that this does not populate their routing 4581 tables, but only their connection tables, so JP will not get 4582 messages that it is expected to route to other nodes. 4583 4. JP MUST enter all the peers it has contacted into its routing 4584 table. 4585 5. JP SHOULD send a Join to its immediate successor, the admitting 4586 peer (AP) for Node-ID n. The AP sends the response to the Join. 4587 6. AP MUST do a series of Store requests to JP to store the data 4588 that JP will be responsible for. 4589 7. AP MUST send JP an Update explicitly labeling JP as its 4590 predecessor. At this point, JP is part of the ring and 4591 responsible for a section of the overlay. AP can now forget any 4592 data which is assigned to JP and not AP. 4593 8. The AP MUST send an Update to all of its neighbors with the new 4594 values of its neighbor set (including JP). 4595 9. The JP MUST send Updates to all the peers in its neighbor table. 4597 In order to populate its neighbor table, JP sends a Ping via the 4598 bootstrap node directed at Resource-ID n+1 (directly after its own 4599 Resource-ID). This allows it to discover its own successor. Call 4600 that node p0. It then sends a ping to p0+1 to discover its successor 4601 (p1). This process can be repeated to discover as many successors as 4602 desired. The values for the two peers before p will be found at a 4603 later stage when n receives an Update. 4605 In order to set up its finger table entry for peer i, JP simply sends 4606 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4607 approximately the right location around the ring. 4609 The joining peer MUST NOT send any Update message placing itself in 4610 the overlay until it has successfully completed an Attach with each 4611 peer that should be in its neighbor table. 4613 9.5. Routing Attaches 4615 When a peer needs to Attach to a new peer in its neighbor table, it 4616 MUST source-route the Attach request through the peer from which it 4617 learned the new peer's Node-ID. Source-routing these requests allows 4618 the overlay to recover from instability. 4620 All other Attach requests, such as those for new finger table 4621 entries, are routed conventionally through the overlay. 4623 9.6. Updates 4625 A chord Update is defined as 4627 enum { reserved (0), 4628 peer_ready(1), neighbors(2), full(3), (255) } 4629 ChordUpdateType; 4631 struct { 4632 uint32 uptime; 4633 ChordUpdateType type; 4634 select(type){ 4635 case peer_ready: /* Empty */ 4636 ; 4638 case neighbors: 4639 NodeId predecessors<0..2^16-1>; 4640 NodeId successors<0..2^16-1>; 4642 case full: 4643 NodeId predecessors<0..2^16-1>; 4644 NodeId successors<0..2^16-1>; 4645 NodeId fingers<0..2^16-1>; 4646 }; 4647 } ChordUpdate; 4649 The "type" field contains the type of the update, which depends on 4650 the reason the update was sent. 4652 uptime: time this peer has been up in seconds. 4654 peer_ready: this peer is ready to receive messages. This message 4655 is used to indicate that a node which has Attached is a peer and 4656 can be routed through. It is also used as a connectivity check to 4657 non-neighbor peers. 4659 neighbors: this version is sent to members of the Chord neighbor 4660 table. 4662 full: this version is sent to peers which request an Update with a 4663 RouteQueryReq. 4665 If the message is of type "neighbors", then the contents of the 4666 message will be: 4668 predecessors 4669 The predecessor set of the Updating peer. 4671 successors 4672 The successor set of the Updating peer. 4674 If the message is of type "full", then the contents of the message 4675 will be: 4677 predecessors 4678 The predecessor set of the Updating peer. 4680 successors 4681 The successor set of the Updating peer. 4683 fingers 4684 The finger table of the Updating peer, in numerically ascending 4685 order. 4687 A peer MUST maintain an association (via Attach) to every member of 4688 its neighbor set. A peer MUST attempt to maintain at least three 4689 predecessors and three successors, even though this will not be 4690 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 4691 predecessors and successors be maintained in the neighbor set. 4693 9.6.1. Handling Neighbor Failures 4695 Every time a connection to a peer in the neighbor table is lost (as 4696 determined by connectivity pings or the failure of some request), the 4697 peer MUST remove the entry from its neighbor table and replace it 4698 with the best match it has from the other peers in its routing table. 4699 If using reactive recovery, it then sends an immediate Update to all 4700 nodes in its Neighbor Table. The update will contain all the Node- 4701 IDs of the current entries of the table (after the failed one has 4702 been removed). Note that when replacing a successor the peer SHOULD 4703 delay the creation of new replicas for successor replacement hold- 4704 down time (30 seconds) after removing the failed entry from its 4705 neighbor table in order to allow a triggered update to inform it of a 4706 better match for its neighbor table. 4708 If the neighbor failure effects the peer's range of responsible IDs, 4709 then the Update MUST be sent to all nodes in its Connection Table. 4711 A peer MAY attempt to reestablish connectivity with a lost neighbor 4712 either by waiting additional time to see if connectivity returns or 4713 by actively routing a new ATTACH to the lost peer. Details for these 4714 procedures are beyond the scope of this document. In no event does 4715 an attempt to reestablish connectivity with a lost neighbor allow the 4716 peer to remain in the neighbor table. Such a peer is returned to the 4717 neighbor table once connectivity is reestablished. 4719 If connectivity is lost to all successor peers in the neighbor table, 4720 then this peer should behave as if it is joining the network and use 4721 Pings to find a peer and send it a Join. If connectivity is lost to 4722 all the peers in the finger table, this peer should assume that it 4723 has been disconnected from the rest of the network, and it should 4724 periodically try to join the DHT. 4726 9.6.2. Handling Finger Table Entry Failure 4728 If a finger table entry is found to have failed, all references to 4729 the failed peer are removed from the finger table and replaced with 4730 the closest preceding peer from the finger table or neighbor table. 4732 If using reactive recovery, the peer initiates a search for a new 4733 finger table entry as described below. 4735 9.6.3. Receiving Updates 4737 When a peer, N, receives an Update request, it examines the Node-IDs 4738 in the UpdateReq and at its neighbor table and decides if this 4739 UpdateReq would change its neighbor table. This is done by taking 4740 the set of peers currently in the neighbor table and comparing them 4741 to the peers in the update request. There are two major cases: 4743 o The UpdateReq contains peers that match N's neighbor table, so no 4744 change is needed to the neighbor set. 4745 o The UpdateReq contains peers N does not know about that should be 4746 in N's neighbor table, i.e. they are closer than entries in the 4747 neighbor table. 4749 In the first case, no change is needed. 4751 In the second case, N MUST attempt to Attach to the new peers and if 4752 it is successful it MUST adjust its neighbor set accordingly. Note 4753 that it can maintain the now inferior peers as neighbors, but it MUST 4754 remember the closer ones. 4756 After any Pings and Attaches are done, if the neighbor table changes 4757 and the peer is using reactive recovery, the peer sends an Update 4758 request to each member of its Connection Table. These Update 4759 requests are what end up filling in the predecessor/successor tables 4760 of peers that this peer is a neighbor to. A peer MUST NOT enter 4761 itself in its successor or predecessor table and instead should leave 4762 the entries empty. 4764 If peer N is responsible for a Resource-ID R, and N discovers that 4765 the replica set for R (the next two nodes in its successor set) has 4766 changed, it MUST send a Store for any data associated with R to any 4767 new node in the replica set. It SHOULD NOT delete data from peers 4768 which have left the replica set. 4770 When a peer N detects that it is no longer in the replica set for a 4771 resource R (i.e., there are three predecessors between N and R), it 4772 SHOULD delete all data associated with R from its local store. 4774 When a peer discovers that its range of responsible IDs have changed, 4775 it MUST send an UPDATE to all entries in its connection table. 4777 9.6.4. Stabilization 4779 There are four components to stabilization: 4780 1. exchange Updates with all peers in its neighbor table to exchange 4781 state. 4782 2. search for better peers to place in its finger table. 4783 3. search to determine if the current finger table size is 4784 sufficiently large. 4785 4. search to determine if the overlay has partitioned and needs to 4786 recover. 4788 9.6.4.1. Updating neighbor table 4790 A peer MUST periodically send an Update request to every peer in its 4791 Connection Table. The purpose of this is to keep the predecessor and 4792 successor lists up to date and to detect failed peers. The default 4793 time is about every ten minutes, but the enrollment server SHOULD set 4794 this in the configuration document using the "chord-reload-update- 4795 interval" element (denominated in seconds.) A peer SHOULD randomly 4796 offset these Update requests so they do not occur all at once. 4798 9.6.4.2. Refreshing finger table 4800 A peer MUST periodically search for new peers to replace invalid 4801 (repeated) entries in the finger table. A finger table entry i is 4802 valid if it is in the range [n+2^(128-i), 4803 n+2^(128-(i-1))-2^(128-(i+1))]. Invalid entries occur in the finger 4804 table when a previous finger table entry has failed or when no peer 4805 has been found in that range. 4807 A peer SHOULD NOT send Ping requests looking for new finger table 4808 entries more often than the configuration element "chord-reload-ping- 4809 interval", which defaults to 3600 seconds (one per hour). 4811 Two possible methods for searching for new peers for the finger table 4812 entries are presented: 4814 Alternative 1: A peer selects one entry in the finger table from 4815 among the invalid entries. It pings for a new peer for that finger 4816 table entry. The selection SHOULD be exponentially weighted to 4817 attempt to replace earlier (lower i) entries in the finger table. A 4818 simple way to implement this selection is to search through the 4819 finger table entries from i=0 and each time an invalid entry is 4820 encountered, send a Ping to replace that entry with probability 0.5. 4822 Alternative 2: A peer monitors the Update messages received from its 4823 connections to observe when an Update indicates a peer that would be 4824 used to replace in invalid finger table entry, i, and flags that 4825 entry in the finger table. Every "chord-reload-ping-interval" 4826 seconds, the peer selects from among those flagged candidates using 4827 an exponentially weighted probability as above. 4829 When searching for a better entry, the peer SHOULD send the Ping to a 4830 Node-ID selected randomly from that range. Random selection is 4831 preferred over a search for strictly spaced entries to minimize the 4832 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 4833 implementation or subsequent specification MAY choose a method for 4834 selecting finger table entries other than choosing randomly within 4835 the range. Any such alternate methods SHOULD be employed only on 4836 finger table stabilization and not for the selection of initial 4837 finger table entries unless the alternative method is faster and 4838 imposes less overhead on the overlay. 4840 A peer MAY choose to keep connections to multiple peers that can act 4841 for a given finger table entry. 4843 9.6.4.3. Adjusting finger table size 4845 If the finger table has less than 16 entries, the node SHOULD attempt 4846 to discover more fingers to grow the size of the table to 16. The 4847 value 16 was chosen to ensure high odds of a node maintaining 4848 connectivity to the overlay even with strange network partitions. 4850 For many overlays, 16 finger table entries will be enough, but as an 4851 overlay grows very large, more than 16 entries may be required in the 4852 finger table for efficient routing. An implementation SHOULD be 4853 capable of increasing the number of entries in the finger table to 4854 128 entries. 4856 Note to implementers: Although log(N) entries are all that are 4857 required for optimal performance, careful implementation of 4858 stabilization will result in no additional traffic being generated 4859 when maintaining a finger table larger than log(N) entries. 4860 Implementers are encouraged to make use of RouteQuery and algorithms 4861 for determining where new finger table entries may be found. 4862 Complete details of possible implementations are outside the scope of 4863 this specification. 4865 A simple approach to sizing the finger table is to ensure the finger 4866 table is large enough to contain at least the final successor in the 4867 peer's neighbor table. 4869 9.6.4.4. Detecting partitioning 4871 To detect that a partitioning has occurred and to heal the overlay, a 4872 peer P MUST periodically repeat the discovery process used in the 4873 initial join for the overlay to locate an appropriate bootstrap node, 4874 B. P should then send a Ping for its own Node-ID routed through B. If 4875 a response is received from a peer S', which is not P's successor, 4876 then the overlay is partitioned and P should send an Attach to S' 4877 routed through B, followed by an Update sent to S'. (Note that S' 4878 may not be in P's neighbor table once the overlay is healed, but the 4879 connection will allow S' to discover appropriate neighbor entries for 4880 itself via its own stabilization.) 4882 Future specifications may describe alternative mechanisms for 4883 determining when to repeat the discovery process. 4885 9.7. Route Query 4887 For this topology plugin, the RouteQueryReq contains no additional 4888 information. The RouteQueryAns contains the single node ID of the 4889 next peer to which the responding peer would have routed the request 4890 message in recursive routing: 4892 struct { 4893 NodeId next_peer; 4894 } ChordRouteQueryAns; 4896 The contents of this structure are as follows: 4898 next_peer 4899 The peer to which the responding peer would route the message in 4900 order to deliver it to the destination listed in the request. 4902 If the requester has set the send_update flag, the responder SHOULD 4903 initiate an Update immediately after sending the RouteQueryAns. 4905 9.8. Leaving 4907 To support extensions, such as [I-D.maenpaa-p2psip-self-tuning], 4908 Peers SHOULD send a Leave request to all members of their neighbor 4909 table prior to exiting the Overlay Instance. The 4910 overlay_specific_data field MUST contain the ChordLeaveData structure 4911 defined below: 4913 enum { reserved (0), 4914 from_succ(1), from_pred(2), (255) } 4915 ChordLeaveType; 4917 struct { 4918 ChordLeaveType type; 4920 select(type) { 4921 case from_succ: 4922 NodeId successors<0..2^16-1>; 4923 case from_pred: 4924 NodeId predecessors<0..2^16-1>; 4925 }; 4926 } ChordLeaveData; 4928 The 'type' field indicates whether the Leave request was sent by a 4929 predecessor or a successor of the recipient: 4931 from_succ 4932 The Leave request was sent by a successor. 4934 from_pred 4935 The Leave request was sent by a predecessor. 4937 If the type of the request is 'from_succ', the contents will be: 4939 successors 4940 The sender's successor list. 4942 If the type of the request is 'from_pred', the contents will be: 4944 predecessors 4945 The sender's predecessor list. 4947 Any peer which receives a Leave for a peer n in its neighbor set 4948 follows procedures as if it had detected a peer failure as described 4949 in Section 9.6.1. 4951 10. Enrollment and Bootstrap 4953 10.1. Overlay Configuration 4955 This specification defines a new content type "application/ 4956 p2p-overlay+xml" for an MIME entity that contains overlay 4957 information. An example document is shown below. 4959 4961 4964 4966 false 4967 4968 4969 30 4970 false 4971 10 4972 4000 4973 https://example.org 4974 foo 4975 300 4976 400 4977 false 4979 asecret 4980 chord 4981 DATA GOES HERE 4982 4983 4984 4985 single 4986 user-match 4987 1 4988 100 4989 4990 4991 VGhpcyBpcyBub3QgcmlnaHQhCg== 4992 4993 4994 4995 4996 array 4997 node-multiple 4998 3 4999 22 5000 4 5001 1 5002 5003 5004 5005 VGhpcyBpcyBub3QgcmlnaHQhCg== 5006 5007 5008 5009 47112162e84c69ba 5010 6eba45d31a900c06 5011 6ebc45d31a900c06 5012 5013 VGhpcyBpcyBub3QgcmlnaHQhCg== 5014 5016 The file MUST be a well formed XML document and it SHOULD contain an 5017 encoding declaration in the XML declaration. If the charset 5018 parameter of the MIME content type declaration is present and it is 5019 different from the encoding declaration, the charset parameter takes 5020 precedence. Every application conforming to this specification MUST 5021 accept the UTF-8 character encoding to ensure minimal 5022 interoperability. The namespace for the elements defined in this 5023 specification is urn:ietf:params:xml:ns:p2p:config-base and 5024 urn:ietf:params:xml:ns:p2p:config-chord". 5026 The file can contain multiple "configuration" elements where each one 5027 contains the configuration information for a different overlay. Each 5028 "configuration" has the following attributes: 5030 instance-name: name of the overlay 5031 expiration: time in future at which this overlay configuration is no 5032 longer valid and needs to be retrieved again 5033 sequence: a monotonically increasing sequence number between 1 and 5034 2^32 5036 Inside each overlay element, the following elements can occur: 5038 topology-plugin This element has an attribute called algorithm-name 5039 that describes the overlay algorithm being used. 5040 root-cert This element contains a PEM encoded X.509v3 certificate 5041 that is a root trust anchor used to sign all certificates in this 5042 overlay. There can be more than one root-cert element. 5043 enrollment-server This element contains the URL at which the 5044 enrollment server can be reached in a "url" element. This URL 5045 MUST be of type "https:". More than one enrollment-server element 5046 may be present. 5047 self-signed-permitted This element indicates whether self-signed 5048 certificates are permitted. If it is set to "true", then self- 5049 signed certificates are allowed, in which case the enrollment- 5050 server and root-cert elements may be absent. Otherwise, it SHOULD 5051 be absent, but MAY be set to "false". This element also contains 5052 an attribute "digest" which indicates the digest to be used to 5053 compute the Node-ID. Valid values for this parameter are "SHA-1" 5054 and "SHA-256". Implementations MUST support both of these 5055 algorithms. 5056 bootstrap-node This element represents the address of one of the 5057 bootstrap nodes. It has an attribute called "address" that 5058 represents the IP address (either IPv4 or IPv6, since they can be 5059 distinguished) and an attribute called "port" that represents the 5060 port. The IP address is in typical hexidecimal form using 5061 standard period and colon separators as specified in 5062 [I-D.ietf-6man-text-addr-representation]. More than one 5063 bootstrap-peer element may be present. 5064 turn-density This element is a positive integer that represents the 5065 approximate reciprocal of density of nodes that can act as TURN 5066 servers. For example, if 10% of the nodes can act as TURN 5067 servers, this would be set to 10. If it is not present, the 5068 default value is 1. 5070 multicast-bootstrap This element represents the address of a 5071 multicast, broadcast, or anycast address and port that may be used 5072 for bootstrap. Nodes SHOULD listen on the address. It has an 5073 attributed called "address" that represents the IP address and an 5074 attribute called "port" that represents the port. More than one 5075 "multicast-bootstrap" element may be present. 5076 clients-permitted This element represents whether clients are 5077 permitted or whether all nodes must be peers. If it is set to 5078 "TRUE" or absent, this indicates that clients are permitted. If 5079 it is set to "FALSE" then nodes MUST join as peers. 5080 ice-lite-permitted This element represents whether nodes are 5081 allowed to use the "no-ICE" Overlay Link protocols. in this 5082 overlay. If it is absent, it is treated as if it were set to 5083 "FALSE". 5084 chord-update-interval The update frequency for the Chord-reload 5085 topology plugin (see Section 9). 5086 chord-ping-interval The ping frequency for the Chord-reload 5087 topology plugin (see Section 9). 5088 chord-reload-reactive Whether reactive recovery should be used for 5089 this overlay. (see Section 9). 5090 shared-secret If shared secret mode is used, this contains the 5091 shared secret. 5092 max-message-size Maximum size in bytes of any message in the 5093 overlay. If this value is not present, the default is 5000. 5094 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5095 for messages. If this value is not present, the default is 100. 5096 kind-signer This contains a single Node-ID in hexadecimal and 5097 indicates that the certificate with this Node-ID is allowed to 5098 sign kinds. Identifying kind-signer by Node-ID instead of 5099 certificate allows the use of short lived certificates without 5100 constantly having to provide an updated configuration file. 5101 bad-node This contains a single Node-ID in hexadecimal and 5102 indicates that the certificate with this Node-ID MUST NOT be 5103 considered valid. This allows certificate revocation. 5105 Inside each overlay element, the required-kinds elements can also 5106 occur. This element indicates the kinds that members must support 5107 and contains multiple kind-block elements that each define a single 5108 kind that MUST be supported by nodes in the overlay. Each kind-block 5109 consists of a single kind element and a kind-signature. The kind 5110 element defines the kind. The kind-signature is the signature 5111 computed over the kind element. 5113 Each kind has either an ID attribute or a name atribute. The name 5114 attribute is a string representing the kind (the name registered to 5115 IANA) while the ID is an integer kind-id allocated out of private 5116 space. 5118 In addition, the kind element contains the following elements: 5119 max-count: the maximum number of values which members of the overlay 5120 must support. 5121 data-model: the data model to be used. 5122 max-size: the maximum size of individual values. 5123 access-control: the access control model to be used. 5124 max-node-multiple: This is optional and only used when the access 5125 control is NODE-MULTIPLE. This indicates the maximum value for 5126 the i counter. This is an integer greater than 0. 5128 All of the non optional values MUST be provided. If the kind is 5129 registered with IANA, the data-model and access-control attributes 5130 MUST match those in the kind registration. For instance, the example 5131 above indicates that members must support SIP-REGISTRATION with a 5132 maximum of 10 values of up to 1000 bytes each. Multiple required- 5133 kinds elements MAY be present. 5135 The kind-block element also MUST contain a "kind-signature" element. 5136 This signature is computed across the kind from the beginning of the 5137 first < of the kind to the end of the last > of the kind in the same 5138 way as the "signature element described later in this section. 5140 The configuration file is a binary file and cannot be changed - 5141 including whitespace changes - or the signature will break. The 5142 signature is computed by taking each configuration element and 5143 starting form, and including, the first < at the start of 5144 up to and including the > in and 5145 treating this as a binary blob that is signed using the standard 5146 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5147 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5148 signature element following the configuration object in the config 5149 file. 5151 When a node receives a new configuration file, it MUST change its 5152 configuration to meet the new requirements. This may require the 5153 node to exit the DHT and re-join. If a node is not capable of 5154 supporting the new requirements, it MUST exit the overlay. If some 5155 information about a particular kind changes from what the node 5156 previously knew about the kind (for example the max size), the new 5157 information in the configuration files overrides any previously 5158 learned information. If any kind data was signed by a node that is 5159 no longer allowed to sign kinds, that kind MUST be discarded along 5160 with any stored information of that kind. Note that forcing an 5161 avalanche restart of the overlay with a configuration change that 5162 requires re-joining the overlay may result in serious performance 5163 problems, including total collapse of the network if configuration 5164 parameters are not properly considered. Such an event may be 5165 necessary in case of a compromised CA or similar problem, but for 5166 large overlays should be avoided in almost all circumstances. 5168 10.1.1. Relax NG Grammar 5170 The grammar for the configuration data is: 5172 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5173 namespace local = "" 5174 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5175 namespace rng = "http://relaxng.org/ns/structure/1.0" 5177 anything = 5178 (element * { anything } 5179 | attribute * { text } 5180 | text)* 5182 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5183 { anything }* 5184 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5185 { text }* 5186 foreign-nodes = (foreign-attributes | foreign-elements)* 5188 start = 5189 element p2pcf:overlay { 5190 element configuration { 5191 attribute instance-name { text }, 5192 attribute expiration { xsd:dateTime }, 5193 attribute sequence { xsd:long }, 5194 parameter 5195 }, 5196 element signature { 5197 attribute algorithm { signature-algorithm-type }?, 5198 xsd:base64Binary 5199 }? 5200 } 5201 signature-algorithm-type |= "rsa-sha1" 5203 parameter &= element topology-plugin { topology-plugin-type } 5204 parameter &= element max-message-size { xsd:int }? 5205 parameter &= element initial-ttl { xsd:int }? 5206 parameter &= element root-cert { text }? 5207 parameter &= element required-kinds { kind-block* } 5208 parameter &= element enrollment-server { xsd:anyURI }? 5209 parameter &= element kind-signer { text }* 5210 parameter &= element bad-node { text }* 5211 parameter &= element attach-lite-permitted { xsd:boolean }? 5212 parameter &= element shared-secret { xsd:string }? 5213 parameter &= element clients-permitted { xsd:boolean }? 5214 parameter &= element turn-density { xsd:int }? 5215 parameter &= foreign-elements* 5216 parameter &= 5217 element self-signed-permitted { 5218 attribute digest { self-signed-digest-type }, 5219 xsd:boolean 5220 }? 5221 self-signed-digest-type |= "sha1" 5222 parameter &= 5223 element bootstrap-node { 5224 attribute address { xsd:string }, 5225 attribute port { xsd:int } 5226 }+ 5227 hostPort = text 5228 parameter &= 5229 element multicast-bootstrap { hostPort 5230 }* 5232 kind-block = element kind-block { 5233 element kind { 5234 (attribute name { kind-names } 5235 | attribute id { xsd:int }), 5236 kind-paramter 5237 } & 5238 element kind-signature { 5239 attribute algorithm { signature-algorithm-type }?, 5240 xsd:base64Binary 5241 }? 5243 } 5245 kind-paramter &= element max-count { xsd:int } 5246 kind-paramter &= element max-size { xsd:int } 5247 kind-paramter &= element data-model { data-model-type } 5248 data-model-type |= "single" 5249 data-model-type |= "array" 5250 data-model-type |= "dictionary" 5251 kind-paramter &= element access-control { access-control-type } 5252 kind-paramter &= element max-node-multiple { xsd:int }? 5253 access-control-type |= "user-match" 5254 access-control-type |= "node-match" 5255 access-control-type |= "user-node-match" 5256 access-control-type |= "node-multiple" 5257 access-control-type |= "user-match-with-anon-create" 5258 kind-paramter &= foreign-elements* 5260 # Chord specific paramters 5261 topology-plugin-type |= "chord" 5262 kind-names |= "sip-registration" 5263 kind-names |= "turn-service" 5264 parameter &= element chord:chord-ping-interval { xsd:int }? 5265 parameter &= element chord:chord-update-interval { xsd:int }? 5267 10.2. Discovery Through Enrollment Server 5269 When a node first enrolls in a new overlay, it starts with a 5270 discovery process to find an enrollment server. Related work to the 5271 approach used here is described in 5272 [I-D.garcia-p2psip-dns-sd-bootstrapping] and 5273 [I-D.matthews-p2psip-bootstrap-mechanisms]. Another scheme for 5274 referencing overlays is described in 5275 [I-D.hardie-p2poverlay-pointers]. 5277 The node first determines the overlay name. This value is provided 5278 by the user or some other out-of-band provisioning mechanism. The 5279 out-of-band mechanisms may also provide an optional URL for the 5280 enrollment server. If a URL for the enrollment server is not 5281 provided, the node MUST do a DNS SRV query using a Service name of 5282 "p2psip_enroll" and a protocol of tcp to find an enrollment server 5283 and form the URL by appending a path of "/p2psip/enroll" to the 5284 overlay name. For example, if the overlay name was example.com, the 5285 URL would be "https://example.com/p2psip/enroll". 5287 Once an address and URL for the enrollment server is determined, the 5288 peer forms an HTTPS connection to that IP address. The certificate 5289 MUST match the overlay name as described in [RFC2818]. Then the node 5290 MUST fetch a new copy of the configuration file. To do this, the 5291 peer performs a GET to the URL. The result of the HTTP GET is an XML 5292 configuration file described above, which replaces any previously 5293 learned configuration file for this overlay. 5295 For overlays that do not use an enrollment server, nodes obtain the 5296 configuration information needed to join the overlay through some out 5297 of band approach such an an XML configuration file sent over email. 5299 10.3. Credentials 5301 If the configuration document contains a enrollment-server element, 5302 credentials are required to join the Overlay Instance. A peer which 5303 does not yet have credentials MUST contact the enrollment server to 5304 acquire them. 5306 RELOAD defines its own trivial certificate request protocol. We 5307 would have liked to have used an existing protocol but were concerned 5308 about the implementation burden of even the simplest of those 5309 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5310 have a protocol which could be easily implemented in a Web server 5311 which the operator did not control (e.g., in a hosted service) and 5312 was compatible with the existing certificate handling tooling as used 5313 with the Web certificate infrastructure. This means accepting bare 5314 PKCS#10 requests and returning a single bare X.509 certificate. 5315 Although the MIME types for these objects are defined, none of the 5316 existing protocols support exactly this model. 5318 The certificate request protocol is performed over HTTPS. The 5319 request is an HTTP POST with the following properties: 5321 o If authentication is required, there is a URL parameter of 5322 "password" and "username" containing the user's name and password 5323 in the clear (hence the need for HTTPS) 5324 o The body is of content type "application/pkcs10", as defined in 5325 [RFC2311]. 5326 o The Accept header contains the type "application/pkix-cert", 5327 indicating the type that is expected in the response. 5329 The enrollment server MUST authenticate the request using the 5330 provided user name and password. If the authentication succeeds and 5331 the requested user name is acceptable, the server generates and 5332 returns a certificate. The SubjectAltName field in the certificate 5333 contains the following values: 5335 o One or more Node-IDs which MUST be cryptographically random 5336 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5337 way that they are unpredictable to the requesting user. Each is 5338 placed in the subjectAltName using the uniformResourceIdentifier 5339 type and MUST contain RELOAD URIs as described in Section 13.13 5340 and MUST contain a Destination list with a single entry of type 5341 "node_id". 5342 o A single name this user is allowed to use in the overlay, using 5343 type rfc822Name. 5345 The certificate is returned as type "application/pkix-cert", with an 5346 HTTP status code of 200 OK. Certificate processing errors should be 5347 treated as HTTP errors and have appropriate HTTP status codes. 5349 The client MUST check that the certificate returned was signed by one 5350 of the certificates received in the "root-cert" list of the overlay 5351 configuration data. The node then reads the certificate to find the 5352 Node-IDs it can use. 5354 10.3.1. Self-Generated Credentials 5356 If the "self-signed-permitted" element is present and set to "TRUE", 5357 then a node MUST generate its own self-signed certificate to join the 5358 overlay. The self-signed certificate MAY contain any user name of 5359 the users choice. 5361 The Node-ID MUST be computed by applying the digest specified in the 5362 self-signed-permitted element to the DER representation of the user's 5363 public key (more specifically the subjectPublicKeyInfo) and taking 5364 the high order bits. When accepting a self-signed certificate, nodes 5365 MUST check that the Node-ID and public keys match. This prevents 5366 Node-ID theft. 5368 Once the node has constructed a self-signed certificate, it MAY join 5369 the overlay. Before storing its certificate in the overlay 5370 (Section 7) it SHOULD look to see if the user name is already taken 5371 and if so choose another user name. Note that this only provides 5372 protection against accidental name collisions. Name theft is still 5373 possible. If protection against name theft is desired, then the 5374 enrollment service must be used. 5376 10.4. Searching for a Bootstrap Node 5378 If no cached bootstrap nodes are available and the config file has an 5379 multicast-bootstrap element, then the node SHOULD send a Ping request 5380 over UDP to the address and port found to each multicast-bootstrap 5381 element found in the configuration document. This MAY be a 5382 multicast, broadcast, or anycast address. The Ping should use the 5383 wildcard Node-ID as the destination Node-ID. 5385 The responder node that receives the Ping request SHOULD check that 5386 the overlay name is correct and that the requester peer sending the 5387 request has appropriate credentials for the overlay before responding 5388 to the Ping request even if the response is only an error. 5390 10.5. Contacting a Bootstrap Node 5392 In order to join the overlay, the joining node MUST contact a node in 5393 the overlay. Typically this means contacting the bootstrap nodes, 5394 since they are reachable by the local peer or have public IP 5395 addresses. If the joining node has cached a list of peers it has 5396 previously been connected with in this overlay, as an optimization it 5397 MAY attempt to use one or more of them as bootstrap nodes before 5398 falling back to the bootstrap nodes listed in the configuration file. 5400 When contacting a bootstrap node, the joining node first forms the 5401 DTLS or TLS connection to the boostrap node and then sends an Attach 5402 request over this connection with the destination Node-ID set to the 5403 joining node's Node-ID. 5405 When the requester node finally does receive a response from some 5406 responding node, it can note the Node-ID in the response and use this 5407 Node-ID to start sending requests to join the Overlay Instance as 5408 described in Section 5.4. 5410 After a node has successfully joined the overlay network, it will 5411 have direct connections to several peers. Some MAY be added to the 5412 cached bootstrap nodes list and used in future boots. Peers that are 5413 not directly connected MUST NOT be cached. The suggested number of 5414 peers to cache is 10. Algorithms for determining which peers to 5415 cache are beyond the scope of this specification. 5417 11. Message Flow Example 5419 The following abbreviation are used in the message flow diagrams: JP 5420 = joining peer, AP = admitting peer, NP = next peer after the AP, NNP 5421 = next next peer which is the peer after NP, PP = previous peer 5422 before the AP, PPP = previous previous peer which is the peer before 5423 the PP, BP = bootstrap peer. 5425 The follwowing abbreviation are used in the message flow diagrams: 5427 In the following example, we assume that JP has formed a connection 5428 to one of the bootstrap nodes. JP then sends an Attach through that 5429 peer to the admitting peer (AP) to initiate a connection. When AP 5430 responds, JP and AP use ICE to set up a connection and then set up 5431 TLS. 5433 JP PPP PP AP NP NNP BP 5434 | | | | | | | 5435 | | | | | | | 5436 | | | | | | | 5437 |Attach Dest=JP | | | | | 5438 |---------------------------------------------------------->| 5439 | | | | | | | 5440 | | | | | | | 5441 | | |Attach Dest=JP | | | 5442 | | |<--------------------------------------| 5443 | | | | | | | 5444 | | | | | | | 5445 | | |Attach Dest=JP | | | 5446 | | |-------->| | | | 5447 | | | | | | | 5448 | | | | | | | 5449 | | |AttachAns | | | 5450 | | |<--------| | | | 5451 | | | | | | | 5452 | | | | | | | 5453 | | |AttachAns | | | 5454 | | |-------------------------------------->| 5455 | | | | | | | 5456 | | | | | | | 5457 |AttachAns | | | | | 5458 |<----------------------------------------------------------| 5459 | | | | | | | 5460 | | | | | | | 5461 |TLS | | | | | | 5462 |.............................| | | | 5463 | | | | | | | 5464 | | | | | | | 5465 | | | | | | | 5466 | | | | | | | 5468 Once JP has connected to AP, it needs to populate its Routing Table. 5469 In Chord, this means that it needs to populate its neighbor table and 5470 its finger table. To populate its neighbor table, it needs the 5471 successor of AP, NP. It sends an Attach to the Resource-IP AP+1, 5472 which gets routed to NP. When NP responds, JP and NP use ICE and TLS 5473 to set up a connection. 5475 JP PPP PP AP NP NNP BP 5476 | | | | | | | 5477 | | | | | | | 5478 | | | | | | | 5479 |Attach AP+1 | | | | | 5480 |---------------------------->| | | | 5481 | | | | | | | 5482 | | | | | | | 5483 | | | |Attach AP+1 | | 5484 | | | |-------->| | | 5485 | | | | | | | 5486 | | | | | | | 5487 | | | |AttachAns | | 5488 | | | |<--------| | | 5489 | | | | | | | 5490 | | | | | | | 5491 |AttachAns | | | | | 5492 |<----------------------------| | | | 5493 | | | | | | | 5494 | | | | | | | 5495 |Attach | | | | | | 5496 |-------------------------------------->| | | 5497 | | | | | | | 5498 | | | | | | | 5499 |TLS | | | | | | 5500 |.......................................| | | 5501 | | | | | | | 5502 | | | | | | | 5503 | | | | | | | 5504 | | | | | | | 5506 JP also needs to populate its finger table (for Chord). It issues an 5507 Attach to a variety of locations around the overlay. The diagram 5508 below shows it sending an Attach halfway around the Chord ring to the 5509 JP + 2^127. 5511 JP NP XX TP 5512 | | | | 5513 | | | | 5514 | | | | 5515 |Attach JP+2<<126 | | 5516 |-------->| | | 5517 | | | | 5518 | | | | 5519 | |Attach JP+2<<126 | 5520 | |-------->| | 5521 | | | | 5522 | | | | 5523 | | |Attach JP+2<<126 5524 | | |-------->| 5525 | | | | 5526 | | | | 5527 | | |AttachAns| 5528 | | |<--------| 5529 | | | | 5530 | | | | 5531 | |AttachAns| | 5532 | |<--------| | 5533 | | | | 5534 | | | | 5535 |AttachAns| | | 5536 |<--------| | | 5537 | | | | 5538 | | | | 5539 |TLS | | | 5540 |.............................| 5541 | | | | 5542 | | | | 5543 | | | | 5544 | | | | 5546 Once JP has a reasonable set of connections it is ready to take its 5547 place in the DHT. It does this by sending a Join to AP. AP does a 5548 series of Store requests to JP to store the data that JP will be 5549 responsible for. AP then sends JP an Update explicitly labeling JP 5550 as its predecessor. At this point, JP is part of the ring and 5551 responsible for a section of the overlay. AP can now forget any data 5552 which is assigned to JP and not AP. 5554 JP PPP PP AP NP NNP BP 5555 | | | | | | | 5556 | | | | | | | 5557 | | | | | | | 5558 |JoinReq | | | | | | 5559 |---------------------------->| | | | 5560 | | | | | | | 5561 | | | | | | | 5562 |JoinAns | | | | | | 5563 |<----------------------------| | | | 5564 | | | | | | | 5565 | | | | | | | 5566 |StoreReq Data A | | | | | 5567 |<----------------------------| | | | 5568 | | | | | | | 5569 | | | | | | | 5570 |StoreAns | | | | | | 5571 |---------------------------->| | | | 5572 | | | | | | | 5573 | | | | | | | 5574 |StoreReq Data B | | | | | 5575 |<----------------------------| | | | 5576 | | | | | | | 5577 | | | | | | | 5578 |StoreAns | | | | | | 5579 |---------------------------->| | | | 5580 | | | | | | | 5581 | | | | | | | 5582 |UpdateReq| | | | | | 5583 |<----------------------------| | | | 5584 | | | | | | | 5585 | | | | | | | 5586 |UpdateAns| | | | | | 5587 |---------------------------->| | | | 5588 | | | | | | | 5589 | | | | | | | 5590 | | | | | | | 5591 | | | | | | | 5593 In Chord, JP's neighbor table needs to contain its own predecessors. 5594 It couldn't connect to them previously because it did not yet know 5595 their addresses. However, now that it has received an Update from 5596 AP, it has AP's predecessors, which are also its own, so it sends 5597 Attaches to them. Below it is shown connecting to AP's closest 5598 predecessor, PP. 5600 JP PPP PP AP NP NNP BP 5601 | | | | | | | 5602 | | | | | | | 5603 | | | | | | | 5604 |Attach Dest=PP | | | | | 5605 |---------------------------->| | | | 5606 | | | | | | | 5607 | | | | | | | 5608 | | |Attach Dest=PP | | | 5609 | | |<--------| | | | 5610 | | | | | | | 5611 | | | | | | | 5612 | | |AttachAns| | | | 5613 | | |-------->| | | | 5614 | | | | | | | 5615 | | | | | | | 5616 |AttachAns| | | | | | 5617 |<----------------------------| | | | 5618 | | | | | | | 5619 | | | | | | | 5620 |TLS | | | | | | 5621 |...................| | | | | 5622 | | | | | | | 5623 | | | | | | | 5624 |UpdateReq| | | | | | 5625 |------------------>| | | | | 5626 | | | | | | | 5627 | | | | | | | 5628 |UpdateAns| | | | | | 5629 |<------------------| | | | | 5630 | | | | | | | 5631 | | | | | | | 5632 |UpdateReq| | | | | | 5633 |---------------------------->| | | | 5634 | | | | | | | 5635 | | | | | | | 5636 |UpdateAns| | | | | | 5637 |<----------------------------| | | | 5638 | | | | | | | 5639 | | | | | | | 5640 |UpdateReq| | | | | | 5641 |-------------------------------------->| | | 5642 | | | | | | | 5643 | | | | | | | 5644 |UpdateAns| | | | | | 5645 |<--------------------------------------| | | 5646 | | | | | | | 5647 | | | | | | | 5649 Finally, now that JP has a copy of all the data and is ready to route 5650 messages and receive requests, it sends Updates to everyone in its 5651 Routing Table to tell them it is ready to go. Below, it is shown 5652 sending such an update to TP. 5654 JP NP XX TP 5655 | | | | 5656 | | | | 5657 | | | | 5658 |Update | | | 5659 |---------------------------->| 5660 | | | | 5661 | | | | 5662 |UpdateAns| | | 5663 |<----------------------------| 5664 | | | | 5665 | | | | 5666 | | | | 5667 | | | | 5669 12. Security Considerations 5671 12.1. Overview 5673 RELOAD provides a generic storage service, albeit one designed to be 5674 useful for P2PSIP. In this section we discuss security issues that 5675 are likely to be relevant to any usage of RELOAD. More background 5676 information can be found in [RFC5765]. 5678 In any Overlay Instance, any given user depends on a number of peers 5679 with which they have no well-defined relationship except that they 5680 are fellow members of the Overlay Instance. In practice, these other 5681 nodes may be friendly, lazy, curious, or outright malicious. No 5682 security system can provide complete protection in an environment 5683 where most nodes are malicious. The goal of security in RELOAD is to 5684 provide strong security guarantees of some properties even in the 5685 face of a large number of malicious nodes and to allow the overlay to 5686 function correctly in the face of a modest number of malicious nodes. 5688 P2PSIP deployments require the ability to authenticate both peers and 5689 resources (users) without the active presence of a trusted entity in 5690 the system. We describe two mechanisms. The first mechanism is 5691 based on public key certificates and is suitable for general 5692 deployments. The second is an admission control mechanism based on 5693 an overlay-wide shared symmetric key. 5695 12.2. Attacks on P2P Overlays 5697 The two basic functions provided by overlay nodes are storage and 5698 routing: some node is responsible for storing a peer's data and for 5699 allowing a third peer to fetch this stored data. Other nodes are 5700 responsible for routing messages to and from the storing nodes. Each 5701 of these issues is covered in the following sections. 5703 P2P overlays are subject to attacks by subversive nodes that may 5704 attempt to disrupt routing, corrupt or remove user registrations, or 5705 eavesdrop on signaling. The certificate-based security algorithms we 5706 describe in this specification are intended to protect overlay 5707 routing and user registration information in RELOAD messages. 5709 To protect the signaling from attackers pretending to be valid peers 5710 (or peers other than themselves), the first requirement is to ensure 5711 that all messages are received from authorized members of the 5712 overlay. For this reason, RELOAD transports all messages over a 5713 secure channel (TLS and DTLS are defined in this document) which 5714 provides message integrity and authentication of the directly 5715 communicating peer. In addition, messages and data are digitally 5716 signed with the sender's private key, providing end-to-end security 5717 for communications. 5719 12.3. Certificate-based Security 5721 This specification stores users' registrations and possibly other 5722 data in an overlay network. This requires a solution to securing 5723 this data as well as securing, as well as possible, the routing in 5724 the overlay. Both types of security are based on requiring that 5725 every entity in the system (whether user or peer) authenticate 5726 cryptographically using an asymmetric key pair tied to a certificate. 5728 When a user enrolls in the Overlay Instance, they request or are 5729 assigned a unique name, such as "alice@dht.example.net". These names 5730 are unique and are meant to be chosen and used by humans much like a 5731 SIP Address of Record (AOR) or an email address. The user is also 5732 assigned one or more Node-IDs by the central enrollment authority. 5733 Both the name and the Node-ID are placed in the certificate, along 5734 with the user's public key. 5736 Each certificate enables an entity to act in two sorts of roles: 5738 o As a user, storing data at specific Resource-IDs in the Overlay 5739 Instance corresponding to the user name. 5740 o As a overlay peer with the Peer-ID(s) listed in the certificate. 5742 Note that since only users of this Overlay Instance need to validate 5743 a certificate, this usage does not require a global PKI. Instead, 5744 certificates are signed by a central enrollment authority which acts 5745 as the certificate authority for the Overlay Instance. This 5746 authority signs each peer's certificate. Because each peer possesses 5747 the CA's certificate (which they receive on enrollment) they can 5748 verify the certificates of the other entities in the overlay without 5749 further communication. Because the certificates contain the user/ 5750 peer's public key, communications from the user/peer can be verified 5751 in turn. 5753 If self-signed certificates are used, then the security provided is 5754 significantly decreased, since attackers can mount Sybil attacks. In 5755 addition, attackers cannot trust the user names in certificates 5756 (though they can trust the Node-IDs because they are 5757 cryptographically verifiable). This scheme may be appropriate for 5758 some small deployments, such as a small office or an ad hoc overlay 5759 set up among participants in a meeting where all hosts on the network 5760 are trusted. Some additional security can be provided by using the 5761 shared secret admission control scheme as well. 5763 Because all stored data is signed by the owner of the data the 5764 storing peer can verify that the storer is authorized to perform a 5765 store at that Resource-ID and also allow any consumer of the data to 5766 verify the provenance and integrity of the data when it retrieves it. 5768 Note that RELOAD does not itself provide a revocation/status 5769 mechanism (though certificates may of course include OCSP responder 5770 information). Thus, certificate lifetimes should be chosen to 5771 balance the compromise window versus the cost of certificate renewal. 5772 Because RELOAD is already designed to operate in the face of some 5773 fraction of malicious peers, this form of compromise is not fatal. 5775 All implementations MUST implement certificate-based security. 5777 12.4. Shared-Secret Security 5779 RELOAD also supports a shared secret admission control scheme that 5780 relies on a single key that is shared among all members of the 5781 overlay. It is appropriate for small groups that wish to form a 5782 private network without complexity. In shared secret mode, all the 5783 peers share a single symmetric key which is used to key TLS-PSK 5784 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 5785 key cannot form TLS connections with any other peer and therefore 5786 cannot join the overlay. 5788 One natural approach to a shared-secret scheme is to use a user- 5789 entered password as the key. The difficulty with this is that in 5790 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 5792 If passwords are used as the source of shared-keys, then TLS-SRP is a 5793 superior choice because it is not subject to dictionary attacks. 5795 12.5. Storage Security 5797 When certificate-based security is used in RELOAD, any given 5798 Resource-ID/Kind-ID pair is bound to some small set of certificates. 5799 In order to write data, the writer must prove possession of the 5800 private key for one of those certificates. Moreover, all data is 5801 stored, signed with the same private key that was used to authorize 5802 the storage. This set of rules makes questions of authorization and 5803 data integrity - which have historically been thorny for overlays - 5804 relatively simple. 5806 12.5.1. Authorization 5808 When a client wants to store some value, it first digitally signs the 5809 value with its own private key. It then sends a Store request that 5810 contains both the value and the signature towards the storing peer 5811 (which is defined by the Resource Name construction algorithm for 5812 that particular kind of value). 5814 When the storing peer receives the request, it must determine whether 5815 the storing client is authorized to store at this Resource-ID/Kind-ID 5816 pair. Determining this requires comparing the user's identity to the 5817 requirements of the access control model (see Section 6.3). If it 5818 satisfies those requirements the user is authorized to write, pending 5819 quota checks as described in the next section. 5821 For example, consider the certificate with the following properties: 5823 User name: alice@dht.example.com 5824 Node-ID: 013456789abcdef 5825 Serial: 1234 5827 If Alice wishes to Store a value of the "SIP Location" kind, the 5828 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 5829 Resource-ID will be determined by hashing the Resource Name. Because 5830 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 5831 the user name in the certificate hashes to the requested Resource-ID. 5832 It then verifies that the node-id in the certificate matches the 5833 dictionary key being used for the store. If both of these checks 5834 succeed, the Store is authorized. Note that because the access 5835 control model is different for different kinds, the exact set of 5836 checks will vary. 5838 12.5.2. Distributed Quota 5840 Being a peer in an Overlay Instance carries with it the 5841 responsibility to store data for a given region of the Overlay 5842 Instance. However, allowing clients to store unlimited amounts of 5843 data would create unacceptable burdens on peers and would also enable 5844 trivial denial of service attacks. RELOAD addresses this issue by 5845 requiring configurations to define maximum sizes for each kind of 5846 stored data. Attempts to store values exceeding this size MUST be 5847 rejected (if peers are inconsistent about this, then strange 5848 artifacts will happen when the zone of responsibility shifts and a 5849 different peer becomes responsible for overlarge data). Because each 5850 Resource-ID/Kind-ID pair is bound to a small set of certificates, 5851 these size restrictions also create a distributed quota mechanism, 5852 with the quotas administered by the central enrollment server. 5854 Allowing different kinds of data to have different size restrictions 5855 allows new usages the flexibility to define limits that fit their 5856 needs without requiring all usages to have expansive limits. 5858 12.5.3. Correctness 5860 Because each stored value is signed, it is trivial for any retrieving 5861 peer to verify the integrity of the stored value. Some more care 5862 needs to be taken to prevent version rollback attacks. Rollback 5863 attacks on storage are prevented by the use of store times and 5864 lifetime values in each store. A lifetime represents the latest time 5865 at which the data is valid and thus limits (though does not 5866 completely prevent) the ability of the storing node to perform a 5867 rollback attack on retrievers. In order to prevent a rollback attack 5868 at the time of the Store request, we require that storage times be 5869 monotonically increasing. Storing peers MUST reject Store requests 5870 with storage times smaller than or equal to those they are currently 5871 storing. In addition, a fetching node which receives a data value 5872 with a storage time older than the result of the previous fetch knows 5873 a rollback has occurred. 5875 12.5.4. Residual Attacks 5877 The mechanisms described here provides a high degree of security, but 5878 some attacks remain possible. Most simply, it is possible for 5879 storing nodes to refuse to store a value (i.e., reject any request). 5880 In addition, a storing node can deny knowledge of values which it has 5881 previously accepted. To some extent these attacks can be ameliorated 5882 by attempting to store to/retrieve from replicas, but a retrieving 5883 client does not know whether it should try this or not, since there 5884 is a cost to doing so. 5886 The certificate-based authentication scheme prevents a single peer 5887 from being able to forge data owned by other peers. Furthermore, 5888 although a subversive peer can refuse to return data resources for 5889 which it is responsible, it cannot return forged data because it 5890 cannot provide authentication for such registrations. Therefore 5891 parallel searches for redundant registrations can mitigate most of 5892 the effects of a compromised peer. The ultimate reliability of such 5893 an overlay is a statistical question based on the replication factor 5894 and the percentage of compromised peers. 5896 In addition, when a kind is multivalued (e.g., an array data model), 5897 the storing node can return only some subset of the values, thus 5898 biasing its responses. This can be countered by using single values 5899 rather than sets, but that makes coordination between multiple 5900 storing agents much more difficult. This is a trade off that must be 5901 made when designing any usage. 5903 12.6. Routing Security 5905 Because the storage security system guarantees (within limits) the 5906 integrity of the stored data, routing security focuses on stopping 5907 the attacker from performing a DOS attack that misroutes requests in 5908 the overlay. There are a few obvious observations to make about 5909 this. First, it is easy to ensure that an attacker is at least a 5910 valid peer in the Overlay Instance. Second, this is a DOS attack 5911 only. Third, if a large percentage of the peers on the Overlay 5912 Instance are controlled by the attacker, it is probably impossible to 5913 perfectly secure against this. 5915 12.6.1. Background 5917 In general, attacks on DHT routing are mounted by the attacker 5918 arranging to route traffic through one or two nodes it controls. In 5919 the Eclipse attack [Eclipse] the attacker tampers with messages to 5920 and from nodes for which it is on-path with respect to a given victim 5921 node. This allows it to pretend to be all the nodes that are 5922 reachable through it. In the Sybil attack [Sybil], the attacker 5923 registers a large number of nodes and is therefore able to capture a 5924 large amount of the traffic through the DHT. 5926 Both the Eclipse and Sybil attacks require the attacker to be able to 5927 exercise control over her Peer-IDs. The Sybil attack requires the 5928 creation of a large number of peers. The Eclipse attack requires 5929 that the attacker be able to impersonate specific peers. In both 5930 cases, these attacks are limited by the use of centralized, 5931 certificate-based admission control. 5933 12.6.2. Admissions Control 5935 Admission to a RELOAD Overlay Instance is controlled by requiring 5936 that each peer have a certificate containing its Peer-ID. The 5937 requirement to have a certificate is enforced by using certificate- 5938 based mutual authentication on each connection. (Note: the 5939 following only applies when self-signed certificates are not used.) 5940 Whenever a peer connects to another peer, each side automatically 5941 checks that the other has a suitable certificate. These Peer-IDs are 5942 randomly assigned by the central enrollment server. This has two 5943 benefits: 5945 o It allows the enrollment server to limit the number of peer IDs 5946 issued to any individual user. 5947 o It prevents the attacker from choosing specific Peer-IDs. 5949 The first property allows protection against Sybil attacks (provided 5950 the enrollment server uses strict rate limiting policies). The 5951 second property deters but does not completely prevent Eclipse 5952 attacks. Because an Eclipse attacker must impersonate peers on the 5953 other side of the attacker, he must have a certificate for suitable 5954 Peer-IDs, which requires him to repeatedly query the enrollment 5955 server for new certificates, which will match only by chance. From 5956 the attacker's perspective, the difficulty is that if he only has a 5957 small number of certificates, the region of the Overlay Instance he 5958 is impersonating appears to be very sparsely populated by comparison 5959 to the victim's local region. 5961 12.6.3. Peer Identification and Authentication 5963 In general, whenever a peer engages in overlay activity that might 5964 affect the routing table it must establish its identity. This 5965 happens in two ways. First, whenever a peer establishes a direct 5966 connection to another peer it authenticates via certificate-based 5967 mutual authentication. All messages between peers are sent over this 5968 protected channel and therefore the peers can verify the data origin 5969 of the last hop peer for requests and responses without further 5970 cryptography. 5972 In some situations, however, it is desirable to be able to establish 5973 the identity of a peer with whom one is not directly connected. The 5974 most natural case is when a peer Updates its state. At this point, 5975 other peers may need to update their view of the overlay structure, 5976 but they need to verify that the Update message came from the actual 5977 peer rather than from an attacker. To prevent this, all overlay 5978 routing messages are signed by the peer that generated them. 5980 Replay is typically prevented for messages that impact the topology 5981 of the overlay by having the information come directly, or be 5982 verified by, the nodes that claimed to have generated the update. 5983 Data storage replay detection is done by signing time of the node 5984 that generated the signature on the store request thus providing a 5985 time based replay protection but the time synchronization is only 5986 needed between peers that can write to the same location. 5988 12.6.4. Protecting the Signaling 5990 The goal here is to stop an attacker from knowing who is signaling 5991 what to whom. An attacker is unlikely to be able to observe the 5992 activities of a specific individual given the randomization of IDs 5993 and routing based on the present peers discussed above. Furthermore, 5994 because messages can be routed using only the header information, the 5995 actual body of the RELOAD message can be encrypted during 5996 transmission. 5998 There are two lines of defense here. The first is the use of TLS or 5999 DTLS for each communications link between peers. This provides 6000 protection against attackers who are not members of the overlay. The 6001 second line of defense is to digitally sign each message. This 6002 prevents adversarial peers from modifying messages in flight, even if 6003 they are on the routing path. 6005 12.6.5. Residual Attacks 6007 The routing security mechanisms in RELOAD are designed to contain 6008 rather than eliminate attacks on routing. It is still possible for 6009 an attacker to mount a variety of attacks. In particular, if an 6010 attacker is able to take up a position on the overlay routing between 6011 A and B it can make it appear as if B does not exist or is 6012 disconnected. It can also advertise false network metrics in an 6013 attempt to reroute traffic. However, these are primarily DOS 6014 attacks. 6016 The certificate-based security scheme secures the namespace, but if 6017 an individual peer is compromised or if an attacker obtains a 6018 certificate from the CA, then a number of subversive peers can still 6019 appear in the overlay. While these peers cannot falsify responses to 6020 resource queries, they can respond with error messages, effecting a 6021 DoS attack on the resource registration. They can also subvert 6022 routing to other compromised peers. To defend against such attacks, 6023 a resource search must still consist of parallel searches for 6024 replicated registrations. 6026 13. IANA Considerations 6028 This section contains the new code points registered by this 6029 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6030 the RFC number for this specification in the following list.] 6032 13.1. Port Registrations 6034 [[Note to RFC Editor - this paragraph can be removed before 6035 publication. ]] IANA has already allocated a port for the main peer 6036 to peer protocol. This port has the name p2p-sip and the port number 6037 of 6084. The names of this port may need to be changed as this draft 6038 progresses and if it does careful instructions will be needed to IANA 6039 to ensure the final RFC and IANA registrations are in sync. 6041 IANA will make the following port registration: 6043 +-------------------------------+-----------------------------------+ 6044 | Registration Technical | Cullen Jennings | 6045 | Contact | | 6046 | Registration Owner | IETF | 6047 | Transport Protocol | TCP, UDP | 6048 | Port Number | 6084 | 6049 | Service Name | p2psip_enroll | 6050 | Description | RELOAD P2P Protcol | 6051 | Reference | [RFC-AAAA] | 6052 +-------------------------------+-----------------------------------+ 6054 13.2. Overlay Algorithm Types 6056 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6057 Entries in this registry are strings denoting the names of overlay 6058 algorithms. The registration policy for this registry is RFC 5226 6059 IETF Review. The initial contents of this registry are: 6061 +----------------+----------+ 6062 | Algorithm Name | RFC | 6063 +----------------+----------+ 6064 | chord-reload | RFC-AAAA | 6065 +----------------+----------+ 6067 13.3. Access Control Policies 6069 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6070 in this registry are strings denoting access control policies, as 6071 described in Section 6.3. New entries in this registry SHALL be 6072 registered via RFC 5226 Standards Action. The initial contents of 6073 this registry are: 6075 USER-MATCH 6076 NODE-MATCH 6077 USER-NODE-MATCH 6078 NODE-MULTIPLE 6080 13.4. Application-ID 6082 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6083 this registry are 16-bit integers denoting applictions kinds. Code 6084 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6085 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6086 registered via RFC 5226 Expert Review. Code points in the range 6087 0xf001 to 0xfffe are reserved for private us. The initial contents 6088 of this registry are: 6090 +-------------+----------------+-------------------------------+ 6091 | Application | Application-ID | Specification | 6092 +-------------+----------------+-------------------------------+ 6093 | INVALID | 0 | RFC-AAAA | 6094 | RELOAD | 1 | RFC-AAAA | 6095 | SIP | 5060 | Reserved for use by SIP Usage | 6096 | SIP | 5061 | Reserved for use by SIP Usage | 6097 | Reserved | 0xffff | RFC-AAAA | 6098 +-------------+----------------+-------------------------------+ 6100 13.5. Data Kind-ID 6102 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6103 registry are 32-bit integers denoting data kinds, as described in 6104 Section 4.1.2. Code points in the range 0x00000001 to 0x7fffffff 6105 SHALL be registered via RFC 5226 Standards Action. Code points in 6106 the range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 6107 Expert Review. Code points in the range 0xf0000001 to 0xffffffff are 6108 reserved for private use via the kind description mechanism described 6109 in Section 10. The initial contents of this registry are: 6111 +---------------------+------------+----------+ 6112 | Kind | Kind-ID | RFC | 6113 +---------------------+------------+----------+ 6114 | INVALID | 0 | RFC-AAAA | 6115 | TURN_SERVICE | 2 | RFC-AAAA | 6116 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6117 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6118 | Reserved | 0x7fffffff | RFC-AAAA | 6119 | Reserved | 0xffffffff | RFC-AAAA | 6120 +---------------------+------------+----------+ 6122 13.6. Data Model 6124 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6125 registry are 8-bit integers denoting data models, as described in 6126 Section 6.2. Code points in this registry SHALL be registered via 6127 RFC 5226 Standards Action. The initial contents of this registry 6128 are: 6130 +--------------+------+----------+ 6131 | Data Model | Code | RFC | 6132 +--------------+------+----------+ 6133 | INVALID | 0 | RFC-AAAA | 6134 | SINGLE_VALUE | 1 | RFC-AAAA | 6135 | ARRAY | 2 | RFC-AAAA | 6136 | DICTIONARY | 3 | RFC-AAAA | 6137 | RESERVED | 255 | RFC-AAAA | 6138 +--------------+------+----------+ 6140 13.7. Message Codes 6142 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6143 registry are 16-bit integers denoting method codes as described in 6144 Section 5.3.3. These codes SHALL be registered via RFC 5226 6145 Standards Action. The initial contents of this registry are: 6147 +---------------------------------+----------------+----------+ 6148 | Message Code Name | Code Value | RFC | 6149 +---------------------------------+----------------+----------+ 6150 | invalid | 0 | RFC-AAAA | 6151 | probe_req | 1 | RFC-AAAA | 6152 | probe_ans | 2 | RFC-AAAA | 6153 | attach_req | 3 | RFC-AAAA | 6154 | attach_ans | 4 | RFC-AAAA | 6155 | unused | 5 | | 6156 | unused | 6 | | 6157 | store_req | 7 | RFC-AAAA | 6158 | store_ans | 8 | RFC-AAAA | 6159 | fetch_req | 9 | RFC-AAAA | 6160 | fetch_ans | 10 | RFC-AAAA | 6161 | remove_req | 11 | RFC-AAAA | 6162 | remove_ans | 12 | RFC-AAAA | 6163 | find_req | 13 | RFC-AAAA | 6164 | find_ans | 14 | RFC-AAAA | 6165 | join_req | 15 | RFC-AAAA | 6166 | join_ans | 16 | RFC-AAAA | 6167 | leave_req | 17 | RFC-AAAA | 6168 | leave_ans | 18 | RFC-AAAA | 6169 | update_req | 19 | RFC-AAAA | 6170 | update_ans | 20 | RFC-AAAA | 6171 | route_query_req | 21 | RFC-AAAA | 6172 | route_query_ans | 22 | RFC-AAAA | 6173 | ping_req | 23 | RFC-AAAA | 6174 | ping_ans | 24 | RFC-AAAA | 6175 | stat_req | 25 | RFC-AAAA | 6176 | stat_ans | 26 | RFC-AAAA | 6177 | unused (was attachlite_req) | 27 | RFC-AAAA | 6178 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6179 | app_attach_req | 29 | RFC-AAAA | 6180 | app_attach_ans | 30 | RFC-AAAA | 6181 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6182 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6183 | reserved | 0x8000..0xfffe | RFC-AAAA | 6184 | error | 0xffff | RFC-AAAA | 6185 +---------------------------------+----------------+----------+ 6187 13.8. Error Codes 6189 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6190 registry are 16-bit integers denoting error codes. New entries SHALL 6191 be defined via RFC 5226 Standards Action. The initial contents of 6192 this registry are: 6194 +-------------------------------------+----------------+----------+ 6195 | Error Code Name | Code Value | RFC | 6196 +-------------------------------------+----------------+----------+ 6197 | invalid | 0 | RFC-AAAA | 6198 | Unused | 1 | RFC-AAAA | 6199 | Error_Forbidden | 2 | RFC-AAAA | 6200 | Error_Not_Found | 3 | RFC-AAAA | 6201 | Error_Request_Timeout | 4 | RFC-AAAA | 6202 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6203 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6204 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6205 | Error_Data_Too_Large | 8 | RFC-AAAA | 6206 | Error_Data_Too_Old | 9 | RFC-AAAA | 6207 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6208 | Error_Message_Too_Large | 11 | RFC-AAAA | 6209 | Error_Unknown_Kind | 12 | RFC-AAAA | 6210 | Error_Unknown_Extension | 13 | RFC-AAAA | 6211 | reserved | 0x8000..0xfffe | RFC-AAAA | 6212 +-------------------------------------+----------------+----------+ 6214 13.9. Overlay Link Types 6216 IANA shall create a "RELOAD Overlay Link." New entries SHALL be 6217 defined via RFC 5226 Standards Action. This registry SHALL be 6218 initially populated with the following values: 6220 +--------------------+------+---------------+ 6221 | Protocol | Code | Specification | 6222 +--------------------+------+---------------+ 6223 | reserved | 0 | RFC-AAAA | 6224 | DTLS-UDP-SR | 1 | RFC-AAAA | 6225 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6226 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6227 | reserved | 255 | RFC-AAAA | 6228 +--------------------+------+---------------+ 6230 13.10. Forwarding Options 6232 IANA shall create a "Forwarding Option Registry". Entries in this 6233 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6234 Action. Entries in this registry between 128 and 254 SHALL be 6235 defined via RFC 5226 Specification Required. This registry SHALL be 6236 initially populated with the following values: 6238 +-------------------+------+---------------+ 6239 | Forwarding Option | Code | Specification | 6240 +-------------------+------+---------------+ 6241 | invalid | 0 | RFC-AAAA | 6242 | reserved | 255 | RFC-AAAA | 6243 +-------------------+------+---------------+ 6245 13.11. Probe Information Types 6247 IANA shall create a "RELOAD Probe Information Type Registry". 6248 Entries in this registry SHALL be defined via RFC 5226 Standards 6249 Action. This registry SHALL be initially populated with the 6250 following values: 6252 +-----------------+------+---------------+ 6253 | Probe Option | Code | Specification | 6254 +-----------------+------+---------------+ 6255 | invalid | 0 | RFC-AAAA | 6256 | responsible_set | 1 | RFC-AAAA | 6257 | num_resources | 2 | RFC-AAAA | 6258 | uptime | 3 | RFC-AAAA | 6259 | reserved | 255 | RFC-AAAA | 6260 +-----------------+------+---------------+ 6262 13.12. Message Extensions 6264 IANA shall create a "RELOAD Extensions Registry". Entries in this 6265 registry SHALL be defined via RFC 5226 Specification Required. This 6266 registry SHALL be initially populated with the following values: 6268 +-----------------+--------+---------------+ 6269 | Extensions Name | Code | Specification | 6270 +-----------------+--------+---------------+ 6271 | invalid | 0 | RFC-AAAA | 6272 | reserved | 0xFFFF | RFC-AAAA | 6273 +-----------------+--------+---------------+ 6275 13.13. reload URI Scheme 6277 This section describes the scheme for a reload URI, which can be used 6278 to refer to either: 6280 o A peer. 6281 o A resource inside a peer. 6283 The reload URI is defined using a subset of the URI schema specified 6284 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6285 [RFC4395] per the following ABNF syntax: 6287 RELOAD-URI = "reload://" destination "@" overlay "/" 6288 [specifier] 6290 destination = 1 * HEXDIG 6291 overlay = reg-name 6292 specifier = 1*HEXDIG 6294 The definitions of these productions are as follows: 6296 destination: a hex-encoded Destination List object. 6298 overlay: the name of the overlay. 6300 specifier : a hex-encoded StoredDataSpecifier indicating the data 6301 element. 6303 If no specifier is present then this URI addresses the peer which can 6304 be reached via the indicated destination list at the indicated 6305 overlay name. If a specifier is present, then the URI addresses the 6306 data value. 6308 13.13.1. URI Registration 6310 The following summarizes the information necessary to register the 6311 reload URI. 6313 URI Scheme Name: reload 6314 Status: permanent 6315 URI Scheme Syntax: see Section 13.13 of RFC-AAAA 6316 URI Scheme Semantics: The reload URI is intended to be used as a 6317 reference to a RELOAD peer or resource. 6318 Encoding Considerations: The reload URI is not intended to be 6319 human-readable text, so it is encoded entirely in US-ASCII. 6320 Applications/protocols that use this URI scheme: The RELOAD 6321 protocol described in RFC-AAAA. 6322 Interoperability considerations See RFC-AAAA. 6323 Security considerations See RFC-AAAA 6324 Contact Cullen Jennings 6325 Author/Change controller IESG 6326 References RFC-AAAA 6328 14. Acknowledgments 6330 This specification is a merge of the "REsource LOcation And Discovery 6331 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6332 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6333 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6334 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6335 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6336 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6337 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6338 Matuszewski. Thanks to the authors of RFC 5389 for text included 6339 from that. Vidya Narayanan provided many comments and imporvements. 6341 The ideas and text for the Chord specific extension data to the Leave 6342 mechanisms was provided by J. Maenpaa, G. Camarillo, and J. 6343 Hautakorpi. 6345 Thanks to the many people who contributed including Ted Hardie, 6346 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6347 David Bryan, Dave Craig, and Julian Cain. Extensinve working last 6348 call comments were provided by: Jouni Maenpaa, Roni Even, Ari 6349 Keranen, John Buford, Michael Chen, Frederic-Philippe Met, and David 6350 Bryan. 6352 15. References 6354 15.1. Normative References 6356 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6357 Requirement Levels", BCP 14, RFC 2119, March 1997. 6359 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 6360 (ICE): A Protocol for Network Address Translator (NAT) 6361 Traversal for Offer/Answer Protocols", RFC 5245, 6362 April 2010. 6364 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 6365 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 6366 October 2008. 6368 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 6369 Relays around NAT (TURN): Relay Extensions to Session 6370 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 6372 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6373 (CMC): Transport Protocols", RFC 5273, June 2008. 6375 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6376 (CMC)", RFC 5272, June 2008. 6378 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6379 for Transport Layer Security (TLS)", RFC 4279, 6380 December 2005. 6382 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6383 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6385 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6386 Security", RFC 4347, April 2006. 6388 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 6389 Friendly Rate Control (TFRC): Protocol Specification", 6390 RFC 5348, September 2008. 6392 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6393 Encodings", RFC 4648, October 2006. 6395 [RFC2988] Paxson, V. and M. Allman, "Computing TCP's Retransmission 6396 Timer", RFC 2988, November 2000. 6398 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6399 Resource Identifier (URI): Generic Syntax", STD 66, 6400 RFC 3986, January 2005. 6402 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6403 Registration Procedures for New URI Schemes", BCP 35, 6404 RFC 4395, February 2006. 6406 [I-D.ietf-6man-text-addr-representation] 6407 Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 6408 Address Text Representation", 6409 draft-ietf-6man-text-addr-representation-07 (work in 6410 progress), February 2010. 6412 15.2. Informative References 6414 [I-D.ietf-mmusic-ice-tcp] 6415 Rosenberg, J., "TCP Candidates with Interactive 6416 Connectivity Establishment (ICE)", 6417 draft-ietf-mmusic-ice-tcp-07 (work in progress), 6418 July 2008. 6420 [I-D.maenpaa-p2psip-self-tuning] 6421 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 6422 tuning Distributed Hash Table (DHT) for REsource LOcation 6423 And Discovery (RELOAD)", 6424 draft-maenpaa-p2psip-self-tuning-01 (work in progress), 6425 October 2009. 6427 [I-D.baset-tsvwg-tcp-over-udp] 6428 Baset, S. and H. Schulzrinne, "TCP-over-UDP", 6429 draft-baset-tsvwg-tcp-over-udp-01 (work in progress), 6430 June 2009. 6432 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 6433 "Host Identity Protocol", RFC 5201, April 2008. 6435 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 6436 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 6437 April 2007. 6439 [I-D.ietf-p2psip-concepts] 6440 Bryan, D., Matthews, P., Shim, E., Willis, D., and S. 6441 Dawkins, "Concepts and Terminology for Peer to Peer SIP", 6442 draft-ietf-p2psip-concepts-02 (work in progress), 6443 July 2008. 6445 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6446 Communication Layers", STD 3, RFC 1122, October 1989. 6448 [RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. 6449 Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, 6450 RFC 5382, October 2008. 6452 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 6453 the Session Description Protocol (SDP)", RFC 4145, 6454 September 2005. 6456 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6458 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6459 Requirements for Security", BCP 106, RFC 4086, June 2005. 6461 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 6462 "Using the Secure Remote Password (SRP) Protocol for TLS 6463 Authentication", RFC 5054, November 2007. 6465 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6466 Housley, R., and W. Polk, "Internet X.509 Public Key 6467 Infrastructure Certificate and Certificate Revocation List 6468 (CRL) Profile", RFC 5280, May 2008. 6470 [I-D.matthews-p2psip-bootstrap-mechanisms] 6471 Cooper, E., "Bootstrap Mechanisms for P2PSIP", 6472 draft-matthews-p2psip-bootstrap-mechanisms-00 (work in 6473 progress), February 2007. 6475 [I-D.garcia-p2psip-dns-sd-bootstrapping] 6476 Garcia, G., "P2PSIP bootstrapping using DNS-SD", 6477 draft-garcia-p2psip-dns-sd-bootstrapping-00 (work in 6478 progress), October 2007. 6480 [I-D.pascual-p2psip-clients] 6481 Pascual, V., Matuszewski, M., Shim, E., Zhang, H., and S. 6482 Yongchao, "P2PSIP Clients", 6483 draft-pascual-p2psip-clients-01 (work in progress), 6484 February 2008. 6486 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 6487 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 6488 RFC 4787, January 2007. 6490 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 6491 L. Repka, "S/MIME Version 2 Message Specification", 6492 RFC 2311, March 1998. 6494 [I-D.jiang-p2psip-sep] 6495 Jiang, X. and H. Zhang, "Service Extensible P2P Peer 6496 Protocol", draft-jiang-p2psip-sep-01 (work in progress), 6497 February 2008. 6499 [I-D.hardie-p2poverlay-pointers] 6500 Hardie, T., "Mechanisms for use in pointing to overlay 6501 networks, nodes, or resources", 6502 draft-hardie-p2poverlay-pointers-00 (work in progress), 6503 January 2008. 6505 [I-D.ietf-p2psip-sip] 6506 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 6507 H. Schulzrinne, "A SIP Usage for RELOAD", 6508 draft-ietf-p2psip-sip-01 (work in progress), March 2009. 6510 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 6512 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 6513 "Eclipse Attacks on Overlay Networks: Threats and 6514 Defenses", INFOCOM 2006, April 2006. 6516 [non-transitive-dhts-worlds05] 6517 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 6518 Stoica, "Non-Transitive Connectivity and DHTs", 6519 WORLDS'05. 6521 [lookups-churn-p2p06] 6522 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 6523 Improving DHT Lookup Performance under Churn", IEEE 6524 P2P'06. 6526 [bryan-design-hotp2p08] 6527 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 6528 a Versatile, Secure P2PSIP Communications Architecture for 6529 the Public Internet", Hot-P2P'08. 6531 [opendht-sigcomm05] 6532 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 6533 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 6534 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 6536 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 6537 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 6538 Scalable Peer-to-peer Lookup Protocol for Internet 6539 Applications", IEEE/ACM Transactions on Networking Volume 6540 11, Issue 1, 17-32, Feb 2003. 6542 [vulnerabilities-acsac04] 6543 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 6544 Threats in Structured Peer-to-Peer Systems: A Quantitative 6545 Analysis", ACSAC 2004. 6547 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 6548 Issues and Solutions in Peer-to-Peer Systems for Realtime 6549 Communications", RFC 5765, February 2010. 6551 [handling-churn-usenix04] 6552 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 6553 "Handling Churn in a DHT", In Proc. of the USENIX Annual 6554 Technical Conference June 2004 USENIX 2004. 6556 [minimizing-churn-sigcomm06] 6557 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 6558 in Distributed Systems", SIGCOMM 2006. 6560 Appendix A. Change Log 6562 A.1. Changes since draft-ietf-p2psip-reload-04 6564 o Renamed the XML element in configuration files from to . 6567 A.2. Changes since draft-ietf-p2psip-reload-01 6568 o Added the ability to introduce new kinds dynamically. 6569 o Added configuration file updating. 6570 o Major revisions to reliability and flow control algorithms. 6571 o Moved diagnostics out--they now go in a separate draft. 6572 o Removed REMOVE: you now store a "nonexistent" element. 6574 A.3. Changes since draft-ietf-p2psip-reload-00 6576 o Split base protocol from combined draft into new draft. 6577 o Update architecture discussion to address concerns raised about 6578 clarity of roles. 6579 o Moved extensive discussion of routing and client behaviors to 6580 appendix. 6581 o Split Ping into Ping and Probe. 6582 o Added AttachLite to provide way to implement ICE-Lite. 6583 o Added Stat call for retrieving meta-data. 6584 o Added discussion of periodic vs reactive recovery issue. 6585 o Changed finger table stabilization to prefer long-lived over best- 6586 match. 6587 o Updated IANA considerations to be more complete. 6588 o Changed error codes from http-based. 6590 A.4. Changes since draft-ietf-p2psip-base-00 6592 o Removed TUNNEL method 6593 o Allow implementations more flexibility in picking finger table 6594 entries and revising random range. 6595 o Decouple overlay configuration from enrollment server. 6596 o Add error for data too large. 6597 o Change architecture to overlay perspective from previous revision 6598 and update terminology in document to match. 6600 A.5. Changes since draft-ietf-p2psip-base-01 6602 o Reordered message routing section to clarify that other routing 6603 algorithms are possible besides symmetric recursive. 6604 o Clarified document IPR terms. 6606 A.6. Changes since draft-ietf-p2psip-base-01a 6608 o Fragment offset was too small to hold 2^24 bit messages, so fixed 6609 this from 16 bits to 32 bits. 6610 o Changed absolute times from seconds to milliseconds. 6611 o Added error for messages over max size. 6612 o Added error for TTL expired. 6613 o Add time in response to PING. 6615 o Clarified retransmission and fragmentation algorithm. 6616 o Clarified acknowledgement tracking for congestion control. 6618 A.7. Changes since draft-ietf-p2psip-base-02 6620 o Rearranged forwarding header to fix alignment, among other issues. 6621 o Removed route logging. 6622 o Switched to binary ICE for Attach. 6623 o ConfigUpdate improved. 6624 o Change from close DTLS session on fragmentation attack to drop 6625 fragments, indirect attack. 6626 o Updates to trivial sender/receiver text. 6627 o Updates to data model based on list discussion. 6628 o Updates to chord overlay algorithm section. 6629 o Added AppAttach and removed port number from Attach. 6630 o Changed via-list to use shorter structure. 6631 o Rewrote fragmentation. 6632 o Moved AIMD and TFRC congestion control algorithms to appendix 6633 until further WG effort decides direction there. 6635 Appendix B. Routing Alternatives 6637 Significant discussion has been focused on the selection of a routing 6638 algorithm for P2PSIP. This section discusses the motivations for 6639 selecting symmetric recursive routing for RELOAD and describes the 6640 extensions that would be required to support additional routing 6641 algorithms. 6643 B.1. Iterative vs Recursive 6645 Iterative routing has a number of advantages. It is easier to debug, 6646 consumes fewer resources on intermediate peers, and allows the 6647 querying peer to identify and route around misbehaving peers 6648 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 6649 iterative routing is intolerably expensive because a new connection 6650 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 6652 Iterative routing is supported through the Route_Query mechanism and 6653 is primarily intended for debugging. It also allows the querying 6654 peer to evaluate the routing decisions made by the peers at each hop, 6655 consider alternatives, and perhaps detect at what point the 6656 forwarding path fails. 6658 B.2. Symmetric vs Forward response 6660 An alternative to the symmetric recursive routing method used by 6661 RELOAD is Forward-Only routing, where the response is routed to the 6662 requester as if it were a new message initiated by the responder (in 6663 the previous example, Z sends the response to A as if it were sending 6664 a request). Forward-only routing requires no state in either the 6665 message or intermediate peers. 6667 The drawback of forward-only routing is that it does not work when 6668 the overlay is unstable. For example, if A is in the process of 6669 joining the overlay and is sending a Join request to Z, it is not yet 6670 reachable via forward routing. Even if it is established in the 6671 overlay, if network failures produce temporary instability, A may not 6672 be reachable (and may be trying to stabilize its network connectivity 6673 via Attach messages). 6675 Furthermore, forward-only responses are less likely to reach the 6676 querying peer than symmetric recursive ones are, because the forward 6677 path is more likely to have a failed peer than is the request path 6678 (which was just tested to route the request) 6679 [non-transitive-dhts-worlds05]. 6681 An extension to RELOAD that supports forward-only routing but relies 6682 on symmetric responses as a fallback would be possible, but due to 6683 the complexities of determining when to use forward-only and when to 6684 fallback to symmetric, we have chosen not to include it as an option 6685 at this point. 6687 B.3. Direct Response 6689 Another routing option is Direct Response routing, in which the 6690 response is returned directly to the querying node. In the previous 6691 example, if A encodes its IP address in the request, then Z can 6692 simply deliver the response directly to A. In the absence of NATs or 6693 other connectivity issues, this is the optimal routing technique. 6695 The challenge of implementing direct response is the presence of 6696 NATs. There are a number of complexities that must be addressed. In 6697 this discussion, we will continue our assumption that A issued the 6698 request and Z is generating the response. 6700 o The IP address listed by A may be unreachable, either due to NAT 6701 or firewall rules. Therefore, a direct response technique must 6702 fallback to symmetric response [non-transitive-dhts-worlds05]. 6703 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 6704 received the message (and the TLS negotiation will provide earlier 6705 confirmation that A is reachable), but this fallback requires a 6706 timeout that will increase the response latency whenever A is not 6707 reachable from Z. 6709 o Whenever A is behind a NAT it will have multiple candidate IP 6710 addresses, each of which must be advertised to ensure 6711 connectivity; therefore Z will need to attempt multiple 6712 connections to deliver the response. 6713 o One (or all) of A's candidate addresses may route from Z to a 6714 different device on the Internet. In the worst case these nodes 6715 may actually be running RELOAD on the same port. Therefore, it is 6716 absolutely necessary to establish a secure connection to 6717 authenticate A before delivering the response. This step 6718 diminishes the efficiency of direct response because multiple 6719 roundtrips are required before the message can be delivered. 6720 o If A is behind a NAT and does not have a connection already 6721 established with Z, there are only two ways the direct response 6722 will work. The first is that A and Z both be behind the same NAT, 6723 in which case the NAT is not involved. In the more common case, 6724 when Z is outside A's NAT, the response will only be received if 6725 A's NAT implements endpoint-independent filtering. As the choice 6726 of filtering mode conflates application transparency with security 6727 [RFC4787], and no clear recommendation is available, the 6728 prevalence of this feature in future devices remains unclear. 6730 An extension to RELOAD that supports direct response routing but 6731 relies on symmetric responses as a fallback would be possible, but 6732 due to the complexities of determining when to use direct response 6733 and when to fallback to symmetric, and the reduced performance for 6734 responses to peers behind restrictive NATs, we have chosen not to 6735 include it as an option at this point. 6737 B.4. Relay Peers 6739 SEP [I-D.jiang-p2psip-sep] has proposed implementing a form of direct 6740 response by having A identify a peer, Q, that will be directly 6741 reachable by any other peer. A uses Attach to establish a connection 6742 with Q and advertises Q's IP address in the request sent to Z. Z 6743 sends the response to Q, which relays it to A. This then reduces the 6744 latency to two hops, plus Z negotiating a secure connection to Q. 6746 This technique relies on the relative population of nodes such as A 6747 that require relay peers and peers such as Q that are capable of 6748 serving as a relay peer. It also requires nodes to be able to 6749 identify which category they are in. This identification problem has 6750 turned out to be hard to solve and is still an open area of 6751 exploration. 6753 An extension to RELOAD that supports relay peers is possible, but due 6754 to the complexities of implementing such an alternative, we have not 6755 added such a feature to RELOAD at this point. 6757 A concept similar to relay peers, essentially choosing a relay peer 6758 at random, has previously been suggested to solve problems of 6759 pairwise non-transitivity [non-transitive-dhts-worlds05], but 6760 deterministic filtering provided by NATs makes random relay peers no 6761 more likely to work than the responding peer. 6763 B.5. Symmetric Route Stability 6765 A common concern about symmetric recursive routing has been that one 6766 or more peers along the request path may fail before the response is 6767 received. The significance of this problem essentially depends on 6768 the response latency of the overlay. An overlay that produces slow 6769 responses will be vulnerable to churn, whereas responses that are 6770 delivered very quickly are vulnerable only to failures that occur 6771 over that small interval. 6773 The other aspect of this issue is whether the request itself can be 6774 successfully delivered. Assuming typical connection maintenance 6775 intervals, the time period between the last maintenance and the 6776 request being sent will be orders of magnitude greater than the delay 6777 between the request being forwarded and the response being received. 6778 Therefore, if the path was stable enough to be available to route the 6779 request, it is almost certainly going to remain available to route 6780 the response. 6782 An overlay that is unstable enough to suffer this type of failure 6783 frequently is unlikely to be able to support reliable functionality 6784 regardless of the routing mechanism. However, regardless of the 6785 stability of the return path, studies show that in the event of high 6786 churn, iterative routing is a better solution to ensure request 6787 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 6789 Finally, because RELOAD retries the end-to-end request, that retry 6790 will address the issues of churn that remain. 6792 Appendix C. Why Clients? 6794 There are a wide variety of reasons a node may act as a client rather 6795 than as a peer [I-D.pascual-p2psip-clients]. This section outlines 6796 some of those scenarios and how the client's behavior changes based 6797 on its capabilities. 6799 C.1. Why Not Only Peers? 6801 For a number of reasons, a particular node may be forced to act as a 6802 client even though it is willing to act as a peer. These include: 6804 o The node does not have appropriate network connectivity, typically 6805 because it has a low-bandwidth network connection. 6806 o The node may not have sufficient resources, such as computing 6807 power, storage space, or battery power. 6808 o The overlay algorithm may dictate specific requirements for peer 6809 selection. These may include participating in the overlay to 6810 determine trustworthiness; controlling the number of peers in the 6811 overlay to reduce overly-long routing paths; or ensuring minimum 6812 application uptime before a node can join as a peer. 6814 The ultimate criteria for a node to become a peer are determined by 6815 the overlay algorithm and specific deployment. A node acting as a 6816 client that has a full implementation of RELOAD and the appropriate 6817 overlay algorithm is capable of locating its responsible peer in the 6818 overlay and using Attach to establish a direct connection to that 6819 peer. In that way, it may elect to be reachable under either of the 6820 routing approaches listed above. Particularly for overlay algorithms 6821 that elect nodes to serve as peers based on trustworthiness or 6822 population, the overlay algorithm may require such a client to locate 6823 itself at a particular place in the overlay. 6825 C.2. Clients as Application-Level Agents 6827 SIP defines an extensive protocol for registration and security 6828 between a client and its registrar/proxy server(s). Any SIP device 6829 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 6830 peer that implements the server-side functionality required by the 6831 SIP protocol. In this case, the peer would be acting as if it were 6832 the user's peer, and would need the appropriate credentials for that 6833 user. 6835 Application-level support for clients is defined by a usage. A usage 6836 offering support for application-level clients should specify how the 6837 security of the system is maintained when the data is moved between 6838 the application and RELOAD layers. 6840 Authors' Addresses 6842 Cullen Jennings 6843 Cisco 6844 170 West Tasman Drive 6845 MS: SJC-21/2 6846 San Jose, CA 95134 6847 USA 6849 Phone: +1 408 421-9990 6850 Email: fluffy@cisco.com 6852 Bruce B. Lowekamp (editor) 6853 Skype 6854 Palo Alto, CA 6855 USA 6857 Email: bbl@lowekamp.net 6859 Eric Rescorla 6860 Network Resonance 6861 2064 Edgewood Drive 6862 Palo Alto, CA 94303 6863 USA 6865 Phone: +1 650 320-8549 6866 Email: ekr@networkresonance.com 6868 Salman A. Baset 6869 Columbia University 6870 1214 Amsterdam Avenue 6871 New York, NY 6872 USA 6874 Email: salman@cs.columbia.edu 6876 Henning Schulzrinne 6877 Columbia University 6878 1214 Amsterdam Avenue 6879 New York, NY 6880 USA 6882 Email: hgs@cs.columbia.edu