idnits 2.17.1 draft-ietf-p2psip-base-19.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 1936 has weird spacing: '...Options optio...' == Line 2190 has weird spacing: '...ionType type;...' == Line 2412 has weird spacing: '...tyValue ide...' == Line 2738 has weird spacing: '...ionType typ...' == Line 2740 has weird spacing: '...ionData val...' == (3 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 (October 29, 2011) is 4563 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'NodeIdLength' is mentioned on line 1831, but not defined -- Looks like a reference, but probably isn't: '0' on line 4781 == Missing Reference: 'RFC-AAAA' is mentioned on line 6503, but not defined == Unused Reference: 'RFC5348' is defined on line 7001, but no explicit reference was found in the text == Unused Reference: 'RFC4828' is defined on line 7101, but no explicit reference was found in the text ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 3023 (Obsoleted by RFC 7303) ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) ** Obsolete normative reference: RFC 4395 (Obsoleted by RFC 7595) ** Obsolete normative reference: RFC 5245 (Obsoleted by RFC 8445, RFC 8839) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) ** Obsolete normative reference: RFC 5405 (Obsoleted by RFC 8085) ** Obsolete normative reference: RFC 5766 (Obsoleted by RFC 8656) ** Downref: Normative reference to an Informational RFC: RFC 6091 ** Downref: Normative reference to an Informational RFC: RFC 6234 == Outdated reference: A later version (-10) exists of draft-ietf-hip-reload-instance-03 == Outdated reference: A later version (-16) exists of draft-ietf-mmusic-ice-tcp-15 == Outdated reference: A later version (-15) exists of draft-ietf-p2psip-self-tuning-04 == Outdated reference: A later version (-15) exists of draft-ietf-p2psip-service-discovery-03 == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-06 -- Obsolete informational reference (is this intentional?): RFC 5201 (Obsoleted by RFC 7401) -- Obsolete informational reference (is this intentional?): RFC 5785 (Obsoleted by RFC 8615) Summary: 13 errors (**), 0 flaws (~~), 16 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: May 1, 2012 Skype 6 E. Rescorla 7 RTFM, Inc. 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 October 29, 2011 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-19 16 Abstract 18 NOTE: This version address some, but not all, of the comments 19 received during IESG review. The authors are still working on 20 addressing many more of the comments but as the draft deadline for 21 IETF 82 arrives, this represents the modification made so far. 23 This specification defines REsource LOcation And Discovery (RELOAD), 24 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 25 P2P signaling protocol provides its clients with an abstract storage 26 and messaging service between a set of cooperating peers that form 27 the overlay network. RELOAD is designed to support a P2P Session 28 Initiation Protocol (P2PSIP) network, but can be utilized by other 29 applications with similar requirements by defining new usages that 30 specify the kinds of data that must be stored for a particular 31 application. RELOAD defines a security model based on a certificate 32 enrollment service that provides unique identities. NAT traversal is 33 a fundamental service of the protocol. RELOAD also allows access 34 from "client" nodes that do not need to route traffic or store data 35 for others. 37 Status of this Memo 39 This Internet-Draft is submitted in full conformance with the 40 provisions of BCP 78 and BCP 79. 42 Internet-Drafts are working documents of the Internet Engineering 43 Task Force (IETF). Note that other groups may also distribute 44 working documents as Internet-Drafts. The list of current Internet- 45 Drafts is at http://datatracker.ietf.org/drafts/current/. 47 Internet-Drafts are draft documents valid for a maximum of six months 48 and may be updated, replaced, or obsoleted by other documents at any 49 time. It is inappropriate to use Internet-Drafts as reference 50 material or to cite them other than as "work in progress." 52 This Internet-Draft will expire on May 1, 2012. 54 Copyright Notice 56 Copyright (c) 2011 IETF Trust and the persons identified as the 57 document authors. All rights reserved. 59 This document is subject to BCP 78 and the IETF Trust's Legal 60 Provisions Relating to IETF Documents 61 (http://trustee.ietf.org/license-info) in effect on the date of 62 publication of this document. Please review these documents 63 carefully, as they describe your rights and restrictions with respect 64 to this document. Code Components extracted from this document must 65 include Simplified BSD License text as described in Section 4.e of 66 the Trust Legal Provisions and are provided without warranty as 67 described in the Simplified BSD License. 69 This document may contain material from IETF Documents or IETF 70 Contributions published or made publicly available before November 71 10, 2008. The person(s) controlling the copyright in some of this 72 material may not have granted the IETF Trust the right to allow 73 modifications of such material outside the IETF Standards Process. 74 Without obtaining an adequate license from the person(s) controlling 75 the copyright in such materials, this document may not be modified 76 outside the IETF Standards Process, and derivative works of it may 77 not be created outside the IETF Standards Process, except to format 78 it for publication as an RFC or to translate it into languages other 79 than English. 81 Table of Contents 83 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 84 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 85 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 86 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 87 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 88 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 15 89 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 90 1.2.5. Forwarding and Link Management Layer . . . . . . . . 16 91 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 17 92 1.4. Structure of This Document . . . . . . . . . . . . . . . 18 93 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 18 94 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 21 95 3.1. Security and Identification . . . . . . . . . . . . . . 21 96 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 22 97 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 23 98 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 23 99 3.2.2. Minimum Functionality Requirements for Clients . . . 24 100 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 24 101 3.4. Connectivity Management . . . . . . . . . . . . . . . . 27 102 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 28 103 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 28 104 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 28 105 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 30 106 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 30 107 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 30 108 4. Application Support Overview . . . . . . . . . . . . . . . . 31 109 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 31 110 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 32 111 4.1.2. Replication . . . . . . . . . . . . . . . . . . . . 33 112 4.2. Usages . . . . . . . . . . . . . . . . . . . . . . . . . 33 113 4.3. Service Discovery . . . . . . . . . . . . . . . . . . . 34 114 4.4. Application Connectivity . . . . . . . . . . . . . . . . 34 115 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 35 116 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 35 117 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 35 118 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 36 119 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 38 120 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 38 121 5.2.1. Request Origination . . . . . . . . . . . . . . . . 38 122 5.2.2. Response Origination . . . . . . . . . . . . . . . . 39 123 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 39 124 5.3.1. Presentation Language . . . . . . . . . . . . . . . 40 125 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 41 126 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 43 127 5.3.2.1. Processing Configuration Sequence Numbers . . . . 45 128 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 46 129 5.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 48 130 5.3.3. Message Contents Format . . . . . . . . . . . . . . 49 131 5.3.3.1. Response Codes and Response Errors . . . . . . . 50 132 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 52 133 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 56 134 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 56 135 5.4.2. Methods and types for use by topology plugins . . . 56 136 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 56 137 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 58 138 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 58 139 5.4.2.4. RouteQuery . . . . . . . . . . . . . . . . . . . 59 140 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 60 141 5.5. Forwarding and Link Management Layer . . . . . . . . . . 62 142 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 62 143 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 63 144 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 66 145 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 67 146 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 67 147 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 68 148 5.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 68 149 5.5.1.7. Encoding the Attach Message . . . . . . . . . . . 69 150 5.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 69 151 5.5.1.9. Role Determination . . . . . . . . . . . . . . . 70 152 5.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 70 153 5.5.1.11. No-ICE . . . . . . . . . . . . . . . . . . . . . 70 154 5.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 71 155 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 71 156 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 71 157 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 71 158 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 71 159 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 72 160 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 73 161 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 73 162 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 73 163 5.5.4. ConfigUpdate . . . . . . . . . . . . . . . . . . . . 74 164 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 74 165 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 75 166 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 75 167 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 77 168 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 77 169 5.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 77 170 5.6.1.3. Message-oriented Transports . . . . . . . . . . . 78 171 5.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 78 172 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 78 173 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 80 174 5.6.3.1. Stop and Wait Sender Algorithm . . . . . . . . . 80 175 5.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 81 176 5.6.5. TLS/TCP with FH, No-ICE . . . . . . . . . . . . . . 82 177 5.6.6. DTLS/UDP with SR, No-ICE . . . . . . . . . . . . . . 82 178 5.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 82 179 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 83 180 6.1. Data Signature Computation . . . . . . . . . . . . . . . 85 181 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 86 182 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 86 183 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 87 184 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 87 185 6.3. Access Control Policies . . . . . . . . . . . . . . . . 88 186 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 88 187 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 88 188 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 89 189 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 89 190 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 89 191 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 89 192 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 89 193 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 94 194 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 95 195 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 96 196 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 96 197 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 98 198 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 99 199 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 99 200 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 100 201 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 102 202 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 102 203 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 103 204 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 104 205 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 104 206 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 105 207 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 107 208 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 108 209 9.2. Hash Function . . . . . . . . . . . . . . . . . . . . . 108 210 9.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 108 211 9.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 109 212 9.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 109 213 9.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 110 214 9.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 110 215 9.7.1. Handling Neighbor Failures . . . . . . . . . . . . . 112 216 9.7.2. Handling Finger Table Entry Failure . . . . . . . . 113 217 9.7.3. Receiving Updates . . . . . . . . . . . . . . . . . 113 218 9.7.4. Stabilization . . . . . . . . . . . . . . . . . . . 114 219 9.7.4.1. Updating neighbor table . . . . . . . . . . . . . 114 220 9.7.4.2. Refreshing finger table . . . . . . . . . . . . . 114 221 9.7.4.3. Adjusting finger table size . . . . . . . . . . . 115 222 9.7.4.4. Detecting partitioning . . . . . . . . . . . . . 116 223 9.8. Route query . . . . . . . . . . . . . . . . . . . . . . 116 224 9.9. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 117 226 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 118 227 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 118 228 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 124 229 10.2. Discovery Through Configuration Server . . . . . . . . . 127 230 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 127 231 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 128 232 10.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 129 233 10.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 129 234 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 130 235 12. Security Considerations . . . . . . . . . . . . . . . . . . . 136 236 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 136 237 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 137 238 12.3. Certificate-based Security . . . . . . . . . . . . . . . 137 239 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 138 240 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 139 241 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 139 242 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 140 243 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 140 244 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 140 245 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 141 246 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 141 247 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 142 248 12.6.3. Peer Identification and Authentication . . . . . . . 142 249 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 143 250 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 143 251 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 144 252 13.1. Well-Known URI Registration . . . . . . . . . . . . . . 144 253 13.2. Port Registrations . . . . . . . . . . . . . . . . . . . 144 254 13.3. Overlay Algorithm Types . . . . . . . . . . . . . . . . 145 255 13.4. Access Control Policies . . . . . . . . . . . . . . . . 145 256 13.5. Application-ID . . . . . . . . . . . . . . . . . . . . . 145 257 13.6. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 146 258 13.7. Data Model . . . . . . . . . . . . . . . . . . . . . . . 146 259 13.8. Message Codes . . . . . . . . . . . . . . . . . . . . . 147 260 13.9. Error Codes . . . . . . . . . . . . . . . . . . . . . . 149 261 13.10. Overlay Link Types . . . . . . . . . . . . . . . . . . . 149 262 13.11. Overlay Link Protocols . . . . . . . . . . . . . . . . . 150 263 13.12. Forwarding Options . . . . . . . . . . . . . . . . . . . 150 264 13.13. Probe Information Types . . . . . . . . . . . . . . . . 151 265 13.14. Message Extensions . . . . . . . . . . . . . . . . . . . 151 266 13.15. reload URI Scheme . . . . . . . . . . . . . . . . . . . 151 267 13.15.1. URI Registration . . . . . . . . . . . . . . . . . . 152 268 13.16. Media Type Registration . . . . . . . . . . . . . . . . 153 269 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 154 270 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 155 271 15.1. Normative References . . . . . . . . . . . . . . . . . . 155 272 15.2. Informative References . . . . . . . . . . . . . . . . . 156 273 Appendix A. Routing Alternatives . . . . . . . . . . . . . . . . 159 274 A.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 160 275 A.2. Symmetric vs Forward response . . . . . . . . . . . . . 160 276 A.3. Direct Response . . . . . . . . . . . . . . . . . . . . 160 277 A.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 162 278 A.5. Symmetric Route Stability . . . . . . . . . . . . . . . 162 279 Appendix B. Why Clients? . . . . . . . . . . . . . . . . . . . . 163 280 B.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 163 281 B.2. Clients as Application-Level Agents . . . . . . . . . . 163 282 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 164 284 1. Introduction 286 This document defines REsource LOcation And Discovery (RELOAD), a 287 peer-to-peer (P2P) signaling protocol for use on the Internet. It 288 provides a generic, self-organizing overlay network service, allowing 289 nodes to efficiently route messages to other nodes and to efficiently 290 store and retrieve data in the overlay. RELOAD provides several 291 features that are critical for a successful P2P protocol for the 292 Internet: 294 Security Framework: A P2P network will often be established among a 295 set of peers that do not trust each other. RELOAD leverages a 296 central enrollment server to provide credentials for each peer 297 which can then be used to authenticate each operation. This 298 greatly reduces the possible attack surface. 300 Usage Model: RELOAD is designed to support a variety of 301 applications, including P2P multimedia communications with the 302 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 303 the definition of new application usages, each of which can define 304 its own data types, along with the rules for their use. This 305 allows RELOAD to be used with new applications through a simple 306 documentation process that supplies the details for each 307 application. 309 NAT Traversal: RELOAD is designed to function in environments where 310 many if not most of the nodes are behind NATs or firewalls. 311 Operations for NAT traversal are part of the base design, 312 including using ICE to establish new RELOAD or application 313 protocol connections. 315 High Performance Routing: The very nature of overlay algorithms 316 introduces a requirement that peers participating in the P2P 317 network route requests on behalf of other peers in the network. 318 This introduces a load on those other peers, in the form of 319 bandwidth and processing power. RELOAD has been defined with a 320 simple, lightweight forwarding header, thus minimizing the amount 321 of effort required by intermediate peers. 323 Pluggable Overlay Algorithms: RELOAD has been designed with an 324 abstract interface to the overlay layer to simplify implementing a 325 variety of structured (e.g., distributed hash tables) and 326 unstructured overlay algorithms. This specification also defines 327 how RELOAD is used with the Chord based DHT algorithm, which is 328 mandatory to implement. Specifying a default "must implement" 329 overlay algorithm promotes interoperability, while extensibility 330 allows selection of overlay algorithms optimized for a particular 331 application. 333 These properties were designed specifically to meet the requirements 334 for a P2P protocol to support SIP. This document defines the base 335 protocol for the distributed storage and location service, as well as 336 critical usages for NAT traversal and security. The SIP Usage itself 337 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 338 limited to usage by SIP and could serve as a tool for supporting 339 other P2P applications with similar needs. 341 1.1. Basic Setting 343 In this section, we provide a brief overview of the operational 344 setting for RELOAD. A RELOAD Overlay Instance consists of a set of 345 nodes arranged in a partly connected graph. Each node in the overlay 346 is assigned a numeric Node-ID which, together with the specific 347 overlay algorithm in use, determines its position in the graph and 348 the set of nodes it connects to. The figure below shows a trivial 349 example which isn't drawn from any particular overlay algorithm, but 350 was chosen for convenience of representation. 352 +--------+ +--------+ +--------+ 353 | Node 10|--------------| Node 20|--------------| Node 30| 354 +--------+ +--------+ +--------+ 355 | | | 356 | | | 357 +--------+ +--------+ +--------+ 358 | Node 40|--------------| Node 50|--------------| Node 60| 359 +--------+ +--------+ +--------+ 360 | | | 361 | | | 362 +--------+ +--------+ +--------+ 363 | Node 70|--------------| Node 80|--------------| Node 90| 364 +--------+ +--------+ +--------+ 365 | 366 | 367 +--------+ 368 | Node 85| 369 |(Client)| 370 +--------+ 372 Because the graph is not fully connected, when a node wants to send a 373 message to another node, it may need to route it through the network. 374 For instance, Node 10 can talk directly to nodes 20 and 40, but not 375 to Node 70. In order to send a message to Node 70, it would first 376 send it to Node 40 with instructions to pass it along to Node 70. 377 Different overlay algorithms will have different connectivity graphs, 378 but the general idea behind all of them is to allow any node in the 379 graph to efficiently reach every other node within a small number of 380 hops. 382 The RELOAD network is not only a messaging network. It is also a 383 storage network, albeit one designed for small-scale storage rather 384 than for bulk storage of large objects. Records are stored under 385 numeric addresses which occupy the same space as node identifiers. 386 Peers are responsible for storing the data associated with some set 387 of addresses as determined by their Node-ID. For instance, we might 388 say that every peer is responsible for storing any data value which 389 has an address less than or equal to its own Node-ID, but greater 390 than the next lowest Node-ID. Thus, Node-20 would be responsible for 391 storing values 11-20. 393 RELOAD also supports clients. These are nodes which have Node-IDs 394 but do not participate in routing or storage. For instance, in the 395 figure above Node 85 is a client. It can route to the rest of the 396 RELOAD network via Node 80, but no other node will route through it 397 and Node 90 is still responsible for all addresses between 81-90. We 398 refer to non-client nodes as peers. 400 Other applications (for instance, SIP) can be defined on top of 401 RELOAD and use these two basic RELOAD services to provide their own 402 services. 404 1.2. Architecture 406 RELOAD is fundamentally an overlay network. The following figure 407 shows the layered RELOAD architecture. 409 Application 411 +-------+ +-------+ 412 | SIP | | XMPP | ... 413 | Usage | | Usage | 414 +-------+ +-------+ 415 ------------------------------------ Messaging Service Boundary 416 +------------------+ +---------+ 417 | Message |<--->| Storage | 418 | Transport | +---------+ 419 +------------------+ ^ 420 ^ ^ | 421 | v v 422 | +-------------------+ 423 | | Topology | 424 | | Plugin | 425 | +-------------------+ 426 | ^ 427 v v 428 +------------------+ 429 | Forwarding & | 430 | Link Management | 431 +------------------+ 432 ------------------------------------ Overlay Link Service Boundary 433 +-------+ +------+ 434 |TLS | |DTLS | ... 435 +-------+ +------+ 437 The major components of RELOAD are: 439 Usage Layer: Each application defines a RELOAD usage; a set of data 440 Kinds and behaviors which describe how to use the services 441 provided by RELOAD. These usages all talk to RELOAD through a 442 common Message Transport Service. 444 Message Transport: Handles end-to-end reliability, manages request 445 state for the usages, and forwards Store and Fetch operations to 446 the Storage component. Delivers message responses to the 447 component initiating the request. 449 Storage: The Storage component is responsible for processing 450 messages relating to the storage and retrieval of data. It talks 451 directly to the Topology Plugin to manage data replication and 452 migration, and it talks to the Message Transport component to send 453 and receive messages. 455 Topology Plugin: The Topology Plugin is responsible for implementing 456 the specific overlay algorithm being used. It uses the Message 457 Transport component to send and receive overlay management 458 messages, to the Storage component to manage data replication, and 459 directly to the Forwarding Layer to control hop-by-hop message 460 forwarding. This component closely parallels conventional routing 461 algorithms, but is more tightly coupled to the Forwarding Layer 462 because there is no single "routing table" equivalent used by all 463 overlay algorithms. 465 Forwarding and Link Management Layer: Stores and implements the 466 routing table by providing packet forwarding services between 467 nodes. It also handles establishing new links between nodes, 468 including setting up connections across NATs using ICE. 470 Overlay Link Layer: Responsible for actually transporting traffic 471 directly between nodes. Each such protocol includes the 472 appropriate provisions for per-hop framing or hop-by-hop ACKs 473 required by unreliable transports. TLS [RFC5246] and DTLS 474 [RFC4347] are the currently defined "link layer" protocols used by 475 RELOAD for hop-by-hop communication. New protocols can be 476 defined, as described in Section 5.6.1 and Section 10.1. As this 477 document defines only TLS and DTLS, we use those terms throughout 478 the remainder of the document with the understanding that some 479 future specification may add new overlay link layers. 481 To further clarify the roles of the various layers, this figure 482 parallels the architecture with each layer's role from an overlay 483 perspective and implementation layer in the internet: 485 | Internet Model | 486 Real | Equivalent | Reload 487 Internet | in Overlay | Architecture 488 -------------+-----------------+------------------------------------ 489 | | +-------+ +-------+ 490 | Application | | SIP | | XMPP | ... 491 | | | Usage | | Usage | 492 | | +-------+ +-------+ 493 | | ---------------------------------- 494 | |+------------------+ +---------+ 495 | Transport || Message |<--->| Storage | 496 | || Transport | +---------+ 497 | |+------------------+ ^ 498 | | ^ ^ | 499 | | | v v 500 Application | | | +-------------------+ 501 | (Routing) | | | Topology | 502 | | | | Plugin | 503 | | | +-------------------+ 504 | | | ^ 505 | | v v 506 | Network | +------------------+ 507 | | | Forwarding & | 508 | | | Link Management | 509 | | +------------------+ 510 | | ---------------------------------- 511 Transport | Link | +-------+ +------+ 512 | | |TLS | |DTLS | ... 513 | | +-------+ +------+ 514 -------------+-----------------+------------------------------------ 515 Network | 516 | 517 Link | 519 1.2.1. Usage Layer 521 The top layer, called the Usage Layer, has application usages, such 522 as the SIP Registration Usage [I-D.ietf-p2psip-sip], that use the 523 abstract Message Transport Service provided by RELOAD. The goal of 524 this layer is to implement application-specific usages of the generic 525 overlay services provided by RELOAD. The usage defines how a 526 specific application maps its data into something that can be stored 527 in the overlay, where to store the data, how to secure the data, and 528 finally how applications can retrieve and use the data. 530 The architecture diagram shows both a SIP usage and an XMPP usage. A 531 single application may require multiple usages; for example a 532 softphone application may also require a voicemail usage. A usage 533 may define multiple Kinds of data that are stored in the overlay and 534 may also rely on Kinds originally defined by other usages. 536 Because the security and storage policies for each Kind are dictated 537 by the usage defining the Kind, the usages may be coupled with the 538 Storage component to provide security policy enforcement and to 539 implement appropriate storage strategies according to the needs of 540 the usage. The exact implementation of such an interface is outside 541 the scope of this specification. 543 1.2.2. Message Transport 545 The Message Transport component provides a generic message routing 546 service for the overlay. The Message Transport layer is responsible 547 for end-to-end message transactions. Each peer is identified by its 548 location in the overlay as determined by its Node-ID. A component 549 that is a client of the Message Transport can perform two basic 550 functions: 552 o Send a message to a given peer specified by Node-ID or to the peer 553 responsible for a particular Resource-ID. 554 o Receive messages that other peers sent to a Node-ID or Resource-ID 555 for which the receiving peer is responsible. 557 All usages rely on the Message Transport component to send and 558 receive messages from peers. For instance, when a usage wants to 559 store data, it does so by sending Store requests. Note that the 560 Storage component and the Topology Plugin are themselves clients of 561 the Message Transport, because they need to send and receive messages 562 from other peers. 564 The Message Transport Service is responsible for end-to-end 565 reliability, accomplished by timer-based retransmissions. Unlike the 566 Internet transport layer, however, this layer does not provide 567 congestion control. RELOAD is a request-response protocol, with no 568 more than two pairs of request-response messages used in typical 569 transactions between pairs of nodes, therefore there are no 570 opportunities to observe and react to end-to-end congestion. As with 571 all Internet applications, implementers are strongly discouraged from 572 writing applications that react to loss by immediately retrying the 573 transaction. 575 The Message Transport Service is similar to those described as 576 providing "Key based routing" (KBR), although as RELOAD supports 577 different overlay algorithms (including non-DHT overlay algorithms) 578 that calculate keys in different ways, the actual interface must 579 accept Resource Names rather than actual keys. 581 Stability of the underlying network supporting the overlay (the 582 Internet) and congestion control between overlay neighbors, which 583 exchange routing updates and data replicas in addition to forwarding 584 end-to-end messages, is handled by the Forwarding and Link Management 585 layer described below. 587 Real-world experience has shown that a fixed timeout for the end-to- 588 end retransmission timer is sufficient for practical overlay 589 networks. This timer is adjustable via the overlay configuration. 590 As the overlay configuration can be rapidly updated, this value could 591 be dynamically adjusted at coarse time scales, although algorithms 592 for determining how to accomplish this are beyond the scope of this 593 specification. In many cases, however, more appropriate means of 594 improving network performance, such as the Topology Plugin removing 595 lossy links from use in overlay routing or reducing the overall hop- 596 count of end-to-end paths will be more effective than simply 597 increasing the retransmission timer. 599 1.2.3. Storage 601 One of the major functions of RELOAD is to allow nodes to store data 602 in the overlay and to retrieve data stored by other nodes or by 603 themselves. The Storage component is responsible for processing data 604 storage and retrieval messages. For instance, the Storage component 605 might receive a Store request for a given resource from the Message 606 Transport. It would then query the appropriate usage before storing 607 the data value(s) in its local data store and sending a response to 608 the Message Transport for delivery to the requesting node. 609 Typically, these messages will come from other nodes, but depending 610 on the overlay topology, a node might be responsible for storing data 611 for itself as well, especially if the overlay is small. 613 A peer's Node-ID determines the set of resources that it will be 614 responsible for storing. However, the exact mapping between these is 615 determined by the overlay algorithm in use. The Storage component 616 will only receive a Store request from the Message Transport if this 617 peer is responsible for that Resource-ID. The Storage component is 618 notified by the Topology Plugin when the Resource-IDs for which it is 619 responsible change, and the Storage component is then responsible for 620 migrating resources to other peers, as required. 622 1.2.4. Topology Plugin 624 RELOAD is explicitly designed to work with a variety of overlay 625 algorithms. In order to facilitate this, the overlay algorithm 626 implementation is provided by a Topology Plugin so that each overlay 627 can select an appropriate overlay algorithm that relies on the common 628 RELOAD core protocols and code. 630 The Topology Plugin is responsible for maintaining the overlay 631 algorithm Routing Table, which is consulted by the Forwarding and 632 Link Management Layer before routing a message. When connections are 633 made or broken, the Forwarding and Link Management Layer notifies the 634 Topology Plugin, which adjusts the routing table as appropriate. The 635 Topology Plugin will also instruct the Forwarding and Link Management 636 Layer to form new connections as dictated by the requirements of the 637 overlay algorithm Topology. The Topology Plugin issues periodic 638 update requests through Message Transport to maintain and update its 639 Routing Table. 641 As peers enter and leave, resources may be stored on different peers, 642 so the Topology Plugin also keeps track of which peers are 643 responsible for which resources. As peers join and leave, the 644 Topology Plugin instructs the Storage component to issue resource 645 migration requests as appropriate, in order to ensure that other 646 peers have whatever resources they are now responsible for. The 647 Topology Plugin is also responsible for providing for redundant data 648 storage to protect against loss of information in the event of a peer 649 failure and to protect against compromised or subversive peers. 651 1.2.5. Forwarding and Link Management Layer 653 The Forwarding and Link Management Layer is responsible for getting a 654 message to the next peer, as determined by the Topology Plugin. This 655 Layer establishes and maintains the network connections as required 656 by the Topology Plugin. This layer is also responsible for setting 657 up connections to other peers through NATs and firewalls using ICE, 658 and it can elect to forward traffic using relays for NAT and firewall 659 traversal. 661 Congestion control is implemented at this layer to protect the 662 Internet paths used to form the link in the overlay. Additionally, 663 retransmission is performed to improve the reliability of end-to-end 664 transactions. The relationship between this layer and the Message 665 Transport Layer is similar to the relationship between link-level 666 congestion control and retransmission in modern wireless networks is 667 to Internet transport protocols. 669 This layer provides a generic interface that allows the topology 670 plugin to control the overlay and resource operations and messages. 671 Since each overlay algorithm is defined and functions differently, we 672 generically refer to the table of other peers that the overlay 673 algorithm maintains and uses to route requests (neighbors) as a 674 Routing Table. The Topology Plugin actually owns the Routing Table, 675 and forwarding decisions are made by querying the Topology Plugin for 676 the next hop for a particular Node-ID or Resource-ID. If this node 677 is the destination of the message, the message is delivered to the 678 Message Transport. 680 This layer also utilizes a framing header to encapsulate messages as 681 they are forwarding along each hop. This header aids reliability 682 congestion control, flow control, etc. It has meaning only in the 683 context of that individual link. 685 The Forwarding and Link Management Layer sits on top of the Overlay 686 Link Layer protocols that carry the actual traffic. This 687 specification defines how to use DTLS and TLS protocols to carry 688 RELOAD messages. 690 1.3. Security 692 RELOAD's security model is based on each node having one or more 693 public key certificates. In general, these certificates will be 694 assigned by a central server which also assigns Node-IDs, although 695 self-signed certificates can be used in closed networks. These 696 credentials can be leveraged to provide communications security for 697 RELOAD messages. RELOAD provides communications security at three 698 levels: 700 Connection Level: Connections between peers are secured with TLS, 701 DTLS, or potentially some to be defined future protocol. 702 Message Level: Each RELOAD message must be signed. 703 Object Level: Stored objects must be signed by the creating peer. 705 These three levels of security work together to allow peers to verify 706 the origin and correctness of data they receive from other peers, 707 even in the face of malicious activity by other peers in the overlay. 708 RELOAD also provides access control built on top of these 709 communications security features. Because the peer responsible for 710 storing a piece of data can validate the signature on the data being 711 stored, the responsible peer can determine whether a given operation 712 is permitted or not. 714 RELOAD also provides an optional shared secret based admission 715 control feature using shared secrets and TLS-PSK. In order to form a 716 TLS connection to any node in the overlay, a new node needs to know 717 the shared overlay key, thus restricting access to authorized users 718 only. This feature is used together with certificate-based access 719 control, not as a replacement for it. It is typically used when 720 self-signed certificates are being used but would generally not be 721 used when the certificates were all signed by an enrollment server. 723 1.4. Structure of This Document 725 The remainder of this document is structured as follows. 727 o Section 2 provides definitions of terms used in this document. 728 o Section 3 provides an overview of the mechanisms used to establish 729 and maintain the overlay. 730 o Section 4 provides an overview of the mechanism RELOAD provides to 731 support other applications. 732 o Section 5 defines the protocol messages that RELOAD uses to 733 establish and maintain the overlay. 734 o Section 6 defines the protocol messages that are used to store and 735 retrieve data using RELOAD. 736 o Section 7 defines the Certificate Store Usage that is fundamental 737 to RELOAD security. 738 o Section 8 defines the TURN Server Usage needed to locate TURN 739 servers for NAT traversal. 740 o Section 9 defines a specific Topology Plugin using Chord based 741 algorithm. 742 o Section 10 defines the mechanisms that new RELOAD nodes use to 743 join the overlay for the first time. 744 o Section 11 provides an extended example. 746 2. Terminology 748 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 749 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 750 document are to be interpreted as described in RFC 2119 [RFC2119]. 752 Terms used in this document are defined inline when used and are also 753 defined below for reference. 755 DHT: A distributed hash table. A DHT is an abstract hash table 756 service realized by storing the contents of the hash table across 757 a set of peers. 759 Overlay Algorithm: An overlay algorithm defines the rules for 760 determining which peers in an overlay store a particular piece of 761 data and for determining a topology of interconnections amongst 762 peers in order to find a piece of data. 764 Overlay Instance: A specific overlay algorithm and the collection of 765 peers that are collaborating to provide read and write access to 766 it. There can be any number of overlay instances running in an IP 767 network at a time, and each operates in isolation of the others. 769 Peer: A host that is participating in the overlay. Peers are 770 responsible for holding some portion of the data that has been 771 stored in the overlay and also route messages on behalf of other 772 hosts as required by the Overlay Algorithm. 774 Client: A host that is able to store data in and retrieve data from 775 the overlay but which is not participating in routing or data 776 storage for the overlay. 778 Kind: A Kind defines a particular type of data that can be stored in 779 the overlay. Applications define new Kinds to store the data they 780 use. Each Kind is identified with a unique integer called a 781 Kind-ID. 783 Node: We use the term "Node" to refer to a host that may be either a 784 Peer or a Client. Because RELOAD uses the same protocol for both 785 clients and peers, much of the text applies equally to both. 786 Therefore we use "Node" when the text applies to both Clients and 787 Peers and the more specific term (i.e. client or peer) when the 788 text applies only to Clients or only to Peers. 790 Node-ID: A fixed-length value that uniquely identifies a node. 791 Node-IDs of all 0s and all 1s are reserved and are invalid Node- 792 IDs. A value of zero is not used in the wire protocol but can be 793 used to indicate an invalid node in implementations and APIs. The 794 Node-ID of all 1s is used on the wire protocol as a wildcard. 796 Joining Peer: A node that is attempting to become a Peer in a 797 particular Overlay.. 799 Admitting Peer: A Peer in the Overlay which helps the Joining Peer 800 join the Overlay. 802 Bootstrap Node: A network node used by Joining Peers to help locate 803 the Admitting Peer. 805 Peer Admission: The act of admitting a peer (the "Joining Peer" ) 806 into an Overlay. After the admission process is over, the joining 807 peer is a fully-functional peer of the overlay. During the 808 admission process, the joining peer may need to present 809 credentials to prove that it has sufficient authority to join the 810 overlay. 812 Resource: An object or group of objects associated with a string 813 identifier. See "Resource Name" below. 815 Resource Name: The potentially human readable name by which a 816 resource is identified. In unstructured P2P networks, the 817 resource name is sometimes used directly as a Resource-ID. In 818 structured P2P networks the resource name is typically mapped into 819 a Resource-ID by using the string as the input to hash function. 820 Structured and unstructured P2P networks are described in 821 [RFC5694]. A SIP resource, for example, is often identified by 822 its AOR which is an example of a Resource Name. 824 Resource-ID: A value that identifies some resources and which is 825 used as a key for storing and retrieving the resource. Often this 826 is not human friendly/readable. One way to generate a Resource-ID 827 is by applying a mapping function to some other unique name (e.g., 828 user name or service name) for the resource. The Resource-ID is 829 used by the distributed database algorithm to determine the peer 830 or peers that are responsible for storing the data for the 831 overlay. In structured P2P networks, Resource-IDs are generally 832 fixed length and are formed by hashing the resource name. In 833 unstructured networks, resource names may be used directly as 834 Resource-IDs and may be variable lengths. 836 Connection Table: The set of nodes to which a node is directly 837 connected. This includes nodes with which Attach handshakes have 838 been done but which have not sent any Updates. 840 Routing Table: The set of peers which a node can use to route 841 overlay messages. In general, these peers will all be on the 842 connection table but not vice versa, because some peers will have 843 Attached but not sent updates. Peers may send messages directly 844 to peers that are in the connection table but may only route 845 messages to other peers through peers that are in the routing 846 table. 848 Destination List: A list of IDs through which a message is to be 849 routed. A single Node-ID or a Resource-ID is a trivial form of 850 destination list. When multiple Node-IDs are specified (no more 851 than one Resource-ID is permitted, and it MUST be the last entry) 852 a Destination List is a loose source route. 854 Usage: A usage is an application that wishes to use the overlay for 855 some purpose. Each application wishing to use the overlay defines 856 a set of data Kinds that it wishes to use. The SIP usage defines 857 the location data Kind. 859 Transaction ID: A randomly chosen identifier selected by the 860 originator of a request and used to correlate requests and 861 responses. 863 The term "maximum request lifetime" is the maximum time a request 864 will wait for a response; it defaults to 15 seconds. The term 865 "successor replacement hold-down time" is the amount of time to wait 866 before starting replication when a new successor is found; it 867 defaults to 30 seconds. 869 3. Overlay Management Overview 871 The most basic function of RELOAD is as a generic overlay network. 872 Nodes need to be able to join the overlay, form connections to other 873 nodes, and route messages through the overlay to nodes to which they 874 are not directly connected. This section provides an overview of the 875 mechanisms that perform these functions. 877 3.1. Security and Identification 879 Every node in the RELOAD overlay is identified by a Node-ID. The 880 Node-ID is used for three major purposes: 882 o To address the node itself. 883 o To determine its position in the overlay topology when the overlay 884 is structured. 885 o To determine the set of resources for which the node is 886 responsible. 888 Each node has a certificate [RFC5280] containing a Node-ID, which is 889 unique within an overlay instance. 891 The certificate serves multiple purposes: 893 o It entitles the user to store data at specific locations in the 894 Overlay Instance. Each data Kind defines the specific rules for 895 determining which certificates can access each Resource-ID/Kind-ID 896 pair. For instance, some Kinds might allow anyone to write at a 897 given location, whereas others might restrict writes to the owner 898 of a single certificate. 899 o It entitles the user to operate a node that has a Node-ID found in 900 the certificate. When the node forms a connection to another 901 peer, it uses this certificate so that a node connecting to it 902 knows it is connected to the correct node (technically: a (D)TLS 903 association with client authentication is formed.) In addition, 904 the node can sign messages, thus providing integrity and 905 authentication for messages which are sent from the node. 906 o It entitles the user to use the user name found in the 907 certificate. 909 If a user has more than one device, typically they would get one 910 certificate for each device. This allows each device to act as a 911 separate peer. 913 RELOAD supports multiple certificate issuance models. The first is 914 based on a central enrollment process which allocates a unique name 915 and Node-ID and puts them in a certificate for the user. All peers 916 in a particular Overlay Instance have the enrollment server as a 917 trust anchor and so can verify any other peer's certificate. 919 In some settings, a group of users want to set up an overlay network 920 but are not concerned about attack by other users in the network. 921 For instance, users on a LAN might want to set up a short term ad hoc 922 network without going to the trouble of setting up an enrollment 923 server. RELOAD supports the use of self-generated, self-signed 924 certificates. When self-signed certificates are used, the node also 925 generates its own Node-ID and username. The Node-ID is computed as a 926 digest of the public key, to prevent Node-ID theft. Note that the 927 relevant cryptographic property for the digest is preimage 928 resistance. Collision-resistance is not required since an attacker 929 who can create two nodes with the same Node-ID but different public 930 key obtains no advantage. This model is still subject to a number of 931 known attacks (most notably Sybil attacks [Sybil]) and can only be 932 safely used in closed networks where users are mutually trusting. 933 Another drawback of this approach is that user's data is then tied to 934 their keys, so if a key is changed any data stored under their 935 Node-ID must then be re-stored. This is not an issue for centrally- 936 issued Node-IDs provided that the CA re-issues the same Node-ID when 937 a new certificate is generated. 939 The general principle here is that the security mechanisms (TLS and 940 message signatures) are always used, even if the certificates are 941 self-signed. This allows for a single set of code paths in the 942 systems with the only difference being whether certificate 943 verification is required to chain to a single root of trust. 945 3.1.1. Shared-Key Security 947 RELOAD also provides an admission control system based on shared 948 keys. In this model, the peers all share a single key which is used 949 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 951 3.2. Clients 953 RELOAD defines a single protocol that is used both as the peer 954 protocol and as the client protocol for the overlay. This simplifies 955 implementation, particularly for devices that may act in either role, 956 and allows clients to inject messages directly into the overlay. 958 We use the term "peer" to identify a node in the overlay that routes 959 messages for nodes other than those to which it is directly 960 connected. Peers also have storage responsibilities. We use the 961 term "client" to refer to nodes that do not have routing or storage 962 responsibilities. When text applies to both peers and clients, we 963 will simply refer to such devices as "nodes." 965 RELOAD's client support allows nodes that are not participating in 966 the overlay as peers to utilize the same implementation and to 967 benefit from the same security mechanisms as the peers. Clients 968 possess and use certificates that authorize the user to store data at 969 certain locations in the overlay. The Node-ID in the certificate is 970 used to identify the particular client as a member of the overlay and 971 to authenticate its messages. 973 In RELOAD, unlike some other designs, clients are not a first-class 974 concept. From the perspective of a peer, a client is simply a node 975 which has not yet sent any Updates or Joins. It might never do so 976 (if it's a client) or it might eventually do so (if it's just a node 977 that's taking a long time to join). The routing and storage rules 978 for RELOAD provide for correct behavior by peers regardless of 979 whether other nodes attached to them are clients or peers. Of 980 course, a client implementation must know that it intends to be a 981 client, but this localizes complexity only to that node. 983 For more discussion of the motivation for RELOAD's client support, 984 see Appendix B. 986 3.2.1. Client Routing 988 Clients may insert themselves in the overlay in two ways: 990 o Establish a connection to the peer responsible for the client's 991 Node-ID in the overlay. Then requests may be sent from/to the 992 client using its Node-ID in the same manner as if it were a peer, 993 because the responsible peer in the overlay will handle the final 994 step of routing to the client. This may require a TURN relay in 995 cases where NATs or firewalls prevent a client from forming a 996 direct connections with its responsible peer. Note that clients 997 that choose this option need to process Update messages from the 998 peer. Those updates can indicate that the peer no longer is 999 responsible for the Client's Node-ID. The client would then need 1000 to form a connection to the appropriate peer. Failure to do so 1001 will result in the client no longer receiving messages. 1002 o Establish a connection with an arbitrary peer in the overlay 1003 (perhaps based on network proximity or an inability to establish a 1004 direct connection with the responsible peer). In this case, the 1005 client will rely on RELOAD's Destination List feature to ensure 1006 reachability. The client can initiate requests, and any node in 1007 the overlay that knows the Destination List to its current 1008 location can reach it, but the client is not directly reachable 1009 using only its Node-ID. If the client is to receive incoming 1010 requests from other members of the overlay, the Destination List 1011 required to reach it must be learnable via other mechanisms, such 1012 as being stored in the overlay by a usage. A client connected 1013 this way using a certificate with only a single Node-ID MAY 1014 proceed to use the connection without performing an Attach. A 1015 client wishing to connect using this mechanism with a certificate 1016 with multiple Node-IDs can use a Ping to probe the Node-ID of the 1017 node to which it is connected before doing the Attach. 1019 3.2.2. Minimum Functionality Requirements for Clients 1021 A node may act as a client simply because it does not have the 1022 resources or even an implementation of the topology plugin required 1023 to act as a peer in the overlay. In order to exchange RELOAD 1024 messages with a peer, a client must meet a minimum level of 1025 functionality. Such a client must: 1027 o Implement RELOAD's connection-management operations that are used 1028 to establish the connection with the peer. 1029 o Implement RELOAD's data retrieval methods (with client 1030 functionality). 1031 o Be able to calculate Resource-IDs used by the overlay. 1032 o Possess security credentials required by the overlay it is 1033 implementing. 1035 A client speaks the same protocol as the peers, knows how to 1036 calculate Resource-IDs, and signs its requests in the same manner as 1037 peers. While a client does not necessarily require a full 1038 implementation of the overlay algorithm, calculating the Resource-ID 1039 requires an implementation of the appropriate algorithm for the 1040 overlay. 1042 3.3. Routing 1044 This section will discuss the capabilities of RELOAD's routing layer, 1045 the protocol features used to implement them, and a brief overview of 1046 how they are used. Appendix A discusses some alternative designs and 1047 the tradeoffs that would be necessary to support them. 1049 RELOAD's routing provides the following capabilities: 1051 Resource-based routing: RELOAD supports routing messages based 1052 soley on the name of the resource. Such messages are delivered to 1053 a node that is responsible for that resource. Both structured and 1054 unstructured overlays are supported, so the route may not be 1055 deterministic for all Topology Plugins. 1056 Node-based routing: RELOAD supports routing messages to a specific 1057 node in the overlay. 1058 Clients: RELOAD supports requests from and to clients that do not 1059 participate in overlay routing, located via either of the 1060 mechanisms described above. 1061 Bridging overlays: Similar to how a Destination List is used to 1062 reach a client attached via an arbitrary peer, RELOAD can route 1063 messages between two different overlays by building a destination 1064 list that includes a peer (or client) with connectivity to both 1065 networks. 1066 NAT Traversal: RELOAD supports establishing and using connections 1067 between nodes separated by one or more NATs, including locating 1068 peers behind NATs for those overlays allowing/requiring it. 1069 Low state: RELOAD's routing algorithms do not require significant 1070 state (i.e., state linear or greater in the number of outstanding 1071 messages that have passed through it) to be stored on intermediate 1072 peers. 1073 Routability in unstable topologies: Overlay topology changes 1074 constantly in an overlay of moderate size due to the failure of 1075 individual nodes and links in the system. RELOAD's routing allows 1076 peers to re-route messages when a failure is detected, and replies 1077 can be returned to the requesting node as long as the peers that 1078 originally forwarded the successful request do not fail before the 1079 response is returned. 1081 RELOAD's routing utilizes three basic mechanisms: 1083 Destination Lists: While in principle it is possible to just 1084 inject a message into the overlay with a bare Node-ID as the 1085 destination, RELOAD provides a source routing capability in the 1086 form of "Destination Lists". A "Destination List provides a list 1087 of the nodes through which a message must flow. 1088 Via Lists: In order to allow responses to follow the same path as 1089 requests, each message also contains a "Via List", which is added 1090 to by each node a message traverses. This via list can then be 1091 inverted and used as a destination list for the response. 1093 RouteQuery: The RouteQuery method allows a node to query a peer 1094 for the next hop it will use to route a message. This method is 1095 useful for diagnostics and for iterative routing. 1097 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1098 We will first describe symmetric recursive routing and then discuss 1099 its advantages in terms of the requirements discussed above. 1101 Symmetric recursive routing requires that a request message follow a 1102 path through the overlay to the destination: each peer forwards the 1103 message closer to its destination. The return path of the response 1104 is then the same path followed in reverse. For example, a message 1105 following a route from A to Z through B and X: 1107 A B X Z 1108 ------------------------------- 1110 ----------> 1111 Dest=Z 1112 ----------> 1113 Via=A 1114 Dest=Z 1115 ----------> 1116 Via=A,B 1117 Dest=Z 1119 <---------- 1120 Dest=X,B,A 1121 <---------- 1122 Dest=B,A 1123 <---------- 1124 Dest=A 1126 Note that the preceding Figure does not indicate whether A is a 1127 client or peer: A forwards its request to B and the response is 1128 returned to A in the same manner regardless of A's role in the 1129 overlay. 1131 This figure shows use of full via-lists by intermediate peers B and 1132 X. However, if B and/or X are willing to store state, then they may 1133 elect to truncate the lists, save that information internally (keyed 1134 by the transaction id), and return the response message along the 1135 path from which it was received when the response is received. This 1136 option requires greater state to be stored on intermediate peers but 1137 saves a small amount of bandwidth and reduces the need for modifying 1138 the message en route. Selection of this mode of operation is a 1139 choice for the individual peer; the techniques are interoperable even 1140 on a single message. The figure below shows B using full via lists 1141 but X truncating them to X1 and saving the state internally. 1143 A B X Z 1144 ------------------------------- 1146 ----------> 1147 Dest=Z 1148 ----------> 1149 Via=A 1150 Dest=Z 1151 ----------> 1152 Via=X1 1153 Dest=Z 1155 <---------- 1156 Dest=X,X1 1157 <---------- 1158 Dest=B,A 1159 <---------- 1160 Dest=A 1162 RELOAD also supports a basic Iterative routing mode (where the 1163 intermediate peers merely return a response indicating the next hop, 1164 but do not actually forward the message to that next hop themselves). 1165 Iterative routing is implemented using the RouteQuery method, which 1166 requests this behavior. Note that iterative routing is selected only 1167 by the initiating node. 1169 3.4. Connectivity Management 1171 In order to provide efficient routing, a peer needs to maintain a set 1172 of direct connections to other peers in the Overlay Instance. Due to 1173 the presence of NATs, these connections often cannot be formed 1174 directly. Instead, we use the Attach request to establish a 1175 connection. Attach uses ICE [RFC5245] to establish the connection. 1176 It is assumed that the reader is familiar with ICE. 1178 Say that peer A wishes to form a direct connection to peer B. It 1179 gathers ICE candidates and packages them up in an Attach request 1180 which it sends to B through usual overlay routing procedures. B does 1181 its own candidate gathering and sends back a response with its 1182 candidates. A and B then do ICE connectivity checks on the candidate 1183 pairs. The result is a connection between A and B. At this point, A 1184 and B can add each other to their routing tables and send messages 1185 directly between themselves without going through other overlay 1186 peers. 1188 There are two cases where Attach is not used. The first is when a 1189 peer is joining the overlay and is not connected to any peers. In 1190 order to support this case, some small number of "bootstrap nodes" 1191 typically need to be publicly accessible so that new peers can 1192 directly connect to them. Section 10 contains more detail on this. 1193 The second case is when a client node connects to a node at an 1194 arbitrary IP address, rather than to its responsible peer, as 1195 described in the second bullet point of Section 3.2.1. 1197 In general, a peer needs to maintain connections to all of the peers 1198 near it in the Overlay Instance and to enough other peers to have 1199 efficient routing (the details depend on the specific overlay). If a 1200 peer cannot form a connection to some other peer, this isn't 1201 necessarily a disaster; overlays can route correctly even without 1202 fully connected links. However, a peer should try to maintain the 1203 specified link set and if it detects that it has fewer direct 1204 connections, should form more as required. This also implies that 1205 peers need to periodically verify that the connected peers are still 1206 alive and if not try to reform the connection or form an alternate 1207 one. 1209 3.5. Overlay Algorithm Support 1211 The Topology Plugin allows RELOAD to support a variety of overlay 1212 algorithms. This specification defines a DHT based on Chord [Chord], 1213 which is mandatory to implement, but the base RELOAD protocol is 1214 designed to support a variety of overlay algorithms. 1216 3.5.1. Support for Pluggable Overlay Algorithms 1218 RELOAD defines three methods for overlay maintenance: Join, Update, 1219 and Leave. However, the contents of those messages, when they are 1220 sent, and their precise semantics are specified by the actual overlay 1221 algorithm; RELOAD merely provides a framework of commonly-needed 1222 methods that provides uniformity of notation (and ease of debugging) 1223 for a variety of overlay algorithms. 1225 3.5.2. Joining, Leaving, and Maintenance Overview 1227 When a new peer wishes to join the Overlay Instance, it must have a 1228 Node-ID that it is allowed to use and a set of credentials which 1229 match that Node-ID. When an enrollment server is used that Node-ID 1230 will be in the certificate the node received from the enrollment 1231 server. The details of the joining procedure are defined by the 1232 overlay algorithm, but the general steps for joining an Overlay 1233 Instance are: 1235 o Forming connections to some other peers. 1236 o Acquiring the data values this peer is responsible for storing. 1237 o Informing the other peers which were previously responsible for 1238 that data that this peer has taken over responsibility. 1240 The first thing the peer needs to do is to form a connection to some 1241 "bootstrap node". Because this is the first connection the peer 1242 makes, these nodes must have public IP addresses so that they can be 1243 connected to directly. Once a peer has connected to one or more 1244 bootstrap nodes, it can form connections in the usual way by routing 1245 Attach messages through the overlay to other nodes. Once a peer has 1246 connected to the overlay for the first time, it can cache the set of 1247 nodes it has connected to with public IP addresses for use as future 1248 bootstrap nodes. 1250 Once a peer has connected to a bootstrap node, it then needs to take 1251 up its appropriate place in the overlay. This requires two major 1252 operations: 1254 o Forming connections to other peers in the overlay to populate its 1255 Routing Table. 1256 o Getting a copy of the data it is now responsible for storing and 1257 assuming responsibility for that data. 1259 The second operation is performed by contacting the Admitting Peer 1260 (AP), the node which is currently responsible for that section of the 1261 overlay. 1263 The details of this operation depend mostly on the overlay algorithm 1264 involved, but a typical case would be: 1266 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1267 announcing its intention to join. 1268 2. AP sends a Join response. 1269 3. AP does a sequence of Stores to JP to give it the data it will 1270 need. 1271 4. AP does Updates to JP and to other peers to tell it about its own 1272 routing table. At this point, both JP and AP consider JP 1273 responsible for some section of the Overlay Instance. 1274 5. JP makes its own connections to the appropriate peers in the 1275 Overlay Instance. 1277 After this process is completed, JP is a full member of the Overlay 1278 Instance and can process Store/Fetch requests. 1280 Note that the first node is a special case. When ordinary nodes 1281 cannot form connections to the bootstrap nodes, then they are not 1282 part of the overlay. However, the first node in the overlay can 1283 obviously not connect to other nodes. In order to support this case, 1284 potential first nodes (which must also serve as bootstrap nodes 1285 initially) must somehow be instructed (perhaps by configuration 1286 settings) that they are the entire overlay, rather than not part of 1287 it. 1289 Note that clients do not perform either of these operations. 1291 3.6. First-Time Setup 1293 Previous sections addressed how RELOAD works once a node has 1294 connected. This section provides an overview of how users get 1295 connected to the overlay for the first time. RELOAD is designed so 1296 that users can start with the name of the overlay they wish to join 1297 and perhaps a username and password, and leverage that into having a 1298 working peer with minimal user intervention. This helps avoid the 1299 problems that have been experienced with conventional SIP clients 1300 where users are required to manually configure a large number of 1301 settings. 1303 3.6.1. Initial Configuration 1305 In the first phase of the process, the user starts out with the name 1306 of the overlay and uses this to download an initial set of overlay 1307 configuration parameters. The node does a DNS SRV lookup on the 1308 overlay name to get the address of a configuration server. It can 1309 then connect to this server with HTTPS to download a configuration 1310 document which contains the basic overlay configuration parameters as 1311 well as a set of bootstrap nodes which can be used to join the 1312 overlay. 1314 If a node already has the valid configuration document that it 1315 received by some out of band method, this step can be skipped. 1317 3.6.2. Enrollment 1319 If the overlay is using centralized enrollment, then a user needs to 1320 acquire a certificate before joining the overlay. The certificate 1321 attests both to the user's name within the overlay and to the Node- 1322 IDs which they are permitted to operate. In that case, the 1323 configuration document will contain the address of an enrollment 1324 server which can be used to obtain such a certificate. The 1325 enrollment server may (and probably will) require some sort of 1326 username and password before issuing the certificate. The enrollment 1327 server's ability to restrict attackers' access to certificates in the 1328 overlay is one of the cornerstones of RELOAD's security. 1330 4. Application Support Overview 1332 RELOAD is not intended to be used alone, but rather as a substrate 1333 for other applications. These applications can use RELOAD for a 1334 variety of purposes: 1336 o To store data in the overlay and retrieve data stored by other 1337 nodes. 1338 o As a discovery mechanism for services such as TURN. 1339 o To form direct connections which can be used to transmit 1340 application-level messages without using the overlay. 1342 This section provides an overview of these services. 1344 4.1. Data Storage 1346 RELOAD provides operations to Store and Fetch data. Each location in 1347 the Overlay Instance is referenced by a Resource-ID. However, each 1348 location may contain data elements corresponding to multiple Kinds 1349 (e.g., certificate, SIP registration). Similarly, there may be 1350 multiple elements of a given Kind, as shown below: 1352 +--------------------------------+ 1353 | Resource-ID | 1354 | | 1355 | +------------+ +------------+ | 1356 | | Kind 1 | | Kind 2 | | 1357 | | | | | | 1358 | | +--------+ | | +--------+ | | 1359 | | | Value | | | | Value | | | 1360 | | +--------+ | | +--------+ | | 1361 | | | | | | 1362 | | +--------+ | | +--------+ | | 1363 | | | Value | | | | Value | | | 1364 | | +--------+ | | +--------+ | | 1365 | | | +------------+ | 1366 | | +--------+ | | 1367 | | | Value | | | 1368 | | +--------+ | | 1369 | +------------+ | 1370 +--------------------------------+ 1372 Each Kind is identified by a Kind-ID, which is a code point either 1373 assigned by IANA or allocated out of a private range. As part of the 1374 Kind definition, protocol designers may define constraints, such as 1375 limits on size, on the values which may be stored. For many Kinds, 1376 the set may be restricted to a single value; some sets may be allowed 1377 to contain multiple identical items while others may only have unique 1378 items. Note that a Kind may be employed by multiple usages and new 1379 usages are encouraged to use previously defined Kinds where possible. 1380 We define the following data models in this document, though other 1381 usages can define their own structures: 1383 single value: There can be at most one item in the set and any value 1384 overwrites the previous item. 1386 array: Many values can be stored and addressed by a numeric index. 1388 dictionary: The values stored are indexed by a key. Often this key 1389 is one of the values from the certificate of the peer sending the 1390 Store request. 1392 In order to protect stored data from tampering, by other nodes, each 1393 stored value is digitally signed by the node which created it. When 1394 a value is retrieved, the digital signature can be verified to detect 1395 tampering. 1397 4.1.1. Storage Permissions 1399 A major issue in peer-to-peer storage networks is minimizing the 1400 burden of becoming a peer, and in particular minimizing the amount of 1401 data which any peer is required to store for other nodes. RELOAD 1402 addresses this issue by only allowing any given node to store data at 1403 a small number of locations in the overlay, with those locations 1404 being determined by the node's certificate. When a peer uses a Store 1405 request to place data at a location authorized by its certificate, it 1406 signs that data with the private key that corresponds to its 1407 certificate. Then the peer responsible for storing the data is able 1408 to verify that the peer issuing the request is authorized to make 1409 that request. Each data Kind defines the exact rules for determining 1410 what certificate is appropriate. 1412 The most natural rule is that a certificate authorizes a user to 1413 store data keyed with their user name X. This rule is used for all 1414 the Kinds defined in this specification. Thus, only a user with a 1415 certificate for "alice@example.org" could write to that location in 1416 the overlay. However, other usages can define any rules they choose, 1417 including publicly writable values. 1419 The digital signature over the data serves two purposes. First, it 1420 allows the peer responsible for storing the data to verify that this 1421 Store is authorized. Second, it provides integrity for the data. 1422 The signature is saved along with the data value (or values) so that 1423 any reader can verify the integrity of the data. Of course, the 1424 responsible peer can "lose" the value but it cannot undetectably 1425 modify it. 1427 The size requirements of the data being stored in the overlay are 1428 variable. For instance, a SIP AOR and voicemail differ widely in the 1429 storage size. RELOAD leaves it to the Usage and overlay 1430 configuration to limit size imbalance of various Kinds. 1432 4.1.2. Replication 1434 Replication in P2P overlays can be used to provide: 1436 persistence: if the responsible peer crashes and/or if the storing 1437 peer leaves the overlay 1438 security: to guard against DoS attacks by the responsible peer or 1439 routing attacks to that responsible peer 1440 load balancing: to balance the load of queries for popular 1441 resources. 1443 A variety of schemes are used in P2P overlays to achieve some of 1444 these goals. Common techniques include replicating on neighbors of 1445 the responsible peer, randomly locating replicas around the overlay, 1446 or replicating along the path to the responsible peer. 1448 The core RELOAD specification does not specify a particular 1449 replication strategy. Instead, the first level of replication 1450 strategies are determined by the overlay algorithm, which can base 1451 the replication strategy on its particular topology. For example, 1452 Chord places replicas on successor peers, which will take over 1453 responsibility should the responsible peer fail [Chord]. 1455 If additional replication is needed, for example if data persistence 1456 is particularly important for a particular usage, then that usage may 1457 specify additional replication, such as implementing random 1458 replications by inserting a different well known constant into the 1459 Resource Name used to store each replicated copy of the resource. 1460 Such replication strategies can be added independent of the 1461 underlying algorithm, and their usage can be determined based on the 1462 needs of the particular usage. 1464 4.2. Usages 1466 By itself, the distributed storage layer just provides infrastructure 1467 on which applications are built. In order to do anything useful, a 1468 usage must be defined. Each Usage needs to specify several things: 1470 o Registers Kind-ID code points for any Kinds that the Usage 1471 defines. 1473 o Defines the data structure for each of the Kinds. 1474 o Defines access control rules for each of the Kinds. 1475 o Defines how the Resource Name is formed that is hashed to form the 1476 Resource-ID where each Kind is stored. 1477 o Describes how values will be merged after a network partition. 1478 Unless otherwise specified, the default merging rule is to act as 1479 if all the values that need to be merged were stored and as if the 1480 order they were stored in corresponds to the stored time values 1481 associated with (and carried in) their values. Because the stored 1482 time values are those associated with the peer which did the 1483 writing, clock skew is generally not an issue. If two nodes are 1484 on different partitions, write to the same location, and have 1485 clock skew, this can create merge conflicts. However because 1486 RELOAD deliberately segregates storage so that data from different 1487 users and peers is stored in different locations, and a single 1488 peer will typically only be in a single network partition, this 1489 case will generally not arise. 1491 The Kinds defined by a usage may also be applied to other usages. 1492 However, a need for different parameters, such as different size 1493 limits, would imply the need to create a new Kind. 1495 4.3. Service Discovery 1497 RELOAD does not currently define a generic service discovery 1498 algorithm as part of the base protocol, although a simplistic TURN- 1499 specific discovery mechanism is provided. A variety of service 1500 discovery algorithms can be implemented as extensions to the base 1501 protocol, such as the service discovery algorithm ReDIR 1502 [opendht-sigcomm05] or [I-D.ietf-p2psip-service-discovery]. 1504 4.4. Application Connectivity 1506 There is no requirement that a RELOAD usage must use RELOAD's 1507 primitives for establishing its own communication if it already 1508 possesses its own means of establishing connections. For example, 1509 one could design a RELOAD-based resource discovery protocol which 1510 used HTTP to retrieve the actual data. 1512 For more common situations, however, it is the overlay itself - 1513 rather than an external authority such as DNS - which is used to 1514 establish a connection. RELOAD provides connectivity to applications 1515 using the AppAttach method. For example, if a P2PSIP node wishes to 1516 establish a SIP dialog with another P2PSIP node, it will use 1517 AppAttach to establish a direct connection with the other node. This 1518 new connection is separate from the peer protocol connection. It is 1519 a dedicated UDP or TCP flow used only for the SIP dialog. 1521 5. Overlay Management Protocol 1523 This section defines the basic protocols used to create, maintain, 1524 and use the RELOAD overlay network. We start by defining the basic 1525 concept of how message destinations are interpreted when routing 1526 messages. We then describe the symmetric recursive routing model, 1527 which is RELOAD's default routing algorithm. We then define the 1528 message structure and then finally define the messages used to join 1529 and maintain the overlay. 1531 5.1. Message Receipt and Forwarding 1533 When a peer receives a message, it first examines the overlay, 1534 version, and other header fields to determine whether the message is 1535 one it can process. If any of these are incorrect (e.g., the message 1536 is for an overlay in which the peer does not participate) it is an 1537 error. The peer SHOULD generate an appropriate error but local 1538 policy can override this and cause the messages to be silently 1539 dropped. 1541 Once the peer has determined that the message is correctly formatted 1542 (note that this does not include signature checking on intermediate 1543 nodes as the message may be fragmented) it examines the first entry 1544 on the destination list. There are three possible cases here: 1546 o The first entry on the destination list is an ID for which the 1547 peer is responsible. A peer is always responsible for the 1548 wildcard Node-ID. Handling of this case is described in 1549 Section 5.1.1. 1550 o The first entry on the destination list is an ID for which another 1551 peer is responsible. Handling of this case is described in 1552 Section 5.1.2. 1553 o The first entry on the destination list is a private ID that is 1554 being used for destination list compression. Handling of this 1555 case is described in Section 5.1.3. Note that private IDs can be 1556 distinguished from Node-IDs and Resource-IDs on the wire as 1557 described in Section 5.3.2.2). 1559 These cases are handled as discussed below. 1561 5.1.1. Responsible ID 1563 If the first entry on the destination list is an ID for which the 1564 peer is responsible, there are several (mutually exclusive) sub-cases 1565 to consider. 1567 o If the entry is a Resource-ID, then it MUST be the only entry on 1568 the destination list. If there are other entries, the message 1569 MUST be silently dropped. Otherwise, the message is destined for 1570 this node and it verify the signature and pass it up to the upper 1571 layers. 1572 o If the entry is a Node-ID which equals this node's Node-ID, then 1573 the message is destined for this node. If this is the only entry 1574 on the destination list, the message is destined for this node and 1575 is passed up to the upper layers. Otherwise the entry is removed 1576 from the destination list and the message is passed to the Message 1577 Transport. If the message is a response and there is state for 1578 the transaction ID, the state is reinserted into the destination 1579 list before the message is further processed. 1580 o If the entry is the wildcard Node-ID, the message is destined for 1581 this node and it passes it up to the upper layers. 1582 o If the entry is a Node-ID which is not equal to this node, then 1583 the node MUST drop the message silently unless the Node-ID 1584 corresponds to a node which is directly connected to this node 1585 (i.e., a client). In the later case, it MUST forward the message 1586 to the destination node as described in the next section. 1588 Note that this implies that in order to address a message to "the 1589 peer that controls region X", a sender sends to Resource-ID X, not 1590 Node-ID X. 1592 5.1.2. Other ID 1594 If neither of the other three cases applies, then the peer MUST 1595 forward the message towards the first entry on the destination list. 1596 This means that it MUST select one of the peers to which it is 1597 connected and which is likely to be responsible for the first entry 1598 on the destination list. If the first entry on the destination list 1599 is in the peer's connection table, then it SHOULD forward the message 1600 to that peer directly. Otherwise, the peer consults the routing 1601 table to forward the message. 1603 Any intermediate peer which forwards a RELOAD request MUST ensure 1604 that if it receives a response to that message the response can be 1605 routed back through the set of nodes through which the request 1606 passed. This can be ensured in one of two ways: 1608 o The peer MAY add an entry to the via list in the forwarding header 1609 that will enable it to determine the correct node. 1610 o The peer MAY keep per-transaction state which will allow it to 1611 determine the correct node. 1613 As an example of the first strategy, consider an example with nodes 1614 A, B, C, D and E. If node D receives a message from node C with via 1615 list (A, B), then D would forward to the next node (E) with via list 1616 (A, B, C). Now, if E wants to respond to the message, it reverses 1617 the via list to produce the destination list, resulting in (D, C, B, 1618 A). When D forwards the response to C, the destination list will 1619 contain (C, B, A). 1621 As an example of the second strategy, if node D receives a message 1622 from node C with transaction ID X and via list (A, B), it could store 1623 (X, C) in its state database and forward the message with the via 1624 list unchanged. When D receives the response, it consults its state 1625 database for transaction id X, determines that the request came from 1626 C, and forwards the response to C. 1628 Intermediate peers which modify the via list are not required to 1629 simply add entries. The only requirement is that the peer be able to 1630 reconstruct the correct destination list on the return route. RELOAD 1631 provides explicit support for this functionality in the form of 1632 private IDs, which can replace any number of via list entries. For 1633 instance, in the above example, Node D might send E a via list 1634 containing only the private ID (I). E would then use the destination 1635 list (D, I) to send its return message. When D processes this 1636 destination list, it would detect that I is a private ID, recover the 1637 via list (A, B, C), and reverse that to produce the correct 1638 destination list (C, B, A) before sending it to C. This feature is 1639 called List Compression. It MAY either be a compressed version of 1640 the original via list or an index into a state database containing 1641 the original via list. 1643 No matter what mechanism for storing via list state is used, if an 1644 intermediate peer exits the overlay, then on the return trip the 1645 message cannot be forwarded and will be dropped. The ordinary 1646 timeout and retransmission mechanisms provide stability over this 1647 type of failure. 1649 Note that if an intermediate peer retains per-transaction state 1650 instead of modifying the via list, it needs some mechanism for timing 1651 out that state, otherwise its state database will grow without bound. 1652 Whatever algorithm is used, unless a FORWARD_CRITICAL forwarding 1653 option or overlay configuration option explicitly indicates this 1654 state is not needed, the state MUST be maintained for at least the 1655 value of the overlay-reliability-timer configuration parameter and 1656 MAY be kept longer. Future extension, such as 1657 [I-D.jiang-p2psip-relay], may define mechanisms for determining when 1658 this state does not need to be retained. 1660 None of the above mechanisms are required for responses, since there 1661 is no need to ensure that subsequent requests follow the same path. 1663 To be precise on the responsibility of the intermediate node, suppose 1664 that an intermediate node, A, receives a message from node B with via 1665 list X-Y-Z. Node A MUST implement an algorithm that ensures that A 1666 returns a response to this request to node B with the destination 1667 list B-Z-Y-X, provided that the node to which A forwards the request 1668 follows the same contract. Node A normally learns the Node-ID B is 1669 using via an Attach, but a node using a certificate with a single 1670 Node-ID MAY elect to not send an Attach (see Section 3.2.1 bullet 2). 1671 If a node with a certificate with multiple Node-IDs attempts to route 1672 a message other than a Ping or Attach through a node without 1673 performing an Attach, the receiving node MUST reject the request with 1674 an Error_Forbidden error. The node MUST implement support for 1675 returning responses to a Ping or Attach request made by a joining 1676 node Attaching to its responsible peer. 1678 5.1.3. Private ID 1680 If the first entry in the destination list is a private id (e.g., a 1681 compressed via list), the peer MUST replace that entry with the 1682 original via list that it replaced and then re-examine the 1683 destination list to determine which of the three cases in Section 5.1 1684 now applies. 1686 5.2. Symmetric Recursive Routing 1688 This Section defines RELOAD's symmetric recursive routing algorithm, 1689 which is the default algorithm used by nodes to route messages 1690 through the overlay. All implementations MUST implement this routing 1691 algorithm. An overlay may be configured to use alternative routing 1692 algorithms, and alternative routing algorithms may be selected on a 1693 per-message basis. 1695 5.2.1. Request Origination 1697 In order to originate a message to a given Node-ID or Resource-ID, a 1698 node constructs an appropriate destination list. The simplest such 1699 destination list is a single entry containing the Node-ID or 1700 Resource-ID. The resulting message will use the normal overlay 1701 routing mechanisms to forward the message to that destination. The 1702 node can also construct a more complicated destination list for 1703 source routing. 1705 Once the message is constructed, the node sends the message to some 1706 adjacent peer. If the first entry on the destination list is 1707 directly connected, then the message MUST be routed down that 1708 connection. Otherwise, the topology plugin MUST be consulted to 1709 determine the appropriate next hop. 1711 Parallel searches for the resource are a common solution to improve 1712 reliability in the face of churn or of subversive peers. Parallel 1713 searches for usage-specified replicas are managed by the usage layer. 1714 However, a single request can also be routed through multiple 1715 adjacent peers, even when known to be sub-optimal, to improve 1716 reliability [vulnerabilities-acsac04]. Such parallel searches MAY be 1717 specified by the topology plugin. 1719 Because messages may be lost in transit through the overlay, RELOAD 1720 incorporates an end-to-end reliability mechanism. When an 1721 originating node transmits a request it MUST set a timer to the 1722 current overlay-reliability-timer. If a response has not been 1723 received when the timer fires, the request is retransmitted with the 1724 same transaction identifier. The request MAY be retransmitted up to 1725 4 times (for a total of 5 messages). After the timer for the fifth 1726 transmission fires, the message SHALL be considered to have failed. 1727 Note that this retransmission procedure is not followed by 1728 intermediate nodes. They follow the hop-by-hop reliability procedure 1729 described in Section 5.6.3. 1731 The above algorithm can result in multiple requests being delivered 1732 to a node. Receiving nodes MUST generate semantically equivalent 1733 responses to retransmissions of the same request (this can be 1734 determined by transaction id) if the request is received within the 1735 maximum request lifetime (15 seconds). For some requests (e.g., 1736 Fetch) this can be accomplished merely by processing the request 1737 again. For other requests, (e.g., Store) it may be necessary to 1738 maintain state for the duration of the request lifetime. 1740 5.2.2. Response Origination 1742 When a peer sends a response to a request using this routing 1743 algorithm, it MUST construct the destination list by reversing the 1744 order of the entries on the via list. This has the result that the 1745 response traverses the same peers as the request traversed, except in 1746 reverse order (symmetric routing). 1748 5.3. Message Structure 1750 RELOAD is a message-oriented request/response protocol. The messages 1751 are encoded using binary fields. All integers are represented in 1752 network byte order. The general philosophy behind the design was to 1753 use Type, Length, Value fields to allow for extensibility. However, 1754 for the parts of a structure that were required in all messages, we 1755 just define these in a fixed position, as adding a type and length 1756 for them is unnecessary and would simply increase bandwidth and 1757 introduces new potential for interoperability issues. 1759 Each message has three parts, concatenated as shown below: 1761 +-------------------------+ 1762 | Forwarding Header | 1763 +-------------------------+ 1764 | Message Contents | 1765 +-------------------------+ 1766 | Security Block | 1767 +-------------------------+ 1769 The contents of these parts are as follows: 1771 Forwarding Header: Each message has a generic header which is used 1772 to forward the message between peers and to its final destination. 1773 This header is the only information that an intermediate peer 1774 (i.e., one that is not the target of a message) needs to examine. 1776 Message Contents: The message being delivered between the peers. 1777 From the perspective of the forwarding layer, the contents are 1778 opaque, however, they are interpreted by the higher layers. 1780 Security Block: A security block containing certificates and a 1781 digital signature over the "Message Contents" section. Note that 1782 this signature can be computed without parsing the message 1783 contents. All messages MUST be signed by their originator. 1785 The following sections describe the format of each part of the 1786 message. 1788 5.3.1. Presentation Language 1790 The structures defined in this document are defined using a C-like 1791 syntax based on the presentation language used to define 1792 TLS[RFC5246]. Advantages of this style include: 1794 o It familiar enough looking that most readers can grasp it quickly. 1795 o The ability to define nested structures allows a separation 1796 between high-level and low-level message structures. 1797 o It has a straightforward wire encoding that allows quick 1798 implementation, but the structures can be comprehended without 1799 knowing the encoding. 1800 o The ability to mechanically compile encoders and decoders. 1802 Several idiosyncrasies of this language are worth noting. 1804 o All lengths are denoted in bytes, not objects. 1805 o Variable length values are denoted like arrays with angle 1806 brackets. 1807 o "select" is used to indicate variant structures. 1809 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1810 which corresponds to up to 127 values of two bytes (16 bits) each. 1812 5.3.1.1. Common Definitions 1814 The following definitions are used throughout RELOAD and so are 1815 defined here. They also provide a convenient introduction to how to 1816 read the presentation language. 1818 An enum represents an enumerated type. The values associated with 1819 each possibility are represented in parentheses and the maximum value 1820 is represented as a nameless value, for purposes of describing the 1821 width of the containing integral type. For instance, Boolean 1822 represents a true or false: 1824 enum { false (0), true(1), (255)} Boolean; 1826 A boolean value is either a 1 or a 0. The max value of 255 indicates 1827 this is represented as a single byte on the wire. 1829 The NodeId, shown below, represents a single Node-ID. 1831 typedef opaque NodeId[NodeIdLength]; 1833 A NodeId is a fixed-length structure represented as a series of 1834 bytes, with the most significant byte first. The length is set on a 1835 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1836 (See Section 10.1 for how NodeIdLength is set.) Note: the use of 1837 "typedef" here is an extension to the TLS language, but its meaning 1838 should be relatively obvious. Note the [ size ] syntax defines a 1839 fixed length element that does not include the length of the element 1840 in the on the wire encoding. 1842 A ResourceId, shown below, represents a single Resource-ID. 1844 typedef opaque ResourceId<0..2^8-1>; 1846 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1847 NodeIds, ResourceIds are variable length, up to 254 bytes (2040 bits) 1848 in length. On the wire, each ResourceId is preceded by a single 1849 length byte (allowing lengths up to 255). Thus, the 3-byte value 1850 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1851 defines a variable length element that does include the length of the 1852 element in the on the wire encoding. The number of bytes to encode 1853 the length on the wire is derived by range; i.e., it is the minimum 1854 number of bytes which can encode the largest range value. 1856 A more complicated example is IpAddressPort, which represents a 1857 network address and can be used to carry either an IPv6 or IPv4 1858 address: 1860 enum {reservedAddr(0), ipv4_address (1), ipv6_address (2), 1861 (255)} AddressType; 1863 struct { 1864 uint32 addr; 1865 uint16 port; 1866 } IPv4AddrPort; 1868 struct { 1869 uint128 addr; 1870 uint16 port; 1871 } IPv6AddrPort; 1873 struct { 1874 AddressType type; 1875 uint8 length; 1877 select (type) { 1878 case ipv4_address: 1879 IPv4AddrPort v4addr_port; 1881 case ipv6_address: 1882 IPv6AddrPort v6addr_port; 1884 /* This structure can be extended */ 1885 }; 1886 } IpAddressPort; 1888 The first two fields in the structure are the same no matter what 1889 kind of address is being represented: 1891 type: the type of address (v4 or v6). 1892 length: the length of the rest of the structure. 1894 By having the type and the length appear at the beginning of the 1895 structure regardless of the kind of address being represented, an 1896 implementation which does not understand new address type X can still 1897 parse the IpAddressPort field and then discard it if it is not 1898 needed. 1900 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1901 an IPv6AddrPort. Both of these simply consist of an address 1902 represented as an integer and a 16-bit port. As an example, here is 1903 the wire representation of the IPv4 address "192.0.2.1" with port 1904 "6100". 1906 01 ; type = IPv4 1907 06 ; length = 6 1908 c0 00 02 01 ; address = 192.0.2.1 1909 17 d4 ; port = 6100 1911 Unless a given structure that uses a select explicitly allows for 1912 unknown types in the select, any unknown type SHOULD be treated as an 1913 parsing error and the whole message discarded with no response. 1915 5.3.2. Forwarding Header 1917 The forwarding header is defined as a ForwardingHeader structure, as 1918 shown below. 1920 struct { 1921 uint32 relo_token; 1922 uint32 overlay; 1923 uint16 configuration_sequence; 1924 uint8 version; 1925 uint8 ttl; 1926 uint32 fragment; 1927 uint32 length; 1928 uint64 transaction_id; 1929 uint32 max_response_length; 1930 uint16 via_list_length; 1931 uint16 destination_list_length; 1932 uint16 options_length; 1933 Destination via_list[via_list_length]; 1934 Destination destination_list 1935 [destination_list_length]; 1936 ForwardingOptions options[options_length]; 1937 } ForwardingHeader; 1939 The contents of the structure are: 1941 relo_token: The first four bytes identify this message as a RELOAD 1942 message. This field MUST contain the value 0xd2454c4f (the string 1943 'RELO' with the high bit of the first byte set). 1945 overlay: The 32 bit checksum/hash of the overlay being used. The 1946 variable length string representing the overlay name is hashed 1947 with SHA-1 [RFC3174] and the low order 32 bits are used. The 1948 purpose of this field is to allow nodes to participate in multiple 1949 overlays and to detect accidental misconfiguration. This is not a 1950 security critical function. 1952 configuration_sequence: The sequence number of the configuration 1953 file. 1955 version: The version of the RELOAD protocol being used. This is a 1956 fixed point integer between 0.1 and 25.4. This document describes 1957 version 0.1, with a value of 0x01. [[ Note to RFC Editor: Please 1958 update this to version 1.0 with value of 0x0a and remove this 1959 note. ]] 1961 ttl: An 8 bit field indicating the number of iterations, or hops, a 1962 message can experience before it is discarded. The TTL value MUST 1963 be decremented by one at every hop along the route the message 1964 traverses. If the TTL is 0, the message MUST NOT be propagated 1965 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1966 should be generated. The initial value of the TTL SHOULD be 100 1967 unless defined otherwise by the overlay configuration. 1969 fragment: This field is used to handle fragmentation. The high 1970 order two bits are used to indicate the fragmentation status: If 1971 the high bit (0x80000000) is set, it indicates that the message is 1972 a fragment. If the next bit (0x40000000) is set, it indicates 1973 that this is the last fragment. The next six bits (0x20000000 to 1974 0x01000000) are reserved and SHOULD be set to zero. The remainder 1975 of the field is used to indicate the fragment offset; see 1976 Section 5.7 1978 length: The count in bytes of the size of the message, including the 1979 header. 1981 transaction_id: A unique 64 bit number that identifies this 1982 transaction and also allows receivers to disambiguate transactions 1983 which are otherwise identical. In order to provide a high 1984 probability that transaction IDs are unique, they MUST be randomly 1985 generated. Responses use the same Transaction ID as the request 1986 they correspond to. Transaction IDs are also used for fragment 1987 reassembly. 1989 max_response_length: The maximum size in bytes of a response. Used 1990 by requesting nodes to avoid receiving (unexpected) very large 1991 responses. If this value is non-zero, responding peers MUST check 1992 that any response would not exceed it and if so generate an 1993 Error_Response_Too_Large value. This value SHOULD be set to zero 1994 for responses. 1996 via_list_length: The length of the via list in bytes. Note that in 1997 this field and the following two length fields we depart from the 1998 usual variable-length convention of having the length immediately 1999 precede the value in order to make it easier for hardware decoding 2000 engines to quickly determine the length of the header. 2002 destination_list_length: The length of the destination list in 2003 bytes. 2005 options_length: The length of the header options in bytes. 2007 via_list: The via_list contains the sequence of destinations through 2008 which the message has passed. The via_list starts out empty and 2009 grows as the message traverses each peer. 2011 destination_list: The destination_list contains a sequence of 2012 destinations which the message should pass through. The 2013 destination list is constructed by the message originator. The 2014 first element in the destination list is where the message goes 2015 next. The list shrinks as the message traverses each listed peer. 2017 options: Contains a series of ForwardingOptions entries. See 2018 Section 5.3.2.3. 2020 5.3.2.1. Processing Configuration Sequence Numbers 2022 In order to be part of the overlay, a node MUST have a copy of the 2023 overlay configuration document. In order to allow for configuration 2024 document changes, each version of the configuration document has a 2025 sequence number which is monotonically increasing mod 65536. Because 2026 the sequence number may in principle wrap, greater than or less than 2027 are interpreted by modulo arithmetic as in TCP. 2029 When a destination node receives a request, it MUST check that the 2030 configuration_sequence field is equal to its own configuration 2031 sequence number. If they do not match, it MUST generate an error, 2032 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 2033 the configuration file in the request is too old, it MUST generate a 2034 ConfigUpdate message to update the requesting node. This allows new 2035 configuration documents to propagate quickly throughout the system. 2036 The one exception to this rule is that if the configuration_sequence 2037 field is equal to 0xffff, and the message type is ConfigUpdate, then 2038 the message MUST be accepted regardless of the receiving node's 2039 configuration sequence number. Since 65535 is a special value, peers 2040 sending a new configuration when the configuration sequence is 2041 currently 65534 MUST set the configuration sequence number to 0 when 2042 they send out a new configuration. 2044 5.3.2.2. Destination and Via Lists 2046 The destination list and via lists are sequences of Destination 2047 values: 2049 enum {reserved(0), node(1), resource(2), compressed(3), 2050 /* 128-255 not allowed */ (255) } 2051 DestinationType; 2053 select (destination_type) { 2054 case node: 2055 NodeId node_id; 2057 case resource: 2058 ResourceId resource_id; 2060 case compressed: 2061 opaque compressed_id<0..2^8-1>; 2063 /* This structure may be extended with new types */ 2064 } DestinationData; 2066 struct { 2067 DestinationType type; 2068 uint8 length; 2069 DestinationData destination_data; 2070 } Destination; 2072 struct { 2073 uint16 compressed_id; /* top bit MUST be 1 */ 2074 } Destination; 2076 If a destination structure has its first bit set to 1, then it is a 2077 16 bit integer. If the first bit is not set, then it is a structure 2078 starting with DestinationType. If it is a 16 bit integer, it is 2079 treated as if it were a full structure with a DestinationType of 2080 compressed and a compressed_id that was 2 bytes long with the value 2081 of the 16 bit integer. When the destination structure is not a 16 2082 bit integer, it is the TLV structure with the following contents: 2084 type 2085 The type of the DestinationData Payload Data Unit (PDU). This may 2086 be one of "node", "resource", or "compressed". 2088 length 2089 The length of the destination_data. 2091 destination_data 2092 The destination value itself, which is an encoded DestinationData 2093 structure, depending on the value of "type". 2095 Note: This structure encodes a type, length, value. The length 2096 field specifies the length of the DestinationData values, which 2097 allows the addition of new DestinationTypes. This allows an 2098 implementation which does not understand a given DestinationType 2099 to skip over it. 2101 A DestinationData can be one of three types: 2103 node 2104 A Node-ID. 2106 compressed 2107 A compressed list of Node-IDs and/or resources. Because this 2108 value was compressed by one of the peers, it is only meaningful to 2109 that peer and cannot be decoded by other peers. Thus, it is 2110 represented as an opaque string. 2112 resource 2113 The Resource-ID of the resource which is desired. This type MUST 2114 only appear in the final location of a destination list and MUST 2115 NOT appear in a via list. It is meaningless to try to route 2116 through a resource. 2118 One possible encoding of the 16 bit integer version as an opaque 2119 identifier is to encode an index into a connection table. To avoid 2120 misrouting responses in the event a response is delayed and the 2121 connection table entry has changed, the identifier SHOULD be split 2122 between an index and a generation counter for that index. At 2123 startup, the generation counters should be initialized to random 2124 values. An implementation could use 12 bits for the connection table 2125 index and 3 bits for the generation counter. (Note that this does 2126 not suggest a 4096 entry connection table for every node, only the 2127 ability to encode for a larger connection table.) When a connection 2128 table slot is used for a new connection, the generation counter is 2129 incremented (with wrapping). Connection table slots are used on a 2130 rotating basis to maximize the time interval between uses of the same 2131 slot for different connections. When routing a message to an entry 2132 in the destination list encoding a connection table entry, the node 2133 confirms that the generation counter matches the current generation 2134 counter of that index before forwarding the message. If it does not 2135 match, the message is silently dropped. 2137 5.3.2.3. Forwarding Options 2139 The Forwarding header can be extended with forwarding header options, 2140 which are a series of ForwardingOptions structures: 2142 enum { reservedForwarding(0), (255) } 2143 ForwardingOptionsType; 2145 struct { 2146 ForwardingOptionsType type; 2147 uint8 flags; 2148 uint16 length; 2149 select (type) { 2150 /* This type may be extended */ 2151 } option; 2152 } ForwardingOption; 2154 Each ForwardingOption consists of the following values: 2156 type 2157 The type of the option. This structure allows for unknown options 2158 types. 2160 length 2161 The length of the rest of the structure. 2163 flags 2164 Three flags are defined FORWARD_CRITICAL(0x01), 2165 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2166 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2167 set, any node that would forward the message but does not 2168 understand this options MUST reject the request with an 2169 Error_Unsupported_Forwarding_Option error response. If the 2170 DESTINATION_CRITICAL flag is set, any node that generates a 2171 response to the message but does not understand the forwarding 2172 option MUST reject the request with an 2173 Error_Unsupported_Forwarding_Option error response. If the 2174 RESPONSE_COPY flag is set, any node generating a response MUST 2175 copy the option from the request to the response except that the 2176 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags 2177 must be cleared. 2179 option 2180 The option value. 2182 5.3.3. Message Contents Format 2184 The second major part of a RELOAD message is the contents part, which 2185 is defined by MessageContents: 2187 enum { reservedMessagesExtension(0), (2^16-1) } MessageExtensionType; 2189 struct { 2190 MessageExtensionType type; 2191 Boolean critical; 2192 opaque extension_contents<0..2^32-1>; 2193 } MessageExtension; 2195 struct { 2196 uint16 message_code; 2197 opaque message_body<0..2^32-1>; 2198 MessageExtensions extensions<0..2^32-1>; 2199 } MessageContents; 2201 The contents of this structure are as follows: 2203 message_code 2204 This indicates the message that is being sent. The code space is 2205 broken up as follows. 2207 0 Reserved 2209 1 .. 0x7fff Requests and responses. These code points are always 2210 paired, with requests being odd and the corresponding response 2211 being the request code plus 1. Thus, "probe_request" (the 2212 Probe request) has value 1 and "probe_answer" (the Probe 2213 response) has value 2 2215 0xffff Error 2216 The message codes are defined in Section 13.8 2217 message_body 2218 The message body itself, represented as a variable-length string 2219 of bytes. The bytes themselves are dependent on the code value. 2220 See the sections describing the various RELOAD methods (Join, 2221 Update, Attach, Store, Fetch, etc.) for the definitions of the 2222 payload contents. 2223 extensions 2224 Extensions to the message. Currently no extensions are defined, 2225 but new extensions can be defined by the process described in 2226 Section 13.14. 2228 All extensions have the following form: 2230 type 2231 The extension type. 2233 critical 2234 Whether this extension must be understood in order to process the 2235 message. If critical = True and the recipient does not understand 2236 the message, it MUST generate an Error_Unknown_Extension error. 2237 If critical = False, the recipient MAY choose to process the 2238 message even if it does not understand the extension. 2240 extension_contents 2241 The contents of the extension (extension-dependent). 2243 5.3.3.1. Response Codes and Response Errors 2245 A peer processing a request returns its status in the message_code 2246 field. If the request was a success, then the message code is the 2247 response code that matches the request (i.e., the next code up). The 2248 response payload is then as defined in the request/response 2249 descriptions. 2251 If the request has failed, then the message code is set to 0xffff 2252 (error) and the payload MUST be an error_response PDU, as shown 2253 below. 2255 When the message code is 0xffff, the payload MUST be an 2256 ErrorResponse. 2258 public struct { 2259 uint16 error_code; 2260 opaque error_info<0..2^16-1>; 2261 } ErrorResponse; 2263 The contents of this structure are as follows: 2265 error_code 2266 A numeric error code indicating the error that occurred. 2268 error_info 2269 An optional arbitrary byte string. Unless otherwise specified, 2270 this will be a UTF-8 text string providing further information 2271 about what went wrong. 2273 The following error code values are defined. The numeric values for 2274 these are defined in Section 13.9. 2276 Error_Forbidden: The requesting node does not have permission to 2277 make this request. 2279 Error_Not_Found: The resource or peer cannot be found or does not 2280 exist. 2282 Error_Request_Timeout: A response to the request has not been 2283 received in a suitable amount of time. The requesting node MAY 2284 resend the request at a later time. 2286 Error_Data_Too_Old: A store cannot be completed because the 2287 storage_time precedes the existing value. 2289 Error_Data_Too_Large: A store cannot be completed because the 2290 requested object exceeds the size limits for that Kind. 2292 Error_Generation_Counter_Too_Low: A store cannot be completed 2293 because the generation counter precedes the existing value. 2295 Error_Incompatible_with_Overlay: A peer receiving the request is 2296 using a different overlay, overlay algorithm, or hash algorithm. 2298 Error_Unsupported_Forwarding_Option: A peer receiving the request 2299 with a forwarding options flagged as critical but the peer does 2300 not support this option. See section Section 5.3.2.3. 2302 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2303 decremented to zero. See section Section 5.3.2. 2305 Error_Message_Too_Large: A peer receiving the request that was too 2306 large. See section Section 5.6. 2308 Error_Response_Too_Large: A peer would have generated a response 2309 that is too large per the max_response_length field. 2311 Error_Config_Too_Old: A destination peer received a request with a 2312 configuration sequence that's too old. See Section 5.3.2.1. 2314 Error_Config_Too_New: A destination node received a request with a 2315 configuration sequence that's too new. See Section 5.3.2.1. 2317 Error_Unknown_Kind: A destination node received a request with an 2318 unknown Kind-ID. See Section 6.4.1.2. 2320 Error_In_Progress: An Attach is already in progress to this peer. 2321 See Section 5.5.1.2. 2323 Error_Unknown_Extension: A destination node received a request with 2324 an unknown extension. 2326 5.3.4. Security Block 2328 The third part of a RELOAD message is the security block. The 2329 security block is represented by a SecurityBlock structure: 2331 struct { 2332 CertificateType type; 2333 opaque certificate<0..2^16-1>; 2334 } GenericCertificate; 2336 struct { 2337 GenericCertificate certificates<0..2^16-1>; 2338 Signature signature; 2339 } SecurityBlock; 2341 The contents of this structure are: 2343 certificates 2344 A bucket of certificates. 2346 signature 2347 A signature over the message contents. 2349 The certificates bucket SHOULD contain all the certificates necessary 2350 to verify every signature in both the message and the internal 2351 message objects, except for those certificates in a root-cert element 2352 of the current configuration file. This is the only location in the 2353 message which contains certificates, thus allowing for only a single 2354 copy of each certificate to be sent. In systems that have an 2355 alternative certificate distribution mechanism, some certificates MAY 2356 be omitted. However, unless an alternative mechanism for immediately 2357 generating certifcates, such as shared secret security (Section 12.4) 2358 is used, it is strongly RECOMMENDED that implementors include all 2359 referenced certificates, otherwise there is the possibility that 2360 messages may not be immediately verifiable because certificates must 2361 first be retrieved. 2363 NOTE TO IMPLEMENTERS: This requirement implies that a peer storing 2364 data is obligated to retain certificates for the data it holds 2365 regardless of whether it is responsible for or actually holding the 2366 certificates for the Certificate Store usage. 2368 Each certificate is represented by a GenericCertificate structure, 2369 which has the following contents: 2371 type 2372 The type of the certificate, as defined in [RFC6091]. Only the 2373 use of X.509 certificates is defined in this draft. 2375 certificate 2376 The encoded version of the certificate. For X.509 certificates, 2377 it is the DER form. 2379 The signature is computed over the payload and parts of the 2380 forwarding header. The payload, in case of a Store, may contain an 2381 additional signature computed over a StoreReq structure. All 2382 signatures are formatted using the Signature element. This element 2383 is also used in other contexts where signatures are needed. The 2384 input structure to the signature computation varies depending on the 2385 data element being signed. 2387 enum { reservedSignerIdentity(0), 2388 cert_hash(1), cert_hash_node_id(2), 2389 none(3) 2390 (255)} SignerIdentityType; 2392 struct { 2393 select (identity_type) { 2395 case cert_hash; 2396 HashAlgorithm hash_alg; // From TLS 2397 opaque certificate_hash<0..2^8-1>; 2399 case cert_hash_node_id: 2400 HashAlgorithm hash_alg; // From TLS 2401 opaque certificate_node_id_hash<0..2^8-1>; 2403 case none: 2404 /* empty */ 2405 /* This structure may be extended with new types if necessary*/ 2406 }; 2407 } SignerIdentityValue; 2409 struct { 2410 SignerIdentityType identity_type; 2411 uint16 length; 2412 SignerIdentityValue identity[SignerIdentity.length]; 2413 } SignerIdentity; 2415 struct { 2416 SignatureAndHashAlgorithm algorithm; // From TLS 2417 SignerIdentity identity; 2418 opaque signature_value<0..2^16-1>; 2419 } Signature; 2421 The signature construct contains the following values: 2423 algorithm 2424 The signature algorithm in use. The algorithm definitions are 2425 found in the IANA TLS SignatureAlgorithm Registry and 2426 HashAlgorithm registries. All implementations MUST support 2427 RSASSA-PKCS1-v1_5 [RFC3447] signatures with SHA-256 hashes. 2429 identity 2430 The identity used to form the signature. 2432 signature_value 2433 The value of the signature. 2435 There are two permitted identity formats, one for a certificate with 2436 only one node-id and one for a certificate with multiple node-ids. 2437 In the first case, the cert_hash type MUST be used. The hash_alg 2438 field is used to indicate the algorithm used to produce the hash. 2439 The certificate_hash contains the hash of the certificate object 2440 (i.e., the DER-encoded certificate). 2442 In the second case, the cert_hash_node_id type MUST be used. The 2443 hash_alg is as in cert_hash but the cert_hash_node_id is computed 2444 over the NodeId used to sign concatenated with the certificate. 2445 I.e., H(NodeID || certificate). The NodeId is represented without 2446 any framing or length fields, as simple raw bytes. This is safe 2447 because NodeIds are fixed-length for a given overlay. 2449 For signatures over messages the input to the signature is computed 2450 over: 2452 overlay || transaction_id || MessageContents || SignerIdentity 2454 where overlay and transaction_id come from the forwarding header and 2455 || indicates concatenation. 2457 The input to signatures over data values is different, and is 2458 described in Section 6.1. 2460 All RELOAD messages MUST be signed. Upon receipt (and fragment 2461 reassembly if needed) the destination node MUST verify the signature 2462 and the authorizing certificate. If the signature fails, the 2463 implementation SHOULD simply drop the message. This check provides a 2464 minimal level of assurance that the sending node is a valid part of 2465 the overlay as well as cryptographic authentication of the sending 2466 node. In addition, responses MUST be checked as follows: 2468 1. The response to a message sent to a specific Node-ID MUST have 2469 been sent by that Node-ID. 2470 2. The response to a message sent to a Resource-Id MUST have been 2471 sent by a Node-ID which is as close to or closer to the target 2472 Resource-Id than any node in the requesting node's neighbor 2473 table. 2475 The second condition serves as a primitive check for responses from 2476 wildly wrong nodes but is not a complete check. Note that in periods 2477 of churn, it is possible for the requesting node to obtain a closer 2478 neighbor while the request is outstanding. This will cause the 2479 response to be rejected and the request to be retransmitted. 2481 In addition, some methods (especially Store) have additional 2482 authentication requirements, which are described in the sections 2483 covering those methods. 2485 5.4. Overlay Topology 2487 As discussed in previous sections, RELOAD does not itself implement 2488 any overlay topology. Rather, it relies on Topology Plugins, which 2489 allow a variety of overlay algorithms to be used while maintaining 2490 the same RELOAD core. This section describes the requirements for 2491 new topology plugins and the methods that RELOAD provides for overlay 2492 topology maintenance. 2494 5.4.1. Topology Plugin Requirements 2496 When specifying a new overlay algorithm, at least the following need 2497 to be described: 2499 o Joining procedures, including the contents of the Join message. 2500 o Stabilization procedures, including the contents of the Update 2501 message, the frequency of topology probes and keepalives, and the 2502 mechanism used to detect when peers have disconnected. 2503 o Exit procedures, including the contents of the Leave message. 2504 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2505 compute the hash of an identifier. 2506 o The procedures that peers use to route messages. 2507 o The replication strategy used to ensure data redundancy. 2509 All overlay algorithms MUST specify maintenance procedures that send 2510 Updates to clients and peers that have established connections to the 2511 peer responsible for a particular ID when the responsibility for that 2512 ID changes. Because tracking this information is difficult, overlay 2513 algorithms MAY simply specify that an Update is sent to all members 2514 of the Connection Table whenever the range of IDs for which the peer 2515 is responsible changes. 2517 5.4.2. Methods and types for use by topology plugins 2519 This section describes the methods that topology plugins use to join, 2520 leave, and maintain the overlay. 2522 5.4.2.1. Join 2524 A new peer (but one that already has credentials) uses the JoinReq 2525 message to join the overlay. The JoinReq is sent to the responsible 2526 peer depending on the routing mechanism described in the topology 2527 plugin. This notifies the responsible peer that the new peer is 2528 taking over some of the overlay and it needs to synchronize its 2529 state. 2531 struct { 2532 NodeId joining_peer_id; 2533 opaque overlay_specific_data<0..2^16-1>; 2534 } JoinReq; 2536 The minimal JoinReq contains only the Node-ID which the sending peer 2537 wishes to assume. Overlay algorithms MAY specify other data to 2538 appear in this request. Receivers of the JoinReq MUST verify that 2539 the joining_peer_id field matches the Node-ID used to sign the 2540 message and if not MUST reject the message with an Error_Forbidden 2541 error. 2543 Because joins may only be executed between nodes which are directly 2544 adjacent, receiving peers MUST verify that any JoinReq they receive 2545 arrives from a transport channel that is bound to the Node-Id to be 2546 assumed by the joining peer.) This also prevents replay attacks 2547 provided that DTLS anti-replay is used. 2549 If the request succeeds, the responding peer responds with a JoinAns 2550 message, as defined below: 2552 struct { 2553 opaque overlay_specific_data<0..2^16-1>; 2554 } JoinAns; 2556 If the request succeeds, the responding peer MUST follow up by 2557 executing the right sequence of Stores and Updates to transfer the 2558 appropriate section of the overlay space to the joining peer. In 2559 addition, overlay algorithms MAY define data to appear in the 2560 response payload that provides additional info. 2562 Joining nodes MUST verify that the signature on the JoinAns message 2563 matches the expected target (i.e., the adjacency over which they are 2564 joining.) If not, they MUST discard the message. 2566 In general, nodes which cannot form connections SHOULD report an 2567 error. However, implementations MUST provide some mechanism whereby 2568 nodes can determine that they are potentially the first node and take 2569 responsibility for the overlay. This specification does not mandate 2570 any particular mechanism, but a configuration flag or setting seems 2571 appropriate. 2573 5.4.2.2. Leave 2575 The LeaveReq message is used to indicate that a node is exiting the 2576 overlay. A node SHOULD send this message to each peer with which it 2577 is directly connected prior to exiting the overlay. 2579 struct { 2580 NodeId leaving_peer_id; 2581 opaque overlay_specific_data<0..2^16-1>; 2582 } LeaveReq; 2584 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2585 algorithms MAY specify other data to appear in this request. 2586 Receivers of the LeaveReq MUST verify that the leaving_peer_id field 2587 matches the Node-ID used to sign the message and if not MUST reject 2588 the message with an Error_Forbidden error. 2590 Because leaves may only be executed between nodes which are directly 2591 adjacent, receiving peers MUST verify that any LeaveReq they receive 2592 arrives from a transport channel that is bound to the Node-Id to be 2593 assumed by the leaving peer.) This also prevents replay attacks 2594 provided that DTLS anti-replay is used. 2596 Upon receiving a Leave request, a peer MUST update its own routing 2597 table, and send the appropriate Store/Update sequences to re- 2598 stabilize the overlay. 2600 5.4.2.3. Update 2602 Update is the primary overlay-specific maintenance message. It is 2603 used by the sender to notify the recipient of the sender's view of 2604 the current state of the overlay (its routing state), and it is up to 2605 the recipient to take whatever actions are appropriate to deal with 2606 the state change. In general, peers send Update messages to all 2607 their adjacencies whenever they detect a topology shift. 2609 When a peer receives an Attach request with the send_update flag set 2610 to "true" (Section 5.4.2.4.1, it MUST send an Update message back to 2611 the sender of the Attach request after the completion of the 2612 corresponding ICE check and TLS connection. Note that the sender of 2613 a such Attach request may not have joined the overlay yet. 2615 When a peer detects through an Update that it is no longer 2616 responsible for any data value it is storing, it MUST attempt to 2617 Store a copy to the correct node unless it knows the newly 2618 responsible node already has a copy of the data. This prevents data 2619 loss during large-scale topology shifts such as the merging of 2620 partitioned overlays. 2622 The contents of the UpdateReq message are completely overlay- 2623 specific. The UpdateAns response is expected to be either success or 2624 an error. 2626 5.4.2.4. RouteQuery 2628 The RouteQuery request allows the sender to ask a peer where they 2629 would route a message directed to a given destination. In other 2630 words, a RouteQuery for a destination X requests the Node-ID for the 2631 node that the receiving peer would next route to in order to get to 2632 X. A RouteQuery can also request that the receiving peer initiate an 2633 Update request to transfer the receiving peer's routing table. 2635 One important use of the RouteQuery request is to support iterative 2636 routing. The sender selects one of the peers in its routing table 2637 and sends it a RouteQuery message with the destination_object set to 2638 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2639 responds with information about the peers to which the request would 2640 be routed. The sending peer MAY then use the Attach method to attach 2641 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2642 gets a response from a peer that is closest to the identifier in the 2643 destination_object as determined by the topology plugin. At that 2644 point, the sender can send messages directly to that peer. 2646 5.4.2.4.1. Request Definition 2648 A RouteQueryReq message indicates the peer or resource that the 2649 requesting node is interested in. It also contains a "send_update" 2650 option allowing the requesting node to request a full copy of the 2651 other peer's routing table. 2653 struct { 2654 Boolean send_update; 2655 Destination destination; 2656 opaque overlay_specific_data<0..2^16-1>; 2657 } RouteQueryReq; 2659 The contents of the RouteQueryReq message are as follows: 2661 send_update 2662 A single byte. This may be set to "true" to indicate that the 2663 requester wishes the responder to initiate an Update request 2664 immediately. Otherwise, this value MUST be set to "false". 2666 destination 2667 The destination which the requester is interested in. This may be 2668 any valid destination object, including a Node-ID, compressed ids, 2669 or Resource-ID. 2671 overlay_specific_data 2672 Other data as appropriate for the overlay. 2674 5.4.2.4.2. Response Definition 2676 A response to a successful RouteQueryReq request is a RouteQueryAns 2677 message. This is completely overlay specific. 2679 5.4.2.5. Probe 2681 Probe provides primitive "exploration" services: it allows node to 2682 determine which resources another node is responsible for; and it 2683 allows some discovery services using multicast, anycast, or 2684 broadcast. A probe can be addressed to a specific Node-ID, or the 2685 peer controlling a given location (by using a Resource-ID). In 2686 either case, the target Node-IDs respond with a simple response 2687 containing some status information. 2689 5.4.2.5.1. Request Definition 2691 The ProbeReq message contains a list (potentially empty) of the 2692 pieces of status information that the requester would like the 2693 responder to provide. 2695 enum { reservedProbeInformation(0), responsible_set(1), 2696 num_resources(2), uptime(3), (255)} 2697 ProbeInformationType; 2699 struct { 2700 ProbeInformationType requested_info<0..2^8-1>; 2701 } ProbeReq 2703 The currently defined values for ProbeInformation are: 2705 responsible_set 2706 indicates that the peer should Respond with the fraction of the 2707 overlay for which the responding peer is responsible. 2709 num_resources 2710 indicates that the peer should Respond with the number of 2711 resources currently being stored by the peer. 2713 uptime 2714 indicates that the peer should Respond with how long the peer has 2715 been up in seconds. 2717 5.4.2.5.2. Response Definition 2719 A successful ProbeAns response contains the information elements 2720 requested by the peer. 2722 struct { 2723 select (type) { 2724 case responsible_set: 2725 uint32 responsible_ppb; 2727 case num_resources: 2728 uint32 num_resources; 2730 case uptime: 2731 uint32 uptime; 2732 /* This type may be extended */ 2734 }; 2735 } ProbeInformationData; 2737 struct { 2738 ProbeInformationType type; 2739 uint8 length; 2740 ProbeInformationData value; 2741 } ProbeInformation; 2743 struct { 2744 ProbeInformation probe_info<0..2^16-1>; 2745 } ProbeAns; 2747 A ProbeAns message contains a sequence of ProbeInformation 2748 structures. Each has a "length" indicating the length of the 2749 following value field. This structure allows for unknown option 2750 types. 2752 Each of the current possible Probe information types is a 32-bit 2753 unsigned integer. For type "responsible_ppb", it is the fraction of 2754 the overlay for which the peer is responsible in parts per billion. 2755 For type "num_resources", it is the number of resources the peer is 2756 storing. For the type "uptime" it is the number of seconds the peer 2757 has been up. 2759 The responding peer SHOULD include any values that the requesting 2760 node requested and that it recognizes. They SHOULD be returned in 2761 the requested order. Any other values MUST NOT be returned. 2763 5.5. Forwarding and Link Management Layer 2765 Each node maintains connections to a set of other nodes defined by 2766 the topology plugin. This section defines the methods RELOAD uses to 2767 form and maintain connections between nodes in the overlay. Three 2768 methods are defined: 2770 Attach: used to form RELOAD connections between nodes using ICE 2771 for NAT traversal. When node A wants to connect to node B, it 2772 sends an Attach message to node B through the overlay. The Attach 2773 contains A's ICE parameters. B responds with its ICE parameters 2774 and the two nodes perform ICE to form connection. Attach also 2775 allows two nodes to connect via No-ICE instead of full ICE. 2776 AppAttach: used to form application layer connections between 2777 nodes. 2778 Ping: is a simple request/response which is used to verify 2779 connectivity of the target peer. 2781 5.5.1. Attach 2783 A node sends an Attach request when it wishes to establish a direct 2784 TCP or UDP connection to another node for the purpose of sending 2785 RELOAD messages. A client that can establish a connection directly 2786 need not send an attach as described in the second bullet of 2787 Section 3.2.1 2789 As described in Section 5.1, an Attach may be routed to either a 2790 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2791 will fail if that node is not reached. An Attach routed to a 2792 Resource-ID will establish a connection with the peer currently 2793 responsible for that Resource-ID, which may be useful in establishing 2794 a direct connection to the responsible peer for use with frequent or 2795 large resource updates. 2797 An Attach in and of itself does not result in updating the routing 2798 table of either node. That function is performed by Updates. If 2799 node A has Attached to node B, but not received any Updates from B, 2800 it MAY route messages which are directly addressed to B through that 2801 channel but MUST NOT route messages through B to other peers via that 2802 channel. The process of Attaching is separate from the process of 2803 becoming a peer (using Join and Update), to prevent half-open states 2804 where a node has started to form connections but is not really ready 2805 to act as a peer. Thus, clients (unlike peers) can simply Attach 2806 without sending Join or Update. 2808 5.5.1.1. Request Definition 2810 An Attach request message contains the requesting node ICE connection 2811 parameters formatted into a binary structure. 2813 enum { reservedOverlayLink(0), DTLS-UDP-SR(1), 2814 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2815 (255) } OverlayLinkType; 2817 enum { reservedCand(0), host(1), srflx(2), prflx(3), relay(4), 2818 (255) } CandType; 2820 struct { 2821 opaque name<0..2^16-1>; 2822 opaque value<0..2^16-1>; 2823 } IceExtension; 2825 struct { 2826 IpAddressPort addr_port; 2827 OverlayLinkType overlay_link; 2828 opaque foundation<0..255>; 2829 uint32 priority; 2830 CandType type; 2831 select (type){ 2832 case host: 2833 ; /* Nothing */ 2834 case srflx: 2835 case prflx: 2836 case relay: 2837 IpAddressPort rel_addr_port; 2838 }; 2839 IceExtension extensions<0..2^16-1>; 2840 } IceCandidate; 2842 struct { 2843 opaque ufrag<0..2^8-1>; 2844 opaque password<0..2^8-1>; 2845 opaque role<0..2^8-1>; 2846 IceCandidate candidates<0..2^16-1>; 2847 Boolean send_update; 2848 } AttachReqAns; 2850 The values contained in AttachReqAns are: 2852 ufrag 2853 The username fragment (from ICE). 2855 password 2856 The ICE password. 2858 role 2859 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2860 value MUST be 'passive' for the offerer (the peer sending the 2861 Attach request) and 'active' for the answerer (the peer sending 2862 the Attach response). 2864 candidates 2865 One or more ICE candidate values, as described below. 2866 send_update 2867 Has the same meaning as the send_update field in RouteQueryReq. 2869 Each ICE candidate is represented as an IceCandidate structure, which 2870 is a direct translation of the information from the ICE string 2871 structures, with the exception of the component ID. Since there is 2872 only one component, it is always 1, and thus left out of the PDU. 2873 The remaining values are specified as follows: 2875 addr_port 2876 corresponds to the connection-address and port productions. 2878 overlay_link 2879 corresponds to the OverlayLinkType production, Overlay Link 2880 protocols used with No-ICE MUST specify "No-ICE" in their 2881 description. Future overlay link values can be added be defining 2882 new OverlayLinkType values in the IANA registry in Section 13.10. 2883 Future extensions to the encapsulation or framing that provide for 2884 backward compatibility with that specified by a previously defined 2885 OverlayLinkType values MUST use that previous value. 2886 OverlayLinkType protocols are defined in Section 5.6 2887 A single AttachReqAns MUST NOT include both candidates whose 2888 OverlayLinkType protocols use ICE (the default) and candidates 2889 that specify "No-ICE". 2891 foundation 2892 corresponds to the foundation production. 2894 priority 2895 corresponds to the priority production. 2897 type 2898 corresponds to the cand-type production. 2900 rel_addr_port 2901 corresponds to the rel-addr and rel-port productions. Only 2902 present for type "relay". 2904 extensions 2905 ICE extensions. The name and value fields correspond to binary 2906 translations of the equivalent fields in the ICE extensions. 2908 These values should be generated using the procedures described in 2909 Section 5.5.1.3. 2911 5.5.1.2. Response Definition 2913 If a peer receives an Attach request, it MUST determine how to 2914 process the request as follows: 2916 o If it has not initiated an Attach request to the originating peer 2917 of this Attach request, it MUST process this request and SHOULD 2918 generate its own response with an AttachReqAns. It should then 2919 begin ICE checks. 2920 o If it has already sent an Attach request to and received the 2921 response from the originating peer of this Attach request, and as 2922 a result, an ICE check and TLS connection is in progress, then it 2923 SHOULD generate an Error_In_Progress error instead of an 2924 AttachReqAns. 2925 o If it has already sent an Attach request to but not yet received 2926 the response from the originating peer of this Attach request, it 2927 SHOULD apply the following tie-breaker heuristic to determine how 2928 to handle this Attach request and the incomplete Attach request it 2929 has sent out: 2930 * If the peer's own Node-ID is smaller when compared as big- 2931 endian unsigned integers, it MUST cancel its own incomplete 2932 Attach request. It MUST then process this Attach request, 2933 generate an AttachReqAns response, and proceed with the 2934 corresponding ICE check. 2935 * If the peer's own Node-ID is larger when compared as big-endien 2936 unsigned integers, it MUST generate an Error_In_Progress error 2937 to this Attach request, then proceed to wait for and complete 2938 the Attach and the corresponding ICE check it has originated. 2939 o If the peer is overloaded or detects some other kind of error, it 2940 MAY generate an error instead of an AttachReqAns. 2942 When a peer receives an Attach response, it SHOULD parse the response 2943 and begin its own ICE checks. 2945 5.5.1.3. Using ICE With RELOAD 2947 This section describes the profile of ICE that is used with RELOAD. 2948 RELOAD implementations MUST implement full ICE. 2950 In ICE as defined by [RFC5245], SDP is used to carry the ICE 2951 parameters. In RELOAD, this function is performed by a binary 2952 encoding in the Attach method. This encoding is more restricted than 2953 the SDP encoding because the RELOAD environment is simpler: 2955 o Only a single media stream is supported. 2956 o In this case, the "stream" refers not to RTP or other types of 2957 media, but rather to a connection for RELOAD itself or other 2958 application-layer protocols such as SIP. 2959 o RELOAD only allows for a single offer/answer exchange. Unlike the 2960 usage of ICE within SIP, there is never a need to send a 2961 subsequent offer to update the default candidates to match the 2962 ones selected by ICE. 2964 An agent follows the ICE specification as described in [RFC5245] with 2965 the changes and additional procedures described in the subsections 2966 below. 2968 5.5.1.4. Collecting STUN Servers 2970 ICE relies on the node having one or more STUN servers to use. In 2971 conventional ICE, it is assumed that nodes are configured with one or 2972 more STUN servers through some out of band mechanism. This is still 2973 possible in RELOAD but RELOAD also learns STUN servers as it connects 2974 to other peers. Because all RELOAD peers implement ICE and use STUN 2975 keepalives, every peer is a capable of responding to STUN Binding 2976 requests [RFC5389]. Accordingly, any peer that a node knows about 2977 can be used like a STUN server -- though of course it may be behind a 2978 NAT. 2980 A peer on a well-provisioned wide-area overlay will be configured 2981 with one or more bootstrap nodes. These nodes make an initial list 2982 of STUN servers. However, as the peer forms connections with 2983 additional peers, it builds more peers it can use like STUN servers. 2985 Because complicated NAT topologies are possible, a peer may need more 2986 than one STUN server. Specifically, a peer that is behind a single 2987 NAT will typically observe only two IP addresses in its STUN checks: 2988 its local address and its server reflexive address from a STUN server 2989 outside its NAT. However, if there are more NATs involved, it may 2990 learn additional server reflexive addresses (which vary based on 2991 where in the topology the STUN server is). To maximize the chance of 2992 achieving a direct connection, a peer SHOULD group other peers by the 2993 peer-reflexive addresses it discovers through them. It SHOULD then 2994 select one peer from each group to use as a STUN server for future 2995 connections. 2997 Only peers to which the peer currently has connections may be used. 2998 If the connection to that host is lost, it MUST be removed from the 2999 list of stun servers and a new server from the same group MUST be 3000 selected unless there are no others servers in the group in which 3001 case some other peer MAY be used. 3003 5.5.1.5. Gathering Candidates 3005 When a node wishes to establish a connection for the purposes of 3006 RELOAD signaling or application signaling, it follows the process of 3007 gathering candidates as described in Section 4 of ICE [RFC5245]. 3008 RELOAD utilizes a single component. Consequently, gathering for 3009 these "streams" requires a single component. In the case where a 3010 node has not yet found a TURN server, the agent would not include a 3011 relayed candidate. 3013 The ICE specification assumes that an ICE agent is configured with, 3014 or somehow knows of, TURN and STUN servers. RELOAD provides a way 3015 for an agent to learn these by querying the overlay, as described in 3016 Section 5.5.1.4 and Section 8. 3018 The default candidate selection described in Section 4.1.4 of ICE is 3019 ignored; defaults are not signaled or utilized by RELOAD. 3021 An alternative to using the full ICE supported by the Attach request 3022 is to use No-ICE mechanism by providing candidates with "No-ICE" 3023 Overlay Link protocols. Configuration for the overlay indicates 3024 whether or not these Overlay Link protocols can be used. An overlay 3025 MUST be either all ICE or all No-ICE. 3027 No-ICE will not work in all of the scenarios where ICE would work, 3028 but in some cases, particularly those with no NATs or firewalls, it 3029 will work. 3031 5.5.1.6. Prioritizing Candidates 3033 However, standardization of additional protocols for use with ICE is 3034 expected, including TCP[I-D.ietf-mmusic-ice-tcp] and protocols such 3035 as SCTP and DCCP. UDP encapsulations for SCTP and DCCP would expand 3036 the available Overlay Link protocols available for RELOAD. When 3037 additional protocols are available, the following prioritization is 3038 RECOMMENDED: 3040 o Highest priority is assigned to protocols that offer well- 3041 understood congestion and flow control without head of line 3042 blocking. For example, SCTP without message ordering, DCCP, or 3043 those protocols encapsulated using UDP. 3044 o Second highest priority is assigned to protocols that offer well- 3045 understood congestion and flow control but have head of line 3046 blocking such as TCP. 3047 o Lowest priority is assigned to protocols encapsulated over UDP 3048 that do not implement well-established congestion control 3049 algorithms. The DTLS/UDP with SR overlay link protocol is an 3050 example of such a protocol. 3052 Head of line blocking is undesireable in an Overlay Link protocol 3053 because the messages carried on a RELOAD link are independent, rather 3054 than stream-oriented. Therefore, if message N on a link is lost, 3055 delaying message N+1 on that same link until N is successfully 3056 retransmitted does nothing other than increase the latency for the 3057 transaction of message N+1 as they are unrelated to each other. 3058 Therefore, while the high quality, performance, and availability of 3059 modern TCP implementations makes them very attractive, their 3060 performance as an Overlay Link protocol is not optimal. 3062 5.5.1.7. Encoding the Attach Message 3064 Section 4.3 of ICE describes procedures for encoding the SDP for 3065 conveying RELOAD candidates. Instead of actually encoding an SDP 3066 message, the candidate information (IP address and port and transport 3067 protocol, priority, foundation, type and related address) is carried 3068 within the attributes of the Attach request or its response. 3069 Similarly, the username fragment and password are carried in the 3070 Attach message or its response. Section 5.5.1 describes the detailed 3071 attribute encoding for Attach. The Attach request and its response 3072 do not contain any default candidates or the ice-lite attribute, as 3073 these features of ICE are not used by RELOAD. 3075 Since the Attach request contains the candidate information and short 3076 term credentials, it is considered as an offer for a single media 3077 stream that happens to be encoded in a format different than SDP, but 3078 is otherwise considered a valid offer for the purposes of following 3079 the ICE specification. Similarly, the Attach response is considered 3080 a valid answer for the purposes of following the ICE specification. 3082 5.5.1.8. Verifying ICE Support 3084 An agent MUST skip the verification procedures in Section 5.1 and 6.1 3085 of ICE. Since RELOAD requires full ICE from all agents, this check 3086 is not required. 3088 5.5.1.9. Role Determination 3090 The roles of controlling and controlled as described in Section 5.2 3091 of ICE are still utilized with RELOAD. However, the offerer (the 3092 entity sending the Attach request) will always be controlling, and 3093 the answerer (the entity sending the Attach response) will always be 3094 controlled. The connectivity checks MUST still contain the ICE- 3095 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 3096 role reversal capability for which they are defined will never be 3097 needed with RELOAD. This is to allow for a common codebase between 3098 ICE for RELOAD and ICE for SDP. 3100 5.5.1.10. Full ICE 3102 When the overlay uses ICE , connectivity checks and nominations are 3103 used as in regular ICE. 3105 5.5.1.10.1. Connectivity Checks 3107 The processes of forming check lists in Section 5.7 of ICE, 3108 scheduling checks in Section 5.8, and checking connectivity checks in 3109 Section 7 are used with RELOAD without change. 3111 5.5.1.10.2. Concluding ICE 3113 The procedures in Section 8 of ICE are followed to conclude ICE, with 3114 the following exceptions: 3116 o The controlling agent MUST NOT attempt to send an updated offer 3117 once the state of its single media stream reaches Completed. 3118 o Once the state of ICE reaches Completed, the agent can immediately 3119 free all unused candidates. This is because RELOAD does not have 3120 the concept of forking, and thus the three second delay in Section 3121 8.3 of ICE does not apply. 3123 5.5.1.10.3. Media Keepalives 3125 STUN MUST be utilized for the keepalives described in Section 10 of 3126 ICE. 3128 5.5.1.11. No-ICE 3130 No-ICE is selected when either side has provided "no ICE" Overlay 3131 Link candidates. STUN is not used for connectivity checks when doing 3132 No-ICE; instead the DTLS or TLS handshake (or similar security layer 3133 of future overlay link protocols) forms the connectivity check. The 3134 certificate exchanged during the (D)TLS handshake must match the node 3135 that sent the AttachReqAns and if it does not, the connection MUST be 3136 closed. 3138 5.5.1.12. Subsequent Offers and Answers 3140 An agent MUST NOT send a subsequent offer or answer. Thus, the 3141 procedures in Section 9 of ICE MUST be ignored. 3143 5.5.1.13. Sending Media 3145 The procedures of Section 11 of ICE apply to RELOAD as well. 3146 However, in this case, the "media" takes the form of application 3147 layer protocols (e.g. RELOAD) over TLS or DTLS. Consequently, once 3148 ICE processing completes, the agent will begin TLS or DTLS procedures 3149 to establish a secure connection. The node which sent the Attach 3150 request MUST be the TLS server. The other node MUST be the TLS 3151 client. The server MUST request TLS client authentication. The 3152 nodes MUST verify that the certificate presented in the handshake 3153 matches the identity of the other peer as found in the Attach 3154 message. Once the TLS or DTLS signaling is complete, the application 3155 protocol is free to use the connection. 3157 The concept of a previous selected pair for a component does not 3158 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3160 5.5.1.14. Receiving Media 3162 An agent MUST be prepared to receive packets for the application 3163 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3164 time. The jitter and RTP considerations in Section 11 of ICE do not 3165 apply to RELOAD. 3167 5.5.2. AppAttach 3169 A node sends an AppAttach request when it wishes to establish a 3170 direct connection to another node for the purposes of sending 3171 application layer messages. AppAttach is nearly identical to Attach, 3172 except for the purpose of the connection: it is used to transport 3173 non-RELOAD "media". A separate request is used to avoid implementor 3174 confusion between the two methods (this was found to be a real 3175 problem with initial implementations). The AppAttach request and its 3176 response contain an application attribute, which indicates what 3177 protocol is to be run over the connection. 3179 5.5.2.1. Request Definition 3181 An AppAttachReq message contains the requesting node's ICE connection 3182 parameters formatted into a binary structure. 3184 struct { 3185 opaque ufrag<0..2^8-1>; 3186 opaque password<0..2^8-1>; 3187 uint16 application; 3188 opaque role<0..2^8-1>; 3189 IceCandidate candidates<0..2^16-1>; 3190 } AppAttachReq; 3192 The values contained in AppAttachReq and AppAttachAns are: 3194 ufrag 3195 The username fragment (from ICE) 3197 password 3198 The ICE password. 3200 application 3201 A 16-bit application-id as defined in the Section 13.5. This 3202 number represents the IANA registered application that is going to 3203 send data on this connection. For SIP, this is 5060 or 5061. 3205 role 3206 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3208 candidates 3209 One or more ICE candidate values 3211 The application using connection set up with this request is 3212 responsible for providing sufficiently frequent keep traffic for NAT 3213 and Firewall keep alive and for deciding when to close the 3214 connection. 3216 5.5.2.2. Response Definition 3218 If a peer receives an AppAttach request, it SHOULD process the 3219 request and generate its own response with a AppAttachAns. It should 3220 then begin ICE checks. When a peer receives an AppAttach response, 3221 it SHOULD parse the response and begin its own ICE checks. If the 3222 application ID is not supported, the peer MUST reply with an 3223 Error_Not_Found error. 3225 struct { 3226 opaque ufrag<0..2^8-1>; 3227 opaque password<0..2^8-1>; 3228 uint16 application; 3229 opaque role<0..2^8-1>; 3230 IceCandidate candidates<0..2^16-1>; 3232 } AppAttachAns; 3234 The meaning of the fields is the same as in the AppAttachReq. 3236 5.5.3. Ping 3238 Ping is used to test connectivity along a path. A ping can be 3239 addressed to a specific Node-ID, to the peer controlling a given 3240 location (by using a resource ID), or to the broadcast Node-ID 3241 (2^128-1). 3243 5.5.3.1. Request Definition 3245 struct { 3246 opaque<0..2^16-1> padding; 3247 } PingReq 3249 The Ping request is empty of meaningful contents. However, it may 3250 contain up to 65535 bytes of padding to facilitate the discovery of 3251 overlay maximum packet sizes. 3253 5.5.3.2. Response Definition 3255 A successful PingAns response contains the information elements 3256 requested by the peer. 3258 struct { 3259 uint64 response_id; 3260 uint64 time; 3261 } PingAns; 3263 A PingAns message contains the following elements: 3265 response_id 3266 A randomly generated 64-bit response ID. This is used to 3267 distinguish Ping responses. 3269 time 3270 The time when the Ping response was created represented in the 3271 same way as storage_time defined in Section 6. 3273 5.5.4. ConfigUpdate 3275 The ConfigUpdate method is used to push updated configuration data 3276 across the overlay. Whenever a node detects that another node has 3277 old configuration data, it MUST generate a ConfigUpdate request. The 3278 ConfigUpdate request allows updating of two kinds of data: the 3279 configuration data (Section 5.3.2.1) and the Kind information 3280 (Section 6.4.1.1). 3282 5.5.4.1. Request Definition 3284 enum { reservedConfigUpdate(0), config(1), kind(2), (255) } 3285 ConfigUpdateType; 3287 typedef uint32 KindId; 3288 typedef opaque KindDescription<0..2^16-1>; 3290 struct { 3291 ConfigUpdateType type; 3292 uint32 length; 3294 select (type) { 3295 case config: 3296 opaque config_data<0..2^24-1>; 3298 case kind: 3299 KindDescription kinds<0..2^24-1>; 3301 /* This structure may be extended with new types*/ 3302 }; 3303 } ConfigUpdateReq; 3305 The ConfigUpdateReq message contains the following elements: 3307 type 3308 The type of the contents of the message. This structure allows 3309 for unknown content types. 3310 length 3311 The length of the remainder of the message. This is included to 3312 preserve backward compatibility and is 32 bits instead of 24 to 3313 facilitate easy conversion between network and host byte order. 3314 config_data (type==config) 3315 The contents of the configuration document. 3317 kinds (type==kind) 3318 One or more XML kind-block productions (see Section 10.1). These 3319 MUST be encoded with UTF-8 and assume a default namespace of 3320 "urn:ietf:params:xml:ns:p2p:config-base". 3322 5.5.4.2. Response Definition 3324 struct { 3325 } ConfigUpdateAns 3327 If the ConfigUpdateReq is of type "config" it MUST only be processed 3328 if all the following are true: 3329 o The sequence number in the document is greater than the current 3330 configuration sequence number. 3331 o The configuration document is correctly digitally signed (see 3332 Section 10 for details on signatures. 3333 Otherwise appropriate errors MUST be generated. 3335 If the ConfigUpdateReq is of type "kind" it MUST only be processed if 3336 it is correctly digitally signed by an acceptable Kind signer as 3337 specified in the configuration file. Details on kind-signer field in 3338 the configuration file is described in Section 10.1. In addition, if 3339 the Kind update conflicts with an existing known Kind (i.e., it is 3340 signed by a different signer), then it should be rejected with 3341 "Error_Forbidden". This should not happen in correctly functioning 3342 overlays. 3344 If the update is acceptable, then the node MUST reconfigure itself to 3345 match the new information. This may include adding permissions for 3346 new Kinds, deleting old Kinds, or even, in extreme circumstances, 3347 exiting and reentering the overlay, if, for instance, the DHT 3348 algorithm has changed. 3350 The response for ConfigUpdate is empty. 3352 5.6. Overlay Link Layer 3354 RELOAD can use multiple Overlay Link protocols to send its messages. 3355 Because ICE is used to establish connections (see Section 5.5.1.3), 3356 RELOAD nodes are able to detect which Overlay Link protocols are 3357 offered by other nodes and establish connections between them. Any 3358 link protocol needs to be able to establish a secure, authenticated 3359 connection and to provide data origin authentication and message 3360 integrity for individual data elements. RELOAD currently supports 3361 three Overlay Link protocols: 3363 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3364 (OverlayLinkType=DTLS-UDP-SR 3365 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3366 (OverlayLinkType=TLS-TCP-FH-NO-ICE 3367 o DTLS [RFC4347] over UDP with SR, No-ICE (OverlayLinkType=DTLS-UDP- 3368 SR-NO-ICE) 3370 Note that although UDP does not properly have "connections", both TLS 3371 and DTLS have a handshake which establishes a similar, stateful 3372 association, and we simply refer to these as "connections" for the 3373 purposes of this document. 3375 If a peer receives a message that is larger than value of max- 3376 message-size defined in the overlay configuration, the peer SHOULD 3377 send an Error_Message_Too_Large error and then close the TLS or DTLS 3378 session from which the message was received. Note that this error 3379 can be sent and the session closed before receiving the complete 3380 message. If the forwarding header is larger than the max-message- 3381 size, the receiver SHOULD close the TLS or DTLS session without 3382 sending an error. 3384 The Framing Header (FH) is used to frame messages and provide timing 3385 when used on a reliable stream-based transport protocol. Simple 3386 Reliability (SR) makes use of the FH to provide congestion control 3387 and semi-reliability when using unreliable message-oriented transport 3388 protocols. We will first define each of these algorithms, then 3389 define overlay link protocols that use them. 3391 Note: We expect future Overlay Link protocols to define replacements 3392 for all components of these protocols, including the framing header. 3393 These protocols have been chosen for simplicity of implementation and 3394 reasonable performance. 3396 Note to implementers: There are inherent tradeoffs in utilizing 3397 short timeouts to determine when a link has failed. To balance the 3398 tradeoffs, an implementation SHOULD quickly act to remove entries 3399 from the routing table when there is reason to suspect the link has 3400 failed. For example, in a Chord derived overlay algorithm, a closer 3401 finger table entry could be substituted for an entry in the finger 3402 table that has experienced a timeout. That entry can be restored if 3403 it proves to resume functioning, or replaced at some point in the 3404 future if necessary. End-to-end retransmissions will handle any lost 3405 messages, but only if the failing entries do not remain in the finger 3406 table for subsequent retransmissions. 3408 5.6.1. Future Overlay Link Protocols 3410 It is possible to define new link-layer protocols and apply them to a 3411 new overlay using the "overlay-link-protocol" configuration directive 3412 (see Section 10.1.). However, any new protocols MUST meet the 3413 following requirements. 3415 Endpoint authentication When a node forms an association with 3416 another endpoint, it MUST be possible to cryptographically verify 3417 that the endpoint has a given Node-Id. 3419 Traffic origin authentication and integrity When a node receives 3420 traffic from another endpoint, it MUST be possible to 3421 cryptographically verify that the traffic came from a given 3422 association and that it has not been modified in transit from the 3423 other endpoint in the association. The overlay link protocol MUST 3424 also provide replay prevention/detection. 3426 Traffic confidentiality When a node sends traffic to another 3427 endpoint, it MUST NOT be possible for a third party not involved 3428 in the association to determine the contents of that traffic. 3430 Any new overlay protocol MUST be defined via RFC 5226 Standards 3431 Action; see Section 13.11. 3433 5.6.1.1. HIP 3435 In a Host Identity Protocol Based Overlay Networking Environment (HIP 3436 BONE) [RFC6079] HIP [RFC5201] provides connection management (e.g., 3437 NAT traversal and mobility) and security for the overlay network. 3438 The P2PSIP Working Group has expressed interest in supporting a HIP- 3439 based link protocol. Such support would require specifying such 3440 details as: 3442 o How to issue certificates which provided identities meaningful to 3443 the HIP base exchange. We anticipate that this would require a 3444 mapping between ORCHIDs and NodeIds. 3445 o How to carry the HIP I1 and I2 messages. 3446 o How to carry RELOAD messages over HIP. 3448 [I-D.ietf-hip-reload-instance] documents work in progress on using 3449 RELOAD with the HIP BONE. 3451 5.6.1.2. ICE-TCP 3453 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] allows TCP to be 3454 supported as an Overlay Link protocol that can be added using ICE. 3456 5.6.1.3. Message-oriented Transports 3458 Modern message-oriented transports offer high performance, good 3459 congestion control, and avoid head of line blocking in case of lost 3460 data. These characteristics make them preferable as underlying 3461 transport protocols for RELOAD links. SCTP without message ordering 3462 and DCCP are two examples of such protocols. However, currently they 3463 are not well-supported by commonly available NATs, and specifications 3464 for ICE session establishment are not available. 3466 5.6.1.4. Tunneled Transports 3468 As of the time of this writing, there is significant interest in the 3469 IETF community in tunneling other transports over UDP, motivated by 3470 the situation that UDP is well-supported by modern NAT hardware, and 3471 similar performance can be achieved to native implementation. 3472 Currently SCTP, DCCP, and a generic tunneling extension are being 3473 proposed for message-oriented protocols. Once ICE traversal has been 3474 specified for these tunneled protocols, they should be 3475 straightforward to support as overlay link protocols. 3477 5.6.2. Framing Header 3479 In order to support unreliable links and to allow for quick detection 3480 of link failures when using reliable end-to-end transports, each 3481 message is wrapped in a very simple framing layer (FramedMessage) 3482 which is only used for each hop. This layer contains a sequence 3483 number which can then be used for ACKs. The same header is used for 3484 both reliable and unreliable transports for simplicity of 3485 implementation. 3487 The definition of FramedMessage is: 3489 enum { data(128), ack(129), (255)} FramedMessageType; 3491 struct { 3492 FramedMessageType type; 3494 select (type) { 3495 case data: 3496 uint32 sequence; 3497 opaque message<0..2^24-1>; 3499 case ack: 3500 uint32 ack_sequence; 3501 uint32 received; 3502 }; 3504 } FramedMessage; 3506 The type field of the PDU is set to indicate whether the message is 3507 data or an acknowledgement. 3509 If the message is of type "data", then the remainder of the PDU is as 3510 follows: 3512 sequence 3513 the sequence number. This increments by 1 for each framed message 3514 sent over this transport session. 3516 message 3517 the message that is being transmitted. 3519 Each connection has it own sequence number space. Initially the 3520 value is zero and it increments by exactly one for each message sent 3521 over that connection. 3523 When the receiver receives a message, it SHOULD immediately send an 3524 ACK message. The receiver MUST keep track of the 32 most recent 3525 sequence numbers received on this association in order to generate 3526 the appropriate ack. 3528 If the PDU is of type "ack", the contents are as follows: 3530 ack_sequence 3531 The sequence number of the message being acknowledged. 3533 received 3534 A bitmask indicating if each of the previous 32 sequence numbers 3535 before this packet has been among the 32 packets most recently 3536 received on this connection. When a packet is received with a 3537 sequence number N, the receiver looks at the sequence number of 3538 the previously 32 packets received on this connection. Call the 3539 previously received packet number M. For each of the previous 32 3540 packets, if the sequence number M is less than N but greater than 3541 N-32, the N-M bit of the received bitmask is set to one; otherwise 3542 it is zero. Note that a bit being set to one indicates positively 3543 that a particular packet was received, but a bit being set to zero 3544 means only that it is unknown whether or not the packet has been 3545 received, because it might have been received before the 32 most 3546 recently received packets. 3548 The received field bits in the ACK provide a high degree of 3549 redundancy so that the sender can figure out which packets the 3550 receiver has received and can then estimate packet loss rates. If 3551 the sender also keeps track of the time at which recent sequence 3552 numbers have been sent, the RTT can be estimated. 3554 Note that because retransmissions receive new sequence numbers, 3555 multiple ACKs may be received for the same message. This approach 3556 provides more information than traditional TCP sequence numbers, but 3557 care must be taken when applying algorithms designed based on TCP's 3558 stream-oriented sequence number. 3560 5.6.3. Simple Reliability 3562 When RELOAD is carried over DTLS or another unreliable link protocol, 3563 it needs to be used with a reliability and congestion control 3564 mechanism, which is provided on a hop-by-hop basis. The basic 3565 principle is that each message, regardless of whether or not it 3566 carries a request or response, will get an ACK and be reliably 3567 retransmitted. The receiver's job is very simple, limited to just 3568 sending ACKs. All the complexity is at the sender side. This allows 3569 the sending implementation to trade off performance versus 3570 implementation complexity without affecting the wire protocol. 3572 Because the receiver's role is limited to providing packet 3573 acknowledgements, a wide variety of congestion control algorithms can 3574 be implemented on the sender side while using the same basic wire 3575 protocol. The sender algorithm used MUST meet the requirements of 3576 [RFC5405]. 3578 5.6.3.1. Stop and Wait Sender Algorithm 3580 This section describes one possible implementation of a sender 3581 algorithm for Simple Reliability. It is adequate for overlays 3582 running on underlying networks with low latency and loss (LANs) or 3583 low-traffic overlays on the Internet. 3585 A node MUST NOT have more than one unacknowledged message on the DTLS 3586 connection at a time. Note that because retransmissions of the same 3587 message are given new sequence numbers, there may be multiple 3588 unacknowledged sequence numbers in use. 3590 The RTO ("Retransmission TimeOut") is based on an estimate of the 3591 round-trip time (RTT). The value for RTO is calculated separately 3592 for each DTLS session. Implementations can use a static value for 3593 RTO or a dynamic estimate which will result in better performance. 3594 For implementations that use a static value, the default value for 3595 RTO is 500 ms. Nodes MAY use smaller values of RTO if it is known 3596 that all nodes are within the local network. The default RTO MAY be 3597 chosen larger, and this is RECOMMENDED if it is known in advance 3598 (such as on high latency access links) that the round-trip time is 3599 larger. 3601 Implementations that use a dynamic estimate to compute the RTO MUST 3602 use the algorithm described in RFC 6298[RFC6298], with the exception 3603 that the value of RTO SHOULD NOT be rounded up to the nearest second 3604 but instead rounded up to the nearest millisecond. The RTT of a 3605 successful STUN transaction from the ICE stage is used as the initial 3606 measurement for formula 2.2 of RFC 6298. The sender keeps track of 3607 the time each message was sent for all recently sent messages. Any 3608 time an ACK is received, the sender can compute the RTT for that 3609 message by looking at the time the ACK was received and the time when 3610 the message was sent. This is used as a subsequent RTT measurement 3611 for formula 2.3 of RFC 6298 to update the RTO estimate. (Note that 3612 because retransmissions receive new sequence numbers, all received 3613 ACKs are used.) 3615 A node SHOULD retransmit a message if it has not received an ACK 3616 after an interval of RTO. The node MUST double the time to wait 3617 after each retransmission. For each retransmission, the sequence 3618 number MUST be incremented. 3620 Retransmissions continue until a response is received, or until a 3621 total of 5 requests have been sent or there has been a hard ICMP 3622 error [RFC1122] or a TLS alert. The sender knows a response was 3623 received when it receives an ACK with a sequence number that 3624 indicates it is a response to one of the transmissions of this 3625 messages. For example, assuming an RTO of 500 ms, requests would be 3626 sent at times 0 ms, 500 ms, 1500 ms, 3500 ms, and 7500 ms. If all 3627 retransmissions for a message fail, then the sending node SHOULD 3628 close the connection routing the message. 3630 To determine when a link may be failing without waiting for the final 3631 timeout, observe when no ACKs have been received for an entire RTO 3632 interval, and then wait for three retransmissions to occur beyond 3633 that point. If no ACKs have been received by the time the third 3634 retransmission occurs, it is RECOMMENDED that the link be removed 3635 from the routing table. The link MAY be restored to the routing 3636 table if ACKs resume before the connection is closed, as described 3637 above. 3639 A sender MUST wait 10ms between receipt of an ACK and transmission of 3640 the next message. 3642 5.6.4. DTLS/UDP with SR 3644 This overlay link protocol consists of DTLS over UDP while 3645 implementing the Simple Reliability protocol. STUN Connectivity 3646 checks and keepalives are used. Any compliant sender algorithm may 3647 be used. 3649 5.6.5. TLS/TCP with FH, No-ICE 3651 This overlay link protocol consists of TLS over TCP with the framing 3652 header. Because ICE is not used, STUN connectivity checks are not 3653 used upon establishing the TCP connection, nor are they used for 3654 keepalives. 3656 Because the TCP layer's application-level timeout is too slow to be 3657 useful for overlay routing, the Overlay Link implementation MUST use 3658 the framing header to measure the RTT of the connection and calculate 3659 an RTO as specified in Section 2 of [RFC6298]. The resulting RTO is 3660 not used for retransmissions, but as a timeout to indicate when the 3661 link SHOULD be removed from the routing table. It is RECOMMENDED 3662 that such a connection be retained for 30s to determine if the 3663 failure was transient before concluding the link has failed 3664 permanently. 3666 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3667 candidate MUST be provided. 3669 5.6.6. DTLS/UDP with SR, No-ICE 3671 This overlay link protocol consists of DTLS over UDP while 3672 implementing the Simple Reliability protocol. Because ICE is not 3673 used, no STUN connectivity checks or keepalives are used. 3675 5.7. Fragmentation and Reassembly 3677 In order to allow transmission over datagram protocols such as DTLS, 3678 RELOAD messages may be fragmented. 3680 Any node along the path can fragment the message but only the final 3681 destination reassembles the fragments. When a node takes a packet 3682 and fragments it, each fragment has a full copy of the Forwarding 3683 Header but the data after the Forwarding Header is broken up in 3684 appropriate sized chunks. The size of the payload chunks needs to 3685 take into account space to allow the via and destination lists to 3686 grow. Each fragment MUST contain a full copy of the via and 3687 destination list and MUST contain at least 256 bytes of the message 3688 body. If the via and destination list are so large that this is not 3689 possible, RELOAD fragmentation is not performed and IP-layer 3690 fragmentation is allowed to occur. When a message must be 3691 fragmented, it SHOULD be split into equal-sized fragments that are no 3692 larger than the PMTU of the next overlay link minus 32 bytes. This 3693 is to allow the via list to grow before further fragmentation is 3694 required. 3696 Note that this fragmentation is not optimal for the end-to-end path - 3697 a message may be refragmented multiple times as it traverses the 3698 overlay but is only assembled at the final destination. This option 3699 has been chosen as it is far easier to implement than e2e PMTU 3700 discovery across an ever-changing overlay, and it effectively 3701 addresses the reliability issues of relying on IP-layer 3702 fragmentation. However, PING can be used to allow e2e PMTU discovery 3703 to be implemented if desired. 3705 Upon receipt of a fragmented message by the intended peer, the peer 3706 holds the fragments in a holding buffer until the entire message has 3707 been received. The message is then reassembled into a single message 3708 and processed. In order to mitigate denial of service attacks, 3709 receivers SHOULD time out incomplete fragments after maximum request 3710 lifetime (15 seconds). Note this time was derived from looking at 3711 the end to end retransmission time and saving fragments long enough 3712 for the full end to end retransmissions to take place. Ideally the 3713 receiver would have enough buffer space to deal with as many 3714 fragments as can arrive in the maximum request lifetime. However, if 3715 the receiver runs out of buffer space to reassemble the messages it 3716 MUST drop the message. 3718 When a message is fragmented, the fragment offset value is stored in 3719 the lower 24 bits of the fragment field of the forwarding header. 3720 The offset is the number of bytes between the end of the forwarding 3721 header and the start of the data. The first fragment therefore has 3722 an offset of 0. The first and last bit indicators MUST be 3723 appropriately set. If the message is not fragmented, then both the 3724 first and last fragment bits are set to 1 and the offset is 0 3725 resulting in a fragment value of 0xC0000000. Note that this means 3726 that the first fragment bit is always 1, so isn't actually that 3727 useful. 3729 6. Data Storage Protocol 3731 RELOAD provides a set of generic mechanisms for storing and 3732 retrieving data in the Overlay Instance. These mechanisms can be 3733 used for new applications simply by defining new code points and a 3734 small set of rules. No new protocol mechanisms are required. 3736 The basic unit of stored data is a single StoredData structure: 3738 struct { 3739 uint32 length; 3740 uint64 storage_time; 3741 uint32 lifetime; 3742 StoredDataValue value; 3743 Signature signature; 3744 } StoredData; 3746 The contents of this structure are as follows: 3748 length 3749 The size of the StoredData structure in octets excluding the size 3750 of length itself. 3752 storage_time 3753 The time when the data was stored represented as the number of 3754 milliseconds elapsed since midnight Jan 1, 1970 UTC not counting 3755 leap seconds. This will have the same values for seconds as 3756 standard UNIX time or POSIX time. More information can be found 3757 at [UnixTime]. Any attempt to store a data value with a storage 3758 time before that of a value already stored at this location MUST 3759 generate a Error_Data_Too_Old error. This prevents rollback 3760 attacks. The node SHOULD make a best-effort attempt to use a 3761 correct clock to determine this number, however, the protocol does 3762 not require synchronized clocks: the receiving peer uses the 3763 storage time in the previous store, not its own clock. Clock 3764 values are used so that when clocks are generally synchronized, 3765 data may be stored in a single transaction, rather than querying 3766 for the value of a counter before the actual store. 3767 If a node attempting to store new data in response to a user 3768 request (rather than as an overlay maintenance operation such as 3769 occurs during unpartitioning) is rejected with an 3770 Error_Data_Too_Old error, the node MAY elect to perform its store 3771 using a storage_time that increments the value used with the 3772 previous store. This situation may occur when the clocks of nodes 3773 storing to this location are not properly synchronized. 3775 lifetime 3776 The validity period for the data, in seconds, starting from the 3777 time the peer receives the StoreReq. 3779 value 3780 The data value itself, as described in Section 6.2. 3782 signature 3783 A signature as defined in Section 6.1. 3785 Each Resource-ID specifies a single location in the Overlay Instance. 3786 However, each location may contain multiple StoredData values 3787 distinguished by Kind-ID. The definition of a Kind describes both 3788 the data values which may be stored and the data model of the data. 3789 Some data models allow multiple values to be stored under the same 3790 Kind-ID. Section Section 6.2 describes the available data models. 3791 Thus, for instance, a given Resource-ID might contain a single-value 3792 element stored under Kind-ID X and an array containing multiple 3793 values stored under Kind-ID Y. 3795 6.1. Data Signature Computation 3797 Each StoredData element is individually signed. However, the 3798 signature also must be self-contained and cover the Kind-ID and 3799 Resource-ID even though they are not present in the StoredData 3800 structure. The input to the signature algorithm is: 3802 resource_id || kind || storage_time || StoredDataValue || 3803 SignerIdentity 3805 Where || indicates concatenation. 3807 Where these values are: 3809 resource_id 3810 The resource ID where this data is stored. 3812 kind 3813 The Kind-ID for this data. 3815 storage_time 3817 The contents of the storage_time data value. 3818 StoredDataValue 3819 The contents of the stored data value, as described in the 3820 previous sections. 3822 SignerIdentity 3823 The signer identity as defined in Section 5.3.4. 3825 Once the signature has been computed, the signature is represented 3826 using a signature element, as described in Section 5.3.4. 3828 Note that there is no necessarily relationship between the validity 3829 window of a certificate and the expiry of the data it is 3830 authenticating. When signatures are verified, the current time MUST 3831 be compared to the certificate validity period. However, it is 3832 permitted to have a value signed which expires after a certificate's 3833 validity period (though this will likely cause verification failure 3834 at some future time.) 3836 6.2. Data Models 3838 The protocol currently defines the following data models: 3840 o single value 3841 o array 3842 o dictionary 3844 These are represented with the StoredDataValue structure. The actual 3845 dataModel is known from the Kind being stored. 3847 struct { 3848 Boolean exists; 3849 opaque value<0..2^32-1>; 3850 } DataValue; 3852 struct { 3853 select (dataModel) { 3854 case single_value: 3855 DataValue single_value_entry; 3857 case array: 3858 ArrayEntry array_entry; 3860 case dictionary: 3861 DictionaryEntry dictionary_entry; 3863 /* This structure may be extended */ 3864 }; 3865 } StoredDataValue; 3867 We now discuss the properties of each data model in turn: 3869 6.2.1. Single Value 3871 A single-value element is a simple sequence of bytes. There may be 3872 only one single-value element for each Resource-ID, Kind-ID pair. 3874 A single value element is represented as a DataValue, which contains 3875 the following two elements: 3877 exists 3878 This value indicates whether the value exists at all. If it is 3879 set to False, it means that no value is present. If it is True, 3880 that means that a value is present. This gives the protocol a 3881 mechanism for indicating nonexistence as opposed to emptiness. 3883 value 3884 The stored data. 3886 6.2.2. Array 3888 An array is a set of opaque values addressed by an integer index. 3889 Arrays are zero based. Note that arrays can be sparse. For 3890 instance, a Store of "X" at index 2 in an empty array produces an 3891 array with the values [ NA, NA, "X"]. Future attempts to fetch 3892 elements at index 0 or 1 will return values with "exists" set to 3893 False. 3895 A array element is represented as an ArrayEntry: 3897 struct { 3898 uint32 index; 3899 DataValue value; 3900 } ArrayEntry; 3902 The contents of this structure are: 3904 index 3905 The index of the data element in the array. 3907 value 3908 The stored data. 3910 6.2.3. Dictionary 3912 A dictionary is a set of opaque values indexed by an opaque key with 3913 one value for each key. A single dictionary entry is represented as 3914 follows: 3916 A dictionary element is represented as a DictionaryEntry: 3918 typedef opaque DictionaryKey<0..2^16-1>; 3920 struct { 3921 DictionaryKey key; 3922 DataValue value; 3923 } DictionaryEntry; 3925 The contents of this structure are: 3927 key 3928 The dictionary key for this value. 3930 value 3931 The stored data. 3933 6.3. Access Control Policies 3935 Every Kind which is storable in an overlay MUST be associated with an 3936 access control policy. This policy defines whether a request from a 3937 given node to operate on a given value should succeed or fail. It is 3938 anticipated that only a small number of generic access control 3939 policies are required. To that end, this section describes a small 3940 set of such policies and Section 13.4 establishes a registry for new 3941 policies if required. Each policy has a short string identifier 3942 which is used to reference it in the configuration document. 3944 In the following policies, the term "signer" refers to the signer of 3945 the StoredValue object and, in the case of non-replica stores, to the 3946 signer of the StoreReq message. I.e., in a non-replica store, both 3947 the signer of the StoredValue and the signer of the StoreReq MUST 3948 conform to the policy. In the case of a replica store, the signer of 3949 the StoredValue MUST conform to the policy and the StoreReq itself 3950 MUST be checked as described in Section 6.4.1.1. 3952 6.3.1. USER-MATCH 3954 In the USER-MATCH policy, a given value MUST be written (or 3955 overwritten) if and only if the signer's certificate has a user name 3956 which hashes (using the hash function for the overlay) to the 3957 Resource-ID for the resource. Recall that the certificate may, 3958 depending on the overlay configuration, be self-signed. 3960 6.3.2. NODE-MATCH 3962 In the NODE-MATCH policy, a given value MUST be written (or 3963 overwritten) if and only if the signer's certificate has a specified 3964 Node-ID which hashes (using the hash function for the overlay) to the 3965 Resource-ID for the resource and that Node-ID is the one indicated in 3966 the SignerIdentity value cert_hash. 3968 6.3.3. USER-NODE-MATCH 3970 The USER-NODE-MATCH policy may only be used with dictionary types. 3971 In the USER-NODE-MATCH policy, a given value MUST be written (or 3972 overwritten) if and only if the signer's certificate has a user name 3973 which hashes (using the hash function for the overlay) to the 3974 Resource-ID for the resource. In addition, the dictionary key MUST 3975 be equal to the Node-ID in the certificate and that Node-ID MUST be 3976 the one indicated in the SignerIdentity value cert_hash. 3978 6.3.4. NODE-MULTIPLE 3980 In the NODE-MULTIPLE policy, a given value MUST be written (or 3981 overwritten) if and only if signer's certificate contains a Node-ID 3982 such that H(Node-ID || i) is equal to the Resource-ID for some small 3983 integer value of i and that Node-ID is the one indicated in the 3984 SignerIdentity value cert_hash. When this policy is in use, the 3985 maximum value of i MUST be specified in the Kind definition. 3987 Note that as i is not carried on the wire, the verifier MUST iterate 3988 through potential i values up to the maximum value in order to 3989 determine whether a store is acceptable. 3991 6.4. Data Storage Methods 3993 RELOAD provides several methods for storing and retrieving data: 3995 o Store values in the overlay 3996 o Fetch values from the overlay 3997 o Stat: get metadata about values in the overlay 3998 o Find the values stored at an individual peer 4000 These methods are each described in the following sections. 4002 6.4.1. Store 4004 The Store method is used to store data in the overlay. The format of 4005 the Store request depends on the data model which is determined by 4006 the Kind. 4008 6.4.1.1. Request Definition 4010 A StoreReq message is a sequence of StoreKindData values, each of 4011 which represents a sequence of stored values for a given Kind. The 4012 same Kind-ID MUST NOT be used twice in a given store request. Each 4013 value is then processed in turn. These operations MUST be atomic. 4014 If any operation fails, the state MUST be rolled back to before the 4015 request was received. 4017 The store request is defined by the StoreReq structure: 4019 struct { 4020 KindId kind; 4021 uint64 generation_counter; 4022 StoredData values<0..2^32-1>; 4023 } StoreKindData; 4025 struct { 4026 ResourceId resource; 4027 uint8 replica_number; 4028 StoreKindData kind_data<0..2^32-1>; 4029 } StoreReq; 4031 A single Store request stores data of a number of kinds to a single 4032 resource location. The contents of the structure are: 4034 resource 4035 The resource to store at. 4037 replica_number 4038 The number of this replica. When a storing peer saves replicas to 4039 other peers each peer is assigned a replica number starting from 1 4040 and sent in the Store message. This field is set to 0 when a node 4041 is storing its own data. This allows peers to distinguish replica 4042 writes from original writes. 4044 kind_data 4045 A series of elements, one for each Kind of data to be stored. 4047 If the replica number is zero, then the peer MUST check that it is 4048 responsible for the resource and, if not, reject the request. If the 4049 replica number is nonzero, then the peer MUST check that it expects 4050 to be a replica for the resource and that the request sender is 4051 consistent with being the responsible node (i.e., that the receiving 4052 peer does not know of a better node) and, if not, reject the request. 4054 Each StoreKindData element represents the data to be stored for a 4055 single Kind-ID. The contents of the element are: 4057 kind 4058 The Kind-ID. Implementations MUST reject requests corresponding 4059 to unknown Kinds. 4061 generation_counter 4062 The expected current state of the generation counter 4063 (approximately the number of times this object has been written; 4064 see below for details). 4066 values 4067 The value or values to be stored. This may contain one or more 4068 stored_data values depending on the data model associated with 4069 each Kind. 4071 The peer MUST perform the following checks: 4073 o The Kind-ID is known and supported. 4074 o The signatures over each individual data element (if any) are 4075 valid. If this check fails, the request MUST be rejected with an 4076 Error_Forbidden error. 4077 o Each element is signed by a credential which is authorized to 4078 write this Kind at this Resource-ID. If this check fails, the 4079 request MUST be rejected with an Error_Forbidden error. 4080 o For original (non-replica) stores, the StoreReq is signed by a 4081 credential which is authorized to write this Kind at this 4082 Resource-Id. If this check fails, the request MUST be rejected 4083 with an Error_Forbidden error. 4084 o For replica stores, the StoreReq is signed by a Node-Id which is a 4085 plausible node to either have originally stored the value or in 4086 the replica set. What this means is overlay specific, but in the 4087 case of the Chord based DHT defined in this specification, replica 4088 StoreReqs MUST come from nodes which are either in the known 4089 replica set for a given resource or which are closer than some 4090 node in the replica set. If this check fails, the request MUST be 4091 rejected with an Error_Forbidden error. 4092 o For original (non-replica) stores, the peer MUST check that if the 4093 generation counter is non-zero, it equals the current value of the 4094 generation counter for this Kind. This feature allows the 4095 generation counter to be used in a way similar to the HTTP Etag 4096 feature. 4097 o For replica Stores, the peer MUST set the generation counter to 4098 match the generation counter in the message, and MUST NOT check 4099 the generation counter against the current value. Replica Stores 4100 MUST NOT use a generation counter of 0. 4101 o The storage time values are greater than that of any value which 4102 would be replaced by this Store. 4104 o The size and number of the stored values is consistent with the 4105 limits specified in the overlay configuration. 4106 o If the data is signed with identity_type set to "none" and/or 4107 SignatureAndHashAlgorithm values set to {0, 0} ("anonymous" and 4108 "none"), the StoreReq MUST be rejected with an Error_forbidden 4109 error. Only synthesized data returned by the storage can use 4110 these values 4112 If all these checks succeed, the peer MUST attempt to store the data 4113 values. For non-replica stores, if the store succeeds and the data 4114 is changed, then the peer must increase the generation counter by at 4115 least one. If there are multiple stored values in a single 4116 StoreKindData, it is permissible for the peer to increase the 4117 generation counter by only 1 for the entire Kind-ID, or by 1 or more 4118 than one for each value. Accordingly, all stored data values must 4119 have a generation counter of 1 or greater. 0 is used in the Store 4120 request to indicate that the generation counter should be ignored for 4121 processing this request; however the responsible peer should increase 4122 the stored generation counter and should return the correct 4123 generation counter in the response. 4125 When a peer stores data previously stored by another node (e.g., for 4126 replicas or topology shifts) it MUST adjust the lifetime value 4127 downward to reflect the amount of time the value was stored at the 4128 peer. The adjustment SHOULD be implemented by an algorithm 4129 equivalent to the following: at the time the peer initially receives 4130 the StoreReq it notes the local time T. When it then attempts to do a 4131 StoreReq to another node it should decrement the lifetime value by 4132 the difference between the current local time and T. 4134 Unless otherwise specified by the usage, if a peer attempts to store 4135 data previously stored by another node (e.g., for replicas or 4136 topology shifts) and that store fails with either an 4137 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 4138 peer MUST fetch the newer data from the peer generating the error and 4139 use that to replace its own copy. This rule allows resynchronization 4140 after partitions heal. 4142 The properties of stores for each data model are as follows: 4144 Single-value: 4145 A store of a new single-value element creates the element if it 4146 does not exist and overwrites any existing value with the new 4147 value. 4149 Array: 4150 A store of an array entry replaces (or inserts) the given value at 4151 the location specified by the index. Because arrays are sparse, a 4152 store past the end of the array extends it with nonexistent values 4153 (exists=False) as required. A store at index 0xffffffff places 4154 the new value at the end of the array regardless of the length of 4155 the array. The resulting StoredData has the correct index value 4156 when it is subsequently fetched. 4158 Dictionary: 4159 A store of a dictionary entry replaces (or inserts) the given 4160 value at the location specified by the dictionary key. 4162 The following figure shows the relationship between these structures 4163 for an example store which stores the following values at resource 4164 "1234" 4166 o The value "abc" in the single value location for Kind X 4167 o The value "foo" at index 0 in the array for Kind Y 4168 o The value "bar" at index 1 in the array for Kind Y 4170 Store 4171 resource=1234 4172 replica_number = 0 4173 / \ 4174 / \ 4175 StoreKindData StoreKindData 4176 kind=X (Single-Value) kind=Y (Array) 4177 generation_counter = 99 generation_counter = 107 4178 | /\ 4179 | / \ 4180 StoredData / \ 4181 storage_time = xxxxxxx / \ 4182 lifetime = 86400 / \ 4183 signature = XXXX / \ 4184 | | | 4185 | StoredData StoredData 4186 | storage_time = storage_time = 4187 | yyyyyyyy zzzzzzz 4188 | lifetime = 86400 lifetime = 33200 4189 | signature = YYYY signature = ZZZZ 4190 | | | 4191 StoredDataValue | | 4192 value="abc" | | 4193 | | 4194 StoredDataValue StoredDataValue 4195 index=0 index=1 4197 value="foo" value="bar" 4199 6.4.1.2. Response Definition 4201 In response to a successful Store request the peer MUST return a 4202 StoreAns message containing a series of StoreKindResponse elements 4203 containing the current value of the generation counter for each 4204 Kind-ID, as well as a list of the peers where the data will be 4205 replicated by the node processing the request. 4207 struct { 4208 KindId kind; 4209 uint64 generation_counter; 4210 NodeId replicas<0..2^16-1>; 4211 } StoreKindResponse; 4213 struct { 4214 StoreKindResponse kind_responses<0..2^16-1>; 4215 } StoreAns; 4217 The contents of each StoreKindResponse are: 4219 kind 4220 The Kind-ID being represented. 4222 generation_counter 4223 The current value of the generation counter for that Kind-ID. 4225 replicas 4226 The list of other peers at which the data was/will be replicated. 4227 In overlays and applications where the responsible peer is 4228 intended to store redundant copies, this allows the storing peer 4229 to independently verify that the replicas have in fact been 4230 stored. It does this verification by using the Stat method (see 4231 Section 6.4.3). Note that the storing peer is not required to 4232 perform this verification. 4234 The response itself is just StoreKindResponse values packed end-to- 4235 end. 4237 If any of the generation counters in the request precede the 4238 corresponding stored generation counter, then the peer MUST fail the 4239 entire request and respond with an Error_Generation_Counter_Too_Low 4240 error. The error_info in the ErrorResponse MUST be a StoreAns 4241 response containing the correct generation counter for each Kind and 4242 the replica list, which will be empty. For original (non-replica) 4243 stores, a node which receives such an error SHOULD attempt to fetch 4244 the data and, if the storage_time value is newer, replace its own 4245 data with that newer data. This rule improves data consistency in 4246 the case of partitions and merges. 4248 If the data being stored is too large for the allowed limit by the 4249 given usage, then the peer MUST fail the request and generate an 4250 Error_Data_Too_Large error. 4252 If any type of request tries to access a data Kind that the node does 4253 not know about, an Error_Unknown_Kind MUST be generated. The 4254 error_info in the Error_Response is: 4256 KindId unknown_kinds<0..2^8-1>; 4258 which lists all the Kinds that were unrecognized. A node which 4259 receives this error MUST generate a ConfigUpdate message which 4260 contains the appropriate Kind definition (assuming that in fact a 4261 Kind was used which was defined in the configuration document). 4263 6.4.1.3. Removing Values 4265 RELOAD does not have an explicit Remove operation. Rather, values 4266 are Removed by storing "nonexistent" values in their place. Each 4267 DataValue contains a boolean value called "exists" which indicates 4268 whether a value is present at that location. In order to effectively 4269 remove a value, the owner stores a new DataValue with "exists" set to 4270 "false": 4272 exists = false 4273 value = {} (0 length) 4275 The owner SHOULD use a lifetime for the nonexistent value at least as 4276 long as the remainder of the lifetime of the value it is replacing; 4277 otherwise it is possible for the original value to be accidentally or 4278 maliciously re-stored after the storing node has expired it. Note 4279 that there is still a window of vulnerability for replay attack after 4280 the original lifetime has expired (as with any store). This attack 4281 can be mitigated by doing a nonexistent store with a very long 4282 lifetime. 4284 Storing nodes MUST treat these nonexistent values the same way they 4285 treat any other stored value, including overwriting the existing 4286 value, replicating them, and aging them out as necessary when 4287 lifetime expires. When a stored nonexistent value's lifetime 4288 expires, it is simply removed from the storing node like any other 4289 stored value expiration. 4291 Note that in the case of arrays and dictionaries, expiration may 4292 create an implicit, unsigned "nonexistent" value to represent a gap 4293 in the data structure, as might happen when any value is aged out. 4294 However, this value isn't persistent nor is it replicated. It is 4295 simply synthesized by the storing node. 4297 6.4.2. Fetch 4299 The Fetch request retrieves one or more data elements stored at a 4300 given Resource-ID. A single Fetch request can retrieve multiple 4301 different Kinds. 4303 6.4.2.1. Request Definition 4305 struct { 4306 int32 first; 4307 int32 last; 4308 } ArrayRange; 4310 struct { 4311 KindId kind; 4312 uint64 generation; 4313 uint16 length; 4315 select (dataModel) { 4316 case single_value: ; /* Empty */ 4318 case array: 4319 ArrayRange indices<0..2^16-1>; 4321 case dictionary: 4322 DictionaryKey keys<0..2^16-1>; 4324 /* This structure may be extended */ 4326 } model_specifier; 4327 } StoredDataSpecifier; 4329 struct { 4330 ResourceId resource; 4331 StoredDataSpecifier specifiers<0..2^16-1>; 4332 } FetchReq; 4334 The contents of the Fetch requests are as follows: 4336 resource 4337 The Resource-ID to fetch from. 4339 specifiers 4340 A sequence of StoredDataSpecifier values, each specifying some of 4341 the data values to retrieve. 4343 Each StoredDataSpecifier specifies a single Kind of data to retrieve 4344 and (if appropriate) the subset of values that are to be retrieved. 4345 The contents of the StoredDataSpecifier structure are as follows: 4347 kind 4348 The Kind-ID of the data being fetched. Implementations SHOULD 4349 reject requests corresponding to unknown Kinds unless specifically 4350 configured otherwise. 4352 dataModel 4353 The data model of the data. This is not transmitted on the wire 4354 but comes from the definition of the Kind. 4356 generation 4357 The last generation counter that the requesting node saw. This 4358 may be used to avoid unnecessary fetches or it may be set to zero. 4360 length 4361 The length of the rest of the structure, thus allowing 4362 extensibility. 4364 model_specifier 4365 A reference to the data value being requested within the data 4366 model specified for the Kind. For instance, if the data model is 4367 "array", it might specify some subset of the values. 4369 The model_specifier is as follows: 4371 o If the data model is single value, the specifier is empty. 4372 o If the data model is array, the specifier contains a list of 4373 ArrayRange elements, each of which contains two integers. The 4374 first integer is the beginning of the range and the second is the 4375 end of the range. 0 is used to indicate the first element and 4376 0xffffffff is used to indicate the final element. The first 4377 integer must be less than the second. While multiple ranges MAY 4378 be specified, they MUST NOT overlap. 4379 o If the data model is dictionary then the specifier contains a list 4380 of the dictionary keys being requested. If no keys are specified, 4381 than this is a wildcard fetch and all key-value pairs are 4382 returned. 4384 The generation counter is used to indicate the requester's expected 4385 state of the storing peer. If the generation counter in the request 4386 matches the stored counter, then the storing peer returns a response 4387 with no StoredData values. 4389 Note that because the certificate for a user is typically stored at 4390 the same location as any data stored for that user, a requesting node 4391 that does not already have the user's certificate should request the 4392 certificate in the Fetch as an optimization. 4394 6.4.2.2. Response Definition 4396 The response to a successful Fetch request is a FetchAns message 4397 containing the data requested by the requester. 4399 struct { 4400 KindId kind; 4401 uint64 generation; 4402 StoredData values<0..2^32-1>; 4403 } FetchKindResponse; 4405 struct { 4406 FetchKindResponse kind_responses<0..2^32-1>; 4407 } FetchAns; 4409 The FetchAns structure contains a series of FetchKindResponse 4410 structures. There MUST be one FetchKindResponse element for each 4411 Kind-ID in the request. 4413 The contents of the FetchKindResponse structure are as follows: 4415 kind 4416 the Kind that this structure is for. 4418 generation 4419 the generation counter for this Kind. 4421 values 4422 the relevant values. If the generation counter in the request 4423 matches the generation counter in the stored data, then no 4424 StoredData values are returned. Otherwise, all relevant data 4425 values MUST be returned. A nonexistent value (i.e., one which the 4426 node has no knowledge of) is represented by a synthetic value with 4427 "exists" set to False and has an empty signature. Specifically, 4428 the identity_type is set to "none", the SignatureAndHashAlgorithm 4429 values are set to {0, 0} ("anonymous" and "none" respectively), 4430 and the signature value is of zero length. This removes the need 4431 for the responding node to do signatures for values which do not 4432 exist. These signatures are unnecessary as the entire response is 4433 signed by that node. Note that entries which have been removed by 4434 the procedure of Section 6.4.1.3 and have not yet expired also 4435 have exists = false but have valid signatures from the node which 4436 did the store. 4438 Upon receipt of a FetchAns message, nodes MUST verify the signatures 4439 on all the received values. Any values with invalid signatures MUST 4440 be discarded. Implementations MAY return the subset of values with 4441 valid signatures, but in that case SHOULD somehow signal to the 4442 application that a partial response was received. 4444 There is one subtle point about signature computation on arrays. If 4445 the storing node uses the append feature (where the 4446 index=0xffffffff), then the index in the StoredData that is returned 4447 will not match that used by the storing node, which would break the 4448 signature. In order to avoid this issue, the index value in the 4449 array is set to zero before the signature is computed. This implies 4450 that malicious storing nodes can reorder array entries without being 4451 detected. 4453 6.4.3. Stat 4455 The Stat request is used to get metadata (length, generation counter, 4456 digest, etc.) for a stored element without retrieving the element 4457 itself. The name is from the UNIX stat(2) system call which performs 4458 a similar function for files in a file system. It also allows the 4459 requesting node to get a list of matching elements without requesting 4460 the entire element. 4462 6.4.3.1. Request Definition 4464 The Stat request is identical to the Fetch request. It simply 4465 specifies the elements to get metadata about. 4467 struct { 4468 ResourceId resource; 4469 StoredDataSpecifier specifiers<0..2^16-1>; 4470 } StatReq; 4472 6.4.3.2. Response Definition 4474 The Stat response contains the same sort of entries that a Fetch 4475 response would contain; however, instead of containing the element 4476 data it contains metadata. 4478 struct { 4479 Boolean exists; 4480 uint32 value_length; 4481 HashAlgorithm hash_algorithm; 4482 opaque hash_value<0..255>; 4483 } MetaData; 4485 struct { 4486 uint32 index; 4487 MetaData value; 4488 } ArrayEntryMeta; 4490 struct { 4491 DictionaryKey key; 4492 MetaData value; 4493 } DictionaryEntryMeta; 4495 struct { 4496 select (model) { 4497 case single_value: 4498 MetaData single_value_entry; 4500 case array: 4501 ArrayEntryMeta array_entry; 4503 case dictionary: 4504 DictionaryEntryMeta dictionary_entry; 4506 /* This structure may be extended */ 4507 }; 4508 } MetaDataValue; 4510 struct { 4511 uint32 value_length; 4512 uint64 storage_time; 4513 uint32 lifetime; 4514 MetaDataValue metadata; 4515 } StoredMetaData; 4517 struct { 4518 KindId kind; 4519 uint64 generation; 4520 StoredMetaData values<0..2^32-1>; 4521 } StatKindResponse; 4523 struct { 4524 StatKindResponse kind_responses<0..2^32-1>; 4525 } StatAns; 4527 The structures used in StatAns parallel those used in FetchAns: a 4528 response consists of multiple StatKindResponse values, one for each 4529 kind that was in the request. The contents of the StatKindResponse 4530 are the same as those in the FetchKindResponse, except that the 4531 values list contains StoredMetaData entries instead of StoredData 4532 entries. 4534 The contents of the StoredMetaData structure are the same as the 4535 corresponding fields in StoredData except that there is no signature 4536 field and the value is a MetaDataValue rather than a StoredDataValue. 4538 A MetaDataValue is a variant structure, like a StoredDataValue, 4539 except for the types of each arm, which replace DataValue with 4540 MetaData. 4542 The only really new structure is MetaData, which has the following 4543 contents: 4545 exists 4546 Same as in DataValue 4548 value_length 4549 The length of the stored value. 4551 hash_algorithm 4552 The hash algorithm used to perform the digest of the value. 4554 hash_value 4555 A digest of the value using hash_algorithm. 4557 6.4.4. Find 4559 The Find request can be used to explore the Overlay Instance. A Find 4560 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4561 (if any) of the resource of kind T known to the target peer which is 4562 closest to R. This method can be used to walk the Overlay Instance by 4563 iteratively fetching R_n+1=nearest(1 + R_n). 4565 6.4.4.1. Request Definition 4567 The FindReq message contains a Resource-ID and a series of Kind-IDs 4568 identifying the resource the peer is interested in. 4570 struct { 4571 ResourceId resource; 4572 KindId kinds<0..2^8-1>; 4573 } FindReq; 4575 The request contains a list of Kind-IDs which the Find is for, as 4576 indicated below: 4578 resource 4579 The desired Resource-ID 4581 kinds 4582 The desired Kind-IDs. Each value MUST only appear once, and if 4583 not the request MUST be rejected with an error. 4585 6.4.4.2. Response Definition 4587 A response to a successful Find request is a FindAns message 4588 containing the closest Resource-ID on the peer for each kind 4589 specified in the request. 4591 struct { 4592 KindId kind; 4593 ResourceId closest; 4594 } FindKindData; 4596 struct { 4597 FindKindData results<0..2^16-1>; 4598 } FindAns; 4600 If the processing peer is not responsible for the specified 4601 Resource-ID, it SHOULD return an Error_Not_Found error code. 4603 For each Kind-ID in the request the response MUST contain a 4604 FindKindData indicating the closest Resource-ID for that Kind-ID, 4605 unless the kind is not allowed to be used with Find in which case a 4606 FindKindData for that Kind-ID MUST NOT be included in the response. 4607 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4608 0. Note that different Kind-IDs may have different closest Resource- 4609 IDs. 4611 The response is simply a series of FindKindData elements, one per 4612 kind, concatenated end-to-end. The contents of each element are: 4614 kind 4615 The Kind-ID. 4617 closest 4618 The closest resource ID to the specified resource ID. This is 0 4619 if no resource ID is known. 4621 Note that the response does not contain the contents of the data 4622 stored at these Resource-IDs. If the requester wants this, it must 4623 retrieve it using Fetch. 4625 6.4.5. Defining New Kinds 4627 There are two ways to define a new Kind. The first is by writing a 4628 document and registering the Kind-ID with IANA. This is the 4629 preferred method for Kinds which may be widely used and reused. The 4630 second method is to simply define the Kind and its parameters in the 4631 configuration document using the section of Kind-id space set aside 4632 for private use. This method MAY be used to define ad hoc Kinds in 4633 new overlays. 4635 However a Kind is defined, the definition must include: 4637 o The meaning of the data to be stored (in some textual form). 4638 o The Kind-ID. 4639 o The data model (single value, array, dictionary, etc). 4640 o The access control model. 4642 In addition, when Kinds are registered with IANA, each Kind is 4643 assigned a short string name which is used to refer to it in 4644 configuration documents. 4646 While each Kind needs to define what data model is used for its data, 4647 that does not mean that it must define new data models. Where 4648 practical, Kinds should use the existing data models. The intention 4649 is that the basic data model set be sufficient for most applications/ 4650 usages. 4652 7. Certificate Store Usage 4654 The Certificate Store usage allows a peer to store its certificate in 4655 the overlay, thus avoiding the need to send a certificate in each 4656 message - a reference may be sent instead. 4658 A user/peer MUST store its certificate at Resource-IDs derived from 4659 two Resource Names: 4661 o The user name in the certificate. 4663 o The Node-ID in the certificate. 4665 Note that in the second case the certificate is not stored at the 4666 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4667 intention here (as is common throughout RELOAD) is to avoid making a 4668 peer responsible for its own data. 4670 A peer MUST ensure that the user's certificates are stored in the 4671 Overlay Instance. New certificates are stored at the end of the 4672 list. This structure allows users to store an old and a new 4673 certificate that both have the same Node-ID, which allows for 4674 migration of certificates when they are renewed. 4676 This usage defines the following Kinds: 4678 Name: CERTIFICATE_BY_NODE 4680 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4682 Access Control: NODE-MATCH. 4684 Name: CERTIFICATE_BY_USER 4686 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4688 Access Control: USER-MATCH. 4690 8. TURN Server Usage 4692 The TURN server usage allows a RELOAD peer to advertise that it is 4693 prepared to be a TURN server as defined in [RFC5766]. When a node 4694 starts up, it joins the overlay network and forms several connections 4695 in the process. If the ICE stage in any of these connections returns 4696 a reflexive address that is not the same as the peer's perceived 4697 address, then the peer is behind a NAT and not a candidate for a TURN 4698 server. Additionally, if the peer's IP address is in the private 4699 address space range, then it is also not a candidate for a TURN 4700 server. Otherwise, the peer SHOULD assume it is a potential TURN 4701 server and follow the procedures below. 4703 If the node is a candidate for a TURN server it will insert some 4704 pointers in the overlay so that other peers can find it. The overlay 4705 configuration file specifies a turn-density parameter that indicates 4706 how many times each TURN server should record itself in the overlay. 4707 Typically this should be set to the reciprocal of the estimate of 4708 what percentage of peers will act as TURN servers. If the turn- 4709 density is not set to zero, for each value, called d, between 1 and 4710 turn-density, the peer forms a Resource Name by concatenating its 4711 Node-ID and the value d. This Resource Name is hashed to form a 4712 Resource-ID. The address of the peer is stored at that Resource-ID 4713 using type TURN-SERVICE and the TurnServer object: 4715 struct { 4716 uint8 iteration; 4717 IpAddressAndPort server_address; 4718 } TurnServer; 4720 The contents of this structure are as follows: 4722 iteration 4723 the d value 4725 server_address 4726 the address at which the TURN server can be contacted. 4728 Note: Correct functioning of this algorithm depends on having turn- 4729 density be an reasonable estimate of the reciprocal of the 4730 proportion of nodes in the overlay that can act as TURN servers. 4731 If the turn-density value in the configuration file is too low, 4732 then the process of finding TURN servers becomes more expensive as 4733 multiple candidate Resource-IDs must be probed to find a TURN 4734 server. 4736 Peers that provide this service need to support the TURN extensions 4737 to STUN for media relay as defined in [RFC5766]. 4739 This usage defines the following Kind to indicate that a peer is 4740 willing to act as a TURN server: 4742 Name TURN-SERVICE 4743 Data Model The TURN-SERVICE Kind stores a single value for each 4744 Resource-ID. 4745 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4747 Peers can find other servers by selecting a random Resource-ID and 4748 then doing a Find request for the appropriate Kind-ID with that 4749 Resource-ID. The Find request gets routed to a random peer based on 4750 the Resource-ID. If that peer knows of any servers, they will be 4751 returned. The returned response may be empty if the peer does not 4752 know of any servers, in which case the process gets repeated with 4753 some other random Resource-ID. As long as the ratio of servers 4754 relative to peers is not too low, this approach will result in 4755 finding a server relatively quickly. 4757 NOTE TO IMPLEMENTERS: As the access control for this usage is not 4758 CERTIFICATE_BY_NODE or CERTIFICATE_BY_USER, the certificates used by 4759 TurnServer entries need to be retained as described in Section 5.3.4. 4761 9. Chord Algorithm 4763 This algorithm is assigned the name CHORD-RELOAD to indicate it is an 4764 adaptation of the basic Chord based DHT algorithm. 4766 This algorithm differs from the originally presented Chord algorithm 4767 [Chord]. It has been updated based on more recent research results 4768 and implementation experiences, and to adapt it to the RELOAD 4769 protocol. A short list of differences: 4771 o The original Chord algorithm specified that a single predecessor 4772 and a successor list be stored. The CHORD-RELOAD algorithm 4773 attempts to have more than one predecessor and successor. The 4774 predecessor sets help other neighbors learn their successor list. 4775 o The original Chord specification and analysis called for iterative 4776 routing. RELOAD specifies recursive routing. In addition to the 4777 performance implications, the cost of NAT traversal dictates 4778 recursive routing. 4779 o Finger table entries are indexed in opposite order. Original 4780 Chord specifies finger[0] as the immediate successor of the peer. 4781 CHORD-RELOAD specifies finger[0] as the peer 180 degrees around 4782 the ring from the peer. This change was made to simplify 4783 discussion and implementation of variable sized finger tables. 4784 However, with either approach no more than O(log N) entries should 4785 typically be stored in a finger table. 4786 o The stabilize() and fix_fingers() algorithms in the original Chord 4787 algorithm are merged into a single periodic process. 4788 Stabilization is implemented slightly differently because of the 4789 larger neighborhood, and fix_fingers is not as aggressive to 4790 reduce load, nor does it search for optimal matches of the finger 4791 table entries. 4792 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4793 not designed to be used in networks with close to or more than 4794 2^128 nodes (and it is hard to see how one would assemble such a 4795 network). 4796 o RELOAD uses randomized finger entries as described in 4797 Section 9.7.4.2. 4798 o This algorithm allows the use of either reactive or periodic 4799 recovery. The original Chord paper used periodic recovery. 4800 Reactive recovery provides better performance in small overlays, 4801 but is believed to be unstable in large (>1000) overlays with high 4802 levels of churn [handling-churn-usenix04]. The overlay 4803 configuration file specifies a "chord-reactive" element that 4804 indicates whether reactive recovery should be used. 4806 9.1. Overview 4808 The algorithm described here is a modified version of the Chord 4809 algorithm. Each peer keeps track of a finger table and a neighbor 4810 table. The neighbor table contains at least the three peers before 4811 and after this peer in the DHT ring. There may not be three entries 4812 in all cases such as small rings or while the ring topology is 4813 changing. The first entry in the finger table contains the peer 4814 half-way around the ring from this peer; the second entry contains 4815 the peer that is 1/4 of the way around; the third entry contains the 4816 peer that is 1/8th of the way around, and so on. Fundamentally, the 4817 chord data structure can be thought of a doubly-linked list formed by 4818 knowing the successors and predecessor peers in the neighbor table, 4819 sorted by the Node-ID. As long as the successor peers are correct, 4820 the DHT will return the correct result. The pointers to the prior 4821 peers are kept to enable the insertion of new peers into the list 4822 structure. Keeping multiple predecessor and successor pointers makes 4823 it possible to maintain the integrity of the data structure even when 4824 consecutive peers simultaneously fail. The finger table forms a skip 4825 list, so that entries in the linked list can be found in O(log(N)) 4826 time instead of the typical O(N) time that a linked list would 4827 provide. 4829 A peer, n, is responsible for a particular Resource-ID k if k is less 4830 than or equal to n and k is greater than p, where p is the Node-ID of 4831 the previous peer in the neighbor table. Care must be taken when 4832 computing to note that all math is modulo 2^128. 4834 9.2. Hash Function 4836 For this Chord based topology plugin, the size of the Resource-ID is 4837 128 bits. The hash of a Resource-ID is computed using SHA-1 4838 [RFC3174]then truncating the SHA-1 result to the most significant 128 4839 bits. 4841 9.3. Routing 4843 The routing table is the union of the neighbor table and the finger 4844 table. 4846 If a peer is not responsible for a Resource-ID k, but is directly 4847 connected to a node with Node-ID k, then it routes the message to 4848 that node. Otherwise, it routes the request to the peer in the 4849 routing table that has the largest Node-ID that is in the interval 4850 between the peer and k. If no such node is found, it finds the 4851 smallest Node-Id that is greater than k and routes the message to 4852 that node. 4854 9.4. Redundancy 4856 When a peer receives a Store request for Resource-ID k, and it is 4857 responsible for Resource-ID k, it stores the data and returns a 4858 success response. It then sends a Store request to its successor in 4859 the neighbor table and to that peer's successor. Note that these 4860 Store requests are addressed to those specific peers, even though the 4861 Resource-ID they are being asked to store is outside the range that 4862 they are responsible for. The peers receiving these check they came 4863 from an appropriate predecessor in their neighbor table and that they 4864 are in a range that this predecessor is responsible for, and then 4865 they store the data. They do not themselves perform further Stores 4866 because they can determine that they are not responsible for the 4867 Resource-ID. 4869 Managing replicas as the overlay changes is described in 4870 Section 9.7.3. 4872 The sequential replicas used in this overlay algorithm protect 4873 against peer failure but not against malicious peers. Additional 4874 replication from the Usage is required to protect resources from such 4875 attacks, as discussed in Section 12.5.4. 4877 9.5. Joining 4879 The join process for a joining party (JP) with Node-ID n is as 4880 follows. 4882 1. JP MUST connect to its chosen bootstrap node. 4883 2. JP SHOULD send an Attach request to the admitting peer (AP) for 4884 Node-ID n. The "send_update" flag should be used to acquire the 4885 routing table for AP. 4886 3. JP SHOULD send Attach requests to initiate connections to each of 4887 the peers in the neighbor table as well as to the desired finger 4888 table entries. Note that this does not populate their routing 4889 tables, but only their connection tables, so JP will not get 4890 messages that it is expected to route to other nodes. 4891 4. JP MUST enter all the peers it has contacted into its routing 4892 table. 4893 5. JP MUST send a Join to AP. The AP sends the response to the 4894 Join. 4895 6. AP MUST do a series of Store requests to JP to store the data 4896 that JP will be responsible for. 4898 7. AP MUST send JP an Update explicitly labeling JP as its 4899 predecessor. At this point, JP is part of the ring and 4900 responsible for a section of the overlay. AP can now forget any 4901 data which is assigned to JP and not AP. 4902 8. The AP MUST send an Update to all of its neighbors with the new 4903 values of its neighbor set (including JP). 4904 9. The JP MUST send Updates to all the peers in its neighbor table. 4906 If JP sends an Attach to AP with send_update, it immediately knows 4907 most of its expected neighbors from AP's routing table update and can 4908 directly connect to them. This is the RECOMMENDED procedure. 4910 If for some reason JP does not get AP's routing table, it can still 4911 populate its neighbor table incrementally. It sends a Ping directed 4912 at Resource-ID n+1 (directly after its own Resource-ID). This allows 4913 it to discover its own successor. Call that node p0. It then sends 4914 a ping to p0+1 to discover its successor (p1). This process can be 4915 repeated to discover as many successors as desired. The values for 4916 the two peers before p will be found at a later stage when n receives 4917 an Update. An alternate procedure is to send Attaches to those nodes 4918 rather than pings, which forms the connections immediately but may be 4919 slower if the nodes need to collect ICE candidates, thus reducing 4920 parallelism. 4922 In order to set up its finger table entry for peer i, JP simply sends 4923 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4924 approximately the right location around the ring. 4926 The joining peer MUST NOT send any Update message placing itself in 4927 the overlay until it has successfully completed an Attach with each 4928 peer that should be in its neighbor table. 4930 9.6. Routing Attaches 4932 When a peer needs to Attach to a new peer in its neighbor table, it 4933 MUST source-route the Attach request through the peer from which it 4934 learned the new peer's Node-ID. Source-routing these requests allows 4935 the overlay to recover from instability. 4937 All other Attach requests, such as those for new finger table 4938 entries, are routed conventionally through the overlay. 4940 9.7. Updates 4942 An Update for this DHT is defined as 4943 enum { reserved (0), 4944 peer_ready(1), neighbors(2), full(3), (255) } 4945 ChordUpdateType; 4947 struct { 4948 uint32 uptime; 4949 ChordUpdateType type; 4950 select(type){ 4951 case peer_ready: /* Empty */ 4952 ; 4954 case neighbors: 4955 NodeId predecessors<0..2^16-1>; 4956 NodeId successors<0..2^16-1>; 4958 case full: 4959 NodeId predecessors<0..2^16-1>; 4960 NodeId successors<0..2^16-1>; 4961 NodeId fingers<0..2^16-1>; 4962 }; 4963 } ChordUpdate; 4965 The "uptime" field contains the time this peer has been up in 4966 seconds. 4968 The "type" field contains the type of the update, which depends on 4969 the reason the update was sent. 4971 peer_ready: this peer is ready to receive messages. This message 4972 is used to indicate that a node which has Attached is a peer and 4973 can be routed through. It is also used as a connectivity check to 4974 non-neighbor peers. 4976 neighbors: this version is sent to members of the Chord neighbor 4977 table. 4979 full: this version is sent to peers which request an Update with a 4980 RouteQueryReq. 4982 If the message is of type "neighbors", then the contents of the 4983 message will be: 4985 predecessors 4986 The predecessor set of the Updating peer. 4988 successors 4989 The successor set of the Updating peer. 4991 If the message is of type "full", then the contents of the message 4992 will be: 4994 predecessors 4995 The predecessor set of the Updating peer. 4997 successors 4998 The successor set of the Updating peer. 5000 fingers 5001 The finger table of the Updating peer, in numerically ascending 5002 order. 5004 A peer MUST maintain an association (via Attach) to every member of 5005 its neighbor set. A peer MUST attempt to maintain at least three 5006 predecessors and three successors, even though this will not be 5007 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 5008 predecessors and successors be maintained in the neighbor set. 5010 9.7.1. Handling Neighbor Failures 5012 Every time a connection to a peer in the neighbor table is lost (as 5013 determined by connectivity pings or the failure of some request), the 5014 peer MUST remove the entry from its neighbor table and replace it 5015 with the best match it has from the other peers in its routing table. 5016 If using reactive recovery, it then sends an immediate Update to all 5017 nodes in its Neighbor Table. The update will contain all the Node- 5018 IDs of the current entries of the table (after the failed one has 5019 been removed). Note that when replacing a successor the peer SHOULD 5020 delay the creation of new replicas for successor replacement hold- 5021 down time (30 seconds) after removing the failed entry from its 5022 neighbor table in order to allow a triggered update to inform it of a 5023 better match for its neighbor table. 5025 If the neighbor failure effects the peer's range of responsible IDs, 5026 then the Update MUST be sent to all nodes in its Connection Table. 5028 A peer MAY attempt to reestablish connectivity with a lost neighbor 5029 either by waiting additional time to see if connectivity returns or 5030 by actively routing a new Attach to the lost peer. Details for these 5031 procedures are beyond the scope of this document. In no event does 5032 an attempt to reestablish connectivity with a lost neighbor allow the 5033 peer to remain in the neighbor table. Such a peer is returned to the 5034 neighbor table once connectivity is reestablished. 5036 If connectivity is lost to all successor peers in the neighbor table, 5037 then this peer should behave as if it is joining the network and use 5038 Pings to find a peer and send it a Join. If connectivity is lost to 5039 all the peers in the finger table, this peer should assume that it 5040 has been disconnected from the rest of the network, and it should 5041 periodically try to join the DHT. 5043 9.7.2. Handling Finger Table Entry Failure 5045 If a finger table entry is found to have failed, all references to 5046 the failed peer are removed from the finger table and replaced with 5047 the closest preceding peer from the finger table or neighbor table. 5049 If using reactive recovery, the peer initiates a search for a new 5050 finger table entry as described below. 5052 9.7.3. Receiving Updates 5054 When a peer, N, receives an Update request, it examines the Node-IDs 5055 in the UpdateReq and at its neighbor table and decides if this 5056 UpdateReq would change its neighbor table. This is done by taking 5057 the set of peers currently in the neighbor table and comparing them 5058 to the peers in the update request. There are two major cases: 5060 o The UpdateReq contains peers that match N's neighbor table, so no 5061 change is needed to the neighbor set. 5062 o The UpdateReq contains peers N does not know about that should be 5063 in N's neighbor table, i.e. they are closer than entries in the 5064 neighbor table. 5066 In the first case, no change is needed. 5068 In the second case, N MUST attempt to Attach to the new peers and if 5069 it is successful it MUST adjust its neighbor set accordingly. Note 5070 that it can maintain the now inferior peers as neighbors, but it MUST 5071 remember the closer ones. 5073 After any Pings and Attaches are done, if the neighbor table changes 5074 and the peer is using reactive recovery, the peer sends an Update 5075 request to each member of its Connection Table. These Update 5076 requests are what end up filling in the predecessor/successor tables 5077 of peers that this peer is a neighbor to. A peer MUST NOT enter 5078 itself in its successor or predecessor table and instead should leave 5079 the entries empty. 5081 If peer N is responsible for a Resource-ID R, and N discovers that 5082 the replica set for R (the next two nodes in its successor set) has 5083 changed, it MUST send a Store for any data associated with R to any 5084 new node in the replica set. It SHOULD NOT delete data from peers 5085 which have left the replica set. 5087 When a peer N detects that it is no longer in the replica set for a 5088 resource R (i.e., there are three predecessors between N and R), it 5089 SHOULD delete all data associated with R from its local store. 5091 When a peer discovers that its range of responsible IDs have changed, 5092 it MUST send an Update to all entries in its connection table. 5094 9.7.4. Stabilization 5096 There are four components to stabilization: 5097 1. exchange Updates with all peers in its neighbor table to exchange 5098 state. 5099 2. search for better peers to place in its finger table. 5100 3. search to determine if the current finger table size is 5101 sufficiently large. 5102 4. search to determine if the overlay has partitioned and needs to 5103 recover. 5105 9.7.4.1. Updating neighbor table 5107 A peer MUST periodically send an Update request to every peer in its 5108 Connection Table. The purpose of this is to keep the predecessor and 5109 successor lists up to date and to detect failed peers. The default 5110 time is about every ten minutes, but the configuration server SHOULD 5111 set this in the configuration document using the "chord-update- 5112 interval" element (denominated in seconds.) A peer SHOULD randomly 5113 offset these Update requests so they do not occur all at once. 5115 9.7.4.2. Refreshing finger table 5117 A peer MUST periodically search for new peers to replace invalid 5118 entries in the finger table. A finger table entry i is valid if it 5119 is in the range [ n+2^( 128-i ) , n+2^( 128-(i-1) )-1 ]. Invalid 5120 entries occur in the finger table when a previous finger table entry 5121 has failed or when no peer has been found in that range. 5123 A peer SHOULD NOT send Ping requests looking for new finger table 5124 entries more often than the configuration element "chord-ping- 5125 interval", which defaults to 3600 seconds (one per hour). 5127 Two possible methods for searching for new peers for the finger table 5128 entries are presented: 5130 Alternative 1: A peer selects one entry in the finger table from 5131 among the invalid entries. It pings for a new peer for that finger 5132 table entry. The selection SHOULD be exponentially weighted to 5133 attempt to replace earlier (lower i) entries in the finger table. A 5134 simple way to implement this selection is to search through the 5135 finger table entries from i=0 and each time an invalid entry is 5136 encountered, send a Ping to replace that entry with probability 0.5. 5138 Alternative 2: A peer monitors the Update messages received from its 5139 connections to observe when an Update indicates a peer that would be 5140 used to replace in invalid finger table entry, i, and flags that 5141 entry in the finger table. Every "chord-ping-interval" seconds, the 5142 peer selects from among those flagged candidates using an 5143 exponentially weighted probability as above. 5145 When searching for a better entry, the peer SHOULD send the Ping to a 5146 Node-ID selected randomly from that range. Random selection is 5147 preferred over a search for strictly spaced entries to minimize the 5148 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 5149 implementation or subsequent specification MAY choose a method for 5150 selecting finger table entries other than choosing randomly within 5151 the range. Any such alternate methods SHOULD be employed only on 5152 finger table stabilization and not for the selection of initial 5153 finger table entries unless the alternative method is faster and 5154 imposes less overhead on the overlay. 5156 A peer MAY choose to keep connections to multiple peers that can act 5157 for a given finger table entry. 5159 9.7.4.3. Adjusting finger table size 5161 If the finger table has less than 16 entries, the node SHOULD attempt 5162 to discover more fingers to grow the size of the table to 16. The 5163 value 16 was chosen to ensure high odds of a node maintaining 5164 connectivity to the overlay even with strange network partitions. 5166 For many overlays, 16 finger table entries will be enough, but as an 5167 overlay grows very large, more than 16 entries may be required in the 5168 finger table for efficient routing. An implementation SHOULD be 5169 capable of increasing the number of entries in the finger table to 5170 128 entries. 5172 Note to implementers: Although log(N) entries are all that are 5173 required for optimal performance, careful implementation of 5174 stabilization will result in no additional traffic being generated 5175 when maintaining a finger table larger than log(N) entries. 5176 Implementers are encouraged to make use of RouteQuery and algorithms 5177 for determining where new finger table entries may be found. 5178 Complete details of possible implementations are outside the scope of 5179 this specification. 5181 A simple approach to sizing the finger table is to ensure the finger 5182 table is large enough to contain at least the final successor in the 5183 peer's neighbor table. 5185 9.7.4.4. Detecting partitioning 5187 To detect that a partitioning has occurred and to heal the overlay, a 5188 peer P MUST periodically repeat the discovery process used in the 5189 initial join for the overlay to locate an appropriate bootstrap node, 5190 B. P should then send a Ping for its own Node-ID routed through B. If 5191 a response is received from a peer S', which is not P's successor, 5192 then the overlay is partitioned and P should send an Attach to S' 5193 routed through B, followed by an Update sent to S'. (Note that S' 5194 may not be in P's neighbor table once the overlay is healed, but the 5195 connection will allow S' to discover appropriate neighbor entries for 5196 itself via its own stabilization.) 5198 Future specifications may describe alternative mechanisms for 5199 determining when to repeat the discovery process. 5201 9.8. Route query 5203 For this topology plugin, the RouteQueryReq contains no additional 5204 information. The RouteQueryAns contains the single node ID of the 5205 next peer to which the responding peer would have routed the request 5206 message in recursive routing: 5208 struct { 5209 NodeId next_peer; 5210 } ChordRouteQueryAns; 5212 The contents of this structure are as follows: 5214 next_peer 5215 The peer to which the responding peer would route the message in 5216 order to deliver it to the destination listed in the request. 5218 If the requester has set the send_update flag, the responder SHOULD 5219 initiate an Update immediately after sending the RouteQueryAns. 5221 9.9. Leaving 5223 To support extensions, such as [I-D.ietf-p2psip-self-tuning], Peers 5224 SHOULD send a Leave request to all members of their neighbor table 5225 prior to exiting the Overlay Instance. The overlay_specific_data 5226 field MUST contain the ChordLeaveData structure defined below: 5228 enum { reserved (0), 5229 from_succ(1), from_pred(2), (255) } 5230 ChordLeaveType; 5232 struct { 5233 ChordLeaveType type; 5235 select(type) { 5236 case from_succ: 5237 NodeId successors<0..2^16-1>; 5238 case from_pred: 5239 NodeId predecessors<0..2^16-1>; 5240 }; 5241 } ChordLeaveData; 5243 The 'type' field indicates whether the Leave request was sent by a 5244 predecessor or a successor of the recipient: 5246 from_succ 5247 The Leave request was sent by a successor. 5249 from_pred 5250 The Leave request was sent by a predecessor. 5252 If the type of the request is 'from_succ', the contents will be: 5254 successors 5255 The sender's successor list. 5257 If the type of the request is 'from_pred', the contents will be: 5259 predecessors 5260 The sender's predecessor list. 5262 Any peer which receives a Leave for a peer n in its neighbor set 5263 follows procedures as if it had detected a peer failure as described 5264 in Section 9.7.1. 5266 10. Enrollment and Bootstrap 5268 The section defines the format of the configuration data as well the 5269 process to join a new overlay. 5271 10.1. Overlay Configuration 5273 This specification defines a new content type "application/ 5274 p2p-overlay+xml" for an MIME entity that contains overlay 5275 information. An example document is shown below. 5277 5278 5281 5283 CHORD-RELOAD 5284 16 5285 5286 MIIDJDCCAo2gAwIBAgIBADANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJVUzET 5287 MBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxDjAMBgNVBAoT 5288 BXNpcGl0MSkwJwYDVQQLEyBTaXBpdCBUZXN0IENlcnRpZmljYXRlIEF1dGhvcml0 5289 eTAeFw0wMzA3MTgxMjIxNTJaFw0xMzA3MTUxMjIxNTJaMHAxCzAJBgNVBAYTAlVT 5290 MRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEOMAwGA1UE 5291 ChMFc2lwaXQxKTAnBgNVBAsTIFNpcGl0IFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9y 5292 aXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDIh6DkcUDLDyK9BEUxkud 5293 +nJ4xrCVGKfgjHm6XaSuHiEtnfELHM+9WymzkBNzZpJu30yzsxwfKoIKugdNUrD4 5294 N3viCicwcN35LgP/KnbN34cavXHr4ZlqxH+OdKB3hQTpQa38A7YXdaoz6goW2ft5 5295 Mi74z03GNKP/G9BoKOGd5QIDAQABo4HNMIHKMB0GA1UdDgQWBBRrRhcU6pR2JYBU 5296 bhNU2qHjVBShtjCBmgYDVR0jBIGSMIGPgBRrRhcU6pR2JYBUbhNU2qHjVBShtqF0 5297 pHIwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcT 5298 CFNhbiBKb3NlMQ4wDAYDVQQKEwVzaXBpdDEpMCcGA1UECxMgU2lwaXQgVGVzdCBD 5299 ZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 5300 AQUFAAOBgQCWbRvv1ZGTRXxbH8/EqkdSCzSoUPrs+rQqR0xdQac9wNY/nlZbkR3O 5301 qAezG6Sfmklvf+DOg5RxQq/+Y6I03LRepc7KeVDpaplMFGnpfKsibETMipwzayNQ 5302 QgUf4cKBiF+65Ue7hZuDJa2EMv8qW4twEhGDYclpFU9YozyS1OhvUg== 5303 5304 YmFkIGNlcnQK 5305 https://example.org 5306 https://example.net 5307 false 5309 5310 5311 5312 20 5313 5314 5315 false 5316 false 5317 5318 400 5319 30 5320 true 5321 password 5322 4000 5323 30 5324 3000 5325 TLS 5326 47112162e84c69ba 5327 47112162e84c69ba 5328 6eba45d31a900c06 5329 6ebc45d31a900c06 5330 6ebc45d31a900ca6 5332 foo 5334 5335 urn:ietf:params:xml:ns:p2p:config-ext1 5336 5338 5339 5340 5341 SINGLE 5342 USER-MATCH 5343 1 5344 100 5345 5346 5347 VGhpcyBpcyBub3QgcmlnaHQhCg== 5348 5349 5350 5351 5352 ARRAY 5353 NODE-MULTIPLE 5354 3 5355 22 5356 4 5357 1 5358 5359 5360 5361 VGhpcyBpcyBub3QgcmlnaHQhCg== 5363 5364 5365 5366 5367 VGhpcyBpcyBub3QgcmlnaHQhCg== 5369 5370 5371 VGhpcyBpcyBub3QgcmlnaHQhCg== 5373 5375 The file MUST be a well formed XML document and it SHOULD contain an 5376 encoding declaration in the XML declaration. The file MUST use the 5377 UTF-8 character encoding. The namespace for the elements defined in 5378 this specification is urn:ietf:params:xml:ns:p2p:config-base and 5379 urn:ietf:params:xml:ns:p2p:config-chord". 5381 The file can contain multiple "configuration" elements where each one 5382 contains the configuration information for a different overlay. Each 5383 configuration element may be followed by signature elements that 5384 provides a signature over the preceding configuration element. Each 5385 configuration element has the following attributes: 5387 instance-name: name of the overlay 5388 expiration: time in the future at which this overlay configuration 5389 is no longer valid. The node SHOULD retrieve a new copy of the 5390 configuration at a randomly selected time that is before the 5391 expiration time. Note that if the certificates expire before a 5392 new configuration is retried, the node will not be able to 5393 validate the configuration file. 5394 sequence: a monotonically increasing sequence number between 0 and 5395 2^16-2 5397 Inside each overlay element, the following elements can occur: 5399 topology-plugin This element defines the overlay algorithm being 5400 used. If missing the default is "CHORD-RELOAD". 5401 node-id-length This element contains the length of a NodeId 5402 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5403 and 20 (160 bits). If this element is not present, the default of 5404 16 is used. 5405 root-cert This element contains a base-64 encoded X.509v3 5406 certificate that is a root trust anchor used to sign all 5407 certificates in this overlay. There can be more than one root- 5408 cert element. 5410 enrollment-server This element contains the URL at which the 5411 enrollment server can be reached in a "url" element. This URL 5412 MUST be of type "https:". More than one enrollment-server element 5413 may be present. 5414 self-signed-permitted This element indicates whether self-signed 5415 certificates are permitted. If it is set to "true", then self- 5416 signed certificates are allowed, in which case the enrollment- 5417 server and root-cert elements may be absent. Otherwise, it SHOULD 5418 be absent, but MAY be set to "false". This element also contains 5419 an attribute "digest" which indicates the digest to be used to 5420 compute the Node-ID. Valid values for this parameter are "sha1" 5421 and "sha256" representing SHA-1 [RFC3174] and SHA-256 [RFC6234] 5422 respectively. Implementations MUST support both of these 5423 algorithms. 5424 bootstrap-node This element represents the address of one of the 5425 bootstrap nodes. It has an attribute called "address" that 5426 represents the IP address (either IPv4 or IPv6, since they can be 5427 distinguished) and an optional attribute called "port" that 5428 represents the port and defaults to 6084. The IP address is in 5429 typical hexadecimal form using standard period and colon 5430 separators as specified in [RFC5952]. More than one bootstrap- 5431 peer element may be present. 5432 turn-density This element is a positive integer that represents the 5433 approximate reciprocal of density of nodes that can act as TURN 5434 servers. For example, if 5% of the nodes can act as TURN servers, 5435 this would be set to 20. If it is not present, the default value 5436 is 1. If there are no TURN servers in the overlay, it is set to 5437 zero. 5438 multicast-bootstrap This element represents the address of a 5439 multicast, broadcast, or anycast address and port that may be used 5440 for bootstrap. Nodes SHOULD listen on the address. It has an 5441 attributed called "address" that represents the IP address and an 5442 optional attribute called "port" that represents the port and 5443 defaults to 6084. More than one "multicast-bootstrap" element may 5444 be present. 5445 clients-permitted This element represents whether clients are 5446 permitted or whether all nodes must be peers. If it is set to 5447 "true" or absent, this indicates that clients are permitted. If 5448 it is set to "false" then nodes are not allowed to remain clients 5449 after the initial join. There is currently no way for the overlay 5450 to enforce this. 5451 no-ice This element represents whether nodes are required to use 5452 the "No-ICE" Overlay Link protocols in this overlay. If it is 5453 absent, it is treated as if it were set to "false". 5455 chord-update-interval The update frequency for the Chord-reload 5456 topology plugin (see Section 9). 5457 chord-ping-interval The ping frequency for the Chord-reload 5458 topology plugin (see Section 9). 5459 chord-reactive Whether reactive recovery should be used for this 5460 overlay. Set to "true" or "false". Default if missing is "true". 5461 (see Section 9). 5462 shared-secret If shared secret mode is used, this contains the 5463 shared secret. The security guarantee here is that any agent 5464 which is able to access the configuration document (presumably 5465 protected by some sort of HTTP access control or network topology) 5466 is able to recover the shared secret and hence join the overlay. 5467 max-message-size Maximum size in bytes of any message in the 5468 overlay. If this value is not present, the default is 5000. 5469 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5470 for messages. If this value is not present, the default is 100. 5471 overlay-reliability-timer Default value for the end-to-end 5472 retransmission timer for messages, in milliseconds. If not 5473 present, the default value is 3000. 5474 overlay-link-protocol Indicates a permissible overlay link protocol 5475 (see Section 5.6.1 for requirements for such protocols). An 5476 arbitrary number of these elements may appear. If none appear, 5477 then this implies the default value, "TLS", which refers to the 5478 use of TLS and DTLS. If one or more elements appear, then no 5479 default value applies. 5480 kind-signer This contains a single Node-ID in hexadecimal and 5481 indicates that the certificate with this Node-ID is allowed to 5482 sign Kinds. Identifying kind-signer by Node-ID instead of 5483 certificate allows the use of short lived certificates without 5484 constantly having to provide an updated configuration file. 5485 configuration-signer This contains a single Node-ID in hexadecimal 5486 and indicates that the certificate with this Node-ID is allowed to 5487 sign configurations for this instance-name. Identifying the 5488 signer by Node-ID instead of certificate allows the use of short 5489 lived certificates without constantly having to provide an updated 5490 configuration file. 5491 bad-node This contains a single Node-ID in hexadecimal and 5492 indicates that the certificate with this Node-ID MUST NOT be 5493 considered valid. This allows certificate revocation. An 5494 arbitrary number of these elements can be provided. Note that 5495 because certificates may expire, bad-node entries need only be 5496 present for the lifetime of the certificate. Technically 5497 speaking, bad node-ids may be reused once their certificates have 5498 expired, the requirement for node-ids to be pseudo randomly 5499 generated gives this event a vanishing probability. 5501 mandatory-extension This element contains the name of an XML 5502 namespace that a node joining the overlay MUST support. The 5503 presence of a mandatory-extension element does not require the 5504 extension to be used in the current configuration file, but can 5505 indicate that it may be used in the future. Note that the 5506 namespace is case-sensitive, as specified in [w3c-xml-namespaces] 5507 Section 2.3. More than one mandatory-extension element may be 5508 present. 5510 Inside each overlay element, the required-kinds elements can also 5511 occur. This element indicates the Kinds that members must support 5512 and contains multiple kind-block elements that each define a single 5513 Kind that MUST be supported by nodes in the overlay. Each kind-block 5514 consists of a single kind element and a kind-signature. The kind 5515 element defines the Kind. The kind-signature is the signature 5516 computed over the kind element. 5518 Each kind has either an id attribute or a name attribute. The name 5519 attribute is a string representing the Kind (the name registered to 5520 IANA) while the id is an integer Kind-ID allocated out of private 5521 space. 5523 In addition, the kind element contains the following elements: 5524 max-count: the maximum number of values which members of the overlay 5525 must support. 5526 data-model: the data model to be used. 5527 max-size: the maximum size of individual values. 5528 access-control: the access control model to be used. 5529 max-node-multiple: This is optional and only used when the access 5530 control is NODE-MULTIPLE. This indicates the maximum value for 5531 the i counter. This is an integer greater than 0. 5533 All of the non optional values MUST be provided. If the Kind is 5534 registered with IANA, the data-model and access-control elements MUST 5535 match those in the Kind registration, and clients MUST ignore them in 5536 favor of the IANA versions. Multiple required-kinds elements MAY be 5537 present. 5539 The kind-block element also MUST contain a "kind-signature" element. 5540 This signature is computed across the kind from the beginning of the 5541 first < of the kind to the end of the last > of the kind in the same 5542 way as the signature element described later in this section. 5544 The configuration file is a binary file and cannot be changed - 5545 including whitespace changes - or the signature will break. The 5546 signature is computed by taking each configuration element and 5547 starting from, and including, the first < at the start of 5548 up to and including the > in and 5549 treating this as a binary blob that is signed using the standard 5550 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5551 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5552 signature element following the configuration object in the 5553 configuration file. 5555 When a node receives a new configuration file, it MUST change its 5556 configuration to meet the new requirements. This may require the 5557 node to exit the DHT and re-join. If a node is not capable of 5558 supporting the new requirements, it MUST exit the overlay. If some 5559 information about a particular Kind changes from what the node 5560 previously knew about the Kind (for example the max size), the new 5561 information in the configuration files overrides any previously 5562 learned information. If any Kind data was signed by a node that is 5563 no longer allowed to sign kinds, that Kind MUST be discarded along 5564 with any stored information of that Kind. Note that forcing an 5565 avalanche restart of the overlay with a configuration change that 5566 requires re-joining the overlay may result in serious performance 5567 problems, including total collapse of the network if configuration 5568 parameters are not properly considered. Such an event may be 5569 necessary in case of a compromised CA or similar problem, but for 5570 large overlays should be avoided in almost all circumstances. 5572 10.1.1. Relax NG Grammar 5574 The grammar for the configuration data is: 5576 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5577 namespace local = "" 5578 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5579 namespace rng = "http://relaxng.org/ns/structure/1.0" 5581 anything = 5582 (element * { anything } 5583 | attribute * { text } 5584 | text)* 5586 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5587 { anything }* 5588 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5589 { text }* 5590 foreign-nodes = (foreign-attributes | foreign-elements)* 5592 start = element p2pcf:overlay { 5593 overlay-element 5594 } 5596 overlay-element &= element configuration { 5597 attribute instance-name { xsd:string }, 5598 attribute expiration { xsd:dateTime }?, 5599 attribute sequence { xsd:long }?, 5600 foreign-attributes*, 5601 parameter 5602 }+ 5603 overlay-element &= element signature { 5604 attribute algorithm { signature-algorithm-type }?, 5605 xsd:base64Binary 5606 }* 5608 signature-algorithm-type |= "rsa-sha1" 5609 signature-algorithm-type |= xsd:string # signature alg extensions 5611 parameter &= element topology-plugin { topology-plugin-type }? 5612 topology-plugin-type |= xsd:string # topo plugin extensions 5613 parameter &= element max-message-size { xsd:unsignedInt }? 5614 parameter &= element initial-ttl { xsd:int }? 5615 parameter &= element root-cert { xsd:base64Binary }* 5616 parameter &= element required-kinds { kind-block* }? 5617 parameter &= element enrollment-server { xsd:anyURI }* 5618 parameter &= element kind-signer { xsd:string }* 5619 parameter &= element configuration-signer { xsd:string }* 5620 parameter &= element bad-node { xsd:string }* 5621 parameter &= element no-ice { xsd:boolean }? 5622 parameter &= element shared-secret { xsd:string }? 5623 parameter &= element overlay-link-protocol { xsd:string }* 5624 parameter &= element clients-permitted { xsd:boolean }? 5625 parameter &= element turn-density { xsd:unsignedByte }? 5626 parameter &= element node-id-length { xsd:int }? 5627 parameter &= element mandatory-extension { xsd:string }* 5628 parameter &= foreign-elements* 5630 parameter &= 5631 element self-signed-permitted { 5632 attribute digest { self-signed-digest-type }, 5633 xsd:boolean 5634 }? 5635 self-signed-digest-type |= "sha1" 5636 self-signed-digest-type |= xsd:string # signature digest extensions 5638 parameter &= element bootstrap-node { 5639 attribute address { xsd:string }, 5640 attribute port { xsd:int }? 5641 }* 5643 parameter &= element multicast-bootstrap { 5644 attribute address { xsd:string }, 5645 attribute port { xsd:int }? 5646 }* 5648 kind-block = element kind-block { 5649 element kind { 5650 ( attribute name { kind-names } 5651 | attribute id { xsd:unsignedInt } ), 5652 kind-parameter 5653 } & 5654 element kind-signature { 5655 attribute algorithm { signature-algorithm-type }?, 5656 xsd:base64Binary 5657 }? 5658 } 5660 kind-parameter &= element max-count { xsd:int } 5661 kind-parameter &= element max-size { xsd:int } 5662 kind-parameter &= element max-node-multiple { xsd:int }? 5664 kind-parameter &= element data-model { data-model-type } 5665 data-model-type |= "SINGLE" 5666 data-model-type |= "ARRAY" 5667 data-model-type |= "DICTIONARY" 5668 data-model-type |= xsd:string # data model extensions 5670 kind-parameter &= element access-control { access-control-type } 5671 access-control-type |= "USER-MATCH" 5672 access-control-type |= "NODE-MATCH" 5673 access-control-type |= "USER-NODE-MATCH" 5674 access-control-type |= "NODE-MULTIPLE" 5675 access-control-type |= xsd:string # access control extensions 5677 kind-parameter &= foreign-elements* 5679 kind-names |= "TURN-SERVICE" 5680 kind-names |= "CERTIFICATE_BY_NODE" 5681 kind-names |= "CERTIFICATE_BY_USER" 5682 kind-names |= xsd:string # kind extensions 5684 # Chord specific parameters 5685 topology-plugin-type |= "CHORD-RELOAD" 5686 parameter &= element chord:chord-ping-interval { xsd:int }? 5687 parameter &= element chord:chord-update-interval { xsd:int }? 5688 parameter &= element chord:chord-reactive { xsd:boolean }? 5690 10.2. Discovery Through Configuration Server 5692 When a node first enrolls in a new overlay, it starts with a 5693 discovery process to find a configuration server. 5695 The node MAY start by determining the overlay name. This value is 5696 provided by the user or some other out of band provisioning 5697 mechanism. The out of band mechanisms MAY also provide an optional 5698 URL for the configuration server. If a URL for the configuration 5699 server is not provided, the node MUST do a DNS SRV query using a 5700 Service name of "p2psip-enroll" and a protocol of TCP to find a 5701 configuration server and form the URL by appending a path of "/.well- 5702 known/p2psip-enroll" to the overlay name. This uses the "well known 5703 URI" framework defined in [RFC5785]. For example, if the overlay 5704 name was example.com, the URL would be 5705 "https://example.com/.well-known/p2psip-enroll". 5707 Once an address and URL for the configuration server is determined, 5708 the peer forms an HTTPS connection to that IP address. The 5709 certificate MUST match the overlay name as described in [RFC2818]. 5710 Then the node MUST fetch a new copy of the configuration file. To do 5711 this, the peer performs a GET to the URL. The result of the HTTP GET 5712 is an XML configuration file described above, which replaces any 5713 previously learned configuration file for this overlay. 5715 For overlays that do not use a configuration server, nodes obtain the 5716 configuration information needed to join the overlay through some out 5717 of band approach such an XML configuration file sent over email. 5719 10.3. Credentials 5721 If the configuration document contains a enrollment-server element, 5722 credentials are required to join the Overlay Instance. A peer which 5723 does not yet have credentials MUST contact the enrollment server to 5724 acquire them. 5726 RELOAD defines its own trivial certificate request protocol. We 5727 would have liked to have used an existing protocol but were concerned 5728 about the implementation burden of even the simplest of those 5729 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5730 have a protocol which could be easily implemented in a Web server 5731 which the operator did not control (e.g., in a hosted service) and 5732 was compatible with the existing certificate handling tooling as used 5733 with the Web certificate infrastructure. This means accepting bare 5734 PKCS#10 requests and returning a single bare X.509 certificate. 5735 Although the MIME types for these objects are defined, none of the 5736 existing protocols support exactly this model. 5738 The certificate request protocol is performed over HTTPS. The 5739 request is an HTTP POST with the following properties: 5741 o If authentication is required, there is an URL parameter of 5742 "password" and "username" containing the user's name and password 5743 in the clear (hence the need for HTTPS) 5744 o If more than one Node-ID is required, there is an URL parameter of 5745 "nodeids" containing the number of Node-IDs required. 5746 o The body is of content type "application/pkcs10", as defined in 5747 [RFC2311]. 5748 o The Accept header contains the type "application/pkix-cert", 5749 indicating the type that is expected in the response. 5751 The enrollment server MUST authenticate the request using the 5752 provided user name and password. If the authentication succeeds and 5753 the requested user name is acceptable, the server generates and 5754 returns a certificate. The SubjectAltName field in the certificate 5755 contains the following values: 5757 o One or more Node-IDs which MUST be cryptographically random 5758 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5759 way that they are unpredictable to the requesting user. E.g., the 5760 user MUST NOT be informed of potential (random) Node-IDs prior to 5761 authenticating. Each is placed in the subjectAltName using the 5762 uniformResourceIdentifier type and MUST contain RELOAD URIs as 5763 described in Section 13.15 and MUST contain a Destination list 5764 with a single entry of type "node_id". The enrollment server 5765 SHOULD maintain a mapping of users to node-ids and if the same 5766 user returns (e.g., to have their certificate re-issued) return 5767 the same Node-ID, thus avoiding the need for implementations to 5768 re-store all their data when their certificates expire. 5769 o A single name this user is allowed to use in the overlay, using 5770 type rfc822Name. 5772 The certificate is returned as type "application/pkix-cert" as 5773 defined in [RFC2585], with an HTTP status code of 200 OK. 5774 Certificate processing errors should be treated as HTTP errors and 5775 have appropriate HTTP status codes. 5777 The client MUST check that the certificate returned was signed one of 5778 the certificates received in the "root-cert" list of the overlay 5779 configuration data. The node then reads the certificate to find the 5780 Node-IDs it can use. 5782 10.3.1. Self-Generated Credentials 5784 If the "self-signed-permitted" element is present in the 5785 configuration and set to "true", then a node MUST generate its own 5786 self-signed certificate to join the overlay. The self-signed 5787 certificate MAY contain any user name of the users choice. 5789 The Node-ID MUST be computed by applying the digest specified in the 5790 self-signed-permitted element to the DER representation of the user's 5791 public key (more specifically the subjectPublicKeyInfo) and taking 5792 the high order bits. When accepting a self-signed certificate, nodes 5793 MUST check that the Node-ID and public keys match. This prevents 5794 Node-ID theft. 5796 Once the node has constructed a self-signed certificate, it MAY join 5797 the overlay. Before storing its certificate in the overlay 5798 (Section 7) it SHOULD look to see if the user name is already taken 5799 and if so choose another user name. Note that this only provides 5800 protection against accidental name collisions. Name theft is still 5801 possible. If protection against name theft is desired, then the 5802 enrollment service must be used. 5804 10.4. Searching for a Bootstrap Node 5806 If no cached bootstrap nodes are available and the configuration file 5807 has an multicast-bootstrap element, then the node SHOULD send a Ping 5808 request over UDP to the address and port found to each multicast- 5809 bootstrap element found in the configuration document. This MAY be a 5810 multicast, broadcast, or anycast address. The Ping should use the 5811 wildcard Node-ID as the destination Node-ID. 5813 The responder node that receives the Ping request SHOULD check that 5814 the overlay name is correct and that the requester peer sending the 5815 request has appropriate credentials for the overlay before responding 5816 to the Ping request even if the response is only an error. 5818 10.5. Contacting a Bootstrap Node 5820 In order to join the overlay, the joining node MUST contact a node in 5821 the overlay. Typically this means contacting the bootstrap nodes, 5822 since they are reachable by the local peer or have public IP 5823 addresses. If the joining node has cached a list of peers it has 5824 previously been connected with in this overlay, as an optimization it 5825 MAY attempt to use one or more of them as bootstrap nodes before 5826 falling back to the bootstrap nodes listed in the configuration file. 5828 When contacting a bootstrap node, the joining node first forms the 5829 DTLS or TLS connection to the bootstrap node and then sends an Attach 5830 request over this connection with the destination Node-ID set to the 5831 joining node's Node-ID. 5833 When the requester node finally does receive a response from some 5834 responding node, it can note the Node-ID in the response and use this 5835 Node-ID to start sending requests to join the Overlay Instance as 5836 described in Section 5.4. 5838 After a node has successfully joined the overlay network, it will 5839 have direct connections to several peers. Some MAY be added to the 5840 cached bootstrap nodes list and used in future boots. Peers that are 5841 not directly connected MUST NOT be cached. The suggested number of 5842 peers to cache is 10. Algorithms for determining which peers to 5843 cache are beyond the scope of this specification. 5845 11. Message Flow Example 5847 The following abbreviations are used in the message flow diagrams: 5848 JP = joining peer, AP = admitting peer, NP = next peer after the AP, 5849 NNP = next next peer which is the peer after NP, PP = previous peer 5850 before the AP, PPP = previous previous peer which is the peer before 5851 the PP, BP = bootstrap peer. 5853 In the following example, we assume that JP has formed a connection 5854 to one of the bootstrap nodes. JP then sends an Attach through that 5855 peer to a resource ID of itself (JP). It gets routed to the 5856 admitting peer (AP) because JP is not yet part of the overlay. When 5857 AP responds, JP and AP use ICE to set up a connection and then set up 5858 TLS. Once AP has connected to JP, AP sends to JP an Update to 5859 populate its Routing Table. The following example shows the Update 5860 happening after the TLS connection is formed but it could also happen 5861 before in which case the Update would often be routed through other 5862 nodes. 5864 JP PPP PP AP NP NNP BP 5865 | | | | | | | 5866 | | | | | | | 5867 | | | | | | | 5868 |Attach Dest=JP | | | | | 5869 |---------------------------------------------------------->| 5870 | | | | | | | 5871 | | | | | | | 5872 | | |Attach Dest=JP | | | 5873 | | |<--------------------------------------| 5874 | | | | | | | 5875 | | | | | | | 5876 | | |Attach Dest=JP | | | 5877 | | |-------->| | | | 5878 | | | | | | | 5879 | | | | | | | 5880 | | |AttachAns | | | 5881 | | |<--------| | | | 5882 | | | | | | | 5883 | | | | | | | 5884 | | |AttachAns | | | 5885 | | |-------------------------------------->| 5886 | | | | | | | 5887 | | | | | | | 5888 |AttachAns | | | | | 5889 |<----------------------------------------------------------| 5890 | | | | | | | 5891 | | | | | | | 5892 |TLS | | | | | | 5893 |.............................| | | | 5894 | | | | | | | 5895 | | | | | | | 5896 | | | | | | | 5897 |Update | | | | | | 5898 |<----------------------------| | | | 5899 | | | | | | | 5900 | | | | | | | 5901 |UpdateAns| | | | | | 5902 |---------------------------->| | | | 5903 | | | | | | | 5904 | | | | | | | 5905 | | | | | | | 5907 The JP then forms connections to the appropriate neighbors, such as 5908 NP, by sending an Attach which gets routed via other nodes. When NP 5909 responds, JP and NP use ICE and TLS to set up a connection. 5911 JP PPP PP AP NP NNP BP 5912 | | | | | | | 5913 | | | | | | | 5914 | | | | | | | 5915 |Attach NP | | | | | 5916 |---------------------------->| | | | 5917 | | | | | | | 5918 | | | | | | | 5919 | | | |Attach NP| | | 5920 | | | |-------->| | | 5921 | | | | | | | 5922 | | | | | | | 5923 | | | |AttachAns| | | 5924 | | | |<--------| | | 5925 | | | | | | | 5926 | | | | | | | 5927 |AttachAns | | | | | 5928 |<----------------------------| | | | 5929 | | | | | | | 5930 | | | | | | | 5931 |Attach | | | | | | 5932 |-------------------------------------->| | | 5933 | | | | | | | 5934 | | | | | | | 5935 |TLS | | | | | | 5936 |.......................................| | | 5937 | | | | | | | 5938 | | | | | | | 5939 | | | | | | | 5940 | | | | | | | 5942 JP also needs to populate its finger table (for the Chord based DHT). 5943 It issues an Attach to a variety of locations around the overlay. 5944 The diagram below shows it sending an Attach halfway around the Chord 5945 ring to the JP + 2^127. 5947 JP NP XX TP 5948 | | | | 5949 | | | | 5950 | | | | 5951 |Attach JP+2<<126 | | 5952 |-------->| | | 5953 | | | | 5954 | | | | 5955 | |Attach JP+2<<126 | 5956 | |-------->| | 5957 | | | | 5958 | | | | 5959 | | |Attach JP+2<<126 5960 | | |-------->| 5961 | | | | 5962 | | | | 5963 | | |AttachAns| 5964 | | |<--------| 5965 | | | | 5966 | | | | 5967 | |AttachAns| | 5968 | |<--------| | 5969 | | | | 5970 | | | | 5971 |AttachAns| | | 5972 |<--------| | | 5973 | | | | 5974 | | | | 5975 |TLS | | | 5976 |.............................| 5977 | | | | 5978 | | | | 5979 | | | | 5980 | | | | 5982 Once JP has a reasonable set of connections, it is ready to take its 5983 place in the DHT. It does this by sending a Join to AP. AP does a 5984 series of Store requests to JP to store the data that JP will be 5985 responsible for. AP then sends JP an Update explicitly labeling JP 5986 as its predecessor. At this point, JP is part of the ring and 5987 responsible for a section of the overlay. AP can now forget any data 5988 which is assigned to JP and not AP. 5990 JP PPP PP AP NP NNP BP 5991 | | | | | | | 5992 | | | | | | | 5993 | | | | | | | 5994 |JoinReq | | | | | | 5995 |---------------------------->| | | | 5996 | | | | | | | 5997 | | | | | | | 5998 |JoinAns | | | | | | 5999 |<----------------------------| | | | 6000 | | | | | | | 6001 | | | | | | | 6002 |StoreReq Data A | | | | | 6003 |<----------------------------| | | | 6004 | | | | | | | 6005 | | | | | | | 6006 |StoreAns | | | | | | 6007 |---------------------------->| | | | 6008 | | | | | | | 6009 | | | | | | | 6010 |StoreReq Data B | | | | | 6011 |<----------------------------| | | | 6012 | | | | | | | 6013 | | | | | | | 6014 |StoreAns | | | | | | 6015 |---------------------------->| | | | 6016 | | | | | | | 6017 | | | | | | | 6018 |UpdateReq| | | | | | 6019 |<----------------------------| | | | 6020 | | | | | | | 6021 | | | | | | | 6022 |UpdateAns| | | | | | 6023 |---------------------------->| | | | 6024 | | | | | | | 6025 | | | | | | | 6026 | | | | | | | 6027 | | | | | | | 6029 In Chord, JP's neighbor table needs to contain its own predecessors. 6030 It couldn't connect to them previously because it did not yet know 6031 their addresses. However, now that it has received an Update from 6032 AP, it has AP's predecessors, which are also its own, so it sends 6033 Attaches to them. Below it is shown connecting to AP's closest 6034 predecessor, PP. 6036 JP PPP PP AP NP NNP BP 6037 | | | | | | | 6038 | | | | | | | 6039 | | | | | | | 6040 |Attach Dest=PP | | | | | 6041 |---------------------------->| | | | 6042 | | | | | | | 6043 | | | | | | | 6044 | | |Attach Dest=PP | | | 6045 | | |<--------| | | | 6046 | | | | | | | 6047 | | | | | | | 6048 | | |AttachAns| | | | 6049 | | |-------->| | | | 6050 | | | | | | | 6051 | | | | | | | 6052 |AttachAns| | | | | | 6053 |<----------------------------| | | | 6054 | | | | | | | 6055 | | | | | | | 6056 |TLS | | | | | | 6057 |...................| | | | | 6058 | | | | | | | 6059 | | | | | | | 6060 |UpdateReq| | | | | | 6061 |------------------>| | | | | 6062 | | | | | | | 6063 | | | | | | | 6064 |UpdateAns| | | | | | 6065 |<------------------| | | | | 6066 | | | | | | | 6067 | | | | | | | 6068 |UpdateReq| | | | | | 6069 |---------------------------->| | | | 6070 | | | | | | | 6071 | | | | | | | 6072 |UpdateAns| | | | | | 6073 |<----------------------------| | | | 6074 | | | | | | | 6075 | | | | | | | 6076 |UpdateReq| | | | | | 6077 |-------------------------------------->| | | 6078 | | | | | | | 6079 | | | | | | | 6080 |UpdateAns| | | | | | 6081 |<--------------------------------------| | | 6082 | | | | | | | 6083 | | | | | | | 6085 Finally, now that JP has a copy of all the data and is ready to route 6086 messages and receive requests, it sends Updates to everyone in its 6087 Routing Table to tell them it is ready to go. Below, it is shown 6088 sending such an update to TP. 6090 JP NP XX TP 6091 | | | | 6092 | | | | 6093 | | | | 6094 |Update | | | 6095 |---------------------------->| 6096 | | | | 6097 | | | | 6098 |UpdateAns| | | 6099 |<----------------------------| 6100 | | | | 6101 | | | | 6102 | | | | 6103 | | | | 6105 12. Security Considerations 6107 12.1. Overview 6109 RELOAD provides a generic storage service, albeit one designed to be 6110 useful for P2PSIP. In this section we discuss security issues that 6111 are likely to be relevant to any usage of RELOAD. More background 6112 information can be found in [RFC5765]. 6114 In any Overlay Instance, any given user depends on a number of peers 6115 with which they have no well-defined relationship except that they 6116 are fellow members of the Overlay Instance. In practice, these other 6117 nodes may be friendly, lazy, curious, or outright malicious. No 6118 security system can provide complete protection in an environment 6119 where most nodes are malicious. The goal of security in RELOAD is to 6120 provide strong security guarantees of some properties even in the 6121 face of a large number of malicious nodes and to allow the overlay to 6122 function correctly in the face of a modest number of malicious nodes. 6124 P2PSIP deployments require the ability to authenticate both peers and 6125 resources (users) without the active presence of a trusted entity in 6126 the system. We describe two mechanisms. The first mechanism is 6127 based on public key certificates and is suitable for general 6128 deployments. The second is an admission control mechanism based on 6129 an overlay-wide shared symmetric key. 6131 12.2. Attacks on P2P Overlays 6133 The two basic functions provided by overlay nodes are storage and 6134 routing: some node is responsible for storing a peer's data and for 6135 allowing a third peer to fetch this stored data. Other nodes are 6136 responsible for routing messages to and from the storing nodes. Each 6137 of these issues is covered in the following sections. 6139 P2P overlays are subject to attacks by subversive nodes that may 6140 attempt to disrupt routing, corrupt or remove user registrations, or 6141 eavesdrop on signaling. The certificate-based security algorithms we 6142 describe in this specification are intended to protect overlay 6143 routing and user registration information in RELOAD messages. 6145 To protect the signaling from attackers pretending to be valid peers 6146 (or peers other than themselves), the first requirement is to ensure 6147 that all messages are received from authorized members of the 6148 overlay. For this reason, RELOAD transports all messages over a 6149 secure channel (TLS and DTLS are defined in this document) which 6150 provides message integrity and authentication of the directly 6151 communicating peer. In addition, messages and data are digitally 6152 signed with the sender's private key, providing end-to-end security 6153 for communications. 6155 12.3. Certificate-based Security 6157 This specification stores users' registrations and possibly other 6158 data in an overlay network. This requires a solution to securing 6159 this data as well as securing, as well as possible, the routing in 6160 the overlay. Both types of security are based on requiring that 6161 every entity in the system (whether user or peer) authenticate 6162 cryptographically using an asymmetric key pair tied to a certificate. 6164 When a user enrolls in the Overlay Instance, they request or are 6165 assigned a unique name, such as "alice@dht.example.net". These names 6166 are unique and are meant to be chosen and used by humans much like a 6167 SIP Address of Record (AOR) or an email address. The user is also 6168 assigned one or more Node-IDs by the central enrollment authority. 6169 Both the name and the Node-ID are placed in the certificate, along 6170 with the user's public key. 6172 Each certificate enables an entity to act in two sorts of roles: 6174 o As a user, storing data at specific Resource-IDs in the Overlay 6175 Instance corresponding to the user name. 6176 o As a overlay peer with the Node-ID(s) listed in the certificate. 6178 Note that since only users of this Overlay Instance need to validate 6179 a certificate, this usage does not require a global PKI. Instead, 6180 certificates are signed by a central enrollment authority which acts 6181 as the certificate authority for the Overlay Instance. This 6182 authority signs each peer's certificate. Because each peer possesses 6183 the CA's certificate (which they receive on enrollment) they can 6184 verify the certificates of the other entities in the overlay without 6185 further communication. Because the certificates contain the user/ 6186 peer's public key, communications from the user/peer can be verified 6187 in turn. 6189 If self-signed certificates are used, then the security provided is 6190 significantly decreased, since attackers can mount Sybil attacks. In 6191 addition, attackers cannot trust the user names in certificates 6192 (though they can trust the Node-IDs because they are 6193 cryptographically verifiable). This scheme may be appropriate for 6194 some small deployments, such as a small office or an ad hoc overlay 6195 set up among participants in a meeting where all hosts on the network 6196 are trusted. Some additional security can be provided by using the 6197 shared secret admission control scheme as well. 6199 Because all stored data is signed by the owner of the data the 6200 storing peer can verify that the storer is authorized to perform a 6201 store at that Resource-ID and also allow any consumer of the data to 6202 verify the provenance and integrity of the data when it retrieves it. 6204 Note that RELOAD does not itself provide a revocation/status 6205 mechanism (though certificates may of course include OCSP responder 6206 information). Thus, certificate lifetimes should be chosen to 6207 balance the compromise window versus the cost of certificate renewal. 6208 Because RELOAD is already designed to operate in the face of some 6209 fraction of malicious peers, this form of compromise is not fatal. 6211 All implementations MUST implement certificate-based security. 6213 12.4. Shared-Secret Security 6215 RELOAD also supports a shared secret admission control scheme that 6216 relies on a single key that is shared among all members of the 6217 overlay. It is appropriate for small groups that wish to form a 6218 private network without complexity. In shared secret mode, all the 6219 peers share a single symmetric key which is used to key TLS-PSK 6220 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 6221 key cannot form TLS connections with any other peer and therefore 6222 cannot join the overlay. 6224 One natural approach to a shared-secret scheme is to use a user- 6225 entered password as the key. The difficulty with this is that in 6226 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 6228 If passwords are used as the source of shared-keys, then TLS-SRP is a 6229 superior choice because it is not subject to dictionary attacks. 6231 12.5. Storage Security 6233 When certificate-based security is used in RELOAD, any given 6234 Resource-ID/Kind-ID pair is bound to some small set of certificates. 6235 In order to write data, the writer must prove possession of the 6236 private key for one of those certificates. Moreover, all data is 6237 stored, signed with the same private key that was used to authorize 6238 the storage. This set of rules makes questions of authorization and 6239 data integrity - which have historically been thorny for overlays - 6240 relatively simple. 6242 12.5.1. Authorization 6244 When a client wants to store some value, it first digitally signs the 6245 value with its own private key. It then sends a Store request that 6246 contains both the value and the signature towards the storing peer 6247 (which is defined by the Resource Name construction algorithm for 6248 that particular Kind of value). 6250 When the storing peer receives the request, it must determine whether 6251 the storing client is authorized to store at this Resource-ID/Kind-ID 6252 pair. Determining this requires comparing the user's identity to the 6253 requirements of the access control model (see Section 6.3). If it 6254 satisfies those requirements the user is authorized to write, pending 6255 quota checks as described in the next section. 6257 For example, consider the certificate with the following properties: 6259 User name: alice@dht.example.com 6260 Node-ID: 013456789abcdef 6261 Serial: 1234 6263 If Alice wishes to Store a value of the "SIP Location" Kind, the 6264 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 6265 Resource-ID will be determined by hashing the Resource Name. Because 6266 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 6267 the user name in the certificate hashes to the requested Resource-ID. 6268 It then verifies that the Node-Id in the certificate matches the 6269 dictionary key being used for the store. If both of these checks 6270 succeed, the Store is authorized. Note that because the access 6271 control model is different for different Kinds, the exact set of 6272 checks will vary. 6274 12.5.2. Distributed Quota 6276 Being a peer in an Overlay Instance carries with it the 6277 responsibility to store data for a given region of the Overlay 6278 Instance. However, allowing clients to store unlimited amounts of 6279 data would create unacceptable burdens on peers and would also enable 6280 trivial denial of service attacks. RELOAD addresses this issue by 6281 requiring configurations to define maximum sizes for each Kind of 6282 stored data. Attempts to store values exceeding this size MUST be 6283 rejected (if peers are inconsistent about this, then strange 6284 artifacts will happen when the zone of responsibility shifts and a 6285 different peer becomes responsible for overlarge data). Because each 6286 Resource-ID/Kind-ID pair is bound to a small set of certificates, 6287 these size restrictions also create a distributed quota mechanism, 6288 with the quotas administered by the central configuration server. 6290 Allowing different Kinds of data to have different size restrictions 6291 allows new usages the flexibility to define limits that fit their 6292 needs without requiring all usages to have expansive limits. 6294 12.5.3. Correctness 6296 Because each stored value is signed, it is trivial for any retrieving 6297 peer to verify the integrity of the stored value. Some more care 6298 needs to be taken to prevent version rollback attacks. Rollback 6299 attacks on storage are prevented by the use of store times and 6300 lifetime values in each store. A lifetime represents the latest time 6301 at which the data is valid and thus limits (though does not 6302 completely prevent) the ability of the storing node to perform a 6303 rollback attack on retrievers. In order to prevent a rollback attack 6304 at the time of the Store request, we require that storage times be 6305 monotonically increasing. Storing peers MUST reject Store requests 6306 with storage times smaller than or equal to those they are currently 6307 storing. In addition, a fetching node which receives a data value 6308 with a storage time older than the result of the previous fetch knows 6309 a rollback has occurred. 6311 12.5.4. Residual Attacks 6313 The mechanisms described here provides a high degree of security, but 6314 some attacks remain possible. Most simply, it is possible for 6315 storing nodes to refuse to store a value (i.e., reject any request). 6316 In addition, a storing node can deny knowledge of values which it has 6317 previously accepted. To some extent these attacks can be ameliorated 6318 by attempting to store to/retrieve from replicas, but a retrieving 6319 client does not know whether it should try this or not, since there 6320 is a cost to doing so. 6322 The certificate-based authentication scheme prevents a single peer 6323 from being able to forge data owned by other peers. Furthermore, 6324 although a subversive peer can refuse to return data resources for 6325 which it is responsible, it cannot return forged data because it 6326 cannot provide authentication for such registrations. Therefore 6327 parallel searches for redundant registrations can mitigate most of 6328 the effects of a compromised peer. The ultimate reliability of such 6329 an overlay is a statistical question based on the replication factor 6330 and the percentage of compromised peers. 6332 In addition, when a Kind is multivalued (e.g., an array data model), 6333 the storing node can return only some subset of the values, thus 6334 biasing its responses. This can be countered by using single values 6335 rather than sets, but that makes coordination between multiple 6336 storing agents much more difficult. This is a trade off that must be 6337 made when designing any usage. 6339 12.6. Routing Security 6341 Because the storage security system guarantees (within limits) the 6342 integrity of the stored data, routing security focuses on stopping 6343 the attacker from performing a DOS attack that misroutes requests in 6344 the overlay. There are a few obvious observations to make about 6345 this. First, it is easy to ensure that an attacker is at least a 6346 valid peer in the Overlay Instance. Second, this is a DOS attack 6347 only. Third, if a large percentage of the peers on the Overlay 6348 Instance are controlled by the attacker, it is probably impossible to 6349 perfectly secure against this. 6351 12.6.1. Background 6353 In general, attacks on DHT routing are mounted by the attacker 6354 arranging to route traffic through one or two nodes it controls. In 6355 the Eclipse attack [Eclipse] the attacker tampers with messages to 6356 and from nodes for which it is on-path with respect to a given victim 6357 node. This allows it to pretend to be all the nodes that are 6358 reachable through it. In the Sybil attack [Sybil], the attacker 6359 registers a large number of nodes and is therefore able to capture a 6360 large amount of the traffic through the DHT. 6362 Both the Eclipse and Sybil attacks require the attacker to be able to 6363 exercise control over her Node-IDs. The Sybil attack requires the 6364 creation of a large number of peers. The Eclipse attack requires 6365 that the attacker be able to impersonate specific peers. In both 6366 cases, these attacks are limited by the use of centralized, 6367 certificate-based admission control. 6369 12.6.2. Admissions Control 6371 Admission to a RELOAD Overlay Instance is controlled by requiring 6372 that each peer have a certificate containing its Node-Id. The 6373 requirement to have a certificate is enforced by using certificate- 6374 based mutual authentication on each connection. (Note: the 6375 following only applies when self-signed certificates are not used.) 6376 Whenever a peer connects to another peer, each side automatically 6377 checks that the other has a suitable certificate. These Node-Ids are 6378 randomly assigned by the central enrollment server. This has two 6379 benefits: 6381 o It allows the enrollment server to limit the number of Node-IDs 6382 issued to any individual user. 6383 o It prevents the attacker from choosing specific Node-Ids. 6385 The first property allows protection against Sybil attacks (provided 6386 the enrollment server uses strict rate limiting policies). The 6387 second property deters but does not completely prevent Eclipse 6388 attacks. Because an Eclipse attacker must impersonate peers on the 6389 other side of the attacker, he must have a certificate for suitable 6390 Node-Ids, which requires him to repeatedly query the enrollment 6391 server for new certificates, which will match only by chance. From 6392 the attacker's perspective, the difficulty is that if he only has a 6393 small number of certificates, the region of the Overlay Instance he 6394 is impersonating appears to be very sparsely populated by comparison 6395 to the victim's local region. 6397 12.6.3. Peer Identification and Authentication 6399 In general, whenever a peer engages in overlay activity that might 6400 affect the routing table it must establish its identity. This 6401 happens in two ways. First, whenever a peer establishes a direct 6402 connection to another peer it authenticates via certificate-based 6403 mutual authentication. All messages between peers are sent over this 6404 protected channel and therefore the peers can verify the data origin 6405 of the last hop peer for requests and responses without further 6406 cryptography. 6408 In some situations, however, it is desirable to be able to establish 6409 the identity of a peer with whom one is not directly connected. The 6410 most natural case is when a peer Updates its state. At this point, 6411 other peers may need to update their view of the overlay structure, 6412 but they need to verify that the Update message came from the actual 6413 peer rather than from an attacker. To prevent this, all overlay 6414 routing messages are signed by the peer that generated them. 6416 Replay is typically prevented for messages that impact the topology 6417 of the overlay by having the information come directly, or be 6418 verified by, the nodes that claimed to have generated the update. 6419 Data storage replay detection is done by signing time of the node 6420 that generated the signature on the store request thus providing a 6421 time based replay protection but the time synchronization is only 6422 needed between peers that can write to the same location. 6424 12.6.4. Protecting the Signaling 6426 The goal here is to stop an attacker from knowing who is signaling 6427 what to whom. An attacker is unlikely to be able to observe the 6428 activities of a specific individual given the randomization of IDs 6429 and routing based on the present peers discussed above. Furthermore, 6430 because messages can be routed using only the header information, the 6431 actual body of the RELOAD message can be encrypted during 6432 transmission. 6434 There are two lines of defense here. The first is the use of TLS or 6435 DTLS for each communications link between peers. This provides 6436 protection against attackers who are not members of the overlay. The 6437 second line of defense is to digitally sign each message. This 6438 prevents adversarial peers from modifying messages in flight, even if 6439 they are on the routing path. 6441 12.6.5. Residual Attacks 6443 The routing security mechanisms in RELOAD are designed to contain 6444 rather than eliminate attacks on routing. It is still possible for 6445 an attacker to mount a variety of attacks. In particular, if an 6446 attacker is able to take up a position on the overlay routing between 6447 A and B it can make it appear as if B does not exist or is 6448 disconnected. It can also advertise false network metrics in an 6449 attempt to reroute traffic. However, these are primarily DOS 6450 attacks. 6452 The certificate-based security scheme secures the namespace, but if 6453 an individual peer is compromised or if an attacker obtains a 6454 certificate from the CA, then a number of subversive peers can still 6455 appear in the overlay. While these peers cannot falsify responses to 6456 resource queries, they can respond with error messages, effecting a 6457 DoS attack on the resource registration. They can also subvert 6458 routing to other compromised peers. To defend against such attacks, 6459 a resource search must still consist of parallel searches for 6460 replicated registrations. 6462 13. IANA Considerations 6464 This section contains the new code points registered by this 6465 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6466 the RFC number for this specification in the following list.] 6468 13.1. Well-Known URI Registration 6470 IANA SHALL make the following "Well Known URI" registration as 6471 described in [RFC5785]: 6473 [[Note to RFC Editor - this paragraph can be removed before 6474 publication. ]] A review request was sent to 6475 wellknown-uri-review@ietf.org on October 12, 2010. 6477 +----------------------------+----------------------+ 6478 | URI suffix: | p2psip-enroll | 6479 | Change controller: | IETF | 6480 | Specification document(s): | [RFC-AAAA] | 6481 | Related information: | None | 6482 +----------------------------+----------------------+ 6484 13.2. Port Registrations 6486 [[Note to RFC Editor - this paragraph can be removed before 6487 publication. ]] IANA has already allocated a TCP port for the main 6488 peer to peer protocol. This port has the name p2p-sip and the port 6489 number of 6084. IANA needs to update this registration to be defined 6490 for UDP as well as TCP. 6492 IANA SHALL make the following port registration: 6494 +------------------------------+------------------------------------+ 6495 | Registration Technical | Cullen Jennings | 6496 | Contact | | 6497 | Registration Owner | IETF | 6498 | Transport Protocol | TCP & UDP | 6499 | Port Number | 6084 | 6500 | Service Name | p2psip-enroll | 6501 | Description | Peer to Peer Infrastructure | 6502 | | Enrollment | 6503 | Reference | [RFC-AAAA] | 6504 +------------------------------+------------------------------------+ 6506 13.3. Overlay Algorithm Types 6508 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6509 Entries in this registry are strings denoting the names of overlay 6510 algorithms. The registration policy for this registry is RFC 5226 6511 IETF Review. The initial contents of this registry are: 6513 +----------------+----------+ 6514 | Algorithm Name | RFC | 6515 +----------------+----------+ 6516 | CHORD-RELOAD | RFC-AAAA | 6517 | EXP-OVERLAY | RFC-AAAA | 6518 +----------------+----------+ 6520 The value EXP-OVERLAY has been made available for the purposes of 6521 experimentation. This value is not meant for vendor specific use of 6522 any sort and it MUST NOT be used for operational deployments. 6524 13.4. Access Control Policies 6526 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6527 in this registry are strings denoting access control policies, as 6528 described in Section 6.3. New entries in this registry SHALL be 6529 registered via RFC 5226 Standards Action. The initial contents of 6530 this registry are: 6532 +-----------------+----------+ 6533 | Access Policy | RFC | 6534 +-----------------+----------+ 6535 | USER-MATCH | RFC-AAAA | 6536 | NODE-MATCH | RFC-AAAA | 6537 | USER-NODE-MATCH | RFC-AAAA | 6538 | NODE-MULTIPLE | RFC-AAAA | 6539 | EXP-MATCH | RFC-AAAA | 6540 +-----------------+----------+ 6542 The value EXP-MATCH has been made available for the purposes of 6543 experimentation. This value is not meant for vendor specific use of 6544 any sort and it MUST NOT be used for operational deployments. 6546 13.5. Application-ID 6548 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6549 this registry are 16-bit integers denoting application Kinds. Code 6550 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6551 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6552 registered via RFC 5226 Expert Review. Code points in the range 6553 0xf001 to 0xfffe are reserved for private use. The initial contents 6554 of this registry are: 6556 +-------------+----------------+-------------------------------+ 6557 | Application | Application-ID | Specification | 6558 +-------------+----------------+-------------------------------+ 6559 | INVALID | 0 | RFC-AAAA | 6560 | SIP | 5060 | Reserved for use by SIP Usage | 6561 | SIP | 5061 | Reserved for use by SIP Usage | 6562 | Reserved | 0xffff | RFC-AAAA | 6563 +-------------+----------------+-------------------------------+ 6565 13.6. Data Kind-ID 6567 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6568 registry are 32-bit integers denoting data Kinds, as described in 6569 Section 4.2. Code points in the range 0x00000001 to 0x7fffffff SHALL 6570 be registered via RFC 5226 Standards Action. Code points in the 6571 range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 Expert 6572 Review. Code points in the range 0xf0000001 to 0xfffffffe are 6573 reserved for private use via the Kind description mechanism described 6574 in Section 10. The initial contents of this registry are: 6576 +---------------------+------------+----------+ 6577 | Kind | Kind-ID | RFC | 6578 +---------------------+------------+----------+ 6579 | INVALID | 0 | RFC-AAAA | 6580 | TURN-SERVICE | 2 | RFC-AAAA | 6581 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6582 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6583 | Reserved | 0x7fffffff | RFC-AAAA | 6584 | Reserved | 0xfffffffe | RFC-AAAA | 6585 +---------------------+------------+----------+ 6587 13.7. Data Model 6589 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6590 registry denoting data models, as described in Section 6.2. Code 6591 points in this registry SHALL be registered via RFC 5226 Standards 6592 Action. The initial contents of this registry are: 6594 +------------+----------+ 6595 | Data Model | RFC | 6596 +------------+----------+ 6597 | INVALID | RFC-AAAA | 6598 | SINGLE | RFC-AAAA | 6599 | ARRAY | RFC-AAAA | 6600 | DICTIONARY | RFC-AAAA | 6601 | EXP-DATA | RFC-AAAA | 6602 | RESERVED | RFC-AAAA | 6603 +------------+----------+ 6605 The value EXP-DATA has been made available for the purposes of 6606 experimentation. This value is not meant for vendor specific use of 6607 any sort and it MUST NOT be used for operational deployments. 6609 13.8. Message Codes 6611 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6612 registry are 16-bit integers denoting method codes as described in 6613 Section 5.3.3. These codes SHALL be registered via RFC 5226 6614 Standards Action. The initial contents of this registry are: 6616 +---------------------------------+----------------+----------+ 6617 | Message Code Name | Code Value | RFC | 6618 +---------------------------------+----------------+----------+ 6619 | invalid | 0 | RFC-AAAA | 6620 | probe_req | 1 | RFC-AAAA | 6621 | probe_ans | 2 | RFC-AAAA | 6622 | attach_req | 3 | RFC-AAAA | 6623 | attach_ans | 4 | RFC-AAAA | 6624 | unused | 5 | | 6625 | unused | 6 | | 6626 | store_req | 7 | RFC-AAAA | 6627 | store_ans | 8 | RFC-AAAA | 6628 | fetch_req | 9 | RFC-AAAA | 6629 | fetch_ans | 10 | RFC-AAAA | 6630 | unused (was remove_req) | 11 | RFC-AAAA | 6631 | unused (was remove_ans) | 12 | RFC-AAAA | 6632 | find_req | 13 | RFC-AAAA | 6633 | find_ans | 14 | RFC-AAAA | 6634 | join_req | 15 | RFC-AAAA | 6635 | join_ans | 16 | RFC-AAAA | 6636 | leave_req | 17 | RFC-AAAA | 6637 | leave_ans | 18 | RFC-AAAA | 6638 | update_req | 19 | RFC-AAAA | 6639 | update_ans | 20 | RFC-AAAA | 6640 | route_query_req | 21 | RFC-AAAA | 6641 | route_query_ans | 22 | RFC-AAAA | 6642 | ping_req | 23 | RFC-AAAA | 6643 | ping_ans | 24 | RFC-AAAA | 6644 | stat_req | 25 | RFC-AAAA | 6645 | stat_ans | 26 | RFC-AAAA | 6646 | unused (was attachlite_req) | 27 | RFC-AAAA | 6647 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6648 | app_attach_req | 29 | RFC-AAAA | 6649 | app_attach_ans | 30 | RFC-AAAA | 6650 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6651 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6652 | config_update_req | 33 | RFC-AAAA | 6653 | config_update_ans | 34 | RFC-AAAA | 6654 | exp_a_req | 35 | RFC-AAAA | 6655 | exp_a_ans | 36 | RFC-AAAA | 6656 | exp_b_req | 37 | RFC-AAAA | 6657 | exp_b_ans | 38 | RFC-AAAA | 6658 | reserved | 0x8000..0xfffe | RFC-AAAA | 6659 | error | 0xffff | RFC-AAAA | 6660 +---------------------------------+----------------+----------+ 6662 The values exp_a_req, exp_a_ans, exp_b_req, and exp_b_ans have been 6663 made available for the purposes of experimentation. These values are 6664 not meant for vendor specific use of any sort and MUST NOT be used 6665 for operational deployments. 6667 13.9. Error Codes 6669 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6670 registry are 16-bit integers denoting error codes. New entries SHALL 6671 be defined via RFC 5226 Standards Action. The initial contents of 6672 this registry are: 6674 +-------------------------------------+----------------+----------+ 6675 | Error Code Name | Code Value | RFC | 6676 +-------------------------------------+----------------+----------+ 6677 | invalid | 0 | RFC-AAAA | 6678 | Unused | 1 | RFC-AAAA | 6679 | Error_Forbidden | 2 | RFC-AAAA | 6680 | Error_Not_Found | 3 | RFC-AAAA | 6681 | Error_Request_Timeout | 4 | RFC-AAAA | 6682 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6683 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6684 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6685 | Error_Data_Too_Large | 8 | RFC-AAAA | 6686 | Error_Data_Too_Old | 9 | RFC-AAAA | 6687 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6688 | Error_Message_Too_Large | 11 | RFC-AAAA | 6689 | Error_Unknown_Kind | 12 | RFC-AAAA | 6690 | Error_Unknown_Extension | 13 | RFC-AAAA | 6691 | Error_Response_Too_Large | 14 | RFC-AAAA | 6692 | Error_Config_Too_Old | 15 | RFC-AAAA | 6693 | Error_Config_Too_New | 16 | RFC-AAAA | 6694 | Error_In_Progress | 17 | RFC-AAAA | 6695 | Error_Exp_A | 18 | RFC-AAAA | 6696 | Error_Exp_B | 19 | RFC-AAAA | 6697 | reserved | 0x8000..0xfffe | RFC-AAAA | 6698 +-------------------------------------+----------------+----------+ 6700 The values Error_Exp_A and Error_Exp_B have been made available for 6701 the purposes of experimentation. These values are not meant for 6702 vendor specific use of any sort and MUST NOT be used for operational 6703 deployments. 6705 13.10. Overlay Link Types 6707 IANA SHALL create a "RELOAD Overlay Link Registry." New entries 6708 SHALL be defined via RFC 5226 Standards Action. This registry SHALL 6709 be initially populated with the following values: 6711 +--------------------+------+---------------+ 6712 | Protocol | Code | Specification | 6713 +--------------------+------+---------------+ 6714 | reserved | 0 | RFC-AAAA | 6715 | DTLS-UDP-SR | 1 | RFC-AAAA | 6716 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6717 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6718 | EXP-LINK | 5 | RFC-AAAA | 6719 | reserved | 255 | RFC-AAAA | 6720 +--------------------+------+---------------+ 6722 The value EXP-LINK has been made available for the purposes of 6723 experimentation. This value is not meant for vendor specific use of 6724 any sort and it MUST NOT be used for operational deployments. 6726 13.11. Overlay Link Protocols 6728 IANA SHALL create an "Overlay Link Protocol Registry". Entries in 6729 this registry SHALL be defined via RFC 5226 Standards Action. This 6730 registry SHALL be initially populated with the following valuse: 6732 +---------------+---------------+ 6733 | Link Protocol | Specification | 6734 +---------------+---------------+ 6735 | TLS | RFC-AAAA | 6736 | EXP-PROTOCOL | RFC-AAAA | 6737 +---------------+---------------+ 6739 The value EXP-PROTOCOL has been made available for the purposes of 6740 experimentation. This value is not meant for vendor specific use of 6741 any sort and it MUST NOT be used for operational deployments. 6743 13.12. Forwarding Options 6745 IANA SHALL create a "Forwarding Option Registry". Entries in this 6746 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6747 Action. Entries in this registry between 128 and 254 SHALL be 6748 defined via RFC 5226 Specification Required. This registry SHALL be 6749 initially populated with the following values: 6751 +-------------------+------+---------------+ 6752 | Forwarding Option | Code | Specification | 6753 +-------------------+------+---------------+ 6754 | invalid | 0 | RFC-AAAA | 6755 | exp-forward | 1 | RFC-AAAA | 6756 | reserved | 255 | RFC-AAAA | 6757 +-------------------+------+---------------+ 6759 The value exp-forward has been made available for the purposes of 6760 experimentation. This value is not meant for vendor specific use of 6761 any sort and it MUST NOT be used for operational deployments. 6763 13.13. Probe Information Types 6765 IANA SHALL create a "RELOAD Probe Information Type Registry". 6766 Entries in this registry SHALL be defined via RFC 5226 Standards 6767 Action. This registry SHALL be initially populated with the 6768 following values: 6770 +-----------------+------+---------------+ 6771 | Probe Option | Code | Specification | 6772 +-----------------+------+---------------+ 6773 | invalid | 0 | RFC-AAAA | 6774 | responsible_set | 1 | RFC-AAAA | 6775 | num_resources | 2 | RFC-AAAA | 6776 | uptime | 3 | RFC-AAAA | 6777 | exp-probe | 4 | RFC-AAAA | 6778 | reserved | 255 | RFC-AAAA | 6779 +-----------------+------+---------------+ 6781 The value exp-probe has been made available for the purposes of 6782 experimentation. This value is not meant for vendor specific use of 6783 any sort and it MUST NOT be used for operational deployments. 6785 13.14. Message Extensions 6787 IANA SHALL create a "RELOAD Extensions Registry". Entries in this 6788 registry SHALL be defined via RFC 5226 Specification Required. This 6789 registry SHALL be initially populated with the following values: 6791 +-----------------+--------+---------------+ 6792 | Extensions Name | Code | Specification | 6793 +-----------------+--------+---------------+ 6794 | invalid | 0 | RFC-AAAA | 6795 | exp-ext | 1 | RFC-AAAA | 6796 | reserved | 0xFFFF | RFC-AAAA | 6797 +-----------------+--------+---------------+ 6799 The value exp-ext has been made available for the purposes of 6800 experimentation. This value is not meant for vendor specific use of 6801 any sort and it MUST NOT be used for operational deployments. 6803 13.15. reload URI Scheme 6805 This section describes the scheme for a reload URI, which can be used 6806 to refer to either: 6808 o A peer. 6809 o A resource inside a peer. 6811 The reload URI is defined using a subset of the URI schema specified 6812 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6813 [RFC4395] per the following ABNF syntax: 6815 RELOAD-URI = "reload://" destination "@" overlay "/" 6816 [specifier] 6818 destination = 1 * HEXDIG 6819 overlay = reg-name 6820 specifier = 1*HEXDIG 6822 The definitions of these productions are as follows: 6824 destination: a hex-encoded Destination List object (i.e., multiple 6825 concatenated Destination objects with no length prefix prior to 6826 the object as a whole.) 6828 overlay: the name of the overlay. 6830 specifier : a hex-encoded StoredDataSpecifier indicating the data 6831 element. 6833 If no specifier is present then this URI addresses the peer which can 6834 be reached via the indicated destination list at the indicated 6835 overlay name. If a specifier is present, then the URI addresses the 6836 data value. 6838 13.15.1. URI Registration 6840 [[ Note to RFC Editor - please remove this paragraph before 6841 publication. ]] A review request was sent to uri-review@ietf.org on 6842 Oct 7, 2010. 6844 The following summarizes the information necessary to register the 6845 reload URI. 6847 URI Scheme Name: reload 6848 Status: permanent 6849 URI Scheme Syntax: see Section 13.15 of RFC-AAAA 6850 URI Scheme Semantics: The reload URI is intended to be used as a 6851 reference to a RELOAD peer or resource. 6853 Encoding Considerations: The reload URI is not intended to be human- 6854 readable text, so it is encoded entirely in US-ASCII. 6855 Applications/protocols that use this URI scheme: The RELOAD protocol 6856 described in RFC-AAAA. 6857 Interoperability considerations: See RFC-AAAA. 6858 Security considerations: See RFC-AAAA 6859 Contact: Cullen Jennings 6860 Author/Change controller: IESG 6861 References: RFC-AAAA 6863 13.16. Media Type Registration 6865 [[ Note to RFC Editor - please remove this paragraph before 6866 publication. ]] A review request was sent to ietf-types@iana.org on 6867 May 27, 2011. 6869 Type name: application 6871 Subtype name: p2p-overlay+xml 6873 Required parameters: none 6875 Optional parameters: none 6877 Encoding considerations: Must be binary encoded. 6879 Security considerations: This media type is typically not used to 6880 transport information that needs to be kept confidential, however 6881 there are cases where it is integrity of the information is 6882 important. For these cases using a digital signature is RECOMMENDED. 6883 One way of doing this is specified in RFC-AAAA. In the case when the 6884 media includes a "shared-secret" element, then the contents of the 6885 file need to be kept confidential or else anyone that can see the 6886 shared-secret and effect the RELOAD overlay network. 6888 Interoperability considerations: No known interoperability 6889 consideration beyond those identified for application/xml in 6890 [RFC3023]. 6892 Published specification: RFC-AAAA 6894 Applications that use this media type: The type is used to configure 6895 the peer to peer overlay networks defined in RFC-AAAA. 6897 Additional information: The syntax for this media type is specified 6898 in Section 10.1 of RFC-AAAA. The contents MUST be valid XML 6899 compliant with the relax NG grammar specified in RFC-AAAA and use the 6900 UTF-8[RFC3629] character encoding. 6902 Magic number(s): none 6904 File extension(s): relo 6906 Macintosh file type code(s): none 6908 Person & email address to contact for further information: Cullen 6909 Jennings 6911 Intended usage: COMMON 6913 Restrictions on usage: None 6915 Author: Cullen Jennings 6917 Change controller: IESG 6919 14. Acknowledgments 6921 This specification is a merge of the "REsource LOcation And Discovery 6922 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6923 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6924 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6925 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6926 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6927 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6928 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6929 Matuszewski. Thanks to the authors of RFC 5389 for text included 6930 from that. Vidya Narayanan provided many comments and improvements. 6932 The ideas and text for the Chord specific extension data to the Leave 6933 mechanisms was provided by Jouni Maenpaa, Gonzalo Camarillo, and Jani 6934 Hautakorpi. 6936 Thanks to the many people who contributed including Ted Hardie, 6937 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6938 David Bryan, Dave Craig, and Julian Cain. Extensive last call 6939 comments were provided by: Jouni Maenpaa, Roni Even, Gonzalo 6940 Camarillo, Ari Keranen, John Buford, Michael Chen, Frederic-Philippe 6941 Met, Mary Barnes, and David Bryan. Special thanks to Marc Petit- 6942 Huguenin who provided an amazing amount of detailed review. 6944 15. References 6945 15.1. Normative References 6947 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6948 Requirement Levels", BCP 14, RFC 2119, March 1997. 6950 [RFC2585] Housley, R. and P. Hoffman, "Internet X.509 Public Key 6951 Infrastructure Operational Protocols: FTP and HTTP", 6952 RFC 2585, May 1999. 6954 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6956 [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media 6957 Types", RFC 3023, January 2001. 6959 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 6960 (SHA1)", RFC 3174, September 2001. 6962 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 6963 Standards (PKCS) #1: RSA Cryptography Specifications 6964 Version 2.1", RFC 3447, February 2003. 6966 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6967 10646", STD 63, RFC 3629, November 2003. 6969 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6970 Resource Identifier (URI): Generic Syntax", STD 66, 6971 RFC 3986, January 2005. 6973 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6974 for Transport Layer Security (TLS)", RFC 4279, 6975 December 2005. 6977 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6978 Security", RFC 4347, April 2006. 6980 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6981 Registration Procedures for New URI Schemes", BCP 35, 6982 RFC 4395, February 2006. 6984 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6985 Encodings", RFC 4648, October 2006. 6987 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 6988 (ICE): A Protocol for Network Address Translator (NAT) 6989 Traversal for Offer/Answer Protocols", RFC 5245, 6990 April 2010. 6992 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6993 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6995 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6996 (CMC)", RFC 5272, June 2008. 6998 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6999 (CMC): Transport Protocols", RFC 5273, June 2008. 7001 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 7002 Friendly Rate Control (TFRC): Protocol Specification", 7003 RFC 5348, September 2008. 7005 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 7006 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 7007 October 2008. 7009 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 7010 for Application Designers", BCP 145, RFC 5405, 7011 November 2008. 7013 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 7014 Relays around NAT (TURN): Relay Extensions to Session 7015 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 7017 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 7018 Address Text Representation", RFC 5952, August 2010. 7020 [RFC6091] Mavrogiannopoulos, N. and D. Gillmor, "Using OpenPGP Keys 7021 for Transport Layer Security (TLS) Authentication", 7022 RFC 6091, February 2011. 7024 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 7025 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 7027 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 7028 "Computing TCP's Retransmission Timer", RFC 6298, 7029 June 2011. 7031 [w3c-xml-namespaces] 7032 Bray, T., Hollander, D., Layman, A., Tobin, R., and Henry 7033 S. , "Namespaces in XML 1.0 (Third Edition)". 7035 15.2. Informative References 7037 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 7038 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 7039 Scalable Peer-to-peer Lookup Protocol for Internet 7040 Applications", IEEE/ACM Transactions on Networking Volume 7041 11, Issue 1, 17-32, Feb 2003. 7043 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 7044 "Eclipse Attacks on Overlay Networks: Threats and 7045 Defenses", INFOCOM 2006, April 2006. 7047 [I-D.ietf-hip-reload-instance] 7048 Keranen, A., Camarillo, G., and J. Maenpaa, "Host Identity 7049 Protocol-Based Overlay Networking Environment (HIP BONE) 7050 Instance Specification for REsource LOcation And Discovery 7051 (RELOAD)", draft-ietf-hip-reload-instance-03 (work in 7052 progress), January 2011. 7054 [I-D.ietf-mmusic-ice-tcp] 7055 Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 7056 "TCP Candidates with Interactive Connectivity 7057 Establishment (ICE)", draft-ietf-mmusic-ice-tcp-15 (work 7058 in progress), September 2011. 7060 [I-D.ietf-p2psip-self-tuning] 7061 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 7062 tuning Distributed Hash Table (DHT) for REsource LOcation 7063 And Discovery (RELOAD)", draft-ietf-p2psip-self-tuning-04 7064 (work in progress), July 2011. 7066 [I-D.ietf-p2psip-service-discovery] 7067 Maenpaa, J. and G. Camarillo, "Service Discovery Usage for 7068 REsource LOcation And Discovery (RELOAD)", 7069 draft-ietf-p2psip-service-discovery-03 (work in progress), 7070 July 2011. 7072 [I-D.ietf-p2psip-sip] 7073 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 7074 H. Schulzrinne, "A SIP Usage for RELOAD", 7075 draft-ietf-p2psip-sip-06 (work in progress), July 2011. 7077 [I-D.jiang-p2psip-relay] 7078 Jiang, X., Zong, N., Even, R., and Y. Zhang, "An extension 7079 to RELOAD to support Direct Response and Relay Peer 7080 routing", draft-jiang-p2psip-relay-05 (work in progress), 7081 March 2011. 7083 [RFC1122] Braden, R., "Requirements for Internet Hosts - 7084 Communication Layers", STD 3, RFC 1122, October 1989. 7086 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 7087 L. Repka, "S/MIME Version 2 Message Specification", 7088 RFC 2311, March 1998. 7090 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 7091 Requirements for Security", BCP 106, RFC 4086, June 2005. 7093 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 7094 the Session Description Protocol (SDP)", RFC 4145, 7095 September 2005. 7097 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 7098 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 7099 RFC 4787, January 2007. 7101 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 7102 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 7103 April 2007. 7105 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 7106 "Using the Secure Remote Password (SRP) Protocol for TLS 7107 Authentication", RFC 5054, November 2007. 7109 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 7110 "Host Identity Protocol", RFC 5201, April 2008. 7112 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 7113 Housley, R., and W. Polk, "Internet X.509 Public Key 7114 Infrastructure Certificate and Certificate Revocation List 7115 (CRL) Profile", RFC 5280, May 2008. 7117 [RFC5694] Camarillo, G. and IAB, "Peer-to-Peer (P2P) Architecture: 7118 Definition, Taxonomies, Examples, and Applicability", 7119 RFC 5694, November 2009. 7121 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 7122 Issues and Solutions in Peer-to-Peer Systems for Realtime 7123 Communications", RFC 5765, February 2010. 7125 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 7126 Uniform Resource Identifiers (URIs)", RFC 5785, 7127 April 2010. 7129 [RFC6079] Camarillo, G., Nikander, P., Hautakorpi, J., Keranen, A., 7130 and A. Johnston, "HIP BONE: Host Identity Protocol (HIP) 7131 Based Overlay Networking Environment (BONE)", RFC 6079, 7132 January 2011. 7134 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 7136 [UnixTime] 7137 Wikipedia, "Unix Time", . 7140 [bryan-design-hotp2p08] 7141 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 7142 a Versatile, Secure P2PSIP Communications Architecture for 7143 the Public Internet", Hot-P2P'08. 7145 [handling-churn-usenix04] 7146 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 7147 "Handling Churn in a DHT", In Proc. of the USENIX Annual 7148 Technical Conference June 2004 USENIX 2004. 7150 [lookups-churn-p2p06] 7151 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 7152 Improving DHT Lookup Performance under Churn", IEEE 7153 P2P'06. 7155 [minimizing-churn-sigcomm06] 7156 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 7157 in Distributed Systems", SIGCOMM 2006. 7159 [non-transitive-dhts-worlds05] 7160 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 7161 Stoica, "Non-Transitive Connectivity and DHTs", 7162 WORLDS'05. 7164 [opendht-sigcomm05] 7165 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 7166 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 7167 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 7169 [vulnerabilities-acsac04] 7170 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 7171 Threats in Structured Peer-to-Peer Systems: A Quantitative 7172 Analysis", ACSAC 2004. 7174 Appendix A. Routing Alternatives 7176 Significant discussion has been focused on the selection of a routing 7177 algorithm for P2PSIP. This section discusses the motivations for 7178 selecting symmetric recursive routing for RELOAD and describes the 7179 extensions that would be required to support additional routing 7180 algorithms. 7182 A.1. Iterative vs Recursive 7184 Iterative routing has a number of advantages. It is easier to debug, 7185 consumes fewer resources on intermediate peers, and allows the 7186 querying peer to identify and route around misbehaving peers 7187 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 7188 iterative routing is intolerably expensive because a new connection 7189 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 7191 Iterative routing is supported through the RouteQuery mechanism and 7192 is primarily intended for debugging. It also allows the querying 7193 peer to evaluate the routing decisions made by the peers at each hop, 7194 consider alternatives, and perhaps detect at what point the 7195 forwarding path fails. 7197 A.2. Symmetric vs Forward response 7199 An alternative to the symmetric recursive routing method used by 7200 RELOAD is Forward-Only routing, where the response is routed to the 7201 requester as if it were a new message initiated by the responder (in 7202 the previous example, Z sends the response to A as if it were sending 7203 a request). Forward-only routing requires no state in either the 7204 message or intermediate peers. 7206 The drawback of forward-only routing is that it does not work when 7207 the overlay is unstable. For example, if A is in the process of 7208 joining the overlay and is sending a Join request to Z, it is not yet 7209 reachable via forward routing. Even if it is established in the 7210 overlay, if network failures produce temporary instability, A may not 7211 be reachable (and may be trying to stabilize its network connectivity 7212 via Attach messages). 7214 Furthermore, forward-only responses are less likely to reach the 7215 querying peer than symmetric recursive ones are, because the forward 7216 path is more likely to have a failed peer than is the request path 7217 (which was just tested to route the request) 7218 [non-transitive-dhts-worlds05]. 7220 An extension to RELOAD that supports forward-only routing but relies 7221 on symmetric responses as a fallback would be possible, but due to 7222 the complexities of determining when to use forward-only and when to 7223 fallback to symmetric, we have chosen not to include it as an option 7224 at this point. 7226 A.3. Direct Response 7228 Another routing option is Direct Response routing, in which the 7229 response is returned directly to the querying node. In the previous 7230 example, if A encodes its IP address in the request, then Z can 7231 simply deliver the response directly to A. In the absence of NATs or 7232 other connectivity issues, this is the optimal routing technique. 7234 The challenge of implementing direct response is the presence of 7235 NATs. There are a number of complexities that must be addressed. In 7236 this discussion, we will continue our assumption that A issued the 7237 request and Z is generating the response. 7239 o The IP address listed by A may be unreachable, either due to NAT 7240 or firewall rules. Therefore, a direct response technique must 7241 fallback to symmetric response [non-transitive-dhts-worlds05]. 7242 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 7243 received the message (and the TLS negotiation will provide earlier 7244 confirmation that A is reachable), but this fallback requires a 7245 timeout that will increase the response latency whenever A is not 7246 reachable from Z. 7247 o Whenever A is behind a NAT it will have multiple candidate IP 7248 addresses, each of which must be advertised to ensure 7249 connectivity; therefore Z will need to attempt multiple 7250 connections to deliver the response. 7251 o One (or all) of A's candidate addresses may route from Z to a 7252 different device on the Internet. In the worst case these nodes 7253 may actually be running RELOAD on the same port. Therefore, it is 7254 absolutely necessary to establish a secure connection to 7255 authenticate A before delivering the response. This step 7256 diminishes the efficiency of direct response because multiple 7257 roundtrips are required before the message can be delivered. 7258 o If A is behind a NAT and does not have a connection already 7259 established with Z, there are only two ways the direct response 7260 will work. The first is that A and Z both be behind the same NAT, 7261 in which case the NAT is not involved. In the more common case, 7262 when Z is outside A's NAT, the response will only be received if 7263 A's NAT implements endpoint-independent filtering. As the choice 7264 of filtering mode conflates application transparency with security 7265 [RFC4787], and no clear recommendation is available, the 7266 prevalence of this feature in future devices remains unclear. 7268 An extension to RELOAD that supports direct response routing but 7269 relies on symmetric responses as a fallback would be possible, but 7270 due to the complexities of determining when to use direct response 7271 and when to fallback to symmetric, and the reduced performance for 7272 responses to peers behind restrictive NATs, we have chosen not to 7273 include it as an option at this point. 7275 A.4. Relay Peers 7277 [I-D.jiang-p2psip-relay] has proposed implementing a form of direct 7278 response by having A identify a peer, Q, that will be directly 7279 reachable by any other peer. A uses Attach to establish a connection 7280 with Q and advertises Q's IP address in the request sent to Z. Z 7281 sends the response to Q, which relays it to A. This then reduces the 7282 latency to two hops, plus Z negotiating a secure connection to Q. 7284 This technique relies on the relative population of nodes such as A 7285 that require relay peers and peers such as Q that are capable of 7286 serving as a relay peer. It also requires nodes to be able to 7287 identify which category they are in. This identification problem has 7288 turned out to be hard to solve and is still an open area of 7289 exploration. 7291 An extension to RELOAD that supports relay peers is possible, but due 7292 to the complexities of implementing such an alternative, we have not 7293 added such a feature to RELOAD at this point. 7295 A concept similar to relay peers, essentially choosing a relay peer 7296 at random, has previously been suggested to solve problems of 7297 pairwise non-transitivity [non-transitive-dhts-worlds05], but 7298 deterministic filtering provided by NATs makes random relay peers no 7299 more likely to work than the responding peer. 7301 A.5. Symmetric Route Stability 7303 A common concern about symmetric recursive routing has been that one 7304 or more peers along the request path may fail before the response is 7305 received. The significance of this problem essentially depends on 7306 the response latency of the overlay. An overlay that produces slow 7307 responses will be vulnerable to churn, whereas responses that are 7308 delivered very quickly are vulnerable only to failures that occur 7309 over that small interval. 7311 The other aspect of this issue is whether the request itself can be 7312 successfully delivered. Assuming typical connection maintenance 7313 intervals, the time period between the last maintenance and the 7314 request being sent will be orders of magnitude greater than the delay 7315 between the request being forwarded and the response being received. 7316 Therefore, if the path was stable enough to be available to route the 7317 request, it is almost certainly going to remain available to route 7318 the response. 7320 An overlay that is unstable enough to suffer this type of failure 7321 frequently is unlikely to be able to support reliable functionality 7322 regardless of the routing mechanism. However, regardless of the 7323 stability of the return path, studies show that in the event of high 7324 churn, iterative routing is a better solution to ensure request 7325 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 7327 Finally, because RELOAD retries the end-to-end request, that retry 7328 will address the issues of churn that remain. 7330 Appendix B. Why Clients? 7332 There are a wide variety of reasons a node may act as a client rather 7333 than as a peer. This section outlines some of those scenarios and 7334 how the client's behavior changes based on its capabilities. 7336 B.1. Why Not Only Peers? 7338 For a number of reasons, a particular node may be forced to act as a 7339 client even though it is willing to act as a peer. These include: 7341 o The node does not have appropriate network connectivity, typically 7342 because it has a low-bandwidth network connection. 7343 o The node may not have sufficient resources, such as computing 7344 power, storage space, or battery power. 7345 o The overlay algorithm may dictate specific requirements for peer 7346 selection. These may include participating in the overlay to 7347 determine trustworthiness; controlling the number of peers in the 7348 overlay to reduce overly-long routing paths; or ensuring minimum 7349 application uptime before a node can join as a peer. 7351 The ultimate criteria for a node to become a peer are determined by 7352 the overlay algorithm and specific deployment. A node acting as a 7353 client that has a full implementation of RELOAD and the appropriate 7354 overlay algorithm is capable of locating its responsible peer in the 7355 overlay and using Attach to establish a direct connection to that 7356 peer. In that way, it may elect to be reachable under either of the 7357 routing approaches listed above. Particularly for overlay algorithms 7358 that elect nodes to serve as peers based on trustworthiness or 7359 population, the overlay algorithm may require such a client to locate 7360 itself at a particular place in the overlay. 7362 B.2. Clients as Application-Level Agents 7364 SIP defines an extensive protocol for registration and security 7365 between a client and its registrar/proxy server(s). Any SIP device 7366 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 7367 peer that implements the server-side functionality required by the 7368 SIP protocol. In this case, the peer would be acting as if it were 7369 the user's peer, and would need the appropriate credentials for that 7370 user. 7372 Application-level support for clients is defined by a usage. A usage 7373 offering support for application-level clients should specify how the 7374 security of the system is maintained when the data is moved between 7375 the application and RELOAD layers. 7377 Authors' Addresses 7379 Cullen Jennings 7380 Cisco 7381 170 West Tasman Drive 7382 MS: SJC-21/2 7383 San Jose, CA 95134 7384 USA 7386 Phone: +1 408 421-9990 7387 Email: fluffy@cisco.com 7389 Bruce B. Lowekamp (editor) 7390 Skype 7391 Palo Alto, CA 7392 USA 7394 Email: bbl@lowekamp.net 7396 Eric Rescorla 7397 RTFM, Inc. 7398 2064 Edgewood Drive 7399 Palo Alto, CA 94303 7400 USA 7402 Phone: +1 650 678 2350 7403 Email: ekr@rtfm.com 7405 Salman A. Baset 7406 Columbia University 7407 1214 Amsterdam Avenue 7408 New York, NY 7409 USA 7411 Email: salman@cs.columbia.edu 7412 Henning Schulzrinne 7413 Columbia University 7414 1214 Amsterdam Avenue 7415 New York, NY 7416 USA 7418 Email: hgs@cs.columbia.edu