idnits 2.17.1 draft-ietf-p2psip-base-18.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 1863 has weird spacing: '...Options optio...' == Line 2117 has weird spacing: '...ionType type;...' == Line 2343 has weird spacing: '...tyValue ide...' == Line 2652 has weird spacing: '...ionType typ...' == Line 2654 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 (August 3, 2011) is 4650 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 1758, but not defined -- Looks like a reference, but probably isn't: '0' on line 4658 == Missing Reference: 'RFC-AAAA' is mentioned on line 6370, but not defined ** 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 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-13 == 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: 12 errors (**), 0 flaws (~~), 14 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: February 4, 2012 Skype 6 E. Rescorla 7 RTFM, Inc. 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 August 3, 2011 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-18 16 Abstract 18 This specification defines REsource LOcation And Discovery (RELOAD), 19 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 20 P2P signaling protocol provides its clients with an abstract storage 21 and messaging service between a set of cooperating peers that form 22 the overlay network. RELOAD is designed to support a P2P Session 23 Initiation Protocol (P2PSIP) network, but can be utilized by other 24 applications with similar requirements by defining new usages that 25 specify the kinds of data that must be stored for a particular 26 application. RELOAD defines a security model based on a certificate 27 enrollment service that provides unique identities. NAT traversal is 28 a fundamental service of the protocol. RELOAD also allows access 29 from "client" nodes that do not need to route traffic or store data 30 for others. 32 Status of this Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on February 4, 2012. 49 Copyright Notice 51 Copyright (c) 2011 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (http://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 This document may contain material from IETF Documents or IETF 65 Contributions published or made publicly available before November 66 10, 2008. The person(s) controlling the copyright in some of this 67 material may not have granted the IETF Trust the right to allow 68 modifications of such material outside the IETF Standards Process. 69 Without obtaining an adequate license from the person(s) controlling 70 the copyright in such materials, this document may not be modified 71 outside the IETF Standards Process, and derivative works of it may 72 not be created outside the IETF Standards Process, except to format 73 it for publication as an RFC or to translate it into languages other 74 than English. 76 Table of Contents 78 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 79 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 80 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 81 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 82 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 83 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 14 84 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 85 1.2.5. Forwarding and Link Management Layer . . . . . . . . 15 86 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 16 87 1.4. Structure of This Document . . . . . . . . . . . . . . . 17 88 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 89 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 20 90 3.1. Security and Identification . . . . . . . . . . . . . . 20 91 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 21 92 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 21 93 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 22 94 3.2.2. Minimum Functionality Requirements for Clients . . . 23 95 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 23 96 3.4. Connectivity Management . . . . . . . . . . . . . . . . 26 97 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 27 98 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 27 99 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 27 100 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 29 101 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 29 102 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 29 103 4. Application Support Overview . . . . . . . . . . . . . . . . 29 104 4.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 30 105 4.1.1. Storage Permissions . . . . . . . . . . . . . . . . 31 106 4.1.2. Replication . . . . . . . . . . . . . . . . . . . . 32 107 4.2. Usages . . . . . . . . . . . . . . . . . . . . . . . . . 32 108 4.3. Service Discovery . . . . . . . . . . . . . . . . . . . 33 109 4.4. Application Connectivity . . . . . . . . . . . . . . . . 33 110 5. Overlay Management Protocol . . . . . . . . . . . . . . . . . 33 111 5.1. Message Receipt and Forwarding . . . . . . . . . . . . . 34 112 5.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 34 113 5.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 35 114 5.1.3. Private ID . . . . . . . . . . . . . . . . . . . . . 37 115 5.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 37 116 5.2.1. Request Origination . . . . . . . . . . . . . . . . 37 117 5.2.2. Response Origination . . . . . . . . . . . . . . . . 38 118 5.3. Message Structure . . . . . . . . . . . . . . . . . . . 38 119 5.3.1. Presentation Language . . . . . . . . . . . . . . . 39 120 5.3.1.1. Common Definitions . . . . . . . . . . . . . . . 39 121 5.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 42 122 5.3.2.1. Processing Configuration Sequence Numbers . . . . 44 123 5.3.2.2. Destination and Via Lists . . . . . . . . . . . . 45 124 5.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 47 125 5.3.3. Message Contents Format . . . . . . . . . . . . . . 48 126 5.3.3.1. Response Codes and Response Errors . . . . . . . 49 127 5.3.4. Security Block . . . . . . . . . . . . . . . . . . . 51 128 5.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 55 129 5.4.1. Topology Plugin Requirements . . . . . . . . . . . . 55 130 5.4.2. Methods and types for use by topology plugins . . . 55 131 5.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 55 132 5.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 56 133 5.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 57 134 5.4.2.4. RouteQuery . . . . . . . . . . . . . . . . . . . 57 135 5.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 58 136 5.5. Forwarding and Link Management Layer . . . . . . . . . . 60 137 5.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 61 138 5.5.1.1. Request Definition . . . . . . . . . . . . . . . 61 139 5.5.1.2. Response Definition . . . . . . . . . . . . . . . 64 140 5.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 65 141 5.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 65 142 5.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 66 143 5.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 66 144 5.5.1.7. Encoding the Attach Message . . . . . . . . . . . 67 145 5.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 67 146 5.5.1.9. Role Determination . . . . . . . . . . . . . . . 67 147 5.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 68 148 5.5.1.11. No-ICE . . . . . . . . . . . . . . . . . . . . . 68 149 5.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 68 150 5.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 69 151 5.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 69 152 5.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 69 153 5.5.2.1. Request Definition . . . . . . . . . . . . . . . 69 154 5.5.2.2. Response Definition . . . . . . . . . . . . . . . 70 155 5.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 70 156 5.5.3.1. Request Definition . . . . . . . . . . . . . . . 71 157 5.5.3.2. Response Definition . . . . . . . . . . . . . . . 71 158 5.5.4. ConfigUpdate . . . . . . . . . . . . . . . . . . . . 71 159 5.5.4.1. Request Definition . . . . . . . . . . . . . . . 72 160 5.5.4.2. Response Definition . . . . . . . . . . . . . . . 72 161 5.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 73 162 5.6.1. Future Overlay Link Protocols . . . . . . . . . . . 74 163 5.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 75 164 5.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 75 165 5.6.1.3. Message-oriented Transports . . . . . . . . . . . 75 166 5.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 75 167 5.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 76 168 5.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 77 169 5.6.3.1. Retransmission and Flow Control . . . . . . . . . 78 170 5.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 79 171 5.6.5. TLS/TCP with FH, No-ICE . . . . . . . . . . . . . . 79 172 5.6.6. DTLS/UDP with SR, No-ICE . . . . . . . . . . . . . . 80 173 5.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 80 174 6. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 81 175 6.1. Data Signature Computation . . . . . . . . . . . . . . . 82 176 6.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 83 177 6.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 84 178 6.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 84 179 6.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 85 180 6.3. Access Control Policies . . . . . . . . . . . . . . . . 85 181 6.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 86 182 6.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 86 183 6.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 86 184 6.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 86 185 6.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 87 186 6.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 87 187 6.4.1.1. Request Definition . . . . . . . . . . . . . . . 87 188 6.4.1.2. Response Definition . . . . . . . . . . . . . . . 91 189 6.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 93 190 6.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 93 191 6.4.2.1. Request Definition . . . . . . . . . . . . . . . 94 192 6.4.2.2. Response Definition . . . . . . . . . . . . . . . 96 193 6.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 97 194 6.4.3.1. Request Definition . . . . . . . . . . . . . . . 97 195 6.4.3.2. Response Definition . . . . . . . . . . . . . . . 97 196 6.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 99 197 6.4.4.1. Request Definition . . . . . . . . . . . . . . . 99 198 6.4.4.2. Response Definition . . . . . . . . . . . . . . . 100 199 6.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 101 200 7. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 101 201 8. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 102 202 9. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 104 203 9.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 105 204 9.2. Hash Function . . . . . . . . . . . . . . . . . . . . . 105 205 9.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 105 206 9.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 106 207 9.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 106 208 9.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 107 209 9.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 107 210 9.7.1. Handling Neighbor Failures . . . . . . . . . . . . . 109 211 9.7.2. Handling Finger Table Entry Failure . . . . . . . . 110 212 9.7.3. Receiving Updates . . . . . . . . . . . . . . . . . 110 213 9.7.4. Stabilization . . . . . . . . . . . . . . . . . . . 111 214 9.7.4.1. Updating neighbor table . . . . . . . . . . . . . 111 215 9.7.4.2. Refreshing finger table . . . . . . . . . . . . . 111 216 9.7.4.3. Adjusting finger table size . . . . . . . . . . . 112 217 9.7.4.4. Detecting partitioning . . . . . . . . . . . . . 113 218 9.8. Route query . . . . . . . . . . . . . . . . . . . . . . 113 219 9.9. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 114 221 10. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 115 222 10.1. Overlay Configuration . . . . . . . . . . . . . . . . . 115 223 10.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 121 224 10.2. Discovery Through Configuration Server . . . . . . . . . 123 225 10.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 124 226 10.3.1. Self-Generated Credentials . . . . . . . . . . . . . 125 227 10.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 126 228 10.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 126 229 11. Message Flow Example . . . . . . . . . . . . . . . . . . . . 127 230 12. Security Considerations . . . . . . . . . . . . . . . . . . . 133 231 12.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 133 232 12.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 134 233 12.3. Certificate-based Security . . . . . . . . . . . . . . . 134 234 12.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 135 235 12.5. Storage Security . . . . . . . . . . . . . . . . . . . . 136 236 12.5.1. Authorization . . . . . . . . . . . . . . . . . . . 136 237 12.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 137 238 12.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 137 239 12.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 137 240 12.6. Routing Security . . . . . . . . . . . . . . . . . . . . 138 241 12.6.1. Background . . . . . . . . . . . . . . . . . . . . . 138 242 12.6.2. Admissions Control . . . . . . . . . . . . . . . . . 139 243 12.6.3. Peer Identification and Authentication . . . . . . . 139 244 12.6.4. Protecting the Signaling . . . . . . . . . . . . . . 140 245 12.6.5. Residual Attacks . . . . . . . . . . . . . . . . . . 140 246 13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 141 247 13.1. Well-Known URI Registration . . . . . . . . . . . . . . 141 248 13.2. Port Registrations . . . . . . . . . . . . . . . . . . . 141 249 13.3. Overlay Algorithm Types . . . . . . . . . . . . . . . . 142 250 13.4. Access Control Policies . . . . . . . . . . . . . . . . 142 251 13.5. Application-ID . . . . . . . . . . . . . . . . . . . . . 142 252 13.6. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 143 253 13.7. Data Model . . . . . . . . . . . . . . . . . . . . . . . 143 254 13.8. Message Codes . . . . . . . . . . . . . . . . . . . . . 144 255 13.9. Error Codes . . . . . . . . . . . . . . . . . . . . . . 146 256 13.10. Overlay Link Types . . . . . . . . . . . . . . . . . . . 146 257 13.11. Overlay Link Protocols . . . . . . . . . . . . . . . . . 147 258 13.12. Forwarding Options . . . . . . . . . . . . . . . . . . . 147 259 13.13. Probe Information Types . . . . . . . . . . . . . . . . 148 260 13.14. Message Extensions . . . . . . . . . . . . . . . . . . . 148 261 13.15. reload URI Scheme . . . . . . . . . . . . . . . . . . . 148 262 13.15.1. URI Registration . . . . . . . . . . . . . . . . . . 149 263 13.16. Media Type Registration . . . . . . . . . . . . . . . . 150 264 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 151 265 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 152 266 15.1. Normative References . . . . . . . . . . . . . . . . . . 152 267 15.2. Informative References . . . . . . . . . . . . . . . . . 153 268 Appendix A. Routing Alternatives . . . . . . . . . . . . . . . . 156 269 A.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 156 270 A.2. Symmetric vs Forward response . . . . . . . . . . . . . 157 271 A.3. Direct Response . . . . . . . . . . . . . . . . . . . . 157 272 A.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 158 273 A.5. Symmetric Route Stability . . . . . . . . . . . . . . . 159 274 Appendix B. Why Clients? . . . . . . . . . . . . . . . . . . . . 160 275 B.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 160 276 B.2. Clients as Application-Level Agents . . . . . . . . . . 160 277 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 161 278 C.1. Changes since draft-ietf-p2psip-reload-13 . . . . . . . 161 279 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 161 281 1. Introduction 283 This document defines REsource LOcation And Discovery (RELOAD), a 284 peer-to-peer (P2P) signaling protocol for use on the Internet. It 285 provides a generic, self-organizing overlay network service, allowing 286 nodes to efficiently route messages to other nodes and to efficiently 287 store and retrieve data in the overlay. RELOAD provides several 288 features that are critical for a successful P2P protocol for the 289 Internet: 291 Security Framework: A P2P network will often be established among a 292 set of peers that do not trust each other. RELOAD leverages a 293 central enrollment server to provide credentials for each peer 294 which can then be used to authenticate each operation. This 295 greatly reduces the possible attack surface. 297 Usage Model: RELOAD is designed to support a variety of 298 applications, including P2P multimedia communications with the 299 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 300 the definition of new application usages, each of which can define 301 its own data types, along with the rules for their use. This 302 allows RELOAD to be used with new applications through a simple 303 documentation process that supplies the details for each 304 application. 306 NAT Traversal: RELOAD is designed to function in environments where 307 many if not most of the nodes are behind NATs or firewalls. 308 Operations for NAT traversal are part of the base design, 309 including using ICE to establish new RELOAD or application 310 protocol connections. 312 High Performance Routing: The very nature of overlay algorithms 313 introduces a requirement that peers participating in the P2P 314 network route requests on behalf of other peers in the network. 315 This introduces a load on those other peers, in the form of 316 bandwidth and processing power. RELOAD has been defined with a 317 simple, lightweight forwarding header, thus minimizing the amount 318 of effort required by intermediate peers. 320 Pluggable Overlay Algorithms: RELOAD has been designed with an 321 abstract interface to the overlay layer to simplify implementing a 322 variety of structured (e.g., distributed hash tables) and 323 unstructured overlay algorithms. This specification also defines 324 how RELOAD is used with the Chord based DHT algorithm, which is 325 mandatory to implement. Specifying a default "must implement" 326 overlay algorithm promotes interoperability, while extensibility 327 allows selection of overlay algorithms optimized for a particular 328 application. 330 These properties were designed specifically to meet the requirements 331 for a P2P protocol to support SIP. This document defines the base 332 protocol for the distributed storage and location service, as well as 333 critical usages for NAT traversal and security. The SIP Usage itself 334 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 335 limited to usage by SIP and could serve as a tool for supporting 336 other P2P applications with similar needs. 338 1.1. Basic Setting 340 In this section, we provide a brief overview of the operational 341 setting for RELOAD. A RELOAD Overlay Instance consists of a set of 342 nodes arranged in a connected graph. Each node in the overlay is 343 assigned a numeric Node-ID which, together with the specific overlay 344 algorithm in use, determines its position in the graph and the set of 345 nodes it connects to. The figure below shows a trivial example which 346 isn't drawn from any particular overlay algorithm, but was chosen for 347 convenience of representation. 349 +--------+ +--------+ +--------+ 350 | Node 10|--------------| Node 20|--------------| Node 30| 351 +--------+ +--------+ +--------+ 352 | | | 353 | | | 354 +--------+ +--------+ +--------+ 355 | Node 40|--------------| Node 50|--------------| Node 60| 356 +--------+ +--------+ +--------+ 357 | | | 358 | | | 359 +--------+ +--------+ +--------+ 360 | Node 70|--------------| Node 80|--------------| Node 90| 361 +--------+ +--------+ +--------+ 362 | 363 | 364 +--------+ 365 | Node 85| 366 |(Client)| 367 +--------+ 369 Because the graph is not fully connected, when a node wants to send a 370 message to another node, it may need to route it through the network. 371 For instance, Node 10 can talk directly to nodes 20 and 40, but not 372 to Node 70. In order to send a message to Node 70, it would first 373 send it to Node 40 with instructions to pass it along to Node 70. 374 Different overlay algorithms will have different connectivity graphs, 375 but the general idea behind all of them is to allow any node in the 376 graph to efficiently reach every other node within a small number of 377 hops. 379 The RELOAD network is not only a messaging network. It is also a 380 storage network. Records are stored under numeric addresses which 381 occupy the same space as node identifiers. Peers are responsible for 382 storing the data associated with some set of addresses as determined 383 by their Node-ID. For instance, we might say that every peer is 384 responsible for storing any data value which has an address less than 385 or equal to its own Node-ID, but greater than the next lowest 386 Node-ID. Thus, Node-20 would be responsible for storing values 387 11-20. 389 RELOAD also supports clients. These are nodes which have Node-IDs 390 but do not participate in routing or storage. For instance, in the 391 figure above Node 85 is a client. It can route to the rest of the 392 RELOAD network via Node 80, but no other node will route through it 393 and Node 90 is still responsible for all addresses between 81-90. We 394 refer to non-client nodes as peers. 396 Other applications (for instance, SIP) can be defined on top of 397 RELOAD and use these two basic RELOAD services to provide their own 398 services. 400 1.2. Architecture 402 RELOAD is fundamentally an overlay network. The following figure 403 shows the layered RELOAD architecture. 405 Application 407 +-------+ +-------+ 408 | SIP | | XMPP | ... 409 | Usage | | Usage | 410 +-------+ +-------+ 411 ------------------------------------ Messaging Service Boundary 412 +------------------+ +---------+ 413 | Message |<--->| Storage | 414 | Transport | +---------+ 415 +------------------+ ^ 416 ^ ^ | 417 | v v 418 | +-------------------+ 419 | | Topology | 420 | | Plugin | 421 | +-------------------+ 422 | ^ 423 v v 424 +------------------+ 425 | Forwarding & | 426 | Link Management | 427 +------------------+ 428 ------------------------------------ Overlay Link Service Boundary 429 +-------+ +------+ 430 |TLS | |DTLS | ... 431 +-------+ +------+ 433 The major components of RELOAD are: 435 Usage Layer: Each application defines a RELOAD usage; a set of data 436 kinds and behaviors which describe how to use the services 437 provided by RELOAD. These usages all talk to RELOAD through a 438 common Message Transport Service. 440 Message Transport: Handles end-to-end reliability, manages request 441 state for the usages, and forwards Store and Fetch operations to 442 the Storage component. Delivers message responses to the 443 component initiating the request. 445 Storage: The Storage component is responsible for processing 446 messages relating to the storage and retrieval of data. It talks 447 directly to the Topology Plugin to manage data replication and 448 migration, and it talks to the Message Transport component to send 449 and receive messages. 451 Topology Plugin: The Topology Plugin is responsible for implementing 452 the specific overlay algorithm being used. It uses the Message 453 Transport component to send and receive overlay management 454 messages, to the Storage component to manage data replication, and 455 directly to the Forwarding Layer to control hop-by-hop message 456 forwarding. This component closely parallels conventional routing 457 algorithms, but is more tightly coupled to the Forwarding Layer 458 because there is no single "routing table" equivalent used by all 459 overlay algorithms. 461 Forwarding and Link Management Layer: Stores and implements the 462 routing table by providing packet forwarding services between 463 nodes. It also handles establishing new links between nodes, 464 including setting up connections across NATs using ICE. 466 Overlay Link Layer: Responsible for actually transporting traffic 467 directly between nodes. Each such protocol includes the 468 appropriate provisions for per-hop framing or hop-by-hop ACKs 469 required by unreliable transports. TLS [RFC5246] and DTLS 470 [RFC4347] are the currently defined "link layer" protocols used by 471 RELOAD for hop-by-hop communication. New protocols can be 472 defined, as described in Section 5.6.1 and Section 10.1. As this 473 document defines only TLS and DTLS, we use those terms throughout 474 the remainder of the document with the understanding that some 475 future specification may add new overlay link layers. 477 To further clarify the roles of the various layers, this figure 478 parallels the architecture with each layer's role from an overlay 479 perspective and implementation layer in the internet: 481 | Internet Model | 482 Real | Equivalent | Reload 483 Internet | in Overlay | Architecture 484 -------------+-----------------+------------------------------------ 485 | | +-------+ +-------+ 486 | Application | | SIP | | XMPP | ... 487 | | | Usage | | Usage | 488 | | +-------+ +-------+ 489 | | ---------------------------------- 490 | |+------------------+ +---------+ 491 | Transport || Message |<--->| Storage | 492 | || Transport | +---------+ 493 | |+------------------+ ^ 494 | | ^ ^ | 495 | | | v v 496 Application | | | +-------------------+ 497 | (Routing) | | | Topology | 498 | | | | Plugin | 499 | | | +-------------------+ 500 | | | ^ 501 | | v v 502 | Network | +------------------+ 503 | | | Forwarding & | 504 | | | Link Management | 505 | | +------------------+ 506 | | ---------------------------------- 507 Transport | Link | +-------+ +------+ 508 | | |TLS | |DTLS | ... 509 | | +-------+ +------+ 510 -------------+-----------------+------------------------------------ 511 Network | 512 | 513 Link | 515 1.2.1. Usage Layer 517 The top layer, called the Usage Layer, has application usages, such 518 as the SIP Registration Usage [I-D.ietf-p2psip-sip], that use the 519 abstract Message Transport Service provided by RELOAD. The goal of 520 this layer is to implement application-specific usages of the generic 521 overlay services provided by RELOAD. The usage defines how a 522 specific application maps its data into something that can be stored 523 in the overlay, where to store the data, how to secure the data, and 524 finally how applications can retrieve and use the data. 526 The architecture diagram shows both a SIP usage and an XMPP usage. A 527 single application may require multiple usages; for example a 528 softphone application may also require a voicemail usage. A usage 529 may define multiple kinds of data that are stored in the overlay and 530 may also rely on kinds originally defined by other usages. 532 Because the security and storage policies for each kind are dictated 533 by the usage defining the kind, the usages may be coupled with the 534 Storage component to provide security policy enforcement and to 535 implement appropriate storage strategies according to the needs of 536 the usage. The exact implementation of such an interface is outside 537 the scope of this specification. 539 1.2.2. Message Transport 541 The Message Transport component provides a generic message routing 542 service for the overlay. The Message Transport layer is responsible 543 for end-to-end message transactions, including retransmissions. Each 544 peer is identified by its location in the overlay as determined by 545 its Node-ID. A component that is a client of the Message Transport 546 can perform two basic functions: 548 o Send a message to a given peer specified by Node-ID or to the peer 549 responsible for a particular Resource-ID. 550 o Receive messages that other peers sent to a Node-ID or Resource-ID 551 for which the receiving peer is responsible. 553 All usages rely on the Message Transport component to send and 554 receive messages from peers. For instance, when a usage wants to 555 store data, it does so by sending Store requests. Note that the 556 Storage component and the Topology Plugin are themselves clients of 557 the Message Transport, because they need to send and receive messages 558 from other peers. 560 The Message Transport Service is similar to those described as 561 providing "Key based routing" (KBR), although as RELOAD supports 562 different overlay algorithms (including non-DHT overlay algorithms) 563 that calculate keys in different ways, the actual interface must 564 accept Resource Names rather than actual keys. 566 1.2.3. Storage 568 One of the major functions of RELOAD is to allow nodes to store data 569 in the overlay and to retrieve data stored by other nodes or by 570 themselves. The Storage component is responsible for processing data 571 storage and retrieval messages. For instance, the Storage component 572 might receive a Store request for a given resource from the Message 573 Transport. It would then query the appropriate usage before storing 574 the data value(s) in its local data store and sending a response to 575 the Message Transport for delivery to the requesting node. 576 Typically, these messages will come from other nodes, but depending 577 on the overlay topology, a node might be responsible for storing data 578 for itself as well, especially if the overlay is small. 580 A peer's Node-ID determines the set of resources that it will be 581 responsible for storing. However, the exact mapping between these is 582 determined by the overlay algorithm in use. The Storage component 583 will only receive a Store request from the Message Transport if this 584 peer is responsible for that Resource-ID. The Storage component is 585 notified by the Topology Plugin when the Resource-IDs for which it is 586 responsible change, and the Storage component is then responsible for 587 migrating resources to other peers, as required. 589 1.2.4. Topology Plugin 591 RELOAD is explicitly designed to work with a variety of overlay 592 algorithms. In order to facilitate this, the overlay algorithm 593 implementation is provided by a Topology Plugin so that each overlay 594 can select an appropriate overlay algorithm that relies on the common 595 RELOAD core protocols and code. 597 The Topology Plugin is responsible for maintaining the overlay 598 algorithm Routing Table, which is consulted by the Forwarding and 599 Link Management Layer before routing a message. When connections are 600 made or broken, the Forwarding and Link Management Layer notifies the 601 Topology Plugin, which adjusts the routing table as appropriate. The 602 Topology Plugin will also instruct the Forwarding and Link Management 603 Layer to form new connections as dictated by the requirements of the 604 overlay algorithm Topology. The Topology Plugin issues periodic 605 update requests through Message Transport to maintain and update its 606 Routing Table. 608 As peers enter and leave, resources may be stored on different peers, 609 so the Topology Plugin also keeps track of which peers are 610 responsible for which resources. As peers join and leave, the 611 Topology Plugin instructs the Storage component to issue resource 612 migration requests as appropriate, in order to ensure that other 613 peers have whatever resources they are now responsible for. The 614 Topology Plugin is also responsible for providing for redundant data 615 storage to protect against loss of information in the event of a peer 616 failure and to protect against compromised or subversive peers. 618 1.2.5. Forwarding and Link Management Layer 620 The Forwarding and Link Management Layer is responsible for getting a 621 message to the next peer, as determined by the Topology Plugin. This 622 Layer establishes and maintains the network connections as required 623 by the Topology Plugin. This layer is also responsible for setting 624 up connections to other peers through NATs and firewalls using ICE, 625 and it can elect to forward traffic using relays for NAT and firewall 626 traversal. 628 This layer provides a generic interface that allows the topology 629 plugin to control the overlay and resource operations and messages. 630 Since each overlay algorithm is defined and functions differently, we 631 generically refer to the table of other peers that the overlay 632 algorithm maintains and uses to route requests (neighbors) as a 633 Routing Table. The Topology Plugin actually owns the Routing Table, 634 and forwarding decisions are made by querying the Topology Plugin for 635 the next hop for a particular Node-ID or Resource-ID. If this node 636 is the destination of the message, the message is delivered to the 637 Message Transport. 639 This layer also utilizes a framing header to encapsulate messages as 640 they are forwarding along each hop. This header aids reliability 641 congestion control, flow control, etc. It has meaning only in the 642 context of that individual link. 644 The Forwarding and Link Management Layer sits on top of the Overlay 645 Link Layer protocols that carry the actual traffic. This 646 specification defines how to use DTLS and TLS protocols to carry 647 RELOAD messages. 649 1.3. Security 651 RELOAD's security model is based on each node having one or more 652 public key certificates. In general, these certificates will be 653 assigned by a central server which also assigns Node-IDs, although 654 self-signed certificates can be used in closed networks. These 655 credentials can be leveraged to provide communications security for 656 RELOAD messages. RELOAD provides communications security at three 657 levels: 659 Connection Level: Connections between peers are secured with TLS, 660 DTLS, or potentially some to be defined future protocol. 661 Message Level: Each RELOAD message must be signed. 662 Object Level: Stored objects must be signed by the creating peer. 664 These three levels of security work together to allow peers to verify 665 the origin and correctness of data they receive from other peers, 666 even in the face of malicious activity by other peers in the overlay. 667 RELOAD also provides access control built on top of these 668 communications security features. Because the peer responsible for 669 storing a piece of data can validate the signature on the data being 670 stored, the responsible peer can determine whether a given operation 671 is permitted or not. 673 RELOAD also provides an optional shared secret based admission 674 control feature using shared secrets and TLS-PSK. In order to form a 675 TLS connection to any node in the overlay, a new node needs to know 676 the shared overlay key, thus restricting access to authorized users 677 only. This feature is used together with certificate-based access 678 control, not as a replacement for it. It is typically used when 679 self-signed certificates are being used but would generally not be 680 used when the certificates were all signed by an enrollment server. 682 1.4. Structure of This Document 684 The remainder of this document is structured as follows. 686 o Section 2 provides definitions of terms used in this document. 687 o Section 3 provides an overview of the mechanisms used to establish 688 and maintain the overlay. 689 o Section 4 provides an overview of the mechanism RELOAD provides to 690 support other applications. 691 o Section 5 defines the protocol messages that RELOAD uses to 692 establish and maintain the overlay. 693 o Section 6 defines the protocol messages that are used to store and 694 retrieve data using RELOAD. 695 o Section 7 defines the Certificate Store Usage that is fundamental 696 to RELOAD security. 697 o Section 8 defines the TURN Server Usage needed to locate TURN 698 servers for NAT traversal. 699 o Section 9 defines a specific Topology Plugin using Chord based 700 algorithm. 701 o Section 10 defines the mechanisms that new RELOAD nodes use to 702 join the overlay for the first time. 703 o Section 11 provides an extended example. 705 2. Terminology 707 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 708 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 709 document are to be interpreted as described in RFC 2119 [RFC2119]. 711 Terms used in this document are defined inline when used and are also 712 defined below for reference. 714 DHT: A distributed hash table. A DHT is an abstract hash table 715 service realized by storing the contents of the hash table across 716 a set of peers. 718 Overlay Algorithm: An overlay algorithm defines the rules for 719 determining which peers in an overlay store a particular piece of 720 data and for determining a topology of interconnections amongst 721 peers in order to find a piece of data. 723 Overlay Instance: A specific overlay algorithm and the collection of 724 peers that are collaborating to provide read and write access to 725 it. There can be any number of overlay instances running in an IP 726 network at a time, and each operates in isolation of the others. 728 Peer: A host that is participating in the overlay. Peers are 729 responsible for holding some portion of the data that has been 730 stored in the overlay and also route messages on behalf of other 731 hosts as required by the Overlay Algorithm. 733 Client: A host that is able to store data in and retrieve data from 734 the overlay but which is not participating in routing or data 735 storage for the overlay. 737 Kind: A kind defines a particular type of data that can be stored in 738 the overlay. Applications define new Kinds to store the data they 739 use. Each Kind is identified with a unique integer called a 740 Kind-ID. 742 Node: We use the term "Node" to refer to a host that may be either a 743 Peer or a Client. Because RELOAD uses the same protocol for both 744 clients and peers, much of the text applies equally to both. 745 Therefore we use "Node" when the text applies to both Clients and 746 Peers and the more specific term (i.e. client or peer) when the 747 text applies only to Clients or only to Peers. 749 Node-ID: A fixed-length value that uniquely identifies a node. 750 Node-IDs of all 0s and all 1s are reserved and are invalid Node- 751 IDs. A value of zero is not used in the wire protocol but can be 752 used to indicate an invalid node in implementations and APIs. The 753 Node-ID of all 1s is used on the wire protocol as a wildcard. 755 Joining Peer: A node that is attempting to become a Peer in a 756 particular Overlay.. 758 Admitting Peer: A Peer in the Overlay which helps the Joining Peer 759 join the Overlay. 761 Bootstrap Node: A network node used by Joining Peers to help Nlocate 762 the Admitting Peer. 764 Peer Admission: The act of admitting a peer (the "Joining Peer" ) 765 into an Overlay. After the admission process is over, the joining 766 peer is a fully-functional peer of the overlay. During the 767 admission process, the joining peer may need to present 768 credentials to prove that it has sufficient authority to join the 769 overlay. 771 Resource: An object or group of objects associated with a string 772 identifier. See "Resource Name" below. 774 Resource Name: The potentially human readable name by which a 775 resource is identified. In unstructured P2P networks, the 776 resource name is sometimes used directly as a Resource-ID. In 777 structured P2P networks the resource name is typically mapped into 778 a Resource-ID by using the string as the input to hash function. 779 Structured and unstructured P2P networks are described in 780 [RFC5694]. A SIP resource, for example, is often identified by 781 its AOR which is an example of a Resource Name. 783 Resource-ID: A value that identifies some resources and which is 784 used as a key for storing and retrieving the resource. Often this 785 is not human friendly/readable. One way to generate a Resource-ID 786 is by applying a mapping function to some other unique name (e.g., 787 user name or service name) for the resource. The Resource-ID is 788 used by the distributed database algorithm to determine the peer 789 or peers that are responsible for storing the data for the 790 overlay. In structured P2P networks, Resource-IDs are generally 791 fixed length and are formed by hashing the resource name. In 792 unstructured networks, resource names may be used directly as 793 Resource-IDs and may be variable lengths. 795 Connection Table: The set of nodes to which a node is directly 796 connected. This includes nodes with which Attach handshakes have 797 been done but which have not sent any Updates. 799 Routing Table: The set of peers which a node can use to route 800 overlay messages. In general, these peers will all be on the 801 connection table but not vice versa, because some peers will have 802 Attached but not sent updates. Peers may send messages directly 803 to peers that are in the connection table but may only route 804 messages to other peers through peers that are in the routing 805 table. 807 Destination List: A list of IDs through which a message is to be 808 routed. A single Node-ID is a trivial form of destination list. 810 Usage: A usage is an application that wishes to use the overlay for 811 some purpose. Each application wishing to use the overlay defines 812 a set of data kinds that it wishes to use. The SIP usage defines 813 the location data kind. 815 The term "maximum request lifetime" is the maximum time a request 816 will wait for a response; it defaults to 15 seconds. The term 817 "successor replacement hold-down time" is the amount of time to wait 818 before starting replication when a new successor is found; it 819 defaults to 30 seconds. 821 3. Overlay Management Overview 823 The most basic function of RELOAD is as a generic overlay network. 824 Nodes need to be able to join the overlay, form connections to other 825 nodes, and route messages through the overlay to nodes to which they 826 are not directly connected. This section provides an overview of the 827 mechanisms that perform these functions. 829 3.1. Security and Identification 831 Every node in the RELOAD overlay is identified by a Node-ID. The 832 Node-ID is used for three major purposes: 834 o To address the node itself. 835 o To determine its position in the overlay topology when the overlay 836 is structured. 837 o To determine the set of resources for which the node is 838 responsible. 840 Each node has a certificate [RFC5280] containing a Node-ID, which is 841 unique within an overlay instance. 843 The certificate serves multiple purposes: 845 o It entitles the user to store data at specific locations in the 846 Overlay Instance. Each data kind defines the specific rules for 847 determining which certificates can access each Resource-ID/Kind-ID 848 pair. For instance, some kinds might allow anyone to write at a 849 given location, whereas others might restrict writes to the owner 850 of a single certificate. 852 o It entitles the user to operate a node that has a Node-ID found in 853 the certificate. When the node forms a connection to another 854 peer, it uses this certificate so that a node connecting to it 855 knows it is connected to the correct node (technically: a (D)TLS 856 association with client authentication is formed.) In addition, 857 the node can sign messages, thus providing integrity and 858 authentication for messages which are sent from the node. 859 o It entitles the user to use the user name found in the 860 certificate. 862 If a user has more than one device, typically they would get one 863 certificate for each device. This allows each device to act as a 864 separate peer. 866 RELOAD supports multiple certificate issuance models. The first is 867 based on a central enrollment process which allocates a unique name 868 and Node-ID and puts them in a certificate for the user. All peers 869 in a particular Overlay Instance have the enrollment server as a 870 trust anchor and so can verify any other peer's certificate. 872 In some settings, a group of users want to set up an overlay network 873 but are not concerned about attack by other users in the network. 874 For instance, users on a LAN might want to set up a short term ad hoc 875 network without going to the trouble of setting up an enrollment 876 server. RELOAD supports the use of self-generated, self-signed 877 certificates. When self-signed certificates are used, the node also 878 generates its own Node-ID and username. The Node-ID is computed as a 879 digest of the public key, to prevent Node-ID theft; however this 880 model is still subject to a number of known attacks (most notably 881 Sybil attacks [Sybil]) and can only be safely used in closed networks 882 where users are mutually trusting. 884 The general principle here is that the security mechanisms (TLS and 885 message signatures) are always used, even if the certificates are 886 self-signed. This allows for a single set of code paths in the 887 systems with the only difference being whether certificate 888 verification is required to chain to a single root of trust. 890 3.1.1. Shared-Key Security 892 RELOAD also provides an admission control system based on shared 893 keys. In this model, the peers all share a single key which is used 894 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 896 3.2. Clients 898 RELOAD defines a single protocol that is used both as the peer 899 protocol and as the client protocol for the overlay. This simplifies 900 implementation, particularly for devices that may act in either role, 901 and allows clients to inject messages directly into the overlay. 903 We use the term "peer" to identify a node in the overlay that routes 904 messages for nodes other than those to which it is directly 905 connected. Peers typically also have storage responsibilities. We 906 use the term "client" to refer to nodes that do not have routing or 907 storage responsibilities. When text applies to both peers and 908 clients, we will simply refer such devices as "nodes." 910 RELOAD's client support allows nodes that are not participating in 911 the overlay as peers to utilize the same implementation and to 912 benefit from the same security mechanisms as the peers. Clients 913 possess and use certificates that authorize the user to store data at 914 certain locations in the overlay. The Node-ID in the certificate is 915 used to identify the particular client as a member of the overlay and 916 to authenticate its messages. 918 In RELOAD, unlike some other designs, clients are not a first-class 919 concept. From the perspective of a peer, a client is simply a node 920 which has not yet sent any Updates or Joins. It might never do so 921 (if it's a client) or it might eventually do so (if it's just a node 922 that's taking a long time to join). The routing and storage rules 923 for RELOAD provide for correct behavior by peers regardless of 924 whether other nodes attached to them are clients or peers. Of 925 course, a client implementation must know that it intends to be a 926 client, but this localizes complexity only to that node. 928 For more discussion of the motivation for RELOAD's client support, 929 see Appendix B. 931 3.2.1. Client Routing 933 Clients may insert themselves in the overlay in two ways: 935 o Establish a connection to the peer responsible for the client's 936 Node-ID in the overlay. Then requests may be sent from/to the 937 client using its Node-ID in the same manner as if it were a peer, 938 because the responsible peer in the overlay will handle the final 939 step of routing to the client. This may require a TURN relay in 940 cases where NATs or firewalls prevent a client from forming a 941 direct connections with its responsible peer. Note that clients 942 that choose this option need to process Update messages from the 943 peer. Those updates can indicate that the peer no longer is 944 responsible for the Client's Node-ID. The client would then need 945 to form a connection to the appropriate peer. Failure to do so 946 will result in the client no longer receiving messages. 948 o Establish a connection with an arbitrary peer in the overlay 949 (perhaps based on network proximity or an inability to establish a 950 direct connection with the responsible peer). In this case, the 951 client will rely on RELOAD's Destination List feature to ensure 952 reachability. The client can initiate requests, and any node in 953 the overlay that knows the Destination List to its current 954 location can reach it, but the client is not directly reachable 955 using only its Node-ID. If the client is to receive incoming 956 requests from other members of the overlay, the Destination List 957 required to reach it must be learnable via other mechanisms, such 958 as being stored in the overlay by a usage. A client connected 959 this way using a certificate with only a single Node-ID MAY 960 proceed to use the connection without performing an Attach. A 961 client wishing to connect using this mechanism with a certificate 962 with multiple Node-IDs MUST perform an Attach after using Ping to 963 probe the Node-ID of the node to which it is connected. 965 3.2.2. Minimum Functionality Requirements for Clients 967 A node may act as a client simply because it does not have the 968 resources or even an implementation of the topology plugin required 969 to act as a peer in the overlay. In order to exchange RELOAD 970 messages with a peer, a client must meet a minimum level of 971 functionality. Such a client must: 973 o Implement RELOAD's connection-management operations that are used 974 to establish the connection with the peer. 975 o Implement RELOAD's data retrieval methods (with client 976 functionality). 977 o Be able to calculate Resource-IDs used by the overlay. 978 o Possess security credentials required by the overlay it is 979 implementing. 981 A client speaks the same protocol as the peers, knows how to 982 calculate Resource-IDs, and signs its requests in the same manner as 983 peers. While a client does not necessarily require a full 984 implementation of the overlay algorithm, calculating the Resource-ID 985 requires an implementation of the appropriate algorithm for the 986 overlay. 988 3.3. Routing 990 This section will discuss the requirements RELOAD's routing 991 capabilities were designed to meet, then describe the routing 992 features in the protocol, and then provide a brief overview of how 993 they are used. Appendix A discusses some alternative designs and the 994 tradeoffs that would be necessary to support them. 996 RELOAD's routing capabilities must meet the following requirements: 998 NAT Traversal: RELOAD must support establishing and using 999 connections between nodes separated by one or more NATs, including 1000 locating peers behind NATs for those overlays allowing/requiring 1001 it. 1002 Clients: RELOAD must support requests from and to clients that do 1003 not participate in overlay routing. 1004 Client promotion: RELOAD must support clients that become peers at a 1005 later point as determined by the overlay algorithm and deployment. 1006 Low state: RELOAD's routing algorithms must not require 1007 significant state to be stored on intermediate peers. 1008 Return routability in unstable topologies: At some points in 1009 times, different nodes may have inconsistent information about the 1010 connectivity of the routing graph. In all cases, the response to 1011 a request needs to delivered to the node that sent the request and 1012 not to some other node. 1014 RELOAD's routing provides three mechanisms designed to assist in 1015 meeting these needs: 1017 Destination Lists: While in principle it is possible to just 1018 inject a message into the overlay with a bare Node-ID as the 1019 destination, RELOAD provides a source routing capability in the 1020 form of "Destination Lists". A "Destination List provides a list 1021 of the nodes through which a message must flow. 1022 Via Lists: In order to allow responses to follow the same path as 1023 requests, each message also contains a "Via List", which is added 1024 to by each node a message traverses. This via list can then be 1025 inverted and used as a destination list for the response. 1026 RouteQuery: The RouteQuery method allows a node to query a peer 1027 for the next hop it will use to route a message. This method is 1028 useful for diagnostics and for iterative routing. 1030 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1031 We will first describe symmetric recursive routing and then discuss 1032 its advantages in terms of the requirements discussed above. 1034 Symmetric recursive routing requires that a request message follow a 1035 path through the overlay to the destination: each peer forwards the 1036 message closer to its destination. The return path of the response 1037 is then the same path followed in reverse. For example, a message 1038 following a route from A to Z through B and X: 1040 A B X Z 1041 ------------------------------- 1043 ----------> 1044 Dest=Z 1045 ----------> 1046 Via=A 1047 Dest=Z 1048 ----------> 1049 Via=A, B 1050 Dest=Z 1052 <---------- 1053 Dest=X, B, A 1054 <---------- 1055 Dest=B, A 1056 <---------- 1057 Dest=A 1059 Note that the preceding Figure does not indicate whether A is a 1060 client or peer: A forwards its request to B and the response is 1061 returned to A in the same manner regardless of A's role in the 1062 overlay. 1064 This figure shows use of full via-lists by intermediate peers B and 1065 X. However, if B and/or X are willing to store state, then they may 1066 elect to truncate the lists, save that information internally (keyed 1067 by the transaction id), and return the response message along the 1068 path from which it was received when the response is received. This 1069 option requires greater state to be stored on intermediate peers but 1070 saves a small amount of bandwidth and reduces the need for modifying 1071 the message en route. Selection of this mode of operation is a 1072 choice for the individual peer; the techniques are interoperable even 1073 on a single message. The figure below shows B using full via lists 1074 but X truncating them to X1 and saving the state internally. 1076 A B X Z 1077 ------------------------------- 1079 ----------> 1080 Dest=Z 1081 ----------> 1082 Via=A 1083 Dest=Z 1084 ----------> 1085 Dest=Z, X1 1087 <---------- 1088 Dest=X,X1 1089 <---------- 1090 Dest=B, A 1091 <---------- 1092 Dest=A 1094 RELOAD also supports a basic Iterative routing mode (where the 1095 intermediate peers merely return a response indicating the next hop, 1096 but do not actually forward the message to that next hop themselves). 1097 Iterative routing is implemented using the RouteQuery method, which 1098 requests this behavior. Note that iterative routing is selected only 1099 by the initiating node. 1101 3.4. Connectivity Management 1103 In order to provide efficient routing, a peer needs to maintain a set 1104 of direct connections to other peers in the Overlay Instance. Due to 1105 the presence of NATs, these connections often cannot be formed 1106 directly. Instead, we use the Attach request to establish a 1107 connection. Attach uses ICE [RFC5245] to establish the connection. 1108 It is assumed that the reader is familiar with ICE. 1110 Say that peer A wishes to form a direct connection to peer B. It 1111 gathers ICE candidates and packages them up in an Attach request 1112 which it sends to B through usual overlay routing procedures. B does 1113 its own candidate gathering and sends back a response with its 1114 candidates. A and B then do ICE connectivity checks on the candidate 1115 pairs. The result is a connection between A and B. At this point, A 1116 and B can add each other to their routing tables and send messages 1117 directly between themselves without going through other overlay 1118 peers. 1120 There are two cases where Attach is not used. The first is when a 1121 peer is joining the overlay and is not connected to any peers. In 1122 order to support this case, some small number of "bootstrap nodes" 1123 typically need to be publicly accessible so that new peers can 1124 directly connect to them. Section 10 contains more detail on this. 1125 The second case is when a client node connects to a node at an 1126 arbitrary IP address, rather than to its responsible peer, as 1127 described in the second bullet point of Section 3.2.1. 1129 In general, a peer needs to maintain connections to all of the peers 1130 near it in the Overlay Instance and to enough other peers to have 1131 efficient routing (the details depend on the specific overlay). If a 1132 peer cannot form a connection to some other peer, this isn't 1133 necessarily a disaster; overlays can route correctly even without 1134 fully connected links. However, a peer should try to maintain the 1135 specified link set and if it detects that it has fewer direct 1136 connections, should form more as required. This also implies that 1137 peers need to periodically verify that the connected peers are still 1138 alive and if not try to reform the connection or form an alternate 1139 one. 1141 3.5. Overlay Algorithm Support 1143 The Topology Plugin allows RELOAD to support a variety of overlay 1144 algorithms. This specification defines a DHT based on Chord [Chord], 1145 which is mandatory to implement, but the base RELOAD protocol is 1146 designed to support a variety of overlay algorithms. 1148 3.5.1. Support for Pluggable Overlay Algorithms 1150 RELOAD defines three methods for overlay maintenance: Join, Update, 1151 and Leave. However, the contents of those messages, when they are 1152 sent, and their precise semantics are specified by the actual overlay 1153 algorithm; RELOAD merely provides a framework of commonly-needed 1154 methods that provides uniformity of notation (and ease of debugging) 1155 for a variety of overlay algorithms. 1157 3.5.2. Joining, Leaving, and Maintenance Overview 1159 When a new peer wishes to join the Overlay Instance, it must have a 1160 Node-ID that it is allowed to use and a set of credentials which 1161 match that Node-ID. When an enrollment server is used that Node-ID 1162 will be in the certificate the node received from the enrollment 1163 server. The details of the joining procedure are defined by the 1164 overlay algorithm, but the general steps for joining an Overlay 1165 Instance are: 1167 o Forming connections to some other peers. 1168 o Acquiring the data values this peer is responsible for storing. 1169 o Informing the other peers which were previously responsible for 1170 that data that this peer has taken over responsibility. 1172 The first thing the peer needs to do is to form a connection to some 1173 "bootstrap node". Because this is the first connection the peer 1174 makes, these nodes must have public IP addresses so that they can be 1175 connected to directly. Once a peer has connected to one or more 1176 bootstrap nodes, it can form connections in the usual way by routing 1177 Attach messages through the overlay to other nodes. Once a peer has 1178 connected to the overlay for the first time, it can cache the set of 1179 nodes it has connected to with public IP addresses for use as future 1180 bootstrap nodes. 1182 Once a peer has connected to a bootstrap node, it then needs to take 1183 up its appropriate place in the overlay. This requires two major 1184 operations: 1186 o Forming connections to other peers in the overlay to populate its 1187 Routing Table. 1188 o Getting a copy of the data it is now responsible for storing and 1189 assuming responsibility for that data. 1191 The second operation is performed by contacting the Admitting Peer 1192 (AP), the node which is currently responsible for that section of the 1193 overlay. 1195 The details of this operation depend mostly on the overlay algorithm 1196 involved, but a typical case would be: 1198 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1199 announcing its intention to join. 1200 2. AP sends a Join response. 1201 3. AP does a sequence of Stores to JP to give it the data it will 1202 need. 1203 4. AP does Updates to JP and to other peers to tell it about its own 1204 routing table. At this point, both JP and AP consider JP 1205 responsible for some section of the Overlay Instance. 1206 5. JP makes its own connections to the appropriate peers in the 1207 Overlay Instance. 1209 After this process is completed, JP is a full member of the Overlay 1210 Instance and can process Store/Fetch requests. 1212 Note that the first node is a special case. When ordinary nodes 1213 cannot form connections to the bootstrap nodes, then they are not 1214 part of the overlay. However, the first node in the overlay can 1215 obviously not connect to other nodes. In order to support this case, 1216 potential first nodes (which must also serve as bootstrap nodes 1217 initially) must somehow be instructed (perhaps by configuration 1218 settings) that they are the entire overlay, rather than not part of 1219 it. 1221 Note that clients do not perform either of these operations. 1223 3.6. First-Time Setup 1225 Previous sections addressed how RELOAD works once a node has 1226 connected. This section provides an overview of how users get 1227 connected to the overlay for the first time. RELOAD is designed so 1228 that users can start with the name of the overlay they wish to join 1229 and perhaps a username and password, and leverage that into having a 1230 working peer with minimal user intervention. This helps avoid the 1231 problems that have been experienced with conventional SIP clients 1232 where users are required to manually configure a large number of 1233 settings. 1235 3.6.1. Initial Configuration 1237 In the first phase of the process, the user starts out with the name 1238 of the overlay and uses this to download an initial set of overlay 1239 configuration parameters. The node does a DNS SRV lookup on the 1240 overlay name to get the address of a configuration server. It can 1241 then connect to this server with HTTPS to download a configuration 1242 document which contains the basic overlay configuration parameters as 1243 well as a set of bootstrap nodes which can be used to join the 1244 overlay. 1246 If a node already has the valid configuration document that it 1247 received by some out of band method, this step can be skipped. 1249 3.6.2. Enrollment 1251 If the overlay is using centralized enrollment, then a user needs to 1252 acquire a certificate before joining the overlay. The certificate 1253 attests both to the user's name within the overlay and to the Node- 1254 IDs which they are permitted to operate. In that case, the 1255 configuration document will contain the address of an enrollment 1256 server which can be used to obtain such a certificate. The 1257 enrollment server may (and probably will) require some sort of 1258 username and password before issuing the certificate. The enrollment 1259 server's ability to restrict attackers' access to certificates in the 1260 overlay is one of the cornerstones of RELOAD's security. 1262 4. Application Support Overview 1264 RELOAD is not intended to be used alone, but rather as a substrate 1265 for other applications. These applications can use RELOAD for a 1266 variety of purposes: 1268 o To store data in the overlay and retrieve data stored by other 1269 nodes. 1270 o As a discovery mechanism for services such as TURN. 1271 o To form direct connections which can be used to transmit 1272 application-level messages without using the overlay. 1274 This section provides an overview of these services. 1276 4.1. Data Storage 1278 RELOAD provides operations to Store and Fetch data. Each location in 1279 the Overlay Instance is referenced by a Resource-ID. However, each 1280 location may contain data elements corresponding to multiple kinds 1281 (e.g., certificate, SIP registration). Similarly, there may be 1282 multiple elements of a given kind, as shown below: 1284 +--------------------------------+ 1285 | Resource-ID | 1286 | | 1287 | +------------+ +------------+ | 1288 | | Kind 1 | | Kind 2 | | 1289 | | | | | | 1290 | | +--------+ | | +--------+ | | 1291 | | | Value | | | | Value | | | 1292 | | +--------+ | | +--------+ | | 1293 | | | | | | 1294 | | +--------+ | | +--------+ | | 1295 | | | Value | | | | Value | | | 1296 | | +--------+ | | +--------+ | | 1297 | | | +------------+ | 1298 | | +--------+ | | 1299 | | | Value | | | 1300 | | +--------+ | | 1301 | +------------+ | 1302 +--------------------------------+ 1304 Each kind is identified by a Kind-ID, which is a code point either 1305 assigned by IANA or allocated out of a private range. As part of the 1306 kind definition, protocol designers may define constraints, such as 1307 limits on size, on the values which may be stored. For many kinds, 1308 the set may be restricted to a single value; some sets may be allowed 1309 to contain multiple identical items while others may only have unique 1310 items. Note that a kind may be employed by multiple usages and new 1311 usages are encouraged to use previously defined kinds where possible. 1312 We define the following data models in this document, though other 1313 usages can define their own structures: 1315 single value: There can be at most one item in the set and any value 1316 overwrites the previous item. 1318 array: Many values can be stored and addressed by a numeric index. 1320 dictionary: The values stored are indexed by a key. Often this key 1321 is one of the values from the certificate of the peer sending the 1322 Store request. 1324 In order to protect stored data from tampering, by other nodes, each 1325 stored value is digitally signed by the node which created it. When 1326 a value is retrieved, the digital signature can be verified to detect 1327 tampering. 1329 4.1.1. Storage Permissions 1331 A major issue in peer-to-peer storage networks is minimizing the 1332 burden of becoming a peer, and in particular minimizing the amount of 1333 data which any peer is required to store for other nodes. RELOAD 1334 addresses this issue by only allowing any given node to store data at 1335 a small number of locations in the overlay, with those locations 1336 being determined by the node's certificate. When a peer uses a Store 1337 request to place data at a location authorized by its certificate, it 1338 signs that data with the private key that corresponds to its 1339 certificate. Then the peer responsible for storing the data is able 1340 to verify that the peer issuing the request is authorized to make 1341 that request. Each data kind defines the exact rules for determining 1342 what certificate is appropriate. 1344 The most natural rule is that a certificate authorizes a user to 1345 store data keyed with their user name X. This rule is used for all 1346 the kinds defined in this specification. Thus, only a user with a 1347 certificate for "alice@example.org" could write to that location in 1348 the overlay. However, other usages can define any rules they choose, 1349 including publicly writable values. 1351 The digital signature over the data serves two purposes. First, it 1352 allows the peer responsible for storing the data to verify that this 1353 Store is authorized. Second, it provides integrity for the data. 1354 The signature is saved along with the data value (or values) so that 1355 any reader can verify the integrity of the data. Of course, the 1356 responsible peer can "lose" the value but it cannot undetectably 1357 modify it. 1359 The size requirements of the data being stored in the overlay are 1360 variable. For instance, a SIP AOR and voicemail differ widely in the 1361 storage size. RELOAD leaves it to the Usage and overlay 1362 configuration to limit size imbalance of various kinds. 1364 4.1.2. Replication 1366 Replication in P2P overlays can be used to provide: 1368 persistence: if the responsible peer crashes and/or if the storing 1369 peer leaves the overlay 1370 security: to guard against DoS attacks by the responsible peer or 1371 routing attacks to that responsible peer 1372 load balancing: to balance the load of queries for popular 1373 resources. 1375 A variety of schemes are used in P2P overlays to achieve some of 1376 these goals. Common techniques include replicating on neighbors of 1377 the responsible peer, randomly locating replicas around the overlay, 1378 or replicating along the path to the responsible peer. 1380 The core RELOAD specification does not specify a particular 1381 replication strategy. Instead, the first level of replication 1382 strategies are determined by the overlay algorithm, which can base 1383 the replication strategy on its particular topology. For example, 1384 Chord places replicas on successor peers, which will take over 1385 responsibility should the responsible peer fail [Chord]. 1387 If additional replication is needed, for example if data persistence 1388 is particularly important for a particular usage, then that usage may 1389 specify additional replication, such as implementing random 1390 replications by inserting a different well known constant into the 1391 Resource Name used to store each replicated copy of the resource. 1392 Such replication strategies can be added independent of the 1393 underlying algorithm, and their usage can be determined based on the 1394 needs of the particular usage. 1396 4.2. Usages 1398 By itself, the distributed storage layer just provides infrastructure 1399 on which applications are built. In order to do anything useful, a 1400 usage must be defined. Each Usage needs to specify several things: 1402 o Registers Kind-ID code points for any kinds that the Usage 1403 defines. 1404 o Defines the data structure for each of the kinds. 1405 o Defines access control rules for each of the kinds. 1406 o Defines how the Resource Name is formed that is hashed to form the 1407 Resource-ID where each kind is stored. 1409 o Describes how values will be merged after a network partition. 1410 Unless otherwise specified, the default merging rule is to act as 1411 if all the values that need to be merged were stored and as if the 1412 order they were stored in corresponds to the stored time values 1413 associated with (and carried in) their values. Because the stored 1414 time values are those associated with the peer which did the 1415 writing, clock skew is generally not an issue. If two nodes are 1416 on different partitions, write to the same location, and have 1417 clock skew, this can create merge conflicts. However because 1418 RELOAD deliberately segregates storage so that data from different 1419 users and peers is stored in different locations, and a single 1420 peer will typically only be in a single network partition, this 1421 case will generally not arise. 1423 The kinds defined by a usage may also be applied to other usages. 1424 However, a need for different parameters, such as different size 1425 limits, would imply the need to create a new kind. 1427 4.3. Service Discovery 1429 RELOAD does not currently define a generic service discovery 1430 algorithm as part of the base protocol, although a simplistic TURN- 1431 specific discovery mechanism is provided. A variety of service 1432 discovery algorithms can be implemented as extensions to the base 1433 protocol, such as the service discovery algorithm ReDIR 1434 [opendht-sigcomm05] or [I-D.ietf-p2psip-service-discovery]. 1436 4.4. Application Connectivity 1438 There is no requirement that a RELOAD usage must use RELOAD's 1439 primitives for establishing its own communication if it already 1440 possesses its own means of establishing connections. For example, 1441 one could design a RELOAD-based resource discovery protocol which 1442 used HTTP to retrieve the actual data. 1444 For more common situations, however, it is the overlay itself - 1445 rather than an external authority such as DNS - which is used to 1446 establish a connection. RELOAD provides connectivity to applications 1447 using the AppAttach method. For example, if a P2PSIP node wishes to 1448 establish a SIP dialog with another P2PSIP node, it will use 1449 AppAttach to establish a direct connection with the other node. This 1450 new connection is separate from the peer protocol connection. It is 1451 a dedicated UDP or TCP flow used only for the SIP dialog. 1453 5. Overlay Management Protocol 1455 This section defines the basic protocols used to create, maintain, 1456 and use the RELOAD overlay network. We start by defining the basic 1457 concept of how message destinations are interpreted when routing 1458 messages. We then describe the symmetric recursive routing model, 1459 which is RELOAD's default routing algorithm. We then define the 1460 message structure and then finally define the messages used to join 1461 and maintain the overlay. 1463 5.1. Message Receipt and Forwarding 1465 When a peer receives a message, it first examines the overlay, 1466 version, and other header fields to determine whether the message is 1467 one it can process. If any of these are incorrect (e.g., the message 1468 is for an overlay in which the peer does not participate) it is an 1469 error. The peer SHOULD generate an appropriate error but local 1470 policy can override this and cause the messages to be silently 1471 dropped. 1473 Once the peer has determined that the message is correctly formatted, 1474 it examines the first entry on the destination list. There are three 1475 possible cases here: 1477 o The first entry on the destination list is an ID for which the 1478 peer is responsible. A peer is always responsible for the 1479 wildcard Node-ID. Handling of this case is described in 1480 Section 5.1.1. 1481 o The first entry on the destination list is an ID for which another 1482 peer is responsible. Handling of this case is described in 1483 Section 5.1.2. 1484 o The first entry on the destination list is a private ID that is 1485 being used for destination list compression. Handling of this 1486 case is described in Section 5.1.3. Note that private IDs can be 1487 distinguished from Node-IDs and Resource-IDs on the wire as 1488 described in Section 5.3.2.2). 1490 These cases are handled as discussed below. 1492 5.1.1. Responsible ID 1494 If the first entry on the destination list is an ID for which the 1495 peer is responsible, there are several sub-cases to consider. 1497 o If the entry is a Resource-ID, then it MUST be the only entry on 1498 the destination list. If there are other entries, the message 1499 MUST be silently dropped. Otherwise, the message is destined for 1500 this node and it passes it up to the upper layers. 1501 o If the entry is a Node-ID which equals this node's Node-ID, then 1502 the message is destined for this node. If this is the only entry 1503 on the destination list, the message is destined for this node and 1504 is passed up to the upper layers. Otherwise the entry is removed 1505 from the destination list and the message is passed to the Message 1506 Transport. If the message is a response and there is state for 1507 the transaction ID, the state is reinserted into the destination 1508 list before the message is further processed. 1509 o If the entry is the wildcard Node-ID, the message is destined for 1510 this node and it passes it up to the upper layers. 1511 o If the entry is a Node-ID which is not equal to this node, then 1512 the node MUST drop the message silently unless the Node-ID 1513 corresponds to a node which is directly connected to this node 1514 (i.e., a client). In that case, it MUST forward the message to 1515 the destination node as described in the next section. 1517 Note that this implies that in order to address a message to "the 1518 peer that controls region X", a sender sends to Resource-ID X, not 1519 Node-ID X. 1521 5.1.2. Other ID 1523 If neither of the other three cases applies, then the peer MUST 1524 forward the message towards the first entry on the destination list. 1525 This means that it MUST select one of the peers to which it is 1526 connected and which is likely to be responsible for the first entry 1527 on the destination list. If the first entry on the destination list 1528 is in the peer's connection table, then it SHOULD forward the message 1529 to that peer directly. Otherwise, the peer consults the routing 1530 table to forward the message. 1532 Any intermediate peer which forwards a RELOAD request MUST arrange 1533 that if it receives a response to that message the response can be 1534 routed back through the set of nodes through which the request 1535 passed. This may be arranged in one of two ways: 1537 o The peer MAY add an entry to the via list in the forwarding header 1538 that will enable it to determine the correct node. 1539 o The peer MAY keep per-transaction state which will allow it to 1540 determine the correct node. 1542 As an example of the first strategy, if node D receives a message 1543 from node C with via list (A, B), then D would forward to the next 1544 node (E) with via list (A, B, C). Now, if E wants to respond to the 1545 message, it reverses the via list to produce the destination list, 1546 resulting in (D, C, B, A). When D forwards the response to C, the 1547 destination list will contain (C, B, A). 1549 As an example of the second strategy, if node D receives a message 1550 from node C with transaction ID X and via list (A, B), it could store 1551 (X, C) in its state database and forward the message with the via 1552 list unchanged. When D receives the response, it consults its state 1553 database for transaction id X, determines that the request came from 1554 C, and forwards the response to C. 1556 Intermediate peers which modify the via list are not required to 1557 simply add entries. The only requirement is that the peer be able to 1558 reconstruct the correct destination list on the return route. RELOAD 1559 provides explicit support for this functionality in the form of 1560 private IDs, which can replace any number of via list entries. For 1561 instance, in the above example, Node D might send E a via list 1562 containing only the private ID (I). E would then use the destination 1563 list (D, I) to send its return message. When D processes this 1564 destination list, it would detect that I is a private ID, recover the 1565 via list (A, B, C), and reverse that to produce the correct 1566 destination list (C, B, A) before sending it to C. This feature is 1567 called List Compression. It MAY either be a compressed version of 1568 the original via list or an index into a state database containing 1569 the original via list. 1571 No matter what mechanism for storing via list state is used, if an 1572 intermediate peer exits the overlay, then on the return trip the 1573 message cannot be forwarded and will be dropped. The ordinary 1574 timeout and retransmission mechanisms provide stability over this 1575 type of failure. 1577 Note that if an intermediate peer retains per-transaction state 1578 instead of modifying the via list, it needs some mechanism for timing 1579 out that state, otherwise its state database will grow without bound. 1580 Whatever algorithm is used, unless a FORWARD_CRITICAL forwarding 1581 option or overlay configuration option explicitly indicates this 1582 state is not needed, the state MUST be maintained for at least the 1583 value of the overlay reliability timer (3 seconds) and MAY be kept 1584 longer. Future extension, such as [I-D.jiang-p2psip-relay], may 1585 define mechanisms for determining when this state does not need to be 1586 retained. 1588 None of the above mechanisms are required for responses, since there 1589 is no need to ensure that subsequent requests follow the same path. 1591 To be precise on the responsibility of the intermediate node, suppose 1592 that an intermediate node, A, receives a message from node B with via 1593 list X-Y-Z. Node A MUST implement an algorithm that ensures that A 1594 returns a response to this request to node B with the destination 1595 list B-Z-Y-X, provided that the node to which A forwards the request 1596 follows the same contract. Node A normally learns the Node-ID B is 1597 using via an Attach, but a node using a certificate with a single 1598 Node-ID MAY elect to not send an Attach (see Section 3.2.1 bullet 2). 1599 If a node with a certificate with multiple Node-IDs attempts to route 1600 a message other than a Ping or Attach through a node without 1601 performing an Attach, the receiving node MUST reject the request with 1602 an Error_Forbidden error. The node MUST implement support for 1603 returning responses to a Ping or Attach request made by a joining 1604 node Attaching to its responsible peer. 1606 5.1.3. Private ID 1608 If the first entry in the destination list is a private id (e.g., a 1609 compressed via list), the peer MUST replace that entry with the 1610 original via list that it replaced and then re-examine the 1611 destination list to determine which of the three cases in Section 5.1 1612 now applies. 1614 5.2. Symmetric Recursive Routing 1616 This Section defines RELOAD's symmetric recursive routing algorithm, 1617 which is the default algorithm used by nodes to route messages 1618 through the overlay. All implementations MUST implement this routing 1619 algorithm. An overlay may be configured to use alternative routing 1620 algorithms, and alternative routing algorithms may be selected on a 1621 per-message basis. 1623 5.2.1. Request Origination 1625 In order to originate a message to a given Node-ID or Resource-ID, a 1626 node constructs an appropriate destination list. The simplest such 1627 destination list is a single entry containing the Node-ID or 1628 Resource-ID. The resulting message will use the normal overlay 1629 routing mechanisms to forward the message to that destination. The 1630 node can also construct a more complicated destination list for 1631 source routing. 1633 Once the message is constructed, the node sends the message to some 1634 adjacent peer. If the first entry on the destination list is 1635 directly connected, then the message MUST be routed down that 1636 connection. Otherwise, the topology plugin MUST be consulted to 1637 determine the appropriate next hop. 1639 Parallel searches for the resource are a common solution to improve 1640 reliability in the face of churn or of subversive peers. Parallel 1641 searches for usage-specified replicas are managed by the usage layer. 1642 However, a single request can also be routed through multiple 1643 adjacent peers, even when known to be sub-optimal, to improve 1644 reliability [vulnerabilities-acsac04]. Such parallel searches MAY be 1645 specified by the topology plugin. 1647 Because messages may be lost in transit through the overlay, RELOAD 1648 incorporates an end-to-end reliability mechanism. When an 1649 originating node transmits a request it MUST set a 3 second timer. 1650 If a response has not been received when the timer fires, the request 1651 is retransmitted with the same transaction identifier. The request 1652 MAY be retransmitted up to 4 times (for a total of 5 messages). 1653 After the timer for the fifth transmission fires, the message SHALL 1654 be considered to have failed. Note that this retransmission 1655 procedure is not followed by intermediate nodes. They follow the 1656 hop-by-hop reliability procedure described in Section 5.6.3. 1658 The above algorithm can result in multiple requests being delivered 1659 to a node. Receiving nodes MUST generate semantically equivalent 1660 responses to retransmissions of the same request (this can be 1661 determined by transaction id) if the request is received within the 1662 maximum request lifetime (15 seconds). For some requests (e.g., 1663 Fetch) this can be accomplished merely by processing the request 1664 again. For other requests, (e.g., Store) it may be necessary to 1665 maintain state for the duration of the request lifetime. 1667 5.2.2. Response Origination 1669 When a peer sends a response to a request using this routing 1670 algorithm, it MUST construct the destination list by reversing the 1671 order of the entries on the via list. This has the result that the 1672 response traverses the same peers as the request traversed, except in 1673 reverse order (symmetric routing). 1675 5.3. Message Structure 1677 RELOAD is a message-oriented request/response protocol. The messages 1678 are encoded using binary fields. All integers are represented in 1679 network byte order. The general philosophy behind the design was to 1680 use Type, Length, Value fields to allow for extensibility. However, 1681 for the parts of a structure that were required in all messages, we 1682 just define these in a fixed position, as adding a type and length 1683 for them is unnecessary and would simply increase bandwidth and 1684 introduces new potential for interoperability issues. 1686 Each message has three parts, concatenated as shown below: 1688 +-------------------------+ 1689 | Forwarding Header | 1690 +-------------------------+ 1691 | Message Contents | 1692 +-------------------------+ 1693 | Security Block | 1694 +-------------------------+ 1696 The contents of these parts are as follows: 1698 Forwarding Header: Each message has a generic header which is used 1699 to forward the message between peers and to its final destination. 1700 This header is the only information that an intermediate peer 1701 (i.e., one that is not the target of a message) needs to examine. 1703 Message Contents: The message being delivered between the peers. 1704 From the perspective of the forwarding layer, the contents are 1705 opaque, however, they are interpreted by the higher layers. 1707 Security Block: A security block containing certificates and a 1708 digital signature over the "Message Contents" section. Note that 1709 this signature can be computed without parsing the message 1710 contents. All messages MUST be signed by their originator. 1712 The following sections describe the format of each part of the 1713 message. 1715 5.3.1. Presentation Language 1717 The structures defined in this document are defined using a C-like 1718 syntax based on the presentation language used to define 1719 TLS[RFC5246]. Advantages of this style include: 1721 o It familiar enough looking that most readers can grasp it quickly. 1722 o The ability to define nested structures allows a separation 1723 between high-level and low-level message structures. 1724 o It has a straightforward wire encoding that allows quick 1725 implementation, but the structures can be comprehended without 1726 knowing the encoding. 1727 o The ability to mechanically compile encoders and decoders. 1729 Several idiosyncrasies of this language are worth noting. 1731 o All lengths are denoted in bytes, not objects. 1732 o Variable length values are denoted like arrays with angle 1733 brackets. 1734 o "select" is used to indicate variant structures. 1736 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1737 which corresponds to up to 127 values of two bytes (16 bits) each. 1739 5.3.1.1. Common Definitions 1741 The following definitions are used throughout RELOAD and so are 1742 defined here. They also provide a convenient introduction to how to 1743 read the presentation language. 1745 An enum represents an enumerated type. The values associated with 1746 each possibility are represented in parentheses and the maximum value 1747 is represented as a nameless value, for purposes of describing the 1748 width of the containing integral type. For instance, Boolean 1749 represents a true or false: 1751 enum { false (0), true(1), (255)} Boolean; 1753 A boolean value is either a 1 or a 0. The max value of 255 indicates 1754 this is represented as a single byte on the wire. 1756 The NodeId, shown below, represents a single Node-ID. 1758 typedef opaque NodeId[NodeIdLength]; 1760 A NodeId is a fixed-length structure represented as a series of 1761 bytes, with the most significant byte first. The length is set on a 1762 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1763 (See Section 10.1 for how NodeIdLength is set.) Note: the use of 1764 "typedef" here is an extension to the TLS language, but its meaning 1765 should be relatively obvious. Note the [ size ] syntax defines a 1766 fixed length element that does not include the length of the element 1767 in the on the wire encoding. 1769 A ResourceId, shown below, represents a single Resource-ID. 1771 typedef opaque ResourceId<0..2^8-1>; 1773 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1774 NodeIds, ResourceIds are variable length, up to 254 bytes (2040 bits) 1775 in length. On the wire, each ResourceId is preceded by a single 1776 length byte (allowing lengths up to 255). Thus, the 3-byte value 1777 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1778 defines a variable length element that does include the length of the 1779 element in the on the wire encoding. The number of bytes to encode 1780 the length on the wire is derived by range; i.e., it is the minimum 1781 number of bytes which can encode the largest range value. 1783 A more complicated example is IpAddressPort, which represents a 1784 network address and can be used to carry either an IPv6 or IPv4 1785 address: 1787 enum {reservedAddr(0), ipv4_address (1), ipv6_address (2), 1788 (255)} AddressType; 1790 struct { 1791 uint32 addr; 1792 uint16 port; 1793 } IPv4AddrPort; 1795 struct { 1796 uint128 addr; 1797 uint16 port; 1798 } IPv6AddrPort; 1800 struct { 1801 AddressType type; 1802 uint8 length; 1804 select (type) { 1805 case ipv4_address: 1806 IPv4AddrPort v4addr_port; 1808 case ipv6_address: 1809 IPv6AddrPort v6addr_port; 1811 /* This structure can be extended */ 1812 }; 1813 } IpAddressPort; 1815 The first two fields in the structure are the same no matter what 1816 kind of address is being represented: 1818 type: the type of address (v4 or v6). 1819 length: the length of the rest of the structure. 1821 By having the type and the length appear at the beginning of the 1822 structure regardless of the kind of address being represented, an 1823 implementation which does not understand new address type X can still 1824 parse the IpAddressPort field and then discard it if it is not 1825 needed. 1827 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1828 an IPv6AddrPort. Both of these simply consist of an address 1829 represented as an integer and a 16-bit port. As an example, here is 1830 the wire representation of the IPv4 address "192.0.2.1" with port 1831 "6100". 1833 01 ; type = IPv4 1834 06 ; length = 6 1835 c0 00 02 01 ; address = 192.0.2.1 1836 17 d4 ; port = 6100 1838 Unless a given structure that uses a select explicitly allows for 1839 unknown types in the select, any unknown type SHOULD be treated as an 1840 parsing error and the whole message discarded with no response. 1842 5.3.2. Forwarding Header 1844 The forwarding header is defined as a ForwardingHeader structure, as 1845 shown below. 1847 struct { 1848 uint32 relo_token; 1849 uint32 overlay; 1850 uint16 configuration_sequence; 1851 uint8 version; 1852 uint8 ttl; 1853 uint32 fragment; 1854 uint32 length; 1855 uint64 transaction_id; 1856 uint32 max_response_length; 1857 uint16 via_list_length; 1858 uint16 destination_list_length; 1859 uint16 options_length; 1860 Destination via_list[via_list_length]; 1861 Destination destination_list 1862 [destination_list_length]; 1863 ForwardingOptions options[options_length]; 1864 } ForwardingHeader; 1866 The contents of the structure are: 1868 relo_token: The first four bytes identify this message as a RELOAD 1869 message. This field MUST contain the value 0xd2454c4f (the string 1870 'RELO' with the high bit of the first byte set). 1872 overlay: The 32 bit checksum/hash of the overlay being used. The 1873 variable length string representing the overlay name is hashed 1874 with SHA-1 [RFC3174] and the low order 32 bits are used. The 1875 purpose of this field is to allow nodes to participate in multiple 1876 overlays and to detect accidental misconfiguration. This is not a 1877 security critical function. 1879 configuration_sequence: The sequence number of the configuration 1880 file. 1882 version: The version of the RELOAD protocol being used. This is a 1883 fixed point integer between 0.1 and 25.4. This document describes 1884 version 0.1, with a value of 0x01. [[ Note to RFC Editor: Please 1885 update this to version 1.0 with value of 0x0a and remove this 1886 note. ]] 1888 ttl: An 8 bit field indicating the number of iterations, or hops, a 1889 message can experience before it is discarded. The TTL value MUST 1890 be decremented by one at every hop along the route the message 1891 traverses. If the TTL is 0, the message MUST NOT be propagated 1892 further and MUST be discarded, and a "Error_TTL_Exceeded" error 1893 should be generated. The initial value of the TTL SHOULD be 100 1894 unless defined otherwise by the overlay configuration. 1896 fragment: This field is used to handle fragmentation. The high 1897 order two bits are used to indicate the fragmentation status: If 1898 the high bit (0x80000000) is set, it indicates that the message is 1899 a fragment. If the next bit (0x40000000) is set, it indicates 1900 that this is the last fragment. The next six bits (0x20000000 to 1901 0x01000000) are reserved and SHOULD be set to zero. The remainder 1902 of the field is used to indicate the fragment offset; see 1903 Section 5.7 1905 length: The count in bytes of the size of the message, including the 1906 header. 1908 transaction_id: A unique 64 bit number that identifies this 1909 transaction and also allows receivers to disambiguate transactions 1910 which are otherwise identical. In order to provide a high 1911 probability that transaction IDs are unique, they MUST be randomly 1912 generated. Responses use the same Transaction ID as the request 1913 they correspond to. Transaction IDs are also used for fragment 1914 reassembly. 1916 max_response_length: The maximum size in bytes of a response. Used 1917 by requesting nodes to avoid receiving (unexpected) very large 1918 responses. If this value is non-zero, responding peers MUST check 1919 that any response would not exceed it and if so generate an 1920 Error_Response_Too_Large value. This value SHOULD be set to zero 1921 for responses. 1923 via_list_length: The length of the via list in bytes. Note that in 1924 this field and the following two length fields we depart from the 1925 usual variable-length convention of having the length immediately 1926 precede the value in order to make it easier for hardware decoding 1927 engines to quickly determine the length of the header. 1929 destination_list_length: The length of the destination list in 1930 bytes. 1932 options_length: The length of the header options in bytes. 1934 via_list: The via_list contains the sequence of destinations through 1935 which the message has passed. The via_list starts out empty and 1936 grows as the message traverses each peer. 1938 destination_list: The destination_list contains a sequence of 1939 destinations which the message should pass through. The 1940 destination list is constructed by the message originator. The 1941 first element in the destination list is where the message goes 1942 next. The list shrinks as the message traverses each listed peer. 1944 options: Contains a series of ForwardingOptions entries. See 1945 Section 5.3.2.3. 1947 5.3.2.1. Processing Configuration Sequence Numbers 1949 In order to be part of the overlay, a node MUST have a copy of the 1950 overlay configuration document. In order to allow for configuration 1951 document changes, each version of the configuration document has a 1952 sequence number which is monotonically increasing mod 65536. Because 1953 the sequence number may in principle wrap, greater than or less than 1954 are interpreted by modulo arithmetic as in TCP. 1956 When a destination node receives a request, it MUST check that the 1957 configuration_sequence field is equal to its own configuration 1958 sequence number. If they do not match, it MUST generate an error, 1959 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 1960 the configuration file in the request is too old, it MUST generate a 1961 ConfigUpdate message to update the requesting node. This allows new 1962 configuration documents to propagate quickly throughout the system. 1963 The one exception to this rule is that if the configuration_sequence 1964 field is equal to 0xffff, and the message type is ConfigUpdate, then 1965 the message MUST be accepted regardless of the receiving node's 1966 configuration sequence number. Since 65535 is a special value, peers 1967 sending a new configuration when the configuration sequence is 1968 currently 65534 MUST set the configuration sequence number to 0 when 1969 they send out a new configuration. 1971 5.3.2.2. Destination and Via Lists 1973 The destination list and via lists are sequences of Destination 1974 values: 1976 enum {reserved(0), node(1), resource(2), compressed(3), 1977 /* 128-255 not allowed */ (255) } 1978 DestinationType; 1980 select (destination_type) { 1981 case node: 1982 NodeId node_id; 1984 case resource: 1985 ResourceId resource_id; 1987 case compressed: 1988 opaque compressed_id<0..2^8-1>; 1990 /* This structure may be extended with new types */ 1991 } DestinationData; 1993 struct { 1994 DestinationType type; 1995 uint8 length; 1996 DestinationData destination_data; 1997 } Destination; 1999 struct { 2000 uint16 compressed_id; /* top bit MUST be 1 */ 2001 } Destination; 2003 If a destination structure has its first bit set to 1, then it is a 2004 16 bit integer. If the first bit is not set, then it is a structure 2005 starting with DestinationType. If it is a 16 bit integer, it is 2006 treated as if it were a full structure with a DestinationType of 2007 compressed and a compressed_id that was 2 bytes long with the value 2008 of the 16 bit integer. When the destination structure is not a 16 2009 bit integer, it is the TLV structure with the following contents: 2011 type 2012 The type of the DestinationData Payload Data Unit (PDU). This may 2013 be one of "node", "resource", or "compressed". 2015 length 2016 The length of the destination_data. 2018 destination_data 2019 The destination value itself, which is an encoded DestinationData 2020 structure, depending on the value of "type". 2022 Note: This structure encodes a type, length, value. The length 2023 field specifies the length of the DestinationData values, which 2024 allows the addition of new DestinationTypes. This allows an 2025 implementation which does not understand a given DestinationType 2026 to skip over it. 2028 A DestinationData can be one of three types: 2030 node 2031 A Node-ID. 2033 compressed 2034 A compressed list of Node-IDs and/or resources. Because this 2035 value was compressed by one of the peers, it is only meaningful to 2036 that peer and cannot be decoded by other peers. Thus, it is 2037 represented as an opaque string. 2039 resource 2040 The Resource-ID of the resource which is desired. This type MUST 2041 only appear in the final location of a destination list and MUST 2042 NOT appear in a via list. It is meaningless to try to route 2043 through a resource. 2045 One possible encoding of the 16 bit integer version as an opaque 2046 identifier is to encode an index into a connection table. To avoid 2047 misrouting responses in the event a response is delayed and the 2048 connection table entry has changed, the identifier SHOULD be split 2049 between an index and a generation counter for that index. At 2050 startup, the generation counters should be initialized to random 2051 values. An implementation could use 12 bits for the connection table 2052 index and 3 bits for the generation counter. (Note that this does 2053 not suggest a 4096 entry connection table for every node, only the 2054 ability to encode for a larger connection table.) When a connection 2055 table slot is used for a new connection, the generation counter is 2056 incremented (with wrapping). Connection table slots are used on a 2057 rotating basis to maximize the time interval between uses of the same 2058 slot for different connections. When routing a message to an entry 2059 in the destination list encoding a connection table entry, the node 2060 confirms that the generation counter matches the current generation 2061 counter of that index before forwarding the message. If it does not 2062 match, the message is silently dropped. 2064 5.3.2.3. Forwarding Options 2066 The Forwarding header can be extended with forwarding header options, 2067 which are a series of ForwardingOptions structures: 2069 enum { reservedForwarding(0), (255) } 2070 ForwardingOptionsType; 2072 struct { 2073 ForwardingOptionsType type; 2074 uint8 flags; 2075 uint16 length; 2076 select (type) { 2077 /* This type may be extended */ 2078 } option; 2079 } ForwardingOption; 2081 Each ForwardingOption consists of the following values: 2083 type 2084 The type of the option. This structure allows for unknown options 2085 types. 2087 length 2088 The length of the rest of the structure. 2090 flags 2091 Three flags are defined FORWARD_CRITICAL(0x01), 2092 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2093 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2094 set, any node that would forward the message but does not 2095 understand this options MUST reject the request with an 2096 Error_Unsupported_Forwarding_Option error response. If the 2097 DESTINATION_CRITICAL flag is set, any node that generates a 2098 response to the message but does not understand the forwarding 2099 option MUST reject the request with an 2100 Error_Unsupported_Forwarding_Option error response. If the 2101 RESPONSE_COPY flag is set, any node generating a response MUST 2102 copy the option from the request to the response except that the 2103 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags 2104 must be cleared. 2106 option 2107 The option value. 2109 5.3.3. Message Contents Format 2111 The second major part of a RELOAD message is the contents part, which 2112 is defined by MessageContents: 2114 enum { reservedMessagesExtension(0), (2^16-1) } MessageExtensionType; 2116 struct { 2117 MessageExtensionType type; 2118 Boolean critical; 2119 opaque extension_contents<0..2^32-1>; 2120 } MessageExtension; 2122 struct { 2123 uint16 message_code; 2124 opaque message_body<0..2^32-1>; 2125 MessageExtensions extensions<0..2^32-1>; 2126 } MessageContents; 2128 The contents of this structure are as follows: 2130 message_code 2131 This indicates the message that is being sent. The code space is 2132 broken up as follows. 2134 0 Reserved 2136 1 .. 0x7fff Requests and responses. These code points are always 2137 paired, with requests being odd and the corresponding response 2138 being the request code plus 1. Thus, "probe_request" (the 2139 Probe request) has value 1 and "probe_answer" (the Probe 2140 response) has value 2 2142 0xffff Error 2143 The message codes are defined in Section 13.8 2144 message_body 2145 The message body itself, represented as a variable-length string 2146 of bytes. The bytes themselves are dependent on the code value. 2147 See the sections describing the various RELOAD methods (Join, 2148 Update, Attach, Store, Fetch, etc.) for the definitions of the 2149 payload contents. 2151 extensions 2152 Extensions to the message. Currently no extensions are defined, 2153 but new extensions can be defined by the process described in 2154 Section 13.14. 2156 All extensions have the following form: 2158 type 2159 The extension type. 2161 critical 2162 Whether this extension must be understood in order to process the 2163 message. If critical = True and the recipient does not understand 2164 the message, it MUST generate an Error_Unknown_Extension error. 2165 If critical = False, the recipient MAY choose to process the 2166 message even if it does not understand the extension. 2168 extension_contents 2169 The contents of the extension (extension-dependent). 2171 5.3.3.1. Response Codes and Response Errors 2173 A peer processing a request returns its status in the message_code 2174 field. If the request was a success, then the message code is the 2175 response code that matches the request (i.e., the next code up). The 2176 response payload is then as defined in the request/response 2177 descriptions. 2179 If the request has failed, then the message code is set to 0xffff 2180 (error) and the payload MUST be an error_response PDU, as shown 2181 below. 2183 When the message code is 0xffff, the payload MUST be an 2184 ErrorResponse. 2186 public struct { 2187 uint16 error_code; 2188 opaque error_info<0..2^16-1>; 2189 } ErrorResponse; 2191 The contents of this structure are as follows: 2193 error_code 2194 A numeric error code indicating the error that occurred. 2196 error_info 2197 An optional arbitrary byte string. Unless otherwise specified, 2198 this will be a UTF-8 text string providing further information 2199 about what went wrong. 2201 The following error code values are defined. The numeric values for 2202 these are defined in Section 13.9. 2204 Error_Forbidden: The requesting node does not have permission to 2205 make this request. 2207 Error_Not_Found: The resource or peer cannot be found or does not 2208 exist. 2210 Error_Request_Timeout: A response to the request has not been 2211 received in a suitable amount of time. The requesting node MAY 2212 resend the request at a later time. 2214 Error_Data_Too_Old: A store cannot be completed because the 2215 storage_time precedes the existing value. 2217 Error_Data_Too_Old: A store cannot be completed because the 2218 storage_time precedes the existing value. 2220 Error_Data_Too_Large: A store cannot be completed because the 2221 requested object exceeds the size limits for that kind. 2223 Error_Generation_Counter_Too_Low: A store cannot be completed 2224 because the generation counter precedes the existing value. 2226 Error_Incompatible_with_Overlay: A peer receiving the request is 2227 using a different overlay, overlay algorithm, or hash algorithm. 2229 Error_Unsupported_Forwarding_Option: A peer receiving the request 2230 with a forwarding options flagged as critical but the peer does 2231 not support this option. See section Section 5.3.2.3. 2233 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2234 decremented to zero. See section Section 5.3.2. 2236 Error_Message_Too_Large: A peer receiving the request that was too 2237 large. See section Section 5.6. 2239 Error_Response_Too_Large: A peer would have generated a response 2240 that is too large per the max_response_length field. 2242 Error_Config_Too_Old: A destination peer received a request with a 2243 configuration sequence that's too old. See Section 5.3.2.1. 2245 Error_Config_Too_New: A destination node received a request with a 2246 configuration sequence that's too new. See Section 5.3.2.1. 2248 Error_Unknown_Kind: A destination node received a request with an 2249 unknown kind-id. See Section 6.4.1.2. 2251 Error_In_Progress: An Attach is already in progress to this peer. 2252 See Section 5.5.1.2. 2254 Error_Unknown_Extension: A destination node received a request with 2255 an unknown extension. 2257 5.3.4. Security Block 2259 The third part of a RELOAD message is the security block. The 2260 security block is represented by a SecurityBlock structure: 2262 struct { 2263 CertificateType type; 2264 opaque certificate<0..2^16-1>; 2265 } GenericCertificate; 2267 struct { 2268 GenericCertificate certificates<0..2^16-1>; 2269 Signature signature; 2270 } SecurityBlock; 2272 The contents of this structure are: 2274 certificates 2275 A bucket of certificates. 2277 signature 2278 A signature over the message contents. 2280 The certificates bucket SHOULD contain all the certificates necessary 2281 to verify every signature in both the message and the internal 2282 message objects, except for those certificates in a root-cert element 2283 of the current configuration file. This is the only location in the 2284 message which contains certificates, thus allowing for only a single 2285 copy of each certificate to be sent. In systems that have an 2286 alternative certificate distribution mechanism, some certificates MAY 2287 be omitted. However, unless an alternative mechanism for immediately 2288 generating certifcates, such as shared secret security (Section 12.4) 2289 is used, it is strongly RECOMMENDED that implementors include all 2290 referenced certificates, otherwise there is the possibility that 2291 messages may not be immediately verifiable because certificates must 2292 first be retrieved. 2294 NOTE TO IMPLEMENTERS: This requirement implies that a peer storing 2295 data is obligated to retain certificates for the data it holds 2296 regardless of whether it is responsible for or actually holding the 2297 certificates for the Certificate Store usage. 2299 Each certificate is represented by a GenericCertificate structure, 2300 which has the following contents: 2302 type 2303 The type of the certificate, as defined in [RFC6091]. Only the 2304 use of X.509 certificates is defined in this draft. 2306 certificate 2307 The encoded version of the certificate. For X.509 certificates, 2308 it is the DER form. 2310 The signature is computed over the payload and parts of the 2311 forwarding header. The payload, in case of a Store, may contain an 2312 additional signature computed over a StoreReq structure. All 2313 signatures are formatted using the Signature element. This element 2314 is also used in other contexts where signatures are needed. The 2315 input structure to the signature computation varies depending on the 2316 data element being signed. 2318 enum { reservedSignerIdentity(0), 2319 cert_hash(1), cert_hash_node_id(2), 2320 none(3) 2321 (255)} SignerIdentityType; 2323 struct { 2324 select (identity_type) { 2326 case cert_hash; 2327 HashAlgorithm hash_alg; // From TLS 2328 opaque certificate_hash<0..2^8-1>; 2330 case cert_hash_node_id: 2331 HashAlgorithm hash_alg; // From TLS 2332 opaque certificate_node_id_hash<0..2^8-1>; 2334 case none: 2335 /* empty */ 2336 /* This structure may be extended with new types if necessary*/ 2337 }; 2338 } SignerIdentityValue; 2340 struct { 2341 SignerIdentityType identity_type; 2342 uint16 length; 2343 SignerIdentityValue identity[SignerIdentity.length]; 2344 } SignerIdentity; 2346 struct { 2347 SignatureAndHashAlgorithm algorithm; // From TLS 2348 SignerIdentity identity; 2349 opaque signature_value<0..2^16-1>; 2350 } Signature; 2352 The signature construct contains the following values: 2354 algorithm 2355 The signature algorithm in use. The algorithm definitions are 2356 found in the IANA TLS SignatureAlgorithm Registry and 2357 HashAlgorithm registries. All implementations MUST support 2358 RSASSA-PKCS1-v1_5 [RFC3447] signatures with SHA-256 hashes. 2360 identity 2361 The identity used to form the signature. 2363 signature_value 2364 The value of the signature. 2366 There are two permitted identity formats, one for a certificate with 2367 only one node-id and one for a certificate with multiple node-ids. 2368 In the first case, the cert_hash type SHOULD be used. The hash_alg 2369 field is used to indicate the algorithm used to produce the hash. 2370 The certificate_hash contains the hash of the certificate object 2371 (i.e., the DER-encoded certificate). 2373 In the second case, the cert_hash_node_id type MUST be used. The 2374 hash_alg is as in cert_hash but the cert_hash_node_id is computed 2375 over the NodeId used to sign concatenated with the certificate. 2376 I.e., H(NodeID || certificate). The NodeId is represented without 2377 any framing or length fields, as simple raw bytes. This is safe 2378 because NodeIds are fixed-length for a given overlay. 2380 For signatures over messages the input to the signature is computed 2381 over: 2383 overlay || transaction_id || MessageContents || SignerIdentity 2385 where overlay and transaction_id come from the forwarding header and 2386 || indicates concatenation. 2388 The input to signatures over data values is different, and is 2389 described in Section 6.1. 2391 All RELOAD messages MUST be signed. Upon receipt, the receiving node 2392 MUST verify the signature and the authorizing certificate. This 2393 check provides a minimal level of assurance that the sending node is 2394 a valid part of the overlay as well as cryptographic authentication 2395 of the sending node. In addition, responses MUST be checked as 2396 follows: 2398 1. The response to a message sent to a specific Node-ID MUST have 2399 been sent by that Node-ID. 2400 2. The response to a message sent to a Resource-Id MUST have been 2401 sent by a Node-ID which is as close to or closer to the target 2402 Resource-Id than any node in the requesting node's neighbor 2403 table. 2405 The second condition serves as a primitive check for responses from 2406 wildly wrong nodes but is not a complete check. Note that in periods 2407 of churn, it is possible for the requesting node to obtain a closer 2408 neighbor while the request is outstanding. This will cause the 2409 response to be rejected and the request to be retransmitted. 2411 In addition, some methods (especially Store) have additional 2412 authentication requirements, which are described in the sections 2413 covering those methods. 2415 5.4. Overlay Topology 2417 As discussed in previous sections, RELOAD does not itself implement 2418 any overlay topology. Rather, it relies on Topology Plugins, which 2419 allow a variety of overlay algorithms to be used while maintaining 2420 the same RELOAD core. This section describes the requirements for 2421 new topology plugins and the methods that RELOAD provides for overlay 2422 topology maintenance. 2424 5.4.1. Topology Plugin Requirements 2426 When specifying a new overlay algorithm, at least the following need 2427 to be described: 2429 o Joining procedures, including the contents of the Join message. 2430 o Stabilization procedures, including the contents of the Update 2431 message, the frequency of topology probes and keepalives, and the 2432 mechanism used to detect when peers have disconnected. 2433 o Exit procedures, including the contents of the Leave message. 2434 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2435 compute the hash of an identifier. 2436 o The procedures that peers use to route messages. 2437 o The replication strategy used to ensure data redundancy. 2439 All overlay algorithms MUST specify maintenance procedures that send 2440 Updates to clients and peers that have established connections to the 2441 peer responsible for a particular ID when the responsibility for that 2442 ID changes. Because tracking this information is difficult, overlay 2443 algorithms MAY simply specify that an Update is sent to all members 2444 of the Connection Table whenever the range of IDs for which the peer 2445 is responsible changes. 2447 5.4.2. Methods and types for use by topology plugins 2449 This section describes the methods that topology plugins use to join, 2450 leave, and maintain the overlay. 2452 5.4.2.1. Join 2454 A new peer (but one that already has credentials) uses the JoinReq 2455 message to join the overlay. The JoinReq is sent to the responsible 2456 peer depending on the routing mechanism described in the topology 2457 plugin. This notifies the responsible peer that the new peer is 2458 taking over some of the overlay and it needs to synchronize its 2459 state. 2461 struct { 2462 NodeId joining_peer_id; 2463 opaque overlay_specific_data<0..2^16-1>; 2464 } JoinReq; 2466 The minimal JoinReq contains only the Node-ID which the sending peer 2467 wishes to assume. Overlay algorithms MAY specify other data to 2468 appear in this request. Receivers of the JoinReq MUST verify that 2469 the joining_peer_id field matches the Node-ID used to sign the 2470 message and if not MUST reject the message with an Error_Forbidden 2471 error. 2473 If the request succeeds, the responding peer responds with a JoinAns 2474 message, as defined below: 2476 struct { 2477 opaque overlay_specific_data<0..2^16-1>; 2478 } JoinAns; 2480 If the request succeeds, the responding peer MUST follow up by 2481 executing the right sequence of Stores and Updates to transfer the 2482 appropriate section of the overlay space to the joining peer. In 2483 addition, overlay algorithms MAY define data to appear in the 2484 response payload that provides additional info. 2486 In general, nodes which cannot form connections SHOULD report an 2487 error. However, implementations MUST provide some mechanism whereby 2488 nodes can determine that they are potentially the first node and take 2489 responsibility for the overlay. This specification does not mandate 2490 any particular mechanism, but a configuration flag or setting seems 2491 appropriate. 2493 5.4.2.2. Leave 2495 The LeaveReq message is used to indicate that a node is exiting the 2496 overlay. A node SHOULD send this message to each peer with which it 2497 is directly connected prior to exiting the overlay. 2499 struct { 2500 NodeId leaving_peer_id; 2501 opaque overlay_specific_data<0..2^16-1>; 2502 } LeaveReq; 2504 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2505 algorithms MAY specify other data to appear in this request. 2506 Receivers of the LeaveReq MUST verify that the leaving_peer_id field 2507 matches the Node-ID used to sign the message and if not MUST reject 2508 the message with an Error_Forbidden error. 2510 Upon receiving a Leave request, a peer MUST update its own routing 2511 table, and send the appropriate Store/Update sequences to re- 2512 stabilize the overlay. 2514 5.4.2.3. Update 2516 Update is the primary overlay-specific maintenance message. It is 2517 used by the sender to notify the recipient of the sender's view of 2518 the current state of the overlay (its routing state), and it is up to 2519 the recipient to take whatever actions are appropriate to deal with 2520 the state change. In general, peers send Update messages to all 2521 their adjacencies whenever they detect a topology shift. 2523 When a peer receives an Attach request with the send_update flag set 2524 to "true" (Section 5.4.2.4.1, it MUST send an Update message back to 2525 the sender of the Attach request after the completion of the 2526 corresponding ICE check and TLS connection. Note that the sender of 2527 a such Attach request may not have joined the overlay yet. 2529 When a peer detects through an Update that it is no longer 2530 responsible for any data value it is storing, it MUST attempt to 2531 Store a copy to the correct node unless it knows the newly 2532 responsible node already has a copy of the data. This prevents data 2533 loss during large-scale topology shifts such as the merging of 2534 partitioned overlays. 2536 The contents of the UpdateReq message are completely overlay- 2537 specific. The UpdateAns response is expected to be either success or 2538 an error. 2540 5.4.2.4. RouteQuery 2542 The RouteQuery request allows the sender to ask a peer where they 2543 would route a message directed to a given destination. In other 2544 words, a RouteQuery for a destination X requests the Node-ID for the 2545 node that the receiving peer would next route to in order to get to 2546 X. A RouteQuery can also request that the receiving peer initiate an 2547 Update request to transfer the receiving peer's routing table. 2549 One important use of the RouteQuery request is to support iterative 2550 routing. The sender selects one of the peers in its routing table 2551 and sends it a RouteQuery message with the destination_object set to 2552 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2553 responds with information about the peers to which the request would 2554 be routed. The sending peer MAY then use the Attach method to attach 2555 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2556 gets a response from a peer that is closest to the identifier in the 2557 destination_object as determined by the topology plugin. At that 2558 point, the sender can send messages directly to that peer. 2560 5.4.2.4.1. Request Definition 2562 A RouteQueryReq message indicates the peer or resource that the 2563 requesting node is interested in. It also contains a "send_update" 2564 option allowing the requesting node to request a full copy of the 2565 other peer's routing table. 2567 struct { 2568 Boolean send_update; 2569 Destination destination; 2570 opaque overlay_specific_data<0..2^16-1>; 2571 } RouteQueryReq; 2573 The contents of the RouteQueryReq message are as follows: 2575 send_update 2576 A single byte. This may be set to "true" to indicate that the 2577 requester wishes the responder to initiate an Update request 2578 immediately. Otherwise, this value MUST be set to "false". 2580 destination 2581 The destination which the requester is interested in. This may be 2582 any valid destination object, including a Node-ID, compressed ids, 2583 or Resource-ID. 2585 overlay_specific_data 2586 Other data as appropriate for the overlay. 2588 5.4.2.4.2. Response Definition 2590 A response to a successful RouteQueryReq request is a RouteQueryAns 2591 message. This is completely overlay specific. 2593 5.4.2.5. Probe 2595 Probe provides primitive "exploration" services: it allows node to 2596 determine which resources another node is responsible for; and it 2597 allows some discovery services using multicast, anycast, or 2598 broadcast. A probe can be addressed to a specific Node-ID, or the 2599 peer controlling a given location (by using a Resource-ID). In 2600 either case, the target Node-IDs respond with a simple response 2601 containing some status information. 2603 5.4.2.5.1. Request Definition 2605 The ProbeReq message contains a list (potentially empty) of the 2606 pieces of status information that the requester would like the 2607 responder to provide. 2609 enum { reservedProbeInformation(0), responsible_set(1), 2610 num_resources(2), uptime(3), (255)} 2611 ProbeInformationType; 2613 struct { 2614 ProbeInformationType requested_info<0..2^8-1>; 2615 } ProbeReq 2617 The currently defined values for ProbeInformation are: 2619 responsible_set 2620 indicates that the peer should Respond with the fraction of the 2621 overlay for which the responding peer is responsible. 2623 num_resources 2624 indicates that the peer should Respond with the number of 2625 resources currently being stored by the peer. 2627 uptime 2628 indicates that the peer should Respond with how long the peer has 2629 been up in seconds. 2631 5.4.2.5.2. Response Definition 2633 A successful ProbeAns response contains the information elements 2634 requested by the peer. 2636 struct { 2637 select (type) { 2638 case responsible_set: 2639 uint32 responsible_ppb; 2641 case num_resources: 2642 uint32 num_resources; 2644 case uptime: 2645 uint32 uptime; 2646 /* This type may be extended */ 2648 }; 2649 } ProbeInformationData; 2651 struct { 2652 ProbeInformationType type; 2653 uint8 length; 2654 ProbeInformationData value; 2655 } ProbeInformation; 2657 struct { 2658 ProbeInformation probe_info<0..2^16-1>; 2659 } ProbeAns; 2661 A ProbeAns message contains a sequence of ProbeInformation 2662 structures. Each has a "length" indicating the length of the 2663 following value field. This structure allows for unknown option 2664 types. 2666 Each of the current possible Probe information types is a 32-bit 2667 unsigned integer. For type "responsible_ppb", it is the fraction of 2668 the overlay for which the peer is responsible in parts per billion. 2669 For type "num_resources", it is the number of resources the peer is 2670 storing. For the type "uptime" it is the number of seconds the peer 2671 has been up. 2673 The responding peer SHOULD include any values that the requesting 2674 node requested and that it recognizes. They SHOULD be returned in 2675 the requested order. Any other values MUST NOT be returned. 2677 5.5. Forwarding and Link Management Layer 2679 Each node maintains connections to a set of other nodes defined by 2680 the topology plugin. This section defines the methods RELOAD uses to 2681 form and maintain connections between nodes in the overlay. Three 2682 methods are defined: 2684 Attach: used to form RELOAD connections between nodes using ICE 2685 for NAT traversal. When node A wants to connect to node B, it 2686 sends an Attach message to node B through the overlay. The Attach 2687 contains A's ICE parameters. B responds with its ICE parameters 2688 and the two nodes perform ICE to form connection. Attach also 2689 allows two nodes to connect via No-ICE instead of full ICE. 2690 AppAttach: used to form application layer connections between 2691 nodes. 2692 Ping: is a simple request/response which is used to verify 2693 connectivity of the target peer. 2695 5.5.1. Attach 2697 A node sends an Attach request when it wishes to establish a direct 2698 TCP or UDP connection to another node for the purpose of sending 2699 RELOAD messages. A client that can establish a connection directly 2700 need not send an attach as described in the second bullet of 2701 Section 3.2.1 2703 As described in Section 5.1, an Attach may be routed to either a 2704 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2705 will fail if that node is not reached. An Attach routed to a 2706 Resource-ID will establish a connection with the peer currently 2707 responsible for that Resource-ID, which may be useful in establishing 2708 a direct connection to the responsible peer for use with frequent or 2709 large resource updates. 2711 An Attach in and of itself does not result in updating the routing 2712 table of either node. That function is performed by Updates. If 2713 node A has Attached to node B, but not received any Updates from B, 2714 it MAY route messages which are directly addressed to B through that 2715 channel but MUST NOT route messages through B to other peers via that 2716 channel. The process of Attaching is separate from the process of 2717 becoming a peer (using Join and Update), to prevent half-open states 2718 where a node has started to form connections but is not really ready 2719 to act as a peer. Thus, clients (unlike peers) can simply Attach 2720 without sending Join or Update. 2722 5.5.1.1. Request Definition 2724 An Attach request message contains the requesting node ICE connection 2725 parameters formatted into a binary structure. 2727 enum { reservedOverlayLink(0), DTLS-UDP-SR(1), 2728 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2729 (255) } OverlayLinkType; 2731 enum { reservedCand(0), host(1), srflx(2), prflx(3), relay(4), 2732 (255) } CandType; 2734 struct { 2735 opaque name<0..2^16-1>; 2736 opaque value<0..2^16-1>; 2737 } IceExtension; 2739 struct { 2740 IpAddressPort addr_port; 2741 OverlayLinkType overlay_link; 2742 opaque foundation<0..255>; 2743 uint32 priority; 2744 CandType type; 2745 select (type){ 2746 case host: 2747 ; /* Nothing */ 2748 case srflx: 2749 case prflx: 2750 case relay: 2751 IpAddressPort rel_addr_port; 2752 }; 2753 IceExtension extensions<0..2^16-1>; 2754 } IceCandidate; 2756 struct { 2757 opaque ufrag<0..2^8-1>; 2758 opaque password<0..2^8-1>; 2759 opaque role<0..2^8-1>; 2760 IceCandidate candidates<0..2^16-1>; 2761 Boolean send_update; 2762 } AttachReqAns; 2764 The values contained in AttachReqAns are: 2766 ufrag 2767 The username fragment (from ICE). 2769 password 2770 The ICE password. 2772 role 2773 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2774 value MUST be 'passive' for the offerer (the peer sending the 2775 Attach request) and 'active' for the answerer (the peer sending 2776 the Attach response). 2778 candidates 2779 One or more ICE candidate values, as described below. 2780 send_update 2781 Has the same meaning as the send_update field in RouteQueryReq. 2783 Each ICE candidate is represented as an IceCandidate structure, which 2784 is a direct translation of the information from the ICE string 2785 structures, with the exception of the component ID. Since there is 2786 only one component, it is always 1, and thus left out of the PDU. 2787 The remaining values are specified as follows: 2789 addr_port 2790 corresponds to the connection-address and port productions. 2792 overlay_link 2793 corresponds to the OverlayLinkType production, Overlay Link 2794 protocols used with No-ICE MUST specify "No-ICE" in their 2795 description. Future overlay link values can be added be defining 2796 new OverlayLinkType values in the IANA registry in Section 13.10. 2797 Future extensions to the encapsulation or framing that provide for 2798 backward compatibility with that specified by a previously defined 2799 OverlayLinkType values MUST use that previous value. 2800 OverlayLinkType protocols are defined in Section 5.6 2801 A single AttachReqAns MUST NOT include both candidates whose 2802 OverlayLinkType protocols use ICE (the default) and candidates 2803 that specify "No-ICE". 2805 foundation 2806 corresponds to the foundation production. 2808 priority 2809 corresponds to the priority production. 2811 type 2812 corresponds to the cand-type production. 2814 rel_addr_port 2815 corresponds to the rel-addr and rel-port productions. Only 2816 present for type "relay". 2818 extensions 2819 ICE extensions. The name and value fields correspond to binary 2820 translations of the equivalent fields in the ICE extensions. 2822 These values should be generated using the procedures described in 2823 Section 5.5.1.3. 2825 5.5.1.2. Response Definition 2827 If a peer receives an Attach request, it MUST determine how to 2828 process the request as follows: 2830 o If it has not initiated an Attach request to the originating peer 2831 of this Attach request, it MUST process this request and SHOULD 2832 generate its own response with an AttachReqAns. It should then 2833 begin ICE checks. 2834 o If it has already sent an Attach request to and received the 2835 response from the originating peer of this Attach request, and as 2836 a as a result, an ICE check and TLS connection is in progress, 2837 then it SHOULD generate an Error_In_Progress error instead of an 2838 AttachReqAns. 2839 o If it has already sent an Attach request to but not yet received 2840 the response from the originating peer of this Attach request, it 2841 SHOULD apply the following tie-breaker heuristic to determine how 2842 to handle this Attach request and the incomplete Attach request it 2843 has sent out: 2844 * If the peer's own Node-ID is smaller when compared as big- 2845 endian unsigned integers, it MUST cancel its own incomplete 2846 Attach request. It MUST then process this Attach request, 2847 generate an AttachReqAns response, and proceed with the 2848 corresponding ICE check. 2849 * If the peer's own Node-ID is larger when compared as big-endien 2850 unsigned integers, it MUST generate an Error_In_Progress error 2851 to this Attach request, then proceed to wait for and complete 2852 the Attach and the corresponding ICE check it has originated. 2853 o If the peer is overloaded or detects some other kind of error, it 2854 MAY generate an error instead of an AttachReqAns. 2856 When a peer receives an Attach response, it SHOULD parse the response 2857 and begin its own ICE checks. 2859 5.5.1.3. Using ICE With RELOAD 2861 This section describes the profile of ICE that is used with RELOAD. 2862 RELOAD implementations MUST implement full ICE. 2864 In ICE as defined by [RFC5245], SDP is used to carry the ICE 2865 parameters. In RELOAD, this function is performed by a binary 2866 encoding in the Attach method. This encoding is more restricted than 2867 the SDP encoding because the RELOAD environment is simpler: 2869 o Only a single media stream is supported. 2870 o In this case, the "stream" refers not to RTP or other types of 2871 media, but rather to a connection for RELOAD itself or other 2872 application-layer protocols such as SIP. 2873 o RELOAD only allows for a single offer/answer exchange. Unlike the 2874 usage of ICE within SIP, there is never a need to send a 2875 subsequent offer to update the default candidates to match the 2876 ones selected by ICE. 2878 An agent follows the ICE specification as described in [RFC5245] with 2879 the changes and additional procedures described in the subsections 2880 below. 2882 5.5.1.4. Collecting STUN Servers 2884 ICE relies on the node having one or more STUN servers to use. In 2885 conventional ICE, it is assumed that nodes are configured with one or 2886 more STUN servers through some out of band mechanism. This is still 2887 possible in RELOAD but RELOAD also learns STUN servers as it connects 2888 to other peers. Because all RELOAD peers implement ICE and use STUN 2889 keepalives, every peer is a capable of responding to STUN Binding 2890 requests [RFC5389]. Accordingly, any peer that a node knows about 2891 can be used like a STUN server -- though of course it may be behind a 2892 NAT. 2894 A peer on a well-provisioned wide-area overlay will be configured 2895 with one or more bootstrap nodes. These nodes make an initial list 2896 of STUN servers. However, as the peer forms connections with 2897 additional peers, it builds more peers it can use like STUN servers. 2899 Because complicated NAT topologies are possible, a peer may need more 2900 than one STUN server. Specifically, a peer that is behind a single 2901 NAT will typically observe only two IP addresses in its STUN checks: 2902 its local address and its server reflexive address from a STUN server 2903 outside its NAT. However, if there are more NATs involved, it may 2904 learn additional server reflexive addresses (which vary based on 2905 where in the topology the STUN server is). To maximize the chance of 2906 achieving a direct connection, a peer SHOULD group other peers by the 2907 peer-reflexive addresses it discovers through them. It SHOULD then 2908 select one peer from each group to use as a STUN server for future 2909 connections. 2911 Only peers to which the peer currently has connections may be used. 2912 If the connection to that host is lost, it MUST be removed from the 2913 list of stun servers and a new server from the same group MUST be 2914 selected unless there are no others servers in the group in which 2915 case some other peer MAY be used. 2917 5.5.1.5. Gathering Candidates 2919 When a node wishes to establish a connection for the purposes of 2920 RELOAD signaling or application signaling, it follows the process of 2921 gathering candidates as described in Section 4 of ICE [RFC5245]. 2922 RELOAD utilizes a single component. Consequently, gathering for 2923 these "streams" requires a single component. In the case where a 2924 node has not yet found a TURN server, the agent would not include a 2925 relayed candidate. 2927 The ICE specification assumes that an ICE agent is configured with, 2928 or somehow knows of, TURN and STUN servers. RELOAD provides a way 2929 for an agent to learn these by querying the overlay, as described in 2930 Section 5.5.1.4 and Section 8. 2932 The default candidate selection described in Section 4.1.4 of ICE is 2933 ignored; defaults are not signaled or utilized by RELOAD. 2935 An alternative to using the full ICE supported by the Attach request 2936 is to use No-ICE mechanism by providing candidates with "No-ICE" 2937 Overlay Link protocols. Configuration for the overlay indicates 2938 whether or not these Overlay Link protocols can be used. An overlay 2939 MUST be either all ICE or all No-ICE. 2941 No-ICE will not work in all of the scenarios where ICE would work, 2942 but in some cases, particularly those with no NATs or firewalls, it 2943 will work. 2945 5.5.1.6. Prioritizing Candidates 2947 However, standardization of additional protocols for use with ICE is 2948 expected, including TCP[I-D.ietf-mmusic-ice-tcp] and protocols such 2949 as SCTP and DCCP. UDP encapsulations for SCTP and DCCP would expand 2950 the available Overlay Link protocols available for RELOAD. When 2951 additional protocols are available, the following prioritization is 2952 RECOMMENDED: 2954 o Highest priority is assigned to protocols that offer well- 2955 understood congestion and flow control without head of line 2956 blocking. For example, SCTP without message ordering, DCCP, or 2957 those protocols encapsulated using UDP. 2958 o Second highest priority is assigned to protocols that offer well- 2959 understood congestion and flow control but have head of line 2960 blocking such as TCP. 2961 o Lowest priority is assigned to protocols encapsulated over UDP 2962 that do not implement well-established congestion control 2963 algorithms. The DTLS/UDP with SR overlay link protocol is an 2964 example of such a protocol. 2966 5.5.1.7. Encoding the Attach Message 2968 Section 4.3 of ICE describes procedures for encoding the SDP for 2969 conveying RELOAD candidates. Instead of actually encoding an SDP, 2970 the candidate information (IP address and port and transport 2971 protocol, priority, foundation, type and related address) is carried 2972 within the attributes of the Attach request or its response. 2973 Similarly, the username fragment and password are carried in the 2974 Attach message or its response. Section 5.5.1 describes the detailed 2975 attribute encoding for Attach. The Attach request and its response 2976 do not contain any default candidates or the ice-lite attribute, as 2977 these features of ICE are not used by RELOAD. 2979 Since the Attach request contains the candidate information and short 2980 term credentials, it is considered as an offer for a single media 2981 stream that happens to be encoded in a format different than SDP, but 2982 is otherwise considered a valid offer for the purposes of following 2983 the ICE specification. Similarly, the Attach response is considered 2984 a valid answer for the purposes of following the ICE specification. 2986 5.5.1.8. Verifying ICE Support 2988 An agent MUST skip the verification procedures in Section 5.1 and 6.1 2989 of ICE. Since RELOAD requires full ICE from all agents, this check 2990 is not required. 2992 5.5.1.9. Role Determination 2994 The roles of controlling and controlled as described in Section 5.2 2995 of ICE are still utilized with RELOAD. However, the offerer (the 2996 entity sending the Attach request) will always be controlling, and 2997 the answerer (the entity sending the Attach response) will always be 2998 controlled. The connectivity checks MUST still contain the ICE- 2999 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 3000 role reversal capability for which they are defined will never be 3001 needed with RELOAD. This is to allow for a common codebase between 3002 ICE for RELOAD and ICE for SDP. 3004 5.5.1.10. Full ICE 3006 When the overlay uses ICE , connectivity checks and nominations are 3007 used as in regular ICE. 3009 5.5.1.10.1. Connectivity Checks 3011 The processes of forming check lists in Section 5.7 of ICE, 3012 scheduling checks in Section 5.8, and checking connectivity checks in 3013 Section 7 are used with RELOAD without change. 3015 5.5.1.10.2. Concluding ICE 3017 The procedures in Section 8 of ICE are followed to conclude ICE, with 3018 the following exceptions: 3020 o The controlling agent MUST NOT attempt to send an updated offer 3021 once the state of its single media stream reaches Completed. 3022 o Once the state of ICE reaches Completed, the agent can immediately 3023 free all unused candidates. This is because RELOAD does not have 3024 the concept of forking, and thus the three second delay in Section 3025 8.3 of ICE does not apply. 3027 5.5.1.10.3. Media Keepalives 3029 STUN MUST be utilized for the keepalives described in Section 10 of 3030 ICE. 3032 5.5.1.11. No-ICE 3034 No-ICE is selected when either side has provided "no ICE" Overlay 3035 Link candidates. STUN is not used for connectivity checks when doing 3036 No-ICE; instead the DTLS or TLS handshake (or similar security layer 3037 of future overlay link protocols) forms the connectivity check. The 3038 certificate exchanged during the (D)TLS handshake must match the node 3039 that sent the AttachReqAns and if it does not, the connection MUST be 3040 closed. 3042 5.5.1.12. Subsequent Offers and Answers 3044 An agent MUST NOT send a subsequent offer or answer. Thus, the 3045 procedures in Section 9 of ICE MUST be ignored. 3047 5.5.1.13. Sending Media 3049 The procedures of Section 11 of ICE apply to RELOAD as well. 3050 However, in this case, the "media" takes the form of application 3051 layer protocols (e.g. RELOAD) over TLS or DTLS. Consequently, once 3052 ICE processing completes, the agent will begin TLS or DTLS procedures 3053 to establish a secure connection. The node which sent the Attach 3054 request MUST be the TLS server. The other node MUST be the TLS 3055 client. The server MUST request TLS client authentication. The 3056 nodes MUST verify that the certificate presented in the handshake 3057 matches the identity of the other peer as found in the Attach 3058 message. Once the TLS or DTLS signaling is complete, the application 3059 protocol is free to use the connection. 3061 The concept of a previous selected pair for a component does not 3062 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3064 5.5.1.14. Receiving Media 3066 An agent MUST be prepared to receive packets for the application 3067 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3068 time. The jitter and RTP considerations in Section 11 of ICE do not 3069 apply to RELOAD. 3071 5.5.2. AppAttach 3073 A node sends an AppAttach request when it wishes to establish a 3074 direct connection to another node for the purposes of sending 3075 application layer messages. AppAttach is nearly identical to Attach, 3076 except for the purpose of the connection: it is used to transport 3077 non-RELOAD "media". A separate request is used to avoid implementor 3078 confusion between the two methods (this was found to be a real 3079 problem with initial implementations). The AppAttach request and its 3080 response contain an application attribute, which indicates what 3081 protocol is to be run over the connection. 3083 5.5.2.1. Request Definition 3085 An AppAttachReq message contains the requesting node's ICE connection 3086 parameters formatted into a binary structure. 3088 struct { 3089 opaque ufrag<0..2^8-1>; 3090 opaque password<0..2^8-1>; 3091 uint16 application; 3092 opaque role<0..2^8-1>; 3093 IceCandidate candidates<0..2^16-1>; 3094 } AppAttachReq; 3096 The values contained in AppAttachReq and AppAttachAns are: 3098 ufrag 3099 The username fragment (from ICE) 3101 password 3102 The ICE password. 3104 application 3105 A 16-bit application-id as defined in the Section 13.5. This 3106 number represents the IANA registered application that is going to 3107 send data on this connection. For SIP, this is 5060 or 5061. 3109 role 3110 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3112 candidates 3113 One or more ICE candidate values 3115 The application using connection set up with this request is 3116 responsible for providing sufficiently frequent keep traffic for NAT 3117 and Firewall keep alive and for deciding when to close the 3118 connection. 3120 5.5.2.2. Response Definition 3122 If a peer receives an AppAttach request, it SHOULD process the 3123 request and generate its own response with a AppAttachAns. It should 3124 then begin ICE checks. When a peer receives an AppAttach response, 3125 it SHOULD parse the response and begin its own ICE checks. If the 3126 application ID is not supported, the peer MUST reply with an 3127 Error_Not_Found error. 3129 struct { 3130 opaque ufrag<0..2^8-1>; 3131 opaque password<0..2^8-1>; 3132 uint16 application; 3133 opaque role<0..2^8-1>; 3134 IceCandidate candidates<0..2^16-1>; 3135 } AppAttachAns; 3137 The meaning of the fields is the same as in the AppAttachReq. 3139 5.5.3. Ping 3141 Ping is used to test connectivity along a path. A ping can be 3142 addressed to a specific Node-ID, to the peer controlling a given 3143 location (by using a resource ID), or to the broadcast Node-ID 3144 (2^128-1). 3146 5.5.3.1. Request Definition 3148 struct { 3149 opaque<0..2^16-1> padding; 3150 } PingReq 3152 The Ping request is empty of meaningful contents. However, it may 3153 contain up to 65535 bytes of padding to facilitate the discovery of 3154 overlay maximum packet sizes. 3156 5.5.3.2. Response Definition 3158 A successful PingAns response contains the information elements 3159 requested by the peer. 3161 struct { 3162 uint64 response_id; 3163 uint64 time; 3164 } PingAns; 3166 A PingAns message contains the following elements: 3168 response_id 3169 A randomly generated 64-bit response ID. This is used to 3170 distinguish Ping responses. 3172 time 3173 The time when the Ping response was created represented in the 3174 same way as storage_time defined in Section 6. 3176 5.5.4. ConfigUpdate 3178 The ConfigUpdate method is used to push updated configuration data 3179 across the overlay. Whenever a node detects that another node has 3180 old configuration data, it MUST generate a ConfigUpdate request. The 3181 ConfigUpdate request allows updating of two kinds of data: the 3182 configuration data (Section 5.3.2.1) and kind information 3183 (Section 6.4.1.1). 3185 5.5.4.1. Request Definition 3187 enum { reservedConfigUpdate(0), config(1), kind(2), (255) } 3188 ConfigUpdateType; 3190 typedef uint32 KindId; 3191 typedef opaque KindDescription<0..2^16-1>; 3193 struct { 3194 ConfigUpdateType type; 3195 uint32 length; 3197 select (type) { 3198 case config: 3199 opaque config_data<0..2^24-1>; 3201 case kind: 3202 KindDescription kinds<0..2^24-1>; 3204 /* This structure may be extended with new types*/ 3205 }; 3206 } ConfigUpdateReq; 3208 The ConfigUpdateReq message contains the following elements: 3210 type 3211 The type of the contents of the message. This structure allows 3212 for unknown content types. 3213 length 3214 The length of the remainder of the message. This is included to 3215 preserve backward compatibility and is 32 bits instead of 24 to 3216 facilitate easy conversion between network and host byte order. 3217 config_data (type==config) 3218 The contents of the configuration document. 3219 kinds (type==kind) 3220 One or more XML kind-block productions (see Section 10.1). These 3221 MUST be encoded with UTF-8 and assume a default namespace of 3222 "urn:ietf:params:xml:ns:p2p:config-base". 3224 5.5.4.2. Response Definition 3226 struct { 3227 } ConfigUpdateAns 3229 If the ConfigUpdateReq is of type "config" it MUST only be processed 3230 if all the following are true: 3232 o The sequence number in the document is greater than the current 3233 configuration sequence number. 3234 o The configuration document is correctly digitally signed (see 3235 Section 10 for details on signatures. 3236 Otherwise appropriate errors MUST be generated. 3238 If the ConfigUpdateReq is of type "kind" it MUST only be processed if 3239 it is correctly digitally signed by an acceptable kind signer as 3240 specified in the configuration file. Details on kind-signer field in 3241 the configuration file is described in Section 10.1. In addition, if 3242 the kind update conflicts with an existing known kind (i.e., it is 3243 signed by a different signer), then it should be rejected with 3244 "Error_Forbidden". This should not happen in correctly functioning 3245 overlays. 3247 If the update is acceptable, then the node MUST reconfigure itself to 3248 match the new information. This may include adding permissions for 3249 new kinds, deleting old kinds, or even, in extreme circumstances, 3250 exiting and reentering the overlay, if, for instance, the DHT 3251 algorithm has changed. 3253 The response for ConfigUpdate is empty. 3255 5.6. Overlay Link Layer 3257 RELOAD can use multiple Overlay Link protocols to send its messages. 3258 Because ICE is used to establish connections (see Section 5.5.1.3), 3259 RELOAD nodes are able to detect which Overlay Link protocols are 3260 offered by other nodes and establish connections between them. Any 3261 link protocol needs to be able to establish a secure, authenticated 3262 connection and to provide data origin authentication and message 3263 integrity for individual data elements. RELOAD currently supports 3264 three Overlay Link protocols: 3266 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3267 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3268 o DTLS [RFC4347] over UDP with SR, No-ICE 3270 Note that although UDP does not properly have "connections", both TLS 3271 and DTLS have a handshake which establishes a similar, stateful 3272 association, and we simply refer to these as "connections" for the 3273 purposes of this document. 3275 If a peer receives a message that is larger than value of max- 3276 message-size defined in the overlay configuration, the peer SHOULD 3277 send an Error_Message_Too_Large error and then close the TLS or DTLS 3278 session from which the message was received. Note that this error 3279 can be sent and the session closed before receiving the complete 3280 message. If the forwarding header is larger than the max-message- 3281 size, the receiver SHOULD close the TLS or DTLS session without 3282 sending an error. 3284 The Framing Header (FH) is used to frame messages and provide timing 3285 when used on a reliable stream-based transport protocol. Simple 3286 Reliability (SR) makes use of the FH to provide congestion control 3287 and semi-reliability when using unreliable message-oriented transport 3288 protocols. We will first define each of these algorithms, then 3289 define overlay link protocols that use them. 3291 Note: We expect future Overlay Link protocols to define replacements 3292 for all components of these protocols, including the framing header. 3293 These protocols have been chosen for simplicity of implementation and 3294 reasonable performance. 3296 Note to implementers: There are inherent tradeoffs in utilizing 3297 short timeouts to determine when a link has failed. To balance the 3298 tradeoffs, an implementation should be able to quickly act to remove 3299 entries from the routing table when there is reason to suspect the 3300 link has failed. For example, in a Chord derived overlay algorithm, 3301 a closer finger table entry could be substituted for an entry in the 3302 finger table that has experienced a timeout. That entry can be 3303 restored if it proves to resume functioning, or replaced at some 3304 point in the future if necessary. End-to-end retransmissions will 3305 handle any lost messages, but only if the failing entries do not 3306 remain in the finger table for subsequent retransmissions. 3308 5.6.1. Future Overlay Link Protocols 3310 It is possible to define new link-layer protocols and apply them to a 3311 new overlay using the "overlay-link-protocol" configuration directive 3312 (see Section 10.1.). However, any new protocols MUST meet the 3313 following requirements. 3315 Endpoint authentication When a node forms an association with 3316 another endpoint, it MUST be possible to cryptographically verify 3317 that the endpoint has a given Node-Id. 3319 Traffic origin authentication and integrity When a node receives 3320 traffic from another endpoint, it MUST be possible to 3321 cryptographically verify that the traffic came from a given 3322 association and that it has not been modified in transit from the 3323 other endpoint in the association. The overlay link protocol MUST 3324 also provide replay prevention/detection. 3326 Traffic confidentiality When a node sends traffic to another 3327 endpoint, it MUST NOT be possible for a third party not involved 3328 in the association to determine the contents of that traffic. 3330 Any new overlay protocol MUST be defined via RFC 5226 Standards 3331 Action; see Section 13.11. 3333 5.6.1.1. HIP 3335 In a Host Identity Protocol Based Overlay Networking Environment (HIP 3336 BONE) [RFC6079] HIP [RFC5201] provides connection management (e.g., 3337 NAT traversal and mobility) and security for the overlay network. 3338 The P2PSIP Working Group has expressed interest in supporting a HIP- 3339 based link protocol. Such support would require specifying such 3340 details as: 3342 o How to issue certificates which provided identities meaningful to 3343 the HIP base exchange. We anticipate that this would require a 3344 mapping between ORCHIDs and NodeIds. 3345 o How to carry the HIP I1 and I2 messages. 3346 o How to carry RELOAD messages over HIP. 3348 [I-D.ietf-hip-reload-instance] documents work in progress on using 3349 RELOAD with the HIP BONE. 3351 5.6.1.2. ICE-TCP 3353 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] allows TCP to be 3354 supported as an Overlay Link protocol that can be added using ICE. 3356 5.6.1.3. Message-oriented Transports 3358 Modern message-oriented transports offer high performance, good 3359 congestion control, and avoid head of line blocking in case of lost 3360 data. These characteristics make them preferable as underlying 3361 transport protocols for RELOAD links. SCTP without message ordering 3362 and DCCP are two examples of such protocols. However, currently they 3363 are not well-supported by commonly available NATs, and specifications 3364 for ICE session establishment are not available. 3366 5.6.1.4. Tunneled Transports 3368 As of the time of this writing, there is significant interest in the 3369 IETF community in tunneling other transports over UDP, motivated by 3370 the situation that UDP is well-supported by modern NAT hardware, and 3371 similar performance can be achieved to native implementation. 3372 Currently SCTP, DCCP, and a generic tunneling extension are being 3373 proposed for message-oriented protocols. Once ICE traversal has been 3374 specified for these tunneled protocols, they should be 3375 straightforward to support as overlay link protocols. 3377 5.6.2. Framing Header 3379 In order to support unreliable links and to allow for quick detection 3380 of link failures when using reliable end-to-end transports, each 3381 message is wrapped in a very simple framing layer (FramedMessage) 3382 which is only used for each hop. This layer contains a sequence 3383 number which can then be used for ACKs. The same header is used for 3384 both reliable and unreliable transports for simplicity of 3385 implementation. 3387 The definition of FramedMessage is: 3389 enum { data(128), ack(129), (255)} FramedMessageType; 3391 struct { 3392 FramedMessageType type; 3394 select (type) { 3395 case data: 3396 uint32 sequence; 3397 opaque message<0..2^24-1>; 3399 case ack: 3400 uint32 ack_sequence; 3401 uint32 received; 3402 }; 3403 } FramedMessage; 3405 The type field of the PDU is set to indicate whether the message is 3406 data or an acknowledgement. 3408 If the message is of type "data", then the remainder of the PDU is as 3409 follows: 3411 sequence 3412 the sequence number. This increments by 1 for each framed message 3413 sent over this transport session. 3415 message 3416 the message that is being transmitted. 3418 Each connection has it own sequence number space. Initially the 3419 value is zero and it increments by exactly one for each message sent 3420 over that connection. 3422 When the receiver receives a message, it SHOULD immediately send an 3423 ACK message. The receiver MUST keep track of the 32 most recent 3424 sequence numbers received on this association in order to generate 3425 the appropriate ack. 3427 If the PDU is of type "ack", the contents are as follows: 3429 ack_sequence 3430 The sequence number of the message being acknowledged. 3432 received 3433 A bitmask indicating if each of the previous 32 sequence numbers 3434 before this packet has been among the 32 packets most recently 3435 received on this connection. When a packet is received with a 3436 sequence number N, the receiver looks at the sequence number of 3437 the previously 32 packets received on this connection. Call the 3438 previously received packet number M. For each of the previous 32 3439 packets, if the sequence number M is less than N but greater than 3440 N-32, the N-M bit of the received bitmask is set to one; otherwise 3441 it is zero. Note that a bit being set to one indicates positively 3442 that a particular packet was received, but a bit being set to zero 3443 means only that it is unknown whether or not the packet has been 3444 received, because it might have been received before the 32 most 3445 recently received packets. 3447 The received field bits in the ACK provide a high degree of 3448 redundancy so that the sender can figure out which packets the 3449 receiver has received and can then estimate packet loss rates. If 3450 the sender also keeps track of the time at which recent sequence 3451 numbers have been sent, the RTT can be estimated. 3453 5.6.3. Simple Reliability 3455 When RELOAD is carried over DTLS or another unreliable link protocol, 3456 it needs to be used with a reliability and congestion control 3457 mechanism, which is provided on a hop-by-hop basis. The basic 3458 principle is that each message, regardless of whether or not it 3459 carries a request or response, will get an ACK and be reliably 3460 retransmitted. The receiver's job is very simple, limited to just 3461 sending ACKs. All the complexity is at the sender side. This allows 3462 the sending implementation to trade off performance versus 3463 implementation complexity without affecting the wire protocol. 3465 5.6.3.1. Retransmission and Flow Control 3467 Because the receiver's role is limited to providing packet 3468 acknowledgements, a wide variety of congestion control algorithms can 3469 be implemented on the sender side while using the same basic wire 3470 protocol. In general, senders MAY implement any rate control scheme 3471 of their choice, provided that it is REQUIRED to be no more 3472 aggressive then TFRC[RFC5348]. 3474 The following section describes a simple, inefficient scheme that 3475 complies with this requirement. Another alternative would be TFRC-SP 3476 [RFC4828] and use the received bitmask to allow the sender to compute 3477 packet loss event rates. 3479 5.6.3.1.1. Trivial Retransmission 3481 A node SHOULD retransmit a message if it has not received an ACK 3482 after an interval of RTO ("Retransmission TimeOut"). The node MUST 3483 double the time to wait after each retransmission. In each 3484 retransmission, the sequence number is incremented. 3486 The RTO is an estimate of the round-trip time (RTT). Implementations 3487 can use a static value for RTO or a dynamic estimate which will 3488 result in better performance. For implementations that use a static 3489 value, the default value for RTO is 500 ms. Nodes MAY use smaller 3490 values of RTO if it is known that all nodes are within the local 3491 network. The default RTO MAY be chosen larger, and this is 3492 RECOMMENDED if it is known in advance (such as on high latency access 3493 links) that the round-trip time is larger. 3495 Implementations that use a dynamic estimate to compute the RTO MUST 3496 use the algorithm described in RFC 6298[RFC6298], with the exception 3497 that the value of RTO SHOULD NOT be rounded up to the nearest second 3498 but instead rounded up to the nearest millisecond. The RTT of a 3499 successful STUN transaction from the ICE stage is used as the initial 3500 measurement for formula 2.2 of RFC 6298. The sender keeps track of 3501 the time each message was sent for all recently sent messages. Any 3502 time an ACK is received, the sender can compute the RTT for that 3503 message by looking at the time the ACK was received and the time when 3504 the message was sent. This is used as a subsequent RTT measurement 3505 for formula 2.3 of RFC 6298 to update the RTO estimate. (Note that 3506 because retransmissions receive new sequence numbers, all received 3507 ACKs are used.) 3509 The value for RTO is calculated separately for each DTLS session. 3511 Retransmissions continue until a response is received, or until a 3512 total of 5 requests have been sent or there has been a hard ICMP 3513 error [RFC1122] or a TLS alert. The sender knows a response was 3514 received when it receives an ACK with a sequence number that 3515 indicates it is a response to one of the transmissions of this 3516 messages. For example, assuming an RTO of 500 ms, requests would be 3517 sent at times 0 ms, 500 ms, 1500 ms, 3500 ms, and 7500 ms. If all 3518 retransmissions for a message fail, then the sending node SHOULD 3519 close the connection routing the message. 3521 To determine when a link may be failing without waiting for the final 3522 timeout, observe when no ACKs have been received for an entire RTO 3523 interval, and then wait for three retransmissions to occur beyond 3524 that point. If no ACKs have been received by the time the third 3525 retransmission occurs, it is RECOMMENDED that the link be removed 3526 from the routing table. The link MAY be restored to the routing 3527 table if ACKs resume before the connection is closed, as described 3528 above. 3530 Once an ACK has been received for a message, the next message can be 3531 sent, but the peer SHOULD ensure that there is at least 10 ms between 3532 sending any two messages. The only time a value less than 10 ms can 3533 be used is when it is known that all nodes are on a network that can 3534 support retransmissions faster than 10 ms with no congestion issues. 3536 5.6.4. DTLS/UDP with SR 3538 This overlay link protocol consists of DTLS over UDP while 3539 implementing the Simple Reliability protocol. STUN Connectivity 3540 checks and keepalives are used. 3542 5.6.5. TLS/TCP with FH, No-ICE 3544 This overlay link protocol consists of TLS over TCP with the framing 3545 header. Because ICE is not used, STUN connectivity checks are not 3546 used upon establishing the TCP connection, nor are they used for 3547 keepalives. 3549 Because the TCP layer's application-level timeout is too slow to be 3550 useful for overlay routing, the Overlay Link implementation MUST use 3551 the framing header to measure the RTT of the connection and calculate 3552 an RTO as specified in Section 2 of [RFC6298]. The resulting RTO is 3553 not used for retransmissions, but as a timeout to indicate when the 3554 link SHOULD be removed from the routing table. It is RECOMMENDED 3555 that such a connection be retained for 30s to determine if the 3556 failure was transient before concluding the link has failed 3557 permanently. 3559 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3560 candidate MUST be provided. 3562 5.6.6. DTLS/UDP with SR, No-ICE 3564 This overlay link protocol consists of DTLS over UDP while 3565 implementing the Simple Reliability protocol. Because ICE is not 3566 used, no STUN connectivity checks or keepalives are used. 3568 5.7. Fragmentation and Reassembly 3570 In order to allow transmission over datagram protocols such as DTLS, 3571 RELOAD messages may be fragmented. 3573 Any node along the path can fragment the message but only the final 3574 destination reassembles the fragments. When a node takes a packet 3575 and fragments it, each fragment has a full copy of the Forwarding 3576 Header but the data after the Forwarding Header is broken up in 3577 appropriate sized chunks. The size of the payload chunks needs to 3578 take into account space to allow the via and destination lists to 3579 grow. Each fragment MUST contain a full copy of the via and 3580 destination list and MUST contain at least 256 bytes of the message 3581 body. If the via and destination list are so large that this is not 3582 possible, RELOAD fragmentation is not performed and IP-layer 3583 fragmentation is allowed to occur. When a message must be 3584 fragmented, it SHOULD be split into equal-sized fragments that are no 3585 larger than the PMTU of the next overlay link minus 32 bytes. This 3586 is to allow the via list to grow before further fragmentation is 3587 required. 3589 Note that this fragmentation is not optimal for the end-to-end path - 3590 a message may be refragmented multiple times as it traverses the 3591 overlay but is only assembled at the final destination. This option 3592 has been chosen as it is far easier to implement than e2e PMTU 3593 discovery across an ever-changing overlay, and it effectively 3594 addresses the reliability issues of relying on IP-layer 3595 fragmentation. However, PING can be used to allow e2e PMTU to be 3596 implemented if desired. 3598 Upon receipt of a fragmented message by the intended peer, the peer 3599 holds the fragments in a holding buffer until the entire message has 3600 been received. The message is then reassembled into a single message 3601 and processed. In order to mitigate denial of service attacks, 3602 receivers SHOULD time out incomplete fragments after maximum request 3603 lifetime (15 seconds). Note this time was derived from looking at 3604 the end to end retransmission time and saving fragments long enough 3605 for the full end to end retransmissions to take place. Ideally the 3606 receiver would have enough buffer space to deal with as many 3607 fragments as can arrive in the maximum request lifetime. However, if 3608 the receiver runs out of buffer space to reassemble the messages it 3609 MUST drop the message. 3611 When a message is fragmented, the fragment offset value is stored in 3612 the lower 24 bits of the fragment field of the forwarding header. 3613 The offset is the number of bytes between the end of the forwarding 3614 header and the start of the data. The first fragment therefore has 3615 an offset of 0. The first and last bit indicators MUST be 3616 appropriately set. If the message is not fragmented, then both the 3617 first and last fragment bits are set to 1 and the offset is 0 3618 resulting in a fragment value of 0xC0000000. Note that this means 3619 that the first fragment bit is always 1, so isn't actually that 3620 useful. 3622 6. Data Storage Protocol 3624 RELOAD provides a set of generic mechanisms for storing and 3625 retrieving data in the Overlay Instance. These mechanisms can be 3626 used for new applications simply by defining new code points and a 3627 small set of rules. No new protocol mechanisms are required. 3629 The basic unit of stored data is a single StoredData structure: 3631 struct { 3632 uint32 length; 3633 uint64 storage_time; 3634 uint32 lifetime; 3635 StoredDataValue value; 3636 Signature signature; 3637 } StoredData; 3639 The contents of this structure are as follows: 3641 length 3642 The size of the StoredData structure in octets excluding the size 3643 of length itself. 3645 storage_time 3646 The time when the data was stored represented as the number of 3647 milliseconds elapsed since midnight Jan 1, 1970 UTC not counting 3648 leap seconds. This will have the same values for seconds as 3649 standard UNIX time or POSIX time. More information can be found 3650 at [UnixTime]. Any attempt to store a data value with a storage 3651 time before that of a value already stored at this location MUST 3652 generate a Error_Data_Too_Old error. This prevents rollback 3653 attacks. The node SHOULD make a best-effort attempt to use a 3654 correct clock to determine this number, however, the protocol does 3655 not require synchronized clocks: the receiving peer uses the 3656 storage time in the previous store, not its own clock. Clock 3657 values are used so that when clocks are generally synchronized, 3658 data may be stored in a single transaction, rather than querying 3659 for the value of a counter before the actual store. 3660 If a node attempting to store new data in response to a user 3661 request (rather than as an overlay maintenance operation such as 3662 occurs during unpartitioning) is rejected with an 3663 Error_Data_Too_Old error, the node MAY elect to perform its store 3664 using a storage_time that increments the value used with the 3665 previous store. This situation may occur when the clocks of nodes 3666 storing to this location are not properly synchronized. 3668 lifetime 3669 The validity period for the data, in seconds, starting from the 3670 time the peer receives the StoreReq. 3672 value 3673 The data value itself, as described in Section 6.2. 3675 signature 3676 A signature as defined in Section 6.1. 3678 Each Resource-ID specifies a single location in the Overlay Instance. 3679 However, each location may contain multiple StoredData values 3680 distinguished by Kind-ID. The definition of a kind describes both 3681 the data values which may be stored and the data model of the data. 3682 Some data models allow multiple values to be stored under the same 3683 Kind-ID. Section Section 6.2 describes the available data models. 3684 Thus, for instance, a given Resource-ID might contain a single-value 3685 element stored under Kind-ID X and an array containing multiple 3686 values stored under Kind-ID Y. 3688 6.1. Data Signature Computation 3690 Each StoredData element is individually signed. However, the 3691 signature also must be self-contained and cover the Kind-ID and 3692 Resource-ID even though they are not present in the StoredData 3693 structure. The input to the signature algorithm is: 3695 resource_id || kind || storage_time || StoredDataValue || 3696 SignerIdentity 3698 Where || indicates concatenation. 3700 Where these values are: 3702 resource_id 3703 The resource ID where this data is stored. 3705 kind 3706 The Kind-ID for this data. 3708 storage_time 3710 The contents of the storage_time data value. 3711 StoredDataValue 3712 The contents of the stored data value, as described in the 3713 previous sections. 3715 SignerIdentity 3716 The signer identity as defined in Section 5.3.4. 3718 Once the signature has been computed, the signature is represented 3719 using a signature element, as described in Section 5.3.4. 3721 6.2. Data Models 3723 The protocol currently defines the following data models: 3725 o single value 3726 o array 3727 o dictionary 3729 These are represented with the StoredDataValue structure. The actual 3730 dataModel is known from the kind being stored. 3732 struct { 3733 Boolean exists; 3734 opaque value<0..2^32-1>; 3735 } DataValue; 3737 struct { 3738 select (dataModel) { 3739 case single_value: 3740 DataValue single_value_entry; 3742 case array: 3743 ArrayEntry array_entry; 3745 case dictionary: 3746 DictionaryEntry dictionary_entry; 3748 /* This structure may be extended */ 3749 }; 3750 } StoredDataValue; 3752 We now discuss the properties of each data model in turn: 3754 6.2.1. Single Value 3756 A single-value element is a simple sequence of bytes. There may be 3757 only one single-value element for each Resource-ID, Kind-ID pair. 3759 A single value element is represented as a DataValue, which contains 3760 the following two elements: 3762 exists 3763 This value indicates whether the value exists at all. If it is 3764 set to False, it means that no value is present. If it is True, 3765 that means that a value is present. This gives the protocol a 3766 mechanism for indicating nonexistence as opposed to emptiness. 3768 value 3769 The stored data. 3771 6.2.2. Array 3773 An array is a set of opaque values addressed by an integer index. 3774 Arrays are zero based. Note that arrays can be sparse. For 3775 instance, a Store of "X" at index 2 in an empty array produces an 3776 array with the values [ NA, NA, "X"]. Future attempts to fetch 3777 elements at index 0 or 1 will return values with "exists" set to 3778 False. 3780 A array element is represented as an ArrayEntry: 3782 struct { 3783 uint32 index; 3784 DataValue value; 3785 } ArrayEntry; 3787 The contents of this structure are: 3789 index 3790 The index of the data element in the array. 3792 value 3793 The stored data. 3795 6.2.3. Dictionary 3797 A dictionary is a set of opaque values indexed by an opaque key with 3798 one value for each key. A single dictionary entry is represented as 3799 follows: 3801 A dictionary element is represented as a DictionaryEntry: 3803 typedef opaque DictionaryKey<0..2^16-1>; 3805 struct { 3806 DictionaryKey key; 3807 DataValue value; 3808 } DictionaryEntry; 3810 The contents of this structure are: 3812 key 3813 The dictionary key for this value. 3815 value 3816 The stored data. 3818 6.3. Access Control Policies 3820 Every kind which is storable in an overlay MUST be associated with an 3821 access control policy. This policy defines whether a request from a 3822 given node to operate on a given value should succeed or fail. It is 3823 anticipated that only a small number of generic access control 3824 policies are required. To that end, this section describes a small 3825 set of such policies and Section 13.4 establishes a registry for new 3826 policies if required. Each policy has a short string identifier 3827 which is used to reference it in the configuration document. 3829 In the following policies, the term "signer" refers to the signer of 3830 the StoredValue object and, in the case of non-replica stores, to the 3831 signer of the StoreReq message. I.e., in a non-replica store, both 3832 the signer of the StoredValue and the signer of the StoreReq MUST 3833 conform to the policy. In the case of a replica store, the signer of 3834 the StoredValue MUST conform to the policy and the StoreReq itself 3835 MUST be checked as described in Section 6.4.1.1. 3837 6.3.1. USER-MATCH 3839 In the USER-MATCH policy, a given value MUST be written (or 3840 overwritten) if and only if the signer's certificate has a user name 3841 which hashes (using the hash function for the overlay) to the 3842 Resource-ID for the resource. Recall that the certificate may, 3843 depending on the overlay configuration, be self-signed. 3845 6.3.2. NODE-MATCH 3847 In the NODE-MATCH policy, a given value MUST be written (or 3848 overwritten) if and only if the signer's certificate has a specified 3849 Node-ID which hashes (using the hash function for the overlay) to the 3850 Resource-ID for the resource and that Node-ID is the one indicated in 3851 the SignerIdentity value cert_hash. 3853 6.3.3. USER-NODE-MATCH 3855 The USER-NODE-MATCH policy may only be used with dictionary types. 3856 In the USER-NODE-MATCH policy, a given value MUST be written (or 3857 overwritten) if and only if the signer's certificate has a user name 3858 which hashes (using the hash function for the overlay) to the 3859 Resource-ID for the resource. In addition, the dictionary key MUST 3860 be equal to the Node-ID in the certificate and that Node-ID MUST be 3861 the one indicated in the SignerIdentity value cert_hash. 3863 6.3.4. NODE-MULTIPLE 3865 In the NODE-MULTIPLE policy, a given value MUST be written (or 3866 overwritten) if and only if signer's certificate contains a Node-ID 3867 such that H(Node-ID || i) is equal to the Resource-ID for some small 3868 integer value of i and that Node-ID is the one indicated in the 3869 SignerIdentity value cert_hash. When this policy is in use, the 3870 maximum value of i MUST be specified in the kind definition. 3872 Note that as i is not carried on the wire, the verifier MUST iterate 3873 through potential i values up to the maximum value in order to 3874 determine whether a store is acceptable. 3876 6.4. Data Storage Methods 3878 RELOAD provides several methods for storing and retrieving data: 3880 o Store values in the overlay 3881 o Fetch values from the overlay 3882 o Stat: get metadata about values in the overlay 3883 o Find the values stored at an individual peer 3885 These methods are each described in the following sections. 3887 6.4.1. Store 3889 The Store method is used to store data in the overlay. The format of 3890 the Store request depends on the data model which is determined by 3891 the kind. 3893 6.4.1.1. Request Definition 3895 A StoreReq message is a sequence of StoreKindData values, each of 3896 which represents a sequence of stored values for a given kind. The 3897 same Kind-ID MUST NOT be used twice in a given store request. Each 3898 value is then processed in turn. These operations MUST be atomic. 3899 If any operation fails, the state MUST be rolled back to before the 3900 request was received. 3902 The store request is defined by the StoreReq structure: 3904 struct { 3905 KindId kind; 3906 uint64 generation_counter; 3907 StoredData values<0..2^32-1>; 3908 } StoreKindData; 3910 struct { 3911 ResourceId resource; 3912 uint8 replica_number; 3913 StoreKindData kind_data<0..2^32-1>; 3914 } StoreReq; 3916 A single Store request stores data of a number of kinds to a single 3917 resource location. The contents of the structure are: 3919 resource 3920 The resource to store at. 3922 replica_number 3923 The number of this replica. When a storing peer saves replicas to 3924 other peers each peer is assigned a replica number starting from 1 3925 and sent in the Store message. This field is set to 0 when a node 3926 is storing its own data. This allows peers to distinguish replica 3927 writes from original writes. 3929 kind_data 3930 A series of elements, one for each kind of data to be stored. 3932 If the replica number is zero, then the peer MUST check that it is 3933 responsible for the resource and, if not, reject the request. If the 3934 replica number is nonzero, then the peer MUST check that it expects 3935 to be a replica for the resource and that the request sender is 3936 consistent with being the responsible node (i.e., that the receiving 3937 peer does not know of a better node) and, if not, reject the request. 3939 Each StoreKindData element represents the data to be stored for a 3940 single Kind-ID. The contents of the element are: 3942 kind 3943 The Kind-ID. Implementations MUST reject requests corresponding 3944 to unknown kinds. 3946 generation_counter 3947 The expected current state of the generation counter 3948 (approximately the number of times this object has been written; 3949 see below for details). 3951 values 3952 The value or values to be stored. This may contain one or more 3953 stored_data values depending on the data model associated with 3954 each kind. 3956 The peer MUST perform the following checks: 3958 o The Kind-ID is known and supported. 3959 o The signatures over each individual data element (if any) are 3960 valid. If this check fails, the request MUST be rejected with an 3961 Error_Forbidden error. 3962 o Each element is signed by a credential which is authorized to 3963 write this kind at this Resource-ID. If this check fails, the 3964 request MUST be rejected with an Error_Forbidden error. 3966 o For original (non-replica) stores, the StoreReq is signed by a 3967 credential which is authorized to write this kind at this 3968 Resource-Id. If this check fails, the request MUST be rejected 3969 with an Error_Forbidden error. 3970 o For replica stores, the StoreReq is signed by a Node-Id which is a 3971 plausible node to either have originally stored the value or in 3972 the replica set. What this means is overlay specific, but in the 3973 case of the Chord based DHT defined in this specification, replica 3974 StoreReqs MUST come from nodes which are either in the known 3975 replica set for a given resource or which are closer than some 3976 node in the replica set. If this check fails, the request MUST be 3977 rejected with an Error_Forbidden error. 3978 o For original (non-replica) stores, the peer MUST check that if the 3979 generation counter is non-zero, it equals the current value of the 3980 generation counter for this kind. This feature allows the 3981 generation counter to be used in a way similar to the HTTP Etag 3982 feature. 3983 o For replica Stores, the peer MUST set the generation counter to 3984 match the generation counter in the message, and MUST NOT check 3985 the generation counter against the current value. Replica Stores 3986 MUST NOT use a generation counter of 0. 3987 o The storage time values are greater than that of any value which 3988 would be replaced by this Store. 3989 o The size and number of the stored values is consistent with the 3990 limits specified in the overlay configuration. 3991 o If the data is signed with identity_type set to "none" and/or 3992 SignatureAndHashAlgorithm values set to {0, 0} ("anonymous" and 3993 "none"), the StoreReq MUST be rejected with an Error_forbidden 3994 error. Only synthesized data returned by the storage can use 3995 these values 3997 If all these checks succeed, the peer MUST attempt to store the data 3998 values. For non-replica stores, if the store succeeds and the data 3999 is changed, then the peer must increase the generation counter by at 4000 least one. If there are multiple stored values in a single 4001 StoreKindData, it is permissible for the peer to increase the 4002 generation counter by only 1 for the entire Kind-ID, or by 1 or more 4003 than one for each value. Accordingly, all stored data values must 4004 have a generation counter of 1 or greater. 0 is used in the Store 4005 request to indicate that the generation counter should be ignored for 4006 processing this request; however the responsible peer should increase 4007 the stored generation counter and should return the correct 4008 generation counter in the response. 4010 When a peer stores data previously stored by another node (e.g., for 4011 replicas or topology shifts) it MUST adjust the lifetime value 4012 downward to reflect the amount of time the value was stored at the 4013 peer. The adjustment SHOULD be implemented by an algorithm 4014 equivalent to the following: at the time the peer initially receives 4015 the StoreReq it notes the local time T. When it then attempts to do a 4016 StoreReq to another node it should decrement the lifetime value by 4017 the difference between the current local time and T. 4019 Unless otherwise specified by the usage, if a peer attempts to store 4020 data previously stored by another node (e.g., for replicas or 4021 topology shifts) and that store fails with either an 4022 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 4023 peer MUST fetch the newer data from the peer generating the error and 4024 use that to replace its own copy. This rule allows resynchronization 4025 after partitions heal. 4027 The properties of stores for each data model are as follows: 4029 Single-value: 4030 A store of a new single-value element creates the element if it 4031 does not exist and overwrites any existing value with the new 4032 value. 4034 Array: 4035 A store of an array entry replaces (or inserts) the given value at 4036 the location specified by the index. Because arrays are sparse, a 4037 store past the end of the array extends it with nonexistent values 4038 (exists=False) as required. A store at index 0xffffffff places 4039 the new value at the end of the array regardless of the length of 4040 the array. The resulting StoredData has the correct index value 4041 when it is subsequently fetched. 4043 Dictionary: 4044 A store of a dictionary entry replaces (or inserts) the given 4045 value at the location specified by the dictionary key. 4047 The following figure shows the relationship between these structures 4048 for an example store which stores the following values at resource 4049 "1234" 4051 o The value "abc" in the single value location for kind X 4052 o The value "foo" at index 0 in the array for kind Y 4053 o The value "bar" at index 1 in the array for kind Y 4054 Store 4055 resource=1234 4056 replica_number = 0 4057 / \ 4058 / \ 4059 StoreKindData StoreKindData 4060 kind=X (Single-Value) kind=Y (Array) 4061 generation_counter = 99 generation_counter = 107 4062 | /\ 4063 | / \ 4064 StoredData / \ 4065 storage_time = xxxxxxx / \ 4066 lifetime = 86400 / \ 4067 signature = XXXX / \ 4068 | | | 4069 | StoredData StoredData 4070 | storage_time = storage_time = 4071 | yyyyyyyy zzzzzzz 4072 | lifetime = 86400 lifetime = 33200 4073 | signature = YYYY signature = ZZZZ 4074 | | | 4075 StoredDataValue | | 4076 value="abc" | | 4077 | | 4078 StoredDataValue StoredDataValue 4079 index=0 index=1 4080 value="foo" value="bar" 4082 6.4.1.2. Response Definition 4084 In response to a successful Store request the peer MUST return a 4085 StoreAns message containing a series of StoreKindResponse elements 4086 containing the current value of the generation counter for each 4087 Kind-ID, as well as a list of the peers where the data will be 4088 replicated by the node processing the request. 4090 struct { 4091 KindId kind; 4092 uint64 generation_counter; 4093 NodeId replicas<0..2^16-1>; 4094 } StoreKindResponse; 4096 struct { 4097 StoreKindResponse kind_responses<0..2^16-1>; 4098 } StoreAns; 4100 The contents of each StoreKindResponse are: 4102 kind 4103 The Kind-ID being represented. 4105 generation_counter 4106 The current value of the generation counter for that Kind-ID. 4108 replicas 4109 The list of other peers at which the data was/will be replicated. 4110 In overlays and applications where the responsible peer is 4111 intended to store redundant copies, this allows the storing peer 4112 to independently verify that the replicas have in fact been 4113 stored. It does this verification by using the Stat method (see 4114 Section 6.4.3). Note that the storing peer is not required to 4115 perform this verification. 4117 The response itself is just StoreKindResponse values packed end-to- 4118 end. 4120 If any of the generation counters in the request precede the 4121 corresponding stored generation counter, then the peer MUST fail the 4122 entire request and respond with an Error_Generation_Counter_Too_Low 4123 error. The error_info in the ErrorResponse MUST be a StoreAns 4124 response containing the correct generation counter for each kind and 4125 the replica list, which will be empty. For original (non-replica) 4126 stores, a node which receives such an error SHOULD attempt to fetch 4127 the data and, if the storage_time value is newer, replace its own 4128 data with that newer data. This rule improves data consistency in 4129 the case of partitions and merges. 4131 If the data being stored is too large for the allowed limit by the 4132 given usage, then the peer MUST fail the request and generate an 4133 Error_Data_Too_Large error. 4135 If any type of request tries to access a data kind that the node does 4136 not know about, an Error_Unknown_Kind MUST be generated. The 4137 error_info in the Error_Response is: 4139 KindId unknown_kinds<0..2^8-1>; 4141 which lists all the kinds that were unrecognized. A node which 4142 receives this error MUST generate a ConfigUpdate message which 4143 contains the appropriate kind definition (assuming that in fact a 4144 kind was used which was defined in the configuration document). 4146 6.4.1.3. Removing Values 4148 This version of RELOAD (unlike previous versions) does not have an 4149 explicit Remove operation. Rather, values are Removed by storing 4150 "nonexistent" values in their place. Each DataValue contains a 4151 boolean value called "exists" which indicates whether a value is 4152 present at that location. In order to effectively remove a value, 4153 the owner stores a new DataValue with "exists" set to "false": 4155 exists = false 4156 value = {} (0 length) 4158 The owner SHOULD use a lifetime for the nonexistent value at least as 4159 long as the remainder of the lifetime of the value it is replacing; 4160 otherwise it is possible for the original value to be accidentally or 4161 maliciously re-stored after the storing node has expired it. Note 4162 that there is still a window of vulnerability for replay attack after 4163 the original lifetime has expired (as with any store). This attack 4164 can be mitigated by doing a nonexistent store with a very long 4165 lifetime. 4167 Storing nodes MUST treat these nonexistent values the same way they 4168 treat any other stored value, including overwriting the existing 4169 value, replicating them, and aging them out as necessary when 4170 lifetime expires. When a stored nonexistent value's lifetime 4171 expires, it is simply removed from the storing node like any other 4172 stored value expiration. 4174 Note that in the case of arrays and dictionaries, expiration may 4175 create an implicit, unsigned "nonexistent" value to represent a gap 4176 in the data structure, as might happen when any value is aged out. 4177 However, this value isn't persistent nor is it replicated. It is 4178 simply synthesized by the storing node. 4180 6.4.2. Fetch 4182 The Fetch request retrieves one or more data elements stored at a 4183 given Resource-ID. A single Fetch request can retrieve multiple 4184 different kinds. 4186 6.4.2.1. Request Definition 4188 struct { 4189 int32 first; 4190 int32 last; 4191 } ArrayRange; 4193 struct { 4194 KindId kind; 4195 uint64 generation; 4196 uint16 length; 4198 select (dataModel) { 4199 case single_value: ; /* Empty */ 4201 case array: 4202 ArrayRange indices<0..2^16-1>; 4204 case dictionary: 4205 DictionaryKey keys<0..2^16-1>; 4207 /* This structure may be extended */ 4209 } model_specifier; 4210 } StoredDataSpecifier; 4212 struct { 4213 ResourceId resource; 4214 StoredDataSpecifier specifiers<0..2^16-1>; 4215 } FetchReq; 4217 The contents of the Fetch requests are as follows: 4219 resource 4220 The Resource-ID to fetch from. 4222 specifiers 4223 A sequence of StoredDataSpecifier values, each specifying some of 4224 the data values to retrieve. 4226 Each StoredDataSpecifier specifies a single kind of data to retrieve 4227 and (if appropriate) the subset of values that are to be retrieved. 4228 The contents of the StoredDataSpecifier structure are as follows: 4230 kind 4231 The Kind-ID of the data being fetched. Implementations SHOULD 4232 reject requests corresponding to unknown kinds unless specifically 4233 configured otherwise. 4235 dataModel 4236 The data model of the data. This is not transmitted on the wire 4237 but comes from the definition of the kind. 4239 generation 4240 The last generation counter that the requesting node saw. This 4241 may be used to avoid unnecessary fetches or it may be set to zero. 4243 length 4244 The length of the rest of the structure, thus allowing 4245 extensibility. 4247 model_specifier 4248 A reference to the data value being requested within the data 4249 model specified for the kind. For instance, if the data model is 4250 "array", it might specify some subset of the values. 4252 The model_specifier is as follows: 4254 o If the data model is single value, the specifier is empty. 4255 o If the data model is array, the specifier contains a list of 4256 ArrayRange elements, each of which contains two integers. The 4257 first integer is the beginning of the range and the second is the 4258 end of the range. 0 is used to indicate the first element and 4259 0xffffffff is used to indicate the final element. The first 4260 integer must be less than the second. While multiple ranges MAY 4261 be specified, they MUST NOT overlap. 4262 o If the data model is dictionary then the specifier contains a list 4263 of the dictionary keys being requested. If no keys are specified, 4264 than this is a wildcard fetch and all key-value pairs are 4265 returned. 4267 The generation counter is used to indicate the requester's expected 4268 state of the storing peer. If the generation counter in the request 4269 matches the stored counter, then the storing peer returns a response 4270 with no StoredData values. 4272 Note that because the certificate for a user is typically stored at 4273 the same location as any data stored for that user, a requesting node 4274 that does not already have the user's certificate should request the 4275 certificate in the Fetch as an optimization. 4277 6.4.2.2. Response Definition 4279 The response to a successful Fetch request is a FetchAns message 4280 containing the data requested by the requester. 4282 struct { 4283 KindId kind; 4284 uint64 generation; 4285 StoredData values<0..2^32-1>; 4286 } FetchKindResponse; 4288 struct { 4289 FetchKindResponse kind_responses<0..2^32-1>; 4290 } FetchAns; 4292 The FetchAns structure contains a series of FetchKindResponse 4293 structures. There MUST be one FetchKindResponse element for each 4294 Kind-ID in the request. 4296 The contents of the FetchKindResponse structure are as follows: 4298 kind 4299 the kind that this structure is for. 4301 generation 4302 the generation counter for this kind. 4304 values 4305 the relevant values. If the generation counter in the request 4306 matches the generation counter in the stored data, then no 4307 StoredData values are returned. Otherwise, all relevant data 4308 values MUST be returned. A nonexistent value (i.e., one which the 4309 node has no knowledge of) is represented by a synthetic value with 4310 "exists" set to False and has an empty signature. Specifically, 4311 the identity_type is set to "none", the SignatureAndHashAlgorithm 4312 values are set to {0, 0} ("anonymous" and "none" respectively), 4313 and the signature value is of zero length. This removes the need 4314 for the responding node to do signatures for values which do not 4315 exist. These signatures are unnecessary as the entire response is 4316 signed by that node. Note that entries which have been removed by 4317 the procedure of Section 6.4.1.3 and have not yet expired also 4318 have exists = false but have valid signatures from the node which 4319 did the store. 4321 There is one subtle point about signature computation on arrays. If 4322 the storing node uses the append feature (where the 4323 index=0xffffffff), then the index in the StoredData that is returned 4324 will not match that used by the storing node, which would break the 4325 signature. In order to avoid this issue, the index value in the 4326 array is set to zero before the signature is computed. This implies 4327 that malicious storing nodes can reorder array entries without being 4328 detected. 4330 6.4.3. Stat 4332 The Stat request is used to get metadata (length, generation counter, 4333 digest, etc.) for a stored element without retrieving the element 4334 itself. The name is from the UNIX stat(2) system call which performs 4335 a similar function for files in a file system. It also allows the 4336 requesting node to get a list of matching elements without requesting 4337 the entire element. 4339 6.4.3.1. Request Definition 4341 The Stat request is identical to the Fetch request. It simply 4342 specifies the elements to get metadata about. 4344 struct { 4345 ResourceId resource; 4346 StoredDataSpecifier specifiers<0..2^16-1>; 4347 } StatReq; 4349 6.4.3.2. Response Definition 4351 The Stat response contains the same sort of entries that a Fetch 4352 response would contain; however, instead of containing the element 4353 data it contains metadata. 4355 struct { 4356 Boolean exists; 4357 uint32 value_length; 4358 HashAlgorithm hash_algorithm; 4359 opaque hash_value<0..255>; 4360 } MetaData; 4362 struct { 4363 uint32 index; 4364 MetaData value; 4365 } ArrayEntryMeta; 4367 struct { 4368 DictionaryKey key; 4369 MetaData value; 4370 } DictionaryEntryMeta; 4372 struct { 4373 select (model) { 4374 case single_value: 4375 MetaData single_value_entry; 4377 case array: 4378 ArrayEntryMeta array_entry; 4380 case dictionary: 4381 DictionaryEntryMeta dictionary_entry; 4383 /* This structure may be extended */ 4384 }; 4385 } MetaDataValue; 4387 struct { 4388 uint32 value_length; 4389 uint64 storage_time; 4390 uint32 lifetime; 4391 MetaDataValue metadata; 4392 } StoredMetaData; 4394 struct { 4395 KindId kind; 4396 uint64 generation; 4397 StoredMetaData values<0..2^32-1>; 4398 } StatKindResponse; 4400 struct { 4401 StatKindResponse kind_responses<0..2^32-1>; 4402 } StatAns; 4404 The structures used in StatAns parallel those used in FetchAns: a 4405 response consists of multiple StatKindResponse values, one for each 4406 kind that was in the request. The contents of the StatKindResponse 4407 are the same as those in the FetchKindResponse, except that the 4408 values list contains StoredMetaData entries instead of StoredData 4409 entries. 4411 The contents of the StoredMetaData structure are the same as the 4412 corresponding fields in StoredData except that there is no signature 4413 field and the value is a MetaDataValue rather than a StoredDataValue. 4415 A MetaDataValue is a variant structure, like a StoredDataValue, 4416 except for the types of each arm, which replace DataValue with 4417 MetaData. 4419 The only really new structure is MetaData, which has the following 4420 contents: 4422 exists 4423 Same as in DataValue 4425 value_length 4426 The length of the stored value. 4428 hash_algorithm 4429 The hash algorithm used to perform the digest of the value. 4431 hash_value 4432 A digest of the value using hash_algorithm. 4434 6.4.4. Find 4436 The Find request can be used to explore the Overlay Instance. A Find 4437 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4438 (if any) of the resource of kind T known to the target peer which is 4439 closest to R. This method can be used to walk the Overlay Instance by 4440 iteratively fetching R_n+1=nearest(1 + R_n). 4442 6.4.4.1. Request Definition 4444 The FindReq message contains a Resource-ID and a series of Kind-IDs 4445 identifying the resource the peer is interested in. 4447 struct { 4448 ResourceId resource; 4449 KindId kinds<0..2^8-1>; 4450 } FindReq; 4452 The request contains a list of Kind-IDs which the Find is for, as 4453 indicated below: 4455 resource 4456 The desired Resource-ID 4458 kinds 4459 The desired Kind-IDs. Each value MUST only appear once, and if 4460 not the request MUST be rejected with an error. 4462 6.4.4.2. Response Definition 4464 A response to a successful Find request is a FindAns message 4465 containing the closest Resource-ID on the peer for each kind 4466 specified in the request. 4468 struct { 4469 KindId kind; 4470 ResourceId closest; 4471 } FindKindData; 4473 struct { 4474 FindKindData results<0..2^16-1>; 4475 } FindAns; 4477 If the processing peer is not responsible for the specified 4478 Resource-ID, it SHOULD return an Error_Not_Found error code. 4480 For each Kind-ID in the request the response MUST contain a 4481 FindKindData indicating the closest Resource-ID for that Kind-ID, 4482 unless the kind is not allowed to be used with Find in which case a 4483 FindKindData for that Kind-ID MUST NOT be included in the response. 4484 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4485 0. Note that different Kind-IDs may have different closest Resource- 4486 IDs. 4488 The response is simply a series of FindKindData elements, one per 4489 kind, concatenated end-to-end. The contents of each element are: 4491 kind 4492 The Kind-ID. 4494 closest 4495 The closest resource ID to the specified resource ID. This is 0 4496 if no resource ID is known. 4498 Note that the response does not contain the contents of the data 4499 stored at these Resource-IDs. If the requester wants this, it must 4500 retrieve it using Fetch. 4502 6.4.5. Defining New Kinds 4504 There are two ways to define a new kind. The first is by writing a 4505 document and registering the kind-id with IANA. This is the 4506 preferred method for kinds which may be widely used and reused. The 4507 second method is to simply define the kind and its parameters in the 4508 configuration document using the section of kind-id space set aside 4509 for private use. This method MAY be used to define ad hoc kinds in 4510 new overlays. 4512 However a kind is defined, the definition must include: 4514 o The meaning of the data to be stored (in some textual form). 4515 o The Kind-ID. 4516 o The data model (single value, array, dictionary, etc). 4517 o The access control model. 4519 In addition, when kinds are registered with IANA, each kind is 4520 assigned a short string name which is used to refer to it in 4521 configuration documents. 4523 While each kind needs to define what data model is used for its data, 4524 that does not mean that it must define new data models. Where 4525 practical, kinds should use the existing data models. The intention 4526 is that the basic data model set be sufficient for most applications/ 4527 usages. 4529 7. Certificate Store Usage 4531 The Certificate Store usage allows a peer to store its certificate in 4532 the overlay, thus avoiding the need to send a certificate in each 4533 message - a reference may be sent instead. 4535 A user/peer MUST store its certificate at Resource-IDs derived from 4536 two Resource Names: 4538 o The user name in the certificate. 4540 o The Node-ID in the certificate. 4542 Note that in the second case the certificate is not stored at the 4543 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4544 intention here (as is common throughout RELOAD) is to avoid making a 4545 peer responsible for its own data. 4547 A peer MUST ensure that the user's certificates are stored in the 4548 Overlay Instance. New certificates are stored at the end of the 4549 list. This structure allows users to store an old and a new 4550 certificate that both have the same Node-ID, which allows for 4551 migration of certificates when they are renewed. 4553 This usage defines the following kinds: 4555 Name: CERTIFICATE_BY_NODE 4557 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4559 Access Control: NODE-MATCH. 4561 Name: CERTIFICATE_BY_USER 4563 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4565 Access Control: USER-MATCH. 4567 8. TURN Server Usage 4569 The TURN server usage allows a RELOAD peer to advertise that it is 4570 prepared to be a TURN server as defined in [RFC5766]. When a node 4571 starts up, it joins the overlay network and forms several connections 4572 in the process. If the ICE stage in any of these connections returns 4573 a reflexive address that is not the same as the peer's perceived 4574 address, then the peer is behind a NAT and not a candidate for a TURN 4575 server. Additionally, if the peer's IP address is in the private 4576 address space range, then it is also not a candidate for a TURN 4577 server. Otherwise, the peer SHOULD assume it is a potential TURN 4578 server and follow the procedures below. 4580 If the node is a candidate for a TURN server it will insert some 4581 pointers in the overlay so that other peers can find it. The overlay 4582 configuration file specifies a turn-density parameter that indicates 4583 how many times each TURN server should record itself in the overlay. 4584 Typically this should be set to the reciprocal of the estimate of 4585 what percentage of peers will act as TURN servers. If the turn- 4586 density is not set to zero, for each value, called d, between 1 and 4587 turn-density, the peer forms a Resource Name by concatenating its 4588 Node-ID and the value d. This Resource Name is hashed to form a 4589 Resource-ID. The address of the peer is stored at that Resource-ID 4590 using type TURN-SERVICE and the TurnServer object: 4592 struct { 4593 uint8 iteration; 4594 IpAddressAndPort server_address; 4595 } TurnServer; 4597 The contents of this structure are as follows: 4599 iteration 4600 the d value 4602 server_address 4603 the address at which the TURN server can be contacted. 4605 Note: Correct functioning of this algorithm depends on having turn- 4606 density be an reasonable estimate of the reciprocal of the 4607 proportion of nodes in the overlay that can act as TURN servers. 4608 If the turn-density value in the configuration file is too low, 4609 then the process of finding TURN servers becomes more expensive as 4610 multiple candidate Resource-IDs must be probed to find a TURN 4611 server. 4613 Peers that provide this service need to support the TURN extensions 4614 to STUN for media relay as defined in [RFC5766]. 4616 This usage defines the following kind to indicate that a peer is 4617 willing to act as a TURN server: 4619 Name TURN-SERVICE 4620 Data Model The TURN-SERVICE kind stores a single value for each 4621 Resource-ID. 4622 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4624 Peers can find other servers by selecting a random Resource-ID and 4625 then doing a Find request for the appropriate Kind-ID with that 4626 Resource-ID. The Find request gets routed to a random peer based on 4627 the Resource-ID. If that peer knows of any servers, they will be 4628 returned. The returned response may be empty if the peer does not 4629 know of any servers, in which case the process gets repeated with 4630 some other random Resource-ID. As long as the ratio of servers 4631 relative to peers is not too low, this approach will result in 4632 finding a server relatively quickly. 4634 NOTE TO IMPLEMENTERS: As the access control for this usage is not 4635 CERTIFICATE_BY_NODE or CERTIFICATE_BY_USER, the certificates used by 4636 TurnServer entries need to be retained as described in Section 5.3.4. 4638 9. Chord Algorithm 4640 This algorithm is assigned the name chord-reload to indicate it is an 4641 adaptation of the basic Chord based DHT algorithm. 4643 This algorithm differs from the originally presented Chord algorithm 4644 [Chord]. It has been updated based on more recent research results 4645 and implementation experiences, and to adapt it to the RELOAD 4646 protocol. A short list of differences: 4648 o The original Chord algorithm specified that a single predecessor 4649 and a successor list be stored. The chord-reload algorithm 4650 attempts to have more than one predecessor and successor. The 4651 predecessor sets help other neighbors learn their successor list. 4652 o The original Chord specification and analysis called for iterative 4653 routing. RELOAD specifies recursive routing. In addition to the 4654 performance implications, the cost of NAT traversal dictates 4655 recursive routing. 4656 o Finger table entries are indexed in opposite order. Original 4657 Chord specifies finger[0] as the immediate successor of the peer. 4658 chord-reload specifies finger[0] as the peer 180 degrees around 4659 the ring from the peer. This change was made to simplify 4660 discussion and implementation of variable sized finger tables. 4661 However, with either approach no more than O(log N) entries should 4662 typically be stored in a finger table. 4663 o The stabilize() and fix_fingers() algorithms in the original Chord 4664 algorithm are merged into a single periodic process. 4665 Stabilization is implemented slightly differently because of the 4666 larger neighborhood, and fix_fingers is not as aggressive to 4667 reduce load, nor does it search for optimal matches of the finger 4668 table entries. 4669 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4670 not designed to be used in networks with close to or more than 4671 2^128 nodes (and it is hard to see how one would assemble such a 4672 network). 4673 o RELOAD uses randomized finger entries as described in 4674 Section 9.7.4.2. 4675 o This algorithm allows the use of either reactive or periodic 4676 recovery. The original Chord paper used periodic recovery. 4677 Reactive recovery provides better performance in small overlays, 4678 but is believed to be unstable in large (>1000) overlays with high 4679 levels of churn [handling-churn-usenix04]. The overlay 4680 configuration file specifies a "chord-reactive" element that 4681 indicates whether reactive recovery should be used. 4683 9.1. Overview 4685 The algorithm described here is a modified version of the Chord 4686 algorithm. Each peer keeps track of a finger table and a neighbor 4687 table. The neighbor table contains at least the three peers before 4688 and after this peer in the DHT ring. There may not be three entries 4689 in all cases such as small rings or while the ring topology is 4690 changing. The first entry in the finger table contains the peer 4691 half-way around the ring from this peer; the second entry contains 4692 the peer that is 1/4 of the way around; the third entry contains the 4693 peer that is 1/8th of the way around, and so on. Fundamentally, the 4694 chord data structure can be thought of a doubly-linked list formed by 4695 knowing the successors and predecessor peers in the neighbor table, 4696 sorted by the Node-ID. As long as the successor peers are correct, 4697 the DHT will return the correct result. The pointers to the prior 4698 peers are kept to enable the insertion of new peers into the list 4699 structure. Keeping multiple predecessor and successor pointers makes 4700 it possible to maintain the integrity of the data structure even when 4701 consecutive peers simultaneously fail. The finger table forms a skip 4702 list, so that entries in the linked list can be found in O(log(N)) 4703 time instead of the typical O(N) time that a linked list would 4704 provide. 4706 A peer, n, is responsible for a particular Resource-ID k if k is less 4707 than or equal to n and k is greater than p, where p is the Node-ID of 4708 the previous peer in the neighbor table. Care must be taken when 4709 computing to note that all math is modulo 2^128. 4711 9.2. Hash Function 4713 For this Chord based topology plugin, the size of the Resource-ID is 4714 128 bits. The hash of a Resource-ID is computed using SHA-1 4715 [RFC3174]then truncating the SHA-1 result to the most significant 128 4716 bits. 4718 9.3. Routing 4720 The routing table is the union of the neighbor table and the finger 4721 table. 4723 If a peer is not responsible for a Resource-ID k, but is directly 4724 connected to a node with Node-ID k, then it routes the message to 4725 that node. Otherwise, it routes the request to the peer in the 4726 routing table that has the largest Node-ID that is in the interval 4727 between the peer and k. If no such node is found, it finds the 4728 smallest Node-Id that is greater than k and routes the message to 4729 that node. 4731 9.4. Redundancy 4733 When a peer receives a Store request for Resource-ID k, and it is 4734 responsible for Resource-ID k, it stores the data and returns a 4735 success response. It then sends a Store request to its successor in 4736 the neighbor table and to that peer's successor. Note that these 4737 Store requests are addressed to those specific peers, even though the 4738 Resource-ID they are being asked to store is outside the range that 4739 they are responsible for. The peers receiving these check they came 4740 from an appropriate predecessor in their neighbor table and that they 4741 are in a range that this predecessor is responsible for, and then 4742 they store the data. They do not themselves perform further Stores 4743 because they can determine that they are not responsible for the 4744 Resource-ID. 4746 Managing replicas as the overlay changes is described in 4747 Section 9.7.3. 4749 The sequential replicas used in this overlay algorithm protect 4750 against peer failure but not against malicious peers. Additional 4751 replication from the Usage is required to protect resources from such 4752 attacks, as discussed in Section 12.5.4. 4754 9.5. Joining 4756 The join process for a joining party (JP) with Node-ID n is as 4757 follows. 4759 1. JP MUST connect to its chosen bootstrap node. 4760 2. JP SHOULD send an Attach request to the admitting peer (AP) for 4761 Node-ID n. The "send_update" flag should be used to acquire the 4762 routing table for AP. 4763 3. JP SHOULD send Attach requests to initiate connections to each of 4764 the peers in the neighbor table as well as to the desired finger 4765 table entries. Note that this does not populate their routing 4766 tables, but only their connection tables, so JP will not get 4767 messages that it is expected to route to other nodes. 4768 4. JP MUST enter all the peers it has contacted into its routing 4769 table. 4770 5. JP MUST send a Join to AP. The AP sends the response to the 4771 Join. 4772 6. AP MUST do a series of Store requests to JP to store the data 4773 that JP will be responsible for. 4775 7. AP MUST send JP an Update explicitly labeling JP as its 4776 predecessor. At this point, JP is part of the ring and 4777 responsible for a section of the overlay. AP can now forget any 4778 data which is assigned to JP and not AP. 4779 8. The AP MUST send an Update to all of its neighbors with the new 4780 values of its neighbor set (including JP). 4781 9. The JP MUST send Updates to all the peers in its neighbor table. 4783 If JP sends an Attach to AP with send_update, it immediately knows 4784 most of its expected neighbors from AP's routing table update and can 4785 directly connect to them. This is the RECOMMENDED procedure. 4787 If for some reason JP does not get AP's routing table, it can still 4788 populate its neighbor table incrementally. It sends a Ping directed 4789 at Resource-ID n+1 (directly after its own Resource-ID). This allows 4790 it to discover its own successor. Call that node p0. It then sends 4791 a ping to p0+1 to discover its successor (p1). This process can be 4792 repeated to discover as many successors as desired. The values for 4793 the two peers before p will be found at a later stage when n receives 4794 an Update. An alternate procedure is to send Attaches to those nodes 4795 rather than pings, which forms the connections immediately but may be 4796 slower if the nodes need to collect ICE candidates, thus reducing 4797 parallelism. 4799 In order to set up its finger table entry for peer i, JP simply sends 4800 an Attach to peer (n+2^(128-i). This will be routed to a peer in 4801 approximately the right location around the ring. 4803 The joining peer MUST NOT send any Update message placing itself in 4804 the overlay until it has successfully completed an Attach with each 4805 peer that should be in its neighbor table. 4807 9.6. Routing Attaches 4809 When a peer needs to Attach to a new peer in its neighbor table, it 4810 MUST source-route the Attach request through the peer from which it 4811 learned the new peer's Node-ID. Source-routing these requests allows 4812 the overlay to recover from instability. 4814 All other Attach requests, such as those for new finger table 4815 entries, are routed conventionally through the overlay. 4817 9.7. Updates 4819 An Update for this DHT is defined as 4820 enum { reserved (0), 4821 peer_ready(1), neighbors(2), full(3), (255) } 4822 ChordUpdateType; 4824 struct { 4825 uint32 uptime; 4826 ChordUpdateType type; 4827 select(type){ 4828 case peer_ready: /* Empty */ 4829 ; 4831 case neighbors: 4832 NodeId predecessors<0..2^16-1>; 4833 NodeId successors<0..2^16-1>; 4835 case full: 4836 NodeId predecessors<0..2^16-1>; 4837 NodeId successors<0..2^16-1>; 4838 NodeId fingers<0..2^16-1>; 4839 }; 4840 } ChordUpdate; 4842 The "uptime" field contains the time this peer has been up in 4843 seconds. 4845 The "type" field contains the type of the update, which depends on 4846 the reason the update was sent. 4848 peer_ready: this peer is ready to receive messages. This message 4849 is used to indicate that a node which has Attached is a peer and 4850 can be routed through. It is also used as a connectivity check to 4851 non-neighbor peers. 4853 neighbors: this version is sent to members of the Chord neighbor 4854 table. 4856 full: this version is sent to peers which request an Update with a 4857 RouteQueryReq. 4859 If the message is of type "neighbors", then the contents of the 4860 message will be: 4862 predecessors 4863 The predecessor set of the Updating peer. 4865 successors 4866 The successor set of the Updating peer. 4868 If the message is of type "full", then the contents of the message 4869 will be: 4871 predecessors 4872 The predecessor set of the Updating peer. 4874 successors 4875 The successor set of the Updating peer. 4877 fingers 4878 The finger table of the Updating peer, in numerically ascending 4879 order. 4881 A peer MUST maintain an association (via Attach) to every member of 4882 its neighbor set. A peer MUST attempt to maintain at least three 4883 predecessors and three successors, even though this will not be 4884 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 4885 predecessors and successors be maintained in the neighbor set. 4887 9.7.1. Handling Neighbor Failures 4889 Every time a connection to a peer in the neighbor table is lost (as 4890 determined by connectivity pings or the failure of some request), the 4891 peer MUST remove the entry from its neighbor table and replace it 4892 with the best match it has from the other peers in its routing table. 4893 If using reactive recovery, it then sends an immediate Update to all 4894 nodes in its Neighbor Table. The update will contain all the Node- 4895 IDs of the current entries of the table (after the failed one has 4896 been removed). Note that when replacing a successor the peer SHOULD 4897 delay the creation of new replicas for successor replacement hold- 4898 down time (30 seconds) after removing the failed entry from its 4899 neighbor table in order to allow a triggered update to inform it of a 4900 better match for its neighbor table. 4902 If the neighbor failure effects the peer's range of responsible IDs, 4903 then the Update MUST be sent to all nodes in its Connection Table. 4905 A peer MAY attempt to reestablish connectivity with a lost neighbor 4906 either by waiting additional time to see if connectivity returns or 4907 by actively routing a new Attach to the lost peer. Details for these 4908 procedures are beyond the scope of this document. In no event does 4909 an attempt to reestablish connectivity with a lost neighbor allow the 4910 peer to remain in the neighbor table. Such a peer is returned to the 4911 neighbor table once connectivity is reestablished. 4913 If connectivity is lost to all successor peers in the neighbor table, 4914 then this peer should behave as if it is joining the network and use 4915 Pings to find a peer and send it a Join. If connectivity is lost to 4916 all the peers in the finger table, this peer should assume that it 4917 has been disconnected from the rest of the network, and it should 4918 periodically try to join the DHT. 4920 9.7.2. Handling Finger Table Entry Failure 4922 If a finger table entry is found to have failed, all references to 4923 the failed peer are removed from the finger table and replaced with 4924 the closest preceding peer from the finger table or neighbor table. 4926 If using reactive recovery, the peer initiates a search for a new 4927 finger table entry as described below. 4929 9.7.3. Receiving Updates 4931 When a peer, N, receives an Update request, it examines the Node-IDs 4932 in the UpdateReq and at its neighbor table and decides if this 4933 UpdateReq would change its neighbor table. This is done by taking 4934 the set of peers currently in the neighbor table and comparing them 4935 to the peers in the update request. There are two major cases: 4937 o The UpdateReq contains peers that match N's neighbor table, so no 4938 change is needed to the neighbor set. 4939 o The UpdateReq contains peers N does not know about that should be 4940 in N's neighbor table, i.e. they are closer than entries in the 4941 neighbor table. 4943 In the first case, no change is needed. 4945 In the second case, N MUST attempt to Attach to the new peers and if 4946 it is successful it MUST adjust its neighbor set accordingly. Note 4947 that it can maintain the now inferior peers as neighbors, but it MUST 4948 remember the closer ones. 4950 After any Pings and Attaches are done, if the neighbor table changes 4951 and the peer is using reactive recovery, the peer sends an Update 4952 request to each member of its Connection Table. These Update 4953 requests are what end up filling in the predecessor/successor tables 4954 of peers that this peer is a neighbor to. A peer MUST NOT enter 4955 itself in its successor or predecessor table and instead should leave 4956 the entries empty. 4958 If peer N is responsible for a Resource-ID R, and N discovers that 4959 the replica set for R (the next two nodes in its successor set) has 4960 changed, it MUST send a Store for any data associated with R to any 4961 new node in the replica set. It SHOULD NOT delete data from peers 4962 which have left the replica set. 4964 When a peer N detects that it is no longer in the replica set for a 4965 resource R (i.e., there are three predecessors between N and R), it 4966 SHOULD delete all data associated with R from its local store. 4968 When a peer discovers that its range of responsible IDs have changed, 4969 it MUST send an Update to all entries in its connection table. 4971 9.7.4. Stabilization 4973 There are four components to stabilization: 4974 1. exchange Updates with all peers in its neighbor table to exchange 4975 state. 4976 2. search for better peers to place in its finger table. 4977 3. search to determine if the current finger table size is 4978 sufficiently large. 4979 4. search to determine if the overlay has partitioned and needs to 4980 recover. 4982 9.7.4.1. Updating neighbor table 4984 A peer MUST periodically send an Update request to every peer in its 4985 Connection Table. The purpose of this is to keep the predecessor and 4986 successor lists up to date and to detect failed peers. The default 4987 time is about every ten minutes, but the configuration server SHOULD 4988 set this in the configuration document using the "chord-update- 4989 interval" element (denominated in seconds.) A peer SHOULD randomly 4990 offset these Update requests so they do not occur all at once. 4992 9.7.4.2. Refreshing finger table 4994 A peer MUST periodically search for new peers to replace invalid 4995 entries in the finger table. A finger table entry i is valid if it 4996 is in the range [ n+2^( 128-i ) , n+2^( 128-(i-1) )-1 ]. Invalid 4997 entries occur in the finger table when a previous finger table entry 4998 has failed or when no peer has been found in that range. 5000 A peer SHOULD NOT send Ping requests looking for new finger table 5001 entries more often than the configuration element "chord-ping- 5002 interval", which defaults to 3600 seconds (one per hour). 5004 Two possible methods for searching for new peers for the finger table 5005 entries are presented: 5007 Alternative 1: A peer selects one entry in the finger table from 5008 among the invalid entries. It pings for a new peer for that finger 5009 table entry. The selection SHOULD be exponentially weighted to 5010 attempt to replace earlier (lower i) entries in the finger table. A 5011 simple way to implement this selection is to search through the 5012 finger table entries from i=0 and each time an invalid entry is 5013 encountered, send a Ping to replace that entry with probability 0.5. 5015 Alternative 2: A peer monitors the Update messages received from its 5016 connections to observe when an Update indicates a peer that would be 5017 used to replace in invalid finger table entry, i, and flags that 5018 entry in the finger table. Every "chord-ping-interval" seconds, the 5019 peer selects from among those flagged candidates using an 5020 exponentially weighted probability as above. 5022 When searching for a better entry, the peer SHOULD send the Ping to a 5023 Node-ID selected randomly from that range. Random selection is 5024 preferred over a search for strictly spaced entries to minimize the 5025 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 5026 implementation or subsequent specification MAY choose a method for 5027 selecting finger table entries other than choosing randomly within 5028 the range. Any such alternate methods SHOULD be employed only on 5029 finger table stabilization and not for the selection of initial 5030 finger table entries unless the alternative method is faster and 5031 imposes less overhead on the overlay. 5033 A peer MAY choose to keep connections to multiple peers that can act 5034 for a given finger table entry. 5036 9.7.4.3. Adjusting finger table size 5038 If the finger table has less than 16 entries, the node SHOULD attempt 5039 to discover more fingers to grow the size of the table to 16. The 5040 value 16 was chosen to ensure high odds of a node maintaining 5041 connectivity to the overlay even with strange network partitions. 5043 For many overlays, 16 finger table entries will be enough, but as an 5044 overlay grows very large, more than 16 entries may be required in the 5045 finger table for efficient routing. An implementation SHOULD be 5046 capable of increasing the number of entries in the finger table to 5047 128 entries. 5049 Note to implementers: Although log(N) entries are all that are 5050 required for optimal performance, careful implementation of 5051 stabilization will result in no additional traffic being generated 5052 when maintaining a finger table larger than log(N) entries. 5053 Implementers are encouraged to make use of RouteQuery and algorithms 5054 for determining where new finger table entries may be found. 5055 Complete details of possible implementations are outside the scope of 5056 this specification. 5058 A simple approach to sizing the finger table is to ensure the finger 5059 table is large enough to contain at least the final successor in the 5060 peer's neighbor table. 5062 9.7.4.4. Detecting partitioning 5064 To detect that a partitioning has occurred and to heal the overlay, a 5065 peer P MUST periodically repeat the discovery process used in the 5066 initial join for the overlay to locate an appropriate bootstrap node, 5067 B. P should then send a Ping for its own Node-ID routed through B. If 5068 a response is received from a peer S', which is not P's successor, 5069 then the overlay is partitioned and P should send an Attach to S' 5070 routed through B, followed by an Update sent to S'. (Note that S' 5071 may not be in P's neighbor table once the overlay is healed, but the 5072 connection will allow S' to discover appropriate neighbor entries for 5073 itself via its own stabilization.) 5075 Future specifications may describe alternative mechanisms for 5076 determining when to repeat the discovery process. 5078 9.8. Route query 5080 For this topology plugin, the RouteQueryReq contains no additional 5081 information. The RouteQueryAns contains the single node ID of the 5082 next peer to which the responding peer would have routed the request 5083 message in recursive routing: 5085 struct { 5086 NodeId next_peer; 5087 } ChordRouteQueryAns; 5089 The contents of this structure are as follows: 5091 next_peer 5092 The peer to which the responding peer would route the message in 5093 order to deliver it to the destination listed in the request. 5095 If the requester has set the send_update flag, the responder SHOULD 5096 initiate an Update immediately after sending the RouteQueryAns. 5098 9.9. Leaving 5100 To support extensions, such as [I-D.ietf-p2psip-self-tuning], Peers 5101 SHOULD send a Leave request to all members of their neighbor table 5102 prior to exiting the Overlay Instance. The overlay_specific_data 5103 field MUST contain the ChordLeaveData structure defined below: 5105 enum { reserved (0), 5106 from_succ(1), from_pred(2), (255) } 5107 ChordLeaveType; 5109 struct { 5110 ChordLeaveType type; 5112 select(type) { 5113 case from_succ: 5114 NodeId successors<0..2^16-1>; 5115 case from_pred: 5116 NodeId predecessors<0..2^16-1>; 5117 }; 5118 } ChordLeaveData; 5120 The 'type' field indicates whether the Leave request was sent by a 5121 predecessor or a successor of the recipient: 5123 from_succ 5124 The Leave request was sent by a successor. 5126 from_pred 5127 The Leave request was sent by a predecessor. 5129 If the type of the request is 'from_succ', the contents will be: 5131 successors 5132 The sender's successor list. 5134 If the type of the request is 'from_pred', the contents will be: 5136 predecessors 5137 The sender's predecessor list. 5139 Any peer which receives a Leave for a peer n in its neighbor set 5140 follows procedures as if it had detected a peer failure as described 5141 in Section 9.7.1. 5143 10. Enrollment and Bootstrap 5145 The section defines the format of the configuration data as well the 5146 process to join a new overlay. 5148 10.1. Overlay Configuration 5150 This specification defines a new content type "application/ 5151 p2p-overlay+xml" for an MIME entity that contains overlay 5152 information. An example document is shown below. 5154 5155 5158 5160 CHORD-RELOAD 5161 16 5162 5163 MIIDJDCCAo2gAwIBAgIBADANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJVUzET 5164 MBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxDjAMBgNVBAoT 5165 BXNpcGl0MSkwJwYDVQQLEyBTaXBpdCBUZXN0IENlcnRpZmljYXRlIEF1dGhvcml0 5166 eTAeFw0wMzA3MTgxMjIxNTJaFw0xMzA3MTUxMjIxNTJaMHAxCzAJBgNVBAYTAlVT 5167 MRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEOMAwGA1UE 5168 ChMFc2lwaXQxKTAnBgNVBAsTIFNpcGl0IFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9y 5169 aXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDIh6DkcUDLDyK9BEUxkud 5170 +nJ4xrCVGKfgjHm6XaSuHiEtnfELHM+9WymzkBNzZpJu30yzsxwfKoIKugdNUrD4 5171 N3viCicwcN35LgP/KnbN34cavXHr4ZlqxH+OdKB3hQTpQa38A7YXdaoz6goW2ft5 5172 Mi74z03GNKP/G9BoKOGd5QIDAQABo4HNMIHKMB0GA1UdDgQWBBRrRhcU6pR2JYBU 5173 bhNU2qHjVBShtjCBmgYDVR0jBIGSMIGPgBRrRhcU6pR2JYBUbhNU2qHjVBShtqF0 5174 pHIwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcT 5175 CFNhbiBKb3NlMQ4wDAYDVQQKEwVzaXBpdDEpMCcGA1UECxMgU2lwaXQgVGVzdCBD 5176 ZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 5177 AQUFAAOBgQCWbRvv1ZGTRXxbH8/EqkdSCzSoUPrs+rQqR0xdQac9wNY/nlZbkR3O 5178 qAezG6Sfmklvf+DOg5RxQq/+Y6I03LRepc7KeVDpaplMFGnpfKsibETMipwzayNQ 5179 QgUf4cKBiF+65Ue7hZuDJa2EMv8qW4twEhGDYclpFU9YozyS1OhvUg== 5180 5181 YmFkIGNlcnQK 5182 https://example.org 5183 https://example.net 5184 false 5186 5187 5188 5189 20 5190 5191 5192 false 5193 false 5194 5195 400 5196 30 5197 true 5198 password 5199 4000 5200 30 5201 TLS 5202 47112162e84c69ba 5203 47112162e84c69ba 5204 6eba45d31a900c06 5205 6ebc45d31a900c06 5206 6ebc45d31a900ca6 5208 foo 5210 5211 urn:ietf:params:xml:ns:p2p:config-ext1 5212 5214 5215 5216 5217 SINGLE 5218 USER-MATCH 5219 1 5220 100 5221 5222 5223 VGhpcyBpcyBub3QgcmlnaHQhCg== 5224 5225 5226 5227 5228 ARRAY 5229 NODE-MULTIPLE 5230 3 5231 22 5232 4 5233 1 5234 5235 5236 5237 VGhpcyBpcyBub3QgcmlnaHQhCg== 5238 5240 5241 5242 5243 VGhpcyBpcyBub3QgcmlnaHQhCg== 5245 5246 5247 VGhpcyBpcyBub3QgcmlnaHQhCg== 5249 5251 The file MUST be a well formed XML document and it SHOULD contain an 5252 encoding declaration in the XML declaration. The file MUST use the 5253 UTF-8 character encoding. The namespace for the elements defined in 5254 this specification is urn:ietf:params:xml:ns:p2p:config-base and 5255 urn:ietf:params:xml:ns:p2p:config-chord". 5257 The file can contain multiple "configuration" elements where each one 5258 contains the configuration information for a different overlay. Each 5259 configuration element may be followed by signature elements that 5260 provides a signature over the preceding configuration element. Each 5261 configuration element has the following attributes: 5263 instance-name: name of the overlay 5264 expiration: time in the future at which this overlay configuration 5265 is no longer valid. The node SHOULD retrieve a new copy of the 5266 configuration at a randomly selected time that is before the 5267 expiration time. Note that if the certificates expire before a 5268 new configuration is retried, the node will not be able to 5269 validate the configuration file. 5270 sequence: a monotonically increasing sequence number between 0 and 5271 2^16-2 5273 Inside each overlay element, the following elements can occur: 5275 topology-plugin This element defines the overlay algorithm being 5276 used. If missing the default is "CHORD-RELOAD". 5277 node-id-length This element contains the length of a NodeId 5278 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5279 and 20 (160 bits). If this element is not present, the default of 5280 16 is used. 5281 root-cert This element contains a base-64 encoded X.509v3 5282 certificate that is a root trust anchor used to sign all 5283 certificates in this overlay. There can be more than one root- 5284 cert element. 5286 enrollment-server This element contains the URL at which the 5287 enrollment server can be reached in a "url" element. This URL 5288 MUST be of type "https:". More than one enrollment-server element 5289 may be present. 5290 self-signed-permitted This element indicates whether self-signed 5291 certificates are permitted. If it is set to "true", then self- 5292 signed certificates are allowed, in which case the enrollment- 5293 server and root-cert elements may be absent. Otherwise, it SHOULD 5294 be absent, but MAY be set to "false". This element also contains 5295 an attribute "digest" which indicates the digest to be used to 5296 compute the Node-ID. Valid values for this parameter are "sha1" 5297 and "sha256" representing SHA-1 [RFC3174] and SHA-256 [RFC6234] 5298 respectively. Implementations MUST support both of these 5299 algorithms. 5300 bootstrap-node This element represents the address of one of the 5301 bootstrap nodes. It has an attribute called "address" that 5302 represents the IP address (either IPv4 or IPv6, since they can be 5303 distinguished) and an optional attribute called "port" that 5304 represents the port and defaults to 6084. The IP address is in 5305 typical hexadecimal form using standard period and colon 5306 separators as specified in [RFC5952]. More than one bootstrap- 5307 peer element may be present. 5308 turn-density This element is a positive integer that represents the 5309 approximate reciprocal of density of nodes that can act as TURN 5310 servers. For example, if 5% of the nodes can act as TURN servers, 5311 this would be set to 20. If it is not present, the default value 5312 is 1. If there are no TURN servers in the overlay, it is set to 5313 zero. 5314 multicast-bootstrap This element represents the address of a 5315 multicast, broadcast, or anycast address and port that may be used 5316 for bootstrap. Nodes SHOULD listen on the address. It has an 5317 attributed called "address" that represents the IP address and an 5318 optional attribute called "port" that represents the port and 5319 defaults to 6084. More than one "multicast-bootstrap" element may 5320 be present. 5321 clients-permitted This element represents whether clients are 5322 permitted or whether all nodes must be peers. If it is set to 5323 "true" or absent, this indicates that clients are permitted. If 5324 it is set to "false" then nodes are not allowed to remain clients 5325 after the initial join. There is currently no way for the overlay 5326 to enforce this. 5327 no-ice This element represents whether nodes are required to use 5328 the "No-ICE" Overlay Link protocols in this overlay. If it is 5329 absent, it is treated as if it were set to "false". 5331 chord-update-interval The update frequency for the Chord-reload 5332 topology plugin (see Section 9). 5333 chord-ping-interval The ping frequency for the Chord-reload 5334 topology plugin (see Section 9). 5335 chord-reactive Whether reactive recovery should be used for this 5336 overlay. Set to "true" or "false". Default if missing is "true". 5337 (see Section 9). 5338 shared-secret If shared secret mode is used, this contains the 5339 shared secret. 5340 max-message-size Maximum size in bytes of any message in the 5341 overlay. If this value is not present, the default is 5000. 5342 initial-ttl Initial default TTL (time to live, see Section 5.3.2) 5343 for messages. If this value is not present, the default is 100. 5344 overlay-link-protocol Indicates a permissible overlay link protocol 5345 (see Section 5.6.1 for requirements for such protocols). An 5346 arbitrary number of these elements may appear. If none appear, 5347 then this implies the default value, "TLS", which refers to the 5348 use of TLS and DTLS. If one or more elements appear, then no 5349 default value applies. 5350 kind-signer This contains a single Node-ID in hexadecimal and 5351 indicates that the certificate with this Node-ID is allowed to 5352 sign kinds. Identifying kind-signer by Node-ID instead of 5353 certificate allows the use of short lived certificates without 5354 constantly having to provide an updated configuration file. 5355 configuration-signer This contains a single Node-ID in hexadecimal 5356 and indicates that the certificate with this Node-ID is allowed to 5357 sign configurations for this instance-name. Identifying the 5358 signer by Node-ID instead of certificate allows the use of short 5359 lived certificates without constantly having to provide an updated 5360 configuration file. 5361 bad-node This contains a single Node-ID in hexadecimal and 5362 indicates that the certificate with this Node-ID MUST NOT be 5363 considered valid. This allows certificate revocation. An 5364 arbitrary number of these elements can be provided. Note that 5365 because certificates may expire, bad-node entries need only be 5366 present for the lifetime of the certificate. Technically 5367 speaking, bad node-ids may be reused once their certificates have 5368 expired, the requirement for node-ids to be pseudo randomly 5369 generated gives this event a vanishing probability. 5370 mandatory-extension This element contains the name of an XML 5371 namespace that a node joining the overlay MUST support. The 5372 presence of a mandatory-extension element does not require the 5373 extension to be used in the current configuration file, but can 5374 indicate that it may be used in the future. Note that the 5375 namespace is case-sensitive, as specified in [w3c-xml-namespaces] 5376 Section 2.3. More than one mandatory-extension element may be 5377 present. 5379 Inside each overlay element, the required-kinds elements can also 5380 occur. This element indicates the kinds that members must support 5381 and contains multiple kind-block elements that each define a single 5382 kind that MUST be supported by nodes in the overlay. Each kind-block 5383 consists of a single kind element and a kind-signature. The kind 5384 element defines the kind. The kind-signature is the signature 5385 computed over the kind element. 5387 Each kind has either an id attribute or a name attribute. The name 5388 attribute is a string representing the kind (the name registered to 5389 IANA) while the id is an integer kind-id allocated out of private 5390 space. 5392 In addition, the kind element contains the following elements: 5393 max-count: the maximum number of values which members of the overlay 5394 must support. 5395 data-model: the data model to be used. 5396 max-size: the maximum size of individual values. 5397 access-control: the access control model to be used. 5398 max-node-multiple: This is optional and only used when the access 5399 control is NODE-MULTIPLE. This indicates the maximum value for 5400 the i counter. This is an integer greater than 0. 5402 All of the non optional values MUST be provided. If the kind is 5403 registered with IANA, the data-model and access-control elements MUST 5404 match those in the kind registration, and clients MUST ignore them in 5405 favor of the IANA versions. Multiple required-kinds elements MAY be 5406 present. 5408 The kind-block element also MUST contain a "kind-signature" element. 5409 This signature is computed across the kind from the beginning of the 5410 first < of the kind to the end of the last > of the kind in the same 5411 way as the signature element described later in this section. 5413 The configuration file is a binary file and cannot be changed - 5414 including whitespace changes - or the signature will break. The 5415 signature is computed by taking each configuration element and 5416 starting from, and including, the first < at the start of 5417 up to and including the > in and 5418 treating this as a binary blob that is signed using the standard 5419 SecurityBlock defined in Section 5.3.4. The SecurityBlock is base 64 5420 encoded using the base64 alphabet from RFC[RFC4648] and put in the 5421 signature element following the configuration object in the 5422 configuration file. 5424 When a node receives a new configuration file, it MUST change its 5425 configuration to meet the new requirements. This may require the 5426 node to exit the DHT and re-join. If a node is not capable of 5427 supporting the new requirements, it MUST exit the overlay. If some 5428 information about a particular kind changes from what the node 5429 previously knew about the kind (for example the max size), the new 5430 information in the configuration files overrides any previously 5431 learned information. If any kind data was signed by a node that is 5432 no longer allowed to sign kinds, that kind MUST be discarded along 5433 with any stored information of that kind. Note that forcing an 5434 avalanche restart of the overlay with a configuration change that 5435 requires re-joining the overlay may result in serious performance 5436 problems, including total collapse of the network if configuration 5437 parameters are not properly considered. Such an event may be 5438 necessary in case of a compromised CA or similar problem, but for 5439 large overlays should be avoided in almost all circumstances. 5441 10.1.1. Relax NG Grammar 5443 The grammar for the configuration data is: 5445 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5446 namespace local = "" 5447 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5448 namespace rng = "http://relaxng.org/ns/structure/1.0" 5450 anything = 5451 (element * { anything } 5452 | attribute * { text } 5453 | text)* 5455 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5456 { anything }* 5457 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5458 { text }* 5459 foreign-nodes = (foreign-attributes | foreign-elements)* 5461 start = element p2pcf:overlay { 5462 overlay-element 5463 } 5465 overlay-element &= element configuration { 5466 attribute instance-name { xsd:string }, 5467 attribute expiration { xsd:dateTime }?, 5468 attribute sequence { xsd:long }?, 5469 foreign-attributes*, 5470 parameter 5471 }+ 5472 overlay-element &= element signature { 5473 attribute algorithm { signature-algorithm-type }?, 5474 xsd:base64Binary 5476 }* 5478 signature-algorithm-type |= "rsa-sha1" 5479 signature-algorithm-type |= xsd:string # signature alg extensions 5481 parameter &= element topology-plugin { topology-plugin-type }? 5482 topology-plugin-type |= xsd:string # topo plugin extensions 5483 parameter &= element max-message-size { xsd:unsignedInt }? 5484 parameter &= element initial-ttl { xsd:int }? 5485 parameter &= element root-cert { xsd:base64Binary }* 5486 parameter &= element required-kinds { kind-block* }? 5487 parameter &= element enrollment-server { xsd:anyURI }* 5488 parameter &= element kind-signer { xsd:string }* 5489 parameter &= element configuration-signer { xsd:string }* 5490 parameter &= element bad-node { xsd:string }* 5491 parameter &= element no-ice { xsd:boolean }? 5492 parameter &= element shared-secret { xsd:string }? 5493 parameter &= element overlay-link-protocol { xsd:string }* 5494 parameter &= element clients-permitted { xsd:boolean }? 5495 parameter &= element turn-density { xsd:unsignedByte }? 5496 parameter &= element node-id-length { xsd:int }? 5497 parameter &= element mandatory-extension { xsd:string }* 5498 parameter &= foreign-elements* 5500 parameter &= 5501 element self-signed-permitted { 5502 attribute digest { self-signed-digest-type }, 5503 xsd:boolean 5504 }? 5505 self-signed-digest-type |= "sha1" 5506 self-signed-digest-type |= xsd:string # signature digest extensions 5508 parameter &= element bootstrap-node { 5509 attribute address { xsd:string }, 5510 attribute port { xsd:int }? 5511 }* 5513 parameter &= element multicast-bootstrap { 5514 attribute address { xsd:string }, 5515 attribute port { xsd:int }? 5516 }* 5518 kind-block = element kind-block { 5519 element kind { 5520 ( attribute name { kind-names } 5521 | attribute id { xsd:unsignedInt } ), 5522 kind-parameter 5523 } & 5524 element kind-signature { 5525 attribute algorithm { signature-algorithm-type }?, 5526 xsd:base64Binary 5527 }? 5528 } 5530 kind-parameter &= element max-count { xsd:int } 5531 kind-parameter &= element max-size { xsd:int } 5532 kind-parameter &= element max-node-multiple { xsd:int }? 5534 kind-parameter &= element data-model { data-model-type } 5535 data-model-type |= "SINGLE" 5536 data-model-type |= "ARRAY" 5537 data-model-type |= "DICTIONARY" 5538 data-model-type |= xsd:string # data model extensions 5540 kind-parameter &= element access-control { access-control-type } 5541 access-control-type |= "USER-MATCH" 5542 access-control-type |= "NODE-MATCH" 5543 access-control-type |= "USER-NODE-MATCH" 5544 access-control-type |= "NODE-MULTIPLE" 5545 access-control-type |= xsd:string # access control extensions 5547 kind-parameter &= foreign-elements* 5549 kind-names |= "TURN-SERVICE" 5550 kind-names |= "CERTIFICATE_BY_NODE" 5551 kind-names |= "CERTIFICATE_BY_USER" 5552 kind-names |= xsd:string # kind extensions 5554 # Chord specific parameters 5555 topology-plugin-type |= "CHORD-RELOAD" 5556 parameter &= element chord:chord-ping-interval { xsd:int }? 5557 parameter &= element chord:chord-update-interval { xsd:int }? 5558 parameter &= element chord:chord-reactive { xsd:boolean }? 5560 10.2. Discovery Through Configuration Server 5562 When a node first enrolls in a new overlay, it starts with a 5563 discovery process to find a configuration server. 5565 The node MAY start by determines the overlay name. This value is 5566 provided by the user or some other out of band provisioning 5567 mechanism. The out of band mechanisms MAY also provide an optional 5568 URL for the configuration server. If a URL for the configuration 5569 server is not provided, the node MUST do a DNS SRV query using a 5570 Service name of "p2psip-enroll" and a protocol of TCP to find a 5571 configuration server and form the URL by appending a path of "/.well- 5572 known/p2psip-enroll" to the overlay name. This uses the "well known 5573 URI" framework defined in [RFC5785]. For example, if the overlay 5574 name was example.com, the URL would be 5575 "https://example.com//.well-known/p2psip-enroll". 5577 Once an address and URL for the configuration server is determined, 5578 the peer forms an HTTPS connection to that IP address. The 5579 certificate MUST match the overlay name as described in [RFC2818]. 5580 Then the node MUST fetch a new copy of the configuration file. To do 5581 this, the peer performs a GET to the URL. The result of the HTTP GET 5582 is an XML configuration file described above, which replaces any 5583 previously learned configuration file for this overlay. 5585 For overlays that do not use a configuration server, nodes obtain the 5586 configuration information needed to join the overlay through some out 5587 of band approach such an XML configuration file sent over email. 5589 10.3. Credentials 5591 If the configuration document contains a enrollment-server element, 5592 credentials are required to join the Overlay Instance. A peer which 5593 does not yet have credentials MUST contact the enrollment server to 5594 acquire them. 5596 RELOAD defines its own trivial certificate request protocol. We 5597 would have liked to have used an existing protocol but were concerned 5598 about the implementation burden of even the simplest of those 5599 protocols, such as [RFC5272] and [RFC5273]. Our objective was to 5600 have a protocol which could be easily implemented in a Web server 5601 which the operator did not control (e.g., in a hosted service) and 5602 was compatible with the existing certificate handling tooling as used 5603 with the Web certificate infrastructure. This means accepting bare 5604 PKCS#10 requests and returning a single bare X.509 certificate. 5605 Although the MIME types for these objects are defined, none of the 5606 existing protocols support exactly this model. 5608 The certificate request protocol is performed over HTTPS. The 5609 request is an HTTP POST with the following properties: 5611 o If authentication is required, there is an URL parameter of 5612 "password" and "username" containing the user's name and password 5613 in the clear (hence the need for HTTPS) 5614 o If more than one Node-ID is required, there is an URL parameter of 5615 "nodeids" containing the number of Node-IDs required. 5616 o The body is of content type "application/pkcs10", as defined in 5617 [RFC2311]. 5619 o The Accept header contains the type "application/pkix-cert", 5620 indicating the type that is expected in the response. 5622 The enrollment server MUST authenticate the request using the 5623 provided user name and password. If the authentication succeeds and 5624 the requested user name is acceptable, the server generates and 5625 returns a certificate. The SubjectAltName field in the certificate 5626 contains the following values: 5628 o One or more Node-IDs which MUST be cryptographically random 5629 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5630 way that they are unpredictable to the requesting user. E.g., the 5631 user MUST NOT be informed of potential (random) Node-IDs prior to 5632 authenticating. Each is placed in the subjectAltName using the 5633 uniformResourceIdentifier type and MUST contain RELOAD URIs as 5634 described in Section 13.15 and MUST contain a Destination list 5635 with a single entry of type "node_id". 5636 o A single name this user is allowed to use in the overlay, using 5637 type rfc822Name. 5639 The certificate is returned as type "application/pkix-cert" as 5640 defined in [RFC2585], with an HTTP status code of 200 OK. 5641 Certificate processing errors should be treated as HTTP errors and 5642 have appropriate HTTP status codes. 5644 The client MUST check that the certificate returned was signed by one 5645 of the certificates received in the "root-cert" list of the overlay 5646 configuration data. The node then reads the certificate to find the 5647 Node-IDs it can use. 5649 10.3.1. Self-Generated Credentials 5651 If the "self-signed-permitted" element is present in the 5652 configuration and set to "true", then a node MUST generate its own 5653 self-signed certificate to join the overlay. The self-signed 5654 certificate MAY contain any user name of the users choice. 5656 The Node-ID MUST be computed by applying the digest specified in the 5657 self-signed-permitted element to the DER representation of the user's 5658 public key (more specifically the subjectPublicKeyInfo) and taking 5659 the high order bits. When accepting a self-signed certificate, nodes 5660 MUST check that the Node-ID and public keys match. This prevents 5661 Node-ID theft. 5663 Once the node has constructed a self-signed certificate, it MAY join 5664 the overlay. Before storing its certificate in the overlay 5665 (Section 7) it SHOULD look to see if the user name is already taken 5666 and if so choose another user name. Note that this only provides 5667 protection against accidental name collisions. Name theft is still 5668 possible. If protection against name theft is desired, then the 5669 enrollment service must be used. 5671 10.4. Searching for a Bootstrap Node 5673 If no cached bootstrap nodes are available and the configuration file 5674 has an multicast-bootstrap element, then the node SHOULD send a Ping 5675 request over UDP to the address and port found to each multicast- 5676 bootstrap element found in the configuration document. This MAY be a 5677 multicast, broadcast, or anycast address. The Ping should use the 5678 wildcard Node-ID as the destination Node-ID. 5680 The responder node that receives the Ping request SHOULD check that 5681 the overlay name is correct and that the requester peer sending the 5682 request has appropriate credentials for the overlay before responding 5683 to the Ping request even if the response is only an error. 5685 10.5. Contacting a Bootstrap Node 5687 In order to join the overlay, the joining node MUST contact a node in 5688 the overlay. Typically this means contacting the bootstrap nodes, 5689 since they are reachable by the local peer or have public IP 5690 addresses. If the joining node has cached a list of peers it has 5691 previously been connected with in this overlay, as an optimization it 5692 MAY attempt to use one or more of them as bootstrap nodes before 5693 falling back to the bootstrap nodes listed in the configuration file. 5695 When contacting a bootstrap node, the joining node first forms the 5696 DTLS or TLS connection to the bootstrap node and then sends an Attach 5697 request over this connection with the destination Node-ID set to the 5698 joining node's Node-ID. 5700 When the requester node finally does receive a response from some 5701 responding node, it can note the Node-ID in the response and use this 5702 Node-ID to start sending requests to join the Overlay Instance as 5703 described in Section 5.4. 5705 After a node has successfully joined the overlay network, it will 5706 have direct connections to several peers. Some MAY be added to the 5707 cached bootstrap nodes list and used in future boots. Peers that are 5708 not directly connected MUST NOT be cached. The suggested number of 5709 peers to cache is 10. Algorithms for determining which peers to 5710 cache are beyond the scope of this specification. 5712 11. Message Flow Example 5714 The following abbreviation are used in the message flow diagrams: JP 5715 = joining peer, AP = admitting peer, NP = next peer after the AP, NNP 5716 = next next peer which is the peer after NP, PP = previous peer 5717 before the AP, PPP = previous previous peer which is the peer before 5718 the PP, BP = bootstrap peer. 5720 In the following example, we assume that JP has formed a connection 5721 to one of the bootstrap nodes. JP then sends an Attach through that 5722 peer to a resource ID of itself (JP). It gets routed to the 5723 admitting peer (AP) because JP is not yet part of the overlay. When 5724 AP responds, JP and AP use ICE to set up a connection and then set up 5725 TLS. Once AP has connected to JP, AP sends to JP an Update to 5726 populate its Routing Table. The following example shows the Update 5727 happening after the TLS connection is formed but it could also happen 5728 before in which case the Update would often be routed through other 5729 nodes. 5731 JP PPP PP AP NP NNP BP 5732 | | | | | | | 5733 | | | | | | | 5734 | | | | | | | 5735 |Attach Dest=JP | | | | | 5736 |---------------------------------------------------------->| 5737 | | | | | | | 5738 | | | | | | | 5739 | | |Attach Dest=JP | | | 5740 | | |<--------------------------------------| 5741 | | | | | | | 5742 | | | | | | | 5743 | | |Attach Dest=JP | | | 5744 | | |-------->| | | | 5745 | | | | | | | 5746 | | | | | | | 5747 | | |AttachAns | | | 5748 | | |<--------| | | | 5749 | | | | | | | 5750 | | | | | | | 5751 | | |AttachAns | | | 5752 | | |-------------------------------------->| 5753 | | | | | | | 5754 | | | | | | | 5755 |AttachAns | | | | | 5756 |<----------------------------------------------------------| 5757 | | | | | | | 5758 | | | | | | | 5759 |TLS | | | | | | 5760 |.............................| | | | 5761 | | | | | | | 5762 | | | | | | | 5763 | | | | | | | 5764 |Update | | | | | | 5765 |<----------------------------| | | | 5766 | | | | | | | 5767 | | | | | | | 5768 |UpdateAns| | | | | | 5769 |---------------------------->| | | | 5770 | | | | | | | 5771 | | | | | | | 5772 | | | | | | | 5774 The JP then forms connections to the appropriate neighbors, such as 5775 NP, by sending an Attach which gets routed via other nodes. When NP 5776 responds, JP and NP use ICE and TLS to set up a connection. 5778 JP PPP PP AP NP NNP BP 5779 | | | | | | | 5780 | | | | | | | 5781 | | | | | | | 5782 |Attach NP | | | | | 5783 |---------------------------->| | | | 5784 | | | | | | | 5785 | | | | | | | 5786 | | | |Attach NP| | | 5787 | | | |-------->| | | 5788 | | | | | | | 5789 | | | | | | | 5790 | | | |AttachAns| | | 5791 | | | |<--------| | | 5792 | | | | | | | 5793 | | | | | | | 5794 |AttachAns | | | | | 5795 |<----------------------------| | | | 5796 | | | | | | | 5797 | | | | | | | 5798 |Attach | | | | | | 5799 |-------------------------------------->| | | 5800 | | | | | | | 5801 | | | | | | | 5802 |TLS | | | | | | 5803 |.......................................| | | 5804 | | | | | | | 5805 | | | | | | | 5806 | | | | | | | 5807 | | | | | | | 5809 JP also needs to populate its finger table (for the Chord based DHT). 5810 It issues an Attach to a variety of locations around the overlay. 5811 The diagram below shows it sending an Attach halfway around the Chord 5812 ring to the JP + 2^127. 5814 JP NP XX TP 5815 | | | | 5816 | | | | 5817 | | | | 5818 |Attach JP+2<<126 | | 5819 |-------->| | | 5820 | | | | 5821 | | | | 5822 | |Attach JP+2<<126 | 5823 | |-------->| | 5824 | | | | 5825 | | | | 5826 | | |Attach JP+2<<126 5827 | | |-------->| 5828 | | | | 5829 | | | | 5830 | | |AttachAns| 5831 | | |<--------| 5832 | | | | 5833 | | | | 5834 | |AttachAns| | 5835 | |<--------| | 5836 | | | | 5837 | | | | 5838 |AttachAns| | | 5839 |<--------| | | 5840 | | | | 5841 | | | | 5842 |TLS | | | 5843 |.............................| 5844 | | | | 5845 | | | | 5846 | | | | 5847 | | | | 5849 Once JP has a reasonable set of connections, it is ready to take its 5850 place in the DHT. It does this by sending a Join to AP. AP does a 5851 series of Store requests to JP to store the data that JP will be 5852 responsible for. AP then sends JP an Update explicitly labeling JP 5853 as its predecessor. At this point, JP is part of the ring and 5854 responsible for a section of the overlay. AP can now forget any data 5855 which is assigned to JP and not AP. 5857 JP PPP PP AP NP NNP BP 5858 | | | | | | | 5859 | | | | | | | 5860 | | | | | | | 5861 |JoinReq | | | | | | 5862 |---------------------------->| | | | 5863 | | | | | | | 5864 | | | | | | | 5865 |JoinAns | | | | | | 5866 |<----------------------------| | | | 5867 | | | | | | | 5868 | | | | | | | 5869 |StoreReq Data A | | | | | 5870 |<----------------------------| | | | 5871 | | | | | | | 5872 | | | | | | | 5873 |StoreAns | | | | | | 5874 |---------------------------->| | | | 5875 | | | | | | | 5876 | | | | | | | 5877 |StoreReq Data B | | | | | 5878 |<----------------------------| | | | 5879 | | | | | | | 5880 | | | | | | | 5881 |StoreAns | | | | | | 5882 |---------------------------->| | | | 5883 | | | | | | | 5884 | | | | | | | 5885 |UpdateReq| | | | | | 5886 |<----------------------------| | | | 5887 | | | | | | | 5888 | | | | | | | 5889 |UpdateAns| | | | | | 5890 |---------------------------->| | | | 5891 | | | | | | | 5892 | | | | | | | 5893 | | | | | | | 5894 | | | | | | | 5896 In Chord, JP's neighbor table needs to contain its own predecessors. 5897 It couldn't connect to them previously because it did not yet know 5898 their addresses. However, now that it has received an Update from 5899 AP, it has AP's predecessors, which are also its own, so it sends 5900 Attaches to them. Below it is shown connecting to AP's closest 5901 predecessor, PP. 5903 JP PPP PP AP NP NNP BP 5904 | | | | | | | 5905 | | | | | | | 5906 | | | | | | | 5907 |Attach Dest=PP | | | | | 5908 |---------------------------->| | | | 5909 | | | | | | | 5910 | | | | | | | 5911 | | |Attach Dest=PP | | | 5912 | | |<--------| | | | 5913 | | | | | | | 5914 | | | | | | | 5915 | | |AttachAns| | | | 5916 | | |-------->| | | | 5917 | | | | | | | 5918 | | | | | | | 5919 |AttachAns| | | | | | 5920 |<----------------------------| | | | 5921 | | | | | | | 5922 | | | | | | | 5923 |TLS | | | | | | 5924 |...................| | | | | 5925 | | | | | | | 5926 | | | | | | | 5927 |UpdateReq| | | | | | 5928 |------------------>| | | | | 5929 | | | | | | | 5930 | | | | | | | 5931 |UpdateAns| | | | | | 5932 |<------------------| | | | | 5933 | | | | | | | 5934 | | | | | | | 5935 |UpdateReq| | | | | | 5936 |---------------------------->| | | | 5937 | | | | | | | 5938 | | | | | | | 5939 |UpdateAns| | | | | | 5940 |<----------------------------| | | | 5941 | | | | | | | 5942 | | | | | | | 5943 |UpdateReq| | | | | | 5944 |-------------------------------------->| | | 5945 | | | | | | | 5946 | | | | | | | 5947 |UpdateAns| | | | | | 5948 |<--------------------------------------| | | 5949 | | | | | | | 5950 | | | | | | | 5952 Finally, now that JP has a copy of all the data and is ready to route 5953 messages and receive requests, it sends Updates to everyone in its 5954 Routing Table to tell them it is ready to go. Below, it is shown 5955 sending such an update to TP. 5957 JP NP XX TP 5958 | | | | 5959 | | | | 5960 | | | | 5961 |Update | | | 5962 |---------------------------->| 5963 | | | | 5964 | | | | 5965 |UpdateAns| | | 5966 |<----------------------------| 5967 | | | | 5968 | | | | 5969 | | | | 5970 | | | | 5972 12. Security Considerations 5974 12.1. Overview 5976 RELOAD provides a generic storage service, albeit one designed to be 5977 useful for P2PSIP. In this section we discuss security issues that 5978 are likely to be relevant to any usage of RELOAD. More background 5979 information can be found in [RFC5765]. 5981 In any Overlay Instance, any given user depends on a number of peers 5982 with which they have no well-defined relationship except that they 5983 are fellow members of the Overlay Instance. In practice, these other 5984 nodes may be friendly, lazy, curious, or outright malicious. No 5985 security system can provide complete protection in an environment 5986 where most nodes are malicious. The goal of security in RELOAD is to 5987 provide strong security guarantees of some properties even in the 5988 face of a large number of malicious nodes and to allow the overlay to 5989 function correctly in the face of a modest number of malicious nodes. 5991 P2PSIP deployments require the ability to authenticate both peers and 5992 resources (users) without the active presence of a trusted entity in 5993 the system. We describe two mechanisms. The first mechanism is 5994 based on public key certificates and is suitable for general 5995 deployments. The second is an admission control mechanism based on 5996 an overlay-wide shared symmetric key. 5998 12.2. Attacks on P2P Overlays 6000 The two basic functions provided by overlay nodes are storage and 6001 routing: some node is responsible for storing a peer's data and for 6002 allowing a third peer to fetch this stored data. Other nodes are 6003 responsible for routing messages to and from the storing nodes. Each 6004 of these issues is covered in the following sections. 6006 P2P overlays are subject to attacks by subversive nodes that may 6007 attempt to disrupt routing, corrupt or remove user registrations, or 6008 eavesdrop on signaling. The certificate-based security algorithms we 6009 describe in this specification are intended to protect overlay 6010 routing and user registration information in RELOAD messages. 6012 To protect the signaling from attackers pretending to be valid peers 6013 (or peers other than themselves), the first requirement is to ensure 6014 that all messages are received from authorized members of the 6015 overlay. For this reason, RELOAD transports all messages over a 6016 secure channel (TLS and DTLS are defined in this document) which 6017 provides message integrity and authentication of the directly 6018 communicating peer. In addition, messages and data are digitally 6019 signed with the sender's private key, providing end-to-end security 6020 for communications. 6022 12.3. Certificate-based Security 6024 This specification stores users' registrations and possibly other 6025 data in an overlay network. This requires a solution to securing 6026 this data as well as securing, as well as possible, the routing in 6027 the overlay. Both types of security are based on requiring that 6028 every entity in the system (whether user or peer) authenticate 6029 cryptographically using an asymmetric key pair tied to a certificate. 6031 When a user enrolls in the Overlay Instance, they request or are 6032 assigned a unique name, such as "alice@dht.example.net". These names 6033 are unique and are meant to be chosen and used by humans much like a 6034 SIP Address of Record (AOR) or an email address. The user is also 6035 assigned one or more Node-IDs by the central enrollment authority. 6036 Both the name and the Node-ID are placed in the certificate, along 6037 with the user's public key. 6039 Each certificate enables an entity to act in two sorts of roles: 6041 o As a user, storing data at specific Resource-IDs in the Overlay 6042 Instance corresponding to the user name. 6043 o As a overlay peer with the Node-ID(s) listed in the certificate. 6045 Note that since only users of this Overlay Instance need to validate 6046 a certificate, this usage does not require a global PKI. Instead, 6047 certificates are signed by a central enrollment authority which acts 6048 as the certificate authority for the Overlay Instance. This 6049 authority signs each peer's certificate. Because each peer possesses 6050 the CA's certificate (which they receive on enrollment) they can 6051 verify the certificates of the other entities in the overlay without 6052 further communication. Because the certificates contain the user/ 6053 peer's public key, communications from the user/peer can be verified 6054 in turn. 6056 If self-signed certificates are used, then the security provided is 6057 significantly decreased, since attackers can mount Sybil attacks. In 6058 addition, attackers cannot trust the user names in certificates 6059 (though they can trust the Node-IDs because they are 6060 cryptographically verifiable). This scheme may be appropriate for 6061 some small deployments, such as a small office or an ad hoc overlay 6062 set up among participants in a meeting where all hosts on the network 6063 are trusted. Some additional security can be provided by using the 6064 shared secret admission control scheme as well. 6066 Because all stored data is signed by the owner of the data the 6067 storing peer can verify that the storer is authorized to perform a 6068 store at that Resource-ID and also allow any consumer of the data to 6069 verify the provenance and integrity of the data when it retrieves it. 6071 Note that RELOAD does not itself provide a revocation/status 6072 mechanism (though certificates may of course include OCSP responder 6073 information). Thus, certificate lifetimes should be chosen to 6074 balance the compromise window versus the cost of certificate renewal. 6075 Because RELOAD is already designed to operate in the face of some 6076 fraction of malicious peers, this form of compromise is not fatal. 6078 All implementations MUST implement certificate-based security. 6080 12.4. Shared-Secret Security 6082 RELOAD also supports a shared secret admission control scheme that 6083 relies on a single key that is shared among all members of the 6084 overlay. It is appropriate for small groups that wish to form a 6085 private network without complexity. In shared secret mode, all the 6086 peers share a single symmetric key which is used to key TLS-PSK 6087 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 6088 key cannot form TLS connections with any other peer and therefore 6089 cannot join the overlay. 6091 One natural approach to a shared-secret scheme is to use a user- 6092 entered password as the key. The difficulty with this is that in 6093 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 6095 If passwords are used as the source of shared-keys, then TLS-SRP is a 6096 superior choice because it is not subject to dictionary attacks. 6098 12.5. Storage Security 6100 When certificate-based security is used in RELOAD, any given 6101 Resource-ID/Kind-ID pair is bound to some small set of certificates. 6102 In order to write data, the writer must prove possession of the 6103 private key for one of those certificates. Moreover, all data is 6104 stored, signed with the same private key that was used to authorize 6105 the storage. This set of rules makes questions of authorization and 6106 data integrity - which have historically been thorny for overlays - 6107 relatively simple. 6109 12.5.1. Authorization 6111 When a client wants to store some value, it first digitally signs the 6112 value with its own private key. It then sends a Store request that 6113 contains both the value and the signature towards the storing peer 6114 (which is defined by the Resource Name construction algorithm for 6115 that particular kind of value). 6117 When the storing peer receives the request, it must determine whether 6118 the storing client is authorized to store at this Resource-ID/Kind-ID 6119 pair. Determining this requires comparing the user's identity to the 6120 requirements of the access control model (see Section 6.3). If it 6121 satisfies those requirements the user is authorized to write, pending 6122 quota checks as described in the next section. 6124 For example, consider the certificate with the following properties: 6126 User name: alice@dht.example.com 6127 Node-ID: 013456789abcdef 6128 Serial: 1234 6130 If Alice wishes to Store a value of the "SIP Location" kind, the 6131 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 6132 Resource-ID will be determined by hashing the Resource Name. Because 6133 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 6134 the user name in the certificate hashes to the requested Resource-ID. 6135 It then verifies that the Node-Id in the certificate matches the 6136 dictionary key being used for the store. If both of these checks 6137 succeed, the Store is authorized. Note that because the access 6138 control model is different for different kinds, the exact set of 6139 checks will vary. 6141 12.5.2. Distributed Quota 6143 Being a peer in an Overlay Instance carries with it the 6144 responsibility to store data for a given region of the Overlay 6145 Instance. However, allowing clients to store unlimited amounts of 6146 data would create unacceptable burdens on peers and would also enable 6147 trivial denial of service attacks. RELOAD addresses this issue by 6148 requiring configurations to define maximum sizes for each kind of 6149 stored data. Attempts to store values exceeding this size MUST be 6150 rejected (if peers are inconsistent about this, then strange 6151 artifacts will happen when the zone of responsibility shifts and a 6152 different peer becomes responsible for overlarge data). Because each 6153 Resource-ID/Kind-ID pair is bound to a small set of certificates, 6154 these size restrictions also create a distributed quota mechanism, 6155 with the quotas administered by the central configuration server. 6157 Allowing different kinds of data to have different size restrictions 6158 allows new usages the flexibility to define limits that fit their 6159 needs without requiring all usages to have expansive limits. 6161 12.5.3. Correctness 6163 Because each stored value is signed, it is trivial for any retrieving 6164 peer to verify the integrity of the stored value. Some more care 6165 needs to be taken to prevent version rollback attacks. Rollback 6166 attacks on storage are prevented by the use of store times and 6167 lifetime values in each store. A lifetime represents the latest time 6168 at which the data is valid and thus limits (though does not 6169 completely prevent) the ability of the storing node to perform a 6170 rollback attack on retrievers. In order to prevent a rollback attack 6171 at the time of the Store request, we require that storage times be 6172 monotonically increasing. Storing peers MUST reject Store requests 6173 with storage times smaller than or equal to those they are currently 6174 storing. In addition, a fetching node which receives a data value 6175 with a storage time older than the result of the previous fetch knows 6176 a rollback has occurred. 6178 12.5.4. Residual Attacks 6180 The mechanisms described here provides a high degree of security, but 6181 some attacks remain possible. Most simply, it is possible for 6182 storing nodes to refuse to store a value (i.e., reject any request). 6183 In addition, a storing node can deny knowledge of values which it has 6184 previously accepted. To some extent these attacks can be ameliorated 6185 by attempting to store to/retrieve from replicas, but a retrieving 6186 client does not know whether it should try this or not, since there 6187 is a cost to doing so. 6189 The certificate-based authentication scheme prevents a single peer 6190 from being able to forge data owned by other peers. Furthermore, 6191 although a subversive peer can refuse to return data resources for 6192 which it is responsible, it cannot return forged data because it 6193 cannot provide authentication for such registrations. Therefore 6194 parallel searches for redundant registrations can mitigate most of 6195 the effects of a compromised peer. The ultimate reliability of such 6196 an overlay is a statistical question based on the replication factor 6197 and the percentage of compromised peers. 6199 In addition, when a kind is multivalued (e.g., an array data model), 6200 the storing node can return only some subset of the values, thus 6201 biasing its responses. This can be countered by using single values 6202 rather than sets, but that makes coordination between multiple 6203 storing agents much more difficult. This is a trade off that must be 6204 made when designing any usage. 6206 12.6. Routing Security 6208 Because the storage security system guarantees (within limits) the 6209 integrity of the stored data, routing security focuses on stopping 6210 the attacker from performing a DOS attack that misroutes requests in 6211 the overlay. There are a few obvious observations to make about 6212 this. First, it is easy to ensure that an attacker is at least a 6213 valid peer in the Overlay Instance. Second, this is a DOS attack 6214 only. Third, if a large percentage of the peers on the Overlay 6215 Instance are controlled by the attacker, it is probably impossible to 6216 perfectly secure against this. 6218 12.6.1. Background 6220 In general, attacks on DHT routing are mounted by the attacker 6221 arranging to route traffic through one or two nodes it controls. In 6222 the Eclipse attack [Eclipse] the attacker tampers with messages to 6223 and from nodes for which it is on-path with respect to a given victim 6224 node. This allows it to pretend to be all the nodes that are 6225 reachable through it. In the Sybil attack [Sybil], the attacker 6226 registers a large number of nodes and is therefore able to capture a 6227 large amount of the traffic through the DHT. 6229 Both the Eclipse and Sybil attacks require the attacker to be able to 6230 exercise control over her Node-IDs. The Sybil attack requires the 6231 creation of a large number of peers. The Eclipse attack requires 6232 that the attacker be able to impersonate specific peers. In both 6233 cases, these attacks are limited by the use of centralized, 6234 certificate-based admission control. 6236 12.6.2. Admissions Control 6238 Admission to a RELOAD Overlay Instance is controlled by requiring 6239 that each peer have a certificate containing its Node-Id. The 6240 requirement to have a certificate is enforced by using certificate- 6241 based mutual authentication on each connection. (Note: the 6242 following only applies when self-signed certificates are not used.) 6243 Whenever a peer connects to another peer, each side automatically 6244 checks that the other has a suitable certificate. These Node-Ids are 6245 randomly assigned by the central enrollment server. This has two 6246 benefits: 6248 o It allows the enrollment server to limit the number of Node-IDs 6249 issued to any individual user. 6250 o It prevents the attacker from choosing specific Node-Ids. 6252 The first property allows protection against Sybil attacks (provided 6253 the enrollment server uses strict rate limiting policies). The 6254 second property deters but does not completely prevent Eclipse 6255 attacks. Because an Eclipse attacker must impersonate peers on the 6256 other side of the attacker, he must have a certificate for suitable 6257 Node-Ids, which requires him to repeatedly query the enrollment 6258 server for new certificates, which will match only by chance. From 6259 the attacker's perspective, the difficulty is that if he only has a 6260 small number of certificates, the region of the Overlay Instance he 6261 is impersonating appears to be very sparsely populated by comparison 6262 to the victim's local region. 6264 12.6.3. Peer Identification and Authentication 6266 In general, whenever a peer engages in overlay activity that might 6267 affect the routing table it must establish its identity. This 6268 happens in two ways. First, whenever a peer establishes a direct 6269 connection to another peer it authenticates via certificate-based 6270 mutual authentication. All messages between peers are sent over this 6271 protected channel and therefore the peers can verify the data origin 6272 of the last hop peer for requests and responses without further 6273 cryptography. 6275 In some situations, however, it is desirable to be able to establish 6276 the identity of a peer with whom one is not directly connected. The 6277 most natural case is when a peer Updates its state. At this point, 6278 other peers may need to update their view of the overlay structure, 6279 but they need to verify that the Update message came from the actual 6280 peer rather than from an attacker. To prevent this, all overlay 6281 routing messages are signed by the peer that generated them. 6283 Replay is typically prevented for messages that impact the topology 6284 of the overlay by having the information come directly, or be 6285 verified by, the nodes that claimed to have generated the update. 6286 Data storage replay detection is done by signing time of the node 6287 that generated the signature on the store request thus providing a 6288 time based replay protection but the time synchronization is only 6289 needed between peers that can write to the same location. 6291 12.6.4. Protecting the Signaling 6293 The goal here is to stop an attacker from knowing who is signaling 6294 what to whom. An attacker is unlikely to be able to observe the 6295 activities of a specific individual given the randomization of IDs 6296 and routing based on the present peers discussed above. Furthermore, 6297 because messages can be routed using only the header information, the 6298 actual body of the RELOAD message can be encrypted during 6299 transmission. 6301 There are two lines of defense here. The first is the use of TLS or 6302 DTLS for each communications link between peers. This provides 6303 protection against attackers who are not members of the overlay. The 6304 second line of defense is to digitally sign each message. This 6305 prevents adversarial peers from modifying messages in flight, even if 6306 they are on the routing path. 6308 12.6.5. Residual Attacks 6310 The routing security mechanisms in RELOAD are designed to contain 6311 rather than eliminate attacks on routing. It is still possible for 6312 an attacker to mount a variety of attacks. In particular, if an 6313 attacker is able to take up a position on the overlay routing between 6314 A and B it can make it appear as if B does not exist or is 6315 disconnected. It can also advertise false network metrics in an 6316 attempt to reroute traffic. However, these are primarily DOS 6317 attacks. 6319 The certificate-based security scheme secures the namespace, but if 6320 an individual peer is compromised or if an attacker obtains a 6321 certificate from the CA, then a number of subversive peers can still 6322 appear in the overlay. While these peers cannot falsify responses to 6323 resource queries, they can respond with error messages, effecting a 6324 DoS attack on the resource registration. They can also subvert 6325 routing to other compromised peers. To defend against such attacks, 6326 a resource search must still consist of parallel searches for 6327 replicated registrations. 6329 13. IANA Considerations 6331 This section contains the new code points registered by this 6332 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6333 the RFC number for this specification in the following list.] 6335 13.1. Well-Known URI Registration 6337 IANA will make the following "Well Known URI" registration as 6338 described in [RFC5785]: 6340 [[Note to RFC Editor - this paragraph can be removed before 6341 publication. ]] A review request was sent to 6342 wellknown-uri-review@ietf.org on October 12, 2010. 6344 +----------------------------+----------------------+ 6345 | URI suffix: | p2psip-enroll | 6346 | Change controller: | IETF | 6347 | Specification document(s): | [RFC-AAAA] | 6348 | Related information: | None | 6349 +----------------------------+----------------------+ 6351 13.2. Port Registrations 6353 [[Note to RFC Editor - this paragraph can be removed before 6354 publication. ]] IANA has already allocated a TCP port for the main 6355 peer to peer protocol. This port has the name p2p-sip and the port 6356 number of 6084. IANA needs to update this registration to be defined 6357 for UDP as well as TCP. 6359 IANA will make the following port registration: 6361 +------------------------------+------------------------------------+ 6362 | Registration Technical | Cullen Jennings | 6363 | Contact | | 6364 | Registration Owner | IETF | 6365 | Transport Protocol | TCP & UDP | 6366 | Port Number | 6084 | 6367 | Service Name | p2psip-enroll | 6368 | Description | Peer to Peer Infrastructure | 6369 | | Enrollment | 6370 | Reference | [RFC-AAAA] | 6371 +------------------------------+------------------------------------+ 6373 13.3. Overlay Algorithm Types 6375 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6376 Entries in this registry are strings denoting the names of overlay 6377 algorithms. The registration policy for this registry is RFC 5226 6378 IETF Review. The initial contents of this registry are: 6380 +----------------+----------+ 6381 | Algorithm Name | RFC | 6382 +----------------+----------+ 6383 | CHORD-RELOAD | RFC-AAAA | 6384 | EXP-OVERLAY | RFC-AAAA | 6385 +----------------+----------+ 6387 The value EXP-OVERLAY has been made available for the purposes of 6388 experimentation. This values is not meant for vendor specific use of 6389 any sort and it MUST NOT be used for operational deployments. 6391 13.4. Access Control Policies 6393 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6394 in this registry are strings denoting access control policies, as 6395 described in Section 6.3. New entries in this registry SHALL be 6396 registered via RFC 5226 Standards Action. The initial contents of 6397 this registry are: 6399 +-----------------+----------+ 6400 | Access Policy | RFC | 6401 +-----------------+----------+ 6402 | USER-MATCH | RFC-AAAA | 6403 | NODE-MATCH | RFC-AAAA | 6404 | USER-NODE-MATCH | RFC-AAAA | 6405 | NODE-MULTIPLE | RFC-AAAA | 6406 | EXP-MATCH | RFC-AAAA | 6407 +-----------------+----------+ 6409 The value EXP-MATCH has been made available for the purposes of 6410 experimentation. This values is not meant for vendor specific use of 6411 any sort and it MUST NOT be used for operational deployments. 6413 13.5. Application-ID 6415 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6416 this registry are 16-bit integers denoting application kinds. Code 6417 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6418 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6419 registered via RFC 5226 Expert Review. Code points in the range 6420 0xf001 to 0xfffe are reserved for private use. The initial contents 6421 of this registry are: 6423 +-------------+----------------+-------------------------------+ 6424 | Application | Application-ID | Specification | 6425 +-------------+----------------+-------------------------------+ 6426 | INVALID | 0 | RFC-AAAA | 6427 | SIP | 5060 | Reserved for use by SIP Usage | 6428 | SIP | 5061 | Reserved for use by SIP Usage | 6429 | Reserved | 0xffff | RFC-AAAA | 6430 +-------------+----------------+-------------------------------+ 6432 13.6. Data Kind-ID 6434 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6435 registry are 32-bit integers denoting data kinds, as described in 6436 Section 4.2. Code points in the range 0x00000001 to 0x7fffffff SHALL 6437 be registered via RFC 5226 Standards Action. Code points in the 6438 range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 Expert 6439 Review. Code points in the range 0xf0000001 to 0xfffffffe are 6440 reserved for private use via the kind description mechanism described 6441 in Section 10. The initial contents of this registry are: 6443 +---------------------+------------+----------+ 6444 | Kind | Kind-ID | RFC | 6445 +---------------------+------------+----------+ 6446 | INVALID | 0 | RFC-AAAA | 6447 | TURN_SERVICE | 2 | RFC-AAAA | 6448 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6449 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6450 | Reserved | 0x7fffffff | RFC-AAAA | 6451 | Reserved | 0xfffffffe | RFC-AAAA | 6452 +---------------------+------------+----------+ 6454 13.7. Data Model 6456 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6457 registry denoting data models, as described in Section 6.2. Code 6458 points in this registry SHALL be registered via RFC 5226 Standards 6459 Action. The initial contents of this registry are: 6461 +------------+----------+ 6462 | Data Model | RFC | 6463 +------------+----------+ 6464 | INVALID | RFC-AAAA | 6465 | SINGLE | RFC-AAAA | 6466 | ARRAY | RFC-AAAA | 6467 | DICTIONARY | RFC-AAAA | 6468 | EXP-DATA | RFC-AAAA | 6469 | RESERVED | RFC-AAAA | 6470 +------------+----------+ 6472 The value EXP-DATA has been made available for the purposes of 6473 experimentation. This values is not meant for vendor specific use of 6474 any sort and it MUST NOT be used for operational deployments. 6476 13.8. Message Codes 6478 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6479 registry are 16-bit integers denoting method codes as described in 6480 Section 5.3.3. These codes SHALL be registered via RFC 5226 6481 Standards Action. The initial contents of this registry are: 6483 +---------------------------------+----------------+----------+ 6484 | Message Code Name | Code Value | RFC | 6485 +---------------------------------+----------------+----------+ 6486 | invalid | 0 | RFC-AAAA | 6487 | probe_req | 1 | RFC-AAAA | 6488 | probe_ans | 2 | RFC-AAAA | 6489 | attach_req | 3 | RFC-AAAA | 6490 | attach_ans | 4 | RFC-AAAA | 6491 | unused | 5 | | 6492 | unused | 6 | | 6493 | store_req | 7 | RFC-AAAA | 6494 | store_ans | 8 | RFC-AAAA | 6495 | fetch_req | 9 | RFC-AAAA | 6496 | fetch_ans | 10 | RFC-AAAA | 6497 | unused (was remove_req) | 11 | RFC-AAAA | 6498 | unused (was remove_ans) | 12 | RFC-AAAA | 6499 | find_req | 13 | RFC-AAAA | 6500 | find_ans | 14 | RFC-AAAA | 6501 | join_req | 15 | RFC-AAAA | 6502 | join_ans | 16 | RFC-AAAA | 6503 | leave_req | 17 | RFC-AAAA | 6504 | leave_ans | 18 | RFC-AAAA | 6505 | update_req | 19 | RFC-AAAA | 6506 | update_ans | 20 | RFC-AAAA | 6507 | route_query_req | 21 | RFC-AAAA | 6508 | route_query_ans | 22 | RFC-AAAA | 6509 | ping_req | 23 | RFC-AAAA | 6510 | ping_ans | 24 | RFC-AAAA | 6511 | stat_req | 25 | RFC-AAAA | 6512 | stat_ans | 26 | RFC-AAAA | 6513 | unused (was attachlite_req) | 27 | RFC-AAAA | 6514 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6515 | app_attach_req | 29 | RFC-AAAA | 6516 | app_attach_ans | 30 | RFC-AAAA | 6517 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6518 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6519 | config_update_req | 33 | RFC-AAAA | 6520 | config_update_ans | 34 | RFC-AAAA | 6521 | exp_a_req | 35 | RFC-AAAA | 6522 | exp_a_ans | 36 | RFC-AAAA | 6523 | exp_b_req | 37 | RFC-AAAA | 6524 | exp_b_ans | 38 | RFC-AAAA | 6525 | reserved | 0x8000..0xfffe | RFC-AAAA | 6526 | error | 0xffff | RFC-AAAA | 6527 +---------------------------------+----------------+----------+ 6529 The values exp_a_req, exp_a_ans, exp_b_req, and exp_b_ans have been 6530 made available for the purposes of experimentation. These values are 6531 not meant for vendor specific use of any sort and MUST NOT be used 6532 for operational deployments. 6534 13.9. Error Codes 6536 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6537 registry are 16-bit integers denoting error codes. New entries SHALL 6538 be defined via RFC 5226 Standards Action. The initial contents of 6539 this registry are: 6541 +-------------------------------------+----------------+----------+ 6542 | Error Code Name | Code Value | RFC | 6543 +-------------------------------------+----------------+----------+ 6544 | invalid | 0 | RFC-AAAA | 6545 | Unused | 1 | RFC-AAAA | 6546 | Error_Forbidden | 2 | RFC-AAAA | 6547 | Error_Not_Found | 3 | RFC-AAAA | 6548 | Error_Request_Timeout | 4 | RFC-AAAA | 6549 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6550 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6551 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6552 | Error_Data_Too_Large | 8 | RFC-AAAA | 6553 | Error_Data_Too_Old | 9 | RFC-AAAA | 6554 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6555 | Error_Message_Too_Large | 11 | RFC-AAAA | 6556 | Error_Unknown_Kind | 12 | RFC-AAAA | 6557 | Error_Unknown_Extension | 13 | RFC-AAAA | 6558 | Error_Response_Too_Large | 14 | RFC-AAAA | 6559 | Error_Config_Too_Old | 15 | RFC-AAAA | 6560 | Error_Config_Too_New | 16 | RFC-AAAA | 6561 | Error_In_Progress | 17 | RFC-AAAA | 6562 | Error_Exp_A | 18 | RFC-AAAA | 6563 | Error_Exp_B | 19 | RFC-AAAA | 6564 | reserved | 0x8000..0xfffe | RFC-AAAA | 6565 +-------------------------------------+----------------+----------+ 6567 The values Error_Exp_A and Error_Exp_B have been made available for 6568 the purposes of experimentation. These values are not meant for 6569 vendor specific use of any sort and MUST NOT be used for operational 6570 deployments. 6572 13.10. Overlay Link Types 6574 IANA shall create a "RELOAD Overlay Link." New entries SHALL be 6575 defined via RFC 5226 Standards Action. This registry SHALL be 6576 initially populated with the following values: 6578 +--------------------+------+---------------+ 6579 | Protocol | Code | Specification | 6580 +--------------------+------+---------------+ 6581 | reserved | 0 | RFC-AAAA | 6582 | DTLS-UDP-SR | 1 | RFC-AAAA | 6583 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6584 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6585 | EXP-LINK | 5 | RFC-AAAA | 6586 | reserved | 255 | RFC-AAAA | 6587 +--------------------+------+---------------+ 6589 The value EXP-LINK has been made available for the purposes of 6590 experimentation. This values is not meant for vendor specific use of 6591 any sort and it MUST NOT be used for operational deployments. 6593 13.11. Overlay Link Protocols 6595 IANA shall create an "Overlay Link Protocol Registry". Entries in 6596 this registry SHALL be defined via RFC 5226 Standards Action. This 6597 registry SHALL be initially populated with the following valuse: 6599 +---------------+---------------+ 6600 | Link Protocol | Specification | 6601 +---------------+---------------+ 6602 | TLS | RFC-AAAA | 6603 | EXP-PROTOCOL | RFC-AAAA | 6604 +---------------+---------------+ 6606 The value EXP-PROTOCOL has been made available for the purposes of 6607 experimentation. This values is not meant for vendor specific use of 6608 any sort and it MUST NOT be used for operational deployments. 6610 13.12. Forwarding Options 6612 IANA shall create a "Forwarding Option Registry". Entries in this 6613 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6614 Action. Entries in this registry between 128 and 254 SHALL be 6615 defined via RFC 5226 Specification Required. This registry SHALL be 6616 initially populated with the following values: 6618 +-------------------+------+---------------+ 6619 | Forwarding Option | Code | Specification | 6620 +-------------------+------+---------------+ 6621 | invalid | 0 | RFC-AAAA | 6622 | exp-forward | 1 | RFC-AAAA | 6623 | reserved | 255 | RFC-AAAA | 6624 +-------------------+------+---------------+ 6626 The value exp-forward has been made available for the purposes of 6627 experimentation. This values is not meant for vendor specific use of 6628 any sort and it MUST NOT be used for operational deployments. 6630 13.13. Probe Information Types 6632 IANA shall create a "RELOAD Probe Information Type Registry". 6633 Entries in this registry SHALL be defined via RFC 5226 Standards 6634 Action. This registry SHALL be initially populated with the 6635 following values: 6637 +-----------------+------+---------------+ 6638 | Probe Option | Code | Specification | 6639 +-----------------+------+---------------+ 6640 | invalid | 0 | RFC-AAAA | 6641 | responsible_set | 1 | RFC-AAAA | 6642 | num_resources | 2 | RFC-AAAA | 6643 | uptime | 3 | RFC-AAAA | 6644 | exp-probe | 4 | RFC-AAAA | 6645 | reserved | 255 | RFC-AAAA | 6646 +-----------------+------+---------------+ 6648 The value exp-probe has been made available for the purposes of 6649 experimentation. This values is not meant for vendor specific use of 6650 any sort and it MUST NOT be used for operational deployments. 6652 13.14. Message Extensions 6654 IANA shall create a "RELOAD Extensions Registry". Entries in this 6655 registry SHALL be defined via RFC 5226 Specification Required. This 6656 registry SHALL be initially populated with the following values: 6658 +-----------------+--------+---------------+ 6659 | Extensions Name | Code | Specification | 6660 +-----------------+--------+---------------+ 6661 | invalid | 0 | RFC-AAAA | 6662 | exp-ext | 1 | RFC-AAAA | 6663 | reserved | 0xFFFF | RFC-AAAA | 6664 +-----------------+--------+---------------+ 6666 The value exp-ext has been made available for the purposes of 6667 experimentation. This values is not meant for vendor specific use of 6668 any sort and it MUST NOT be used for operational deployments. 6670 13.15. reload URI Scheme 6672 This section describes the scheme for a reload URI, which can be used 6673 to refer to either: 6675 o A peer. 6676 o A resource inside a peer. 6678 The reload URI is defined using a subset of the URI schema specified 6679 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6680 [RFC4395] per the following ABNF syntax: 6682 RELOAD-URI = "reload://" destination "@" overlay "/" 6683 [specifier] 6685 destination = 1 * HEXDIG 6686 overlay = reg-name 6687 specifier = 1*HEXDIG 6689 The definitions of these productions are as follows: 6691 destination: a hex-encoded Destination List object (i.e., multiple 6692 concatenated Destination objects with no length prefix prior to 6693 the object as a whole.) 6695 overlay: the name of the overlay. 6697 specifier : a hex-encoded StoredDataSpecifier indicating the data 6698 element. 6700 If no specifier is present then this URI addresses the peer which can 6701 be reached via the indicated destination list at the indicated 6702 overlay name. If a specifier is present, then the URI addresses the 6703 data value. 6705 13.15.1. URI Registration 6707 [[ Note to RFC Editor - please remove this paragraph before 6708 publication. ]] A review request was sent to uri-review@ietf.org on 6709 Oct 7, 2010. 6711 The following summarizes the information necessary to register the 6712 reload URI. 6714 URI Scheme Name: reload 6715 Status: permanent 6716 URI Scheme Syntax: see Section 13.15 of RFC-AAAA 6717 URI Scheme Semantics: The reload URI is intended to be used as a 6718 reference to a RELOAD peer or resource. 6720 Encoding Considerations: The reload URI is not intended to be human- 6721 readable text, so it is encoded entirely in US-ASCII. 6722 Applications/protocols that use this URI scheme: The RELOAD protocol 6723 described in RFC-AAAA. 6724 Interoperability considerations: See RFC-AAAA. 6725 Security considerations: See RFC-AAAA 6726 Contact: Cullen Jennings 6727 Author/Change controller: IESG 6728 References: RFC-AAAA 6730 13.16. Media Type Registration 6732 [[ Note to RFC Editor - please remove this paragraph before 6733 publication. ]] A review request was sent to ietf-types@iana.org on 6734 May 27, 2011. 6736 Type name: application 6738 Subtype name: p2p-overlay+xml 6740 Required parameters: none 6742 Optional parameters: none 6744 Encoding considerations: Must be binary encoded. 6746 Security considerations: This media type is typically not used to 6747 transport information that typically needs to be kept confidential 6748 however there are cases where it is integrity of the information is 6749 important. For these cases using a digital signature is RECOMMENDED. 6750 One way of doing this is specified in RFC-AAAA. In the case when the 6751 media includes a "shared-secret" element, then the contents of the 6752 file need to be kept confidential or else anyone that can see the 6753 shared-secret and effect the RELOAD overlay network. 6755 Interoperability considerations: No knows interoperability 6756 consideration beyond those identified for application/xml in 6757 [RFC3023]. 6759 Published specification: RFC-AAAA 6761 Applications that use this media type: The type is used to configure 6762 the peer to peer overlay networks defined in RFC-AAAA. 6764 Additional information: The syntax for this media type is specified 6765 in Section 10.1 of RFC-AAAA. The contents MUST be valid XML 6766 compliant with the relax NG grammar specified in RFC-AAAA and use the 6767 UTF-8[RFC3629] character encoding. 6769 Magic number(s): none 6771 File extension(s): relo 6773 Macintosh file type code(s): none 6775 Person & email address to contact for further information: Cullen 6776 Jennings 6778 Intended usage: COMMON 6780 Restrictions on usage: None 6782 Author: Cullen Jennings 6784 Change controller: IESG 6786 14. Acknowledgments 6788 This specification is a merge of the "REsource LOcation And Discovery 6789 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 6790 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 6791 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 6792 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 6793 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 6794 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 6795 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 6796 Matuszewski. Thanks to the authors of RFC 5389 for text included 6797 from that. Vidya Narayanan provided many comments and improvements. 6799 The ideas and text for the Chord specific extension data to the Leave 6800 mechanisms was provided by Jouni Maenpaa, Gonzalo Camarillo, and Jani 6801 Hautakorpi. 6803 Thanks to the many people who contributed including Ted Hardie, 6804 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 6805 David Bryan, Dave Craig, and Julian Cain. Extensive working last 6806 call comments were provided by: Jouni Maenpaa, Roni Even, Gonzalo 6807 Camarillo, Ari Keranen, John Buford, Michael Chen, Frederic-Philippe 6808 Met, and David Bryan. Special thanks to Marc Petit-Huguenin who 6809 provied an amazing amount to detailed review. 6811 15. References 6812 15.1. Normative References 6814 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 6815 Requirement Levels", BCP 14, RFC 2119, March 1997. 6817 [RFC2585] Housley, R. and P. Hoffman, "Internet X.509 Public Key 6818 Infrastructure Operational Protocols: FTP and HTTP", 6819 RFC 2585, May 1999. 6821 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 6823 [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media 6824 Types", RFC 3023, January 2001. 6826 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 6827 (SHA1)", RFC 3174, September 2001. 6829 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 6830 Standards (PKCS) #1: RSA Cryptography Specifications 6831 Version 2.1", RFC 3447, February 2003. 6833 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 6834 10646", STD 63, RFC 3629, November 2003. 6836 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 6837 Resource Identifier (URI): Generic Syntax", STD 66, 6838 RFC 3986, January 2005. 6840 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 6841 for Transport Layer Security (TLS)", RFC 4279, 6842 December 2005. 6844 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 6845 Security", RFC 4347, April 2006. 6847 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 6848 Registration Procedures for New URI Schemes", BCP 35, 6849 RFC 4395, February 2006. 6851 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 6852 Encodings", RFC 4648, October 2006. 6854 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 6855 (ICE): A Protocol for Network Address Translator (NAT) 6856 Traversal for Offer/Answer Protocols", RFC 5245, 6857 April 2010. 6859 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 6860 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 6862 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 6863 (CMC)", RFC 5272, June 2008. 6865 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 6866 (CMC): Transport Protocols", RFC 5273, June 2008. 6868 [RFC5348] Floyd, S., Handley, M., Padhye, J., and J. Widmer, "TCP 6869 Friendly Rate Control (TFRC): Protocol Specification", 6870 RFC 5348, September 2008. 6872 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 6873 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 6874 October 2008. 6876 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 6877 Relays around NAT (TURN): Relay Extensions to Session 6878 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 6880 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 6881 Address Text Representation", RFC 5952, August 2010. 6883 [RFC6091] Mavrogiannopoulos, N. and D. Gillmor, "Using OpenPGP Keys 6884 for Transport Layer Security (TLS) Authentication", 6885 RFC 6091, February 2011. 6887 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 6888 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 6890 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 6891 "Computing TCP's Retransmission Timer", RFC 6298, 6892 June 2011. 6894 [w3c-xml-namespaces] 6895 Bray, T., Hollander, D., Layman, A., Tobin, R., and Henry 6896 S. , "Namespaces in XML 1.0 (Third Edition)". 6898 15.2. Informative References 6900 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 6901 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 6902 Scalable Peer-to-peer Lookup Protocol for Internet 6903 Applications", IEEE/ACM Transactions on Networking Volume 6904 11, Issue 1, 17-32, Feb 2003. 6906 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 6907 "Eclipse Attacks on Overlay Networks: Threats and 6908 Defenses", INFOCOM 2006, April 2006. 6910 [I-D.ietf-hip-reload-instance] 6911 Keranen, A., Camarillo, G., and J. Maenpaa, "Host Identity 6912 Protocol-Based Overlay Networking Environment (HIP BONE) 6913 Instance Specification for REsource LOcation And Discovery 6914 (RELOAD)", draft-ietf-hip-reload-instance-03 (work in 6915 progress), January 2011. 6917 [I-D.ietf-mmusic-ice-tcp] 6918 Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 6919 "TCP Candidates with Interactive Connectivity 6920 Establishment (ICE)", draft-ietf-mmusic-ice-tcp-13 (work 6921 in progress), April 2011. 6923 [I-D.ietf-p2psip-self-tuning] 6924 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 6925 tuning Distributed Hash Table (DHT) for REsource LOcation 6926 And Discovery (RELOAD)", draft-ietf-p2psip-self-tuning-04 6927 (work in progress), July 2011. 6929 [I-D.ietf-p2psip-service-discovery] 6930 Maenpaa, J. and G. Camarillo, "Service Discovery Usage for 6931 REsource LOcation And Discovery (RELOAD)", 6932 draft-ietf-p2psip-service-discovery-03 (work in progress), 6933 July 2011. 6935 [I-D.ietf-p2psip-sip] 6936 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 6937 H. Schulzrinne, "A SIP Usage for RELOAD", 6938 draft-ietf-p2psip-sip-06 (work in progress), July 2011. 6940 [I-D.jiang-p2psip-relay] 6941 Jiang, X., Zong, N., Even, R., and Y. Zhang, "An extension 6942 to RELOAD to support Direct Response and Relay Peer 6943 routing", draft-jiang-p2psip-relay-05 (work in progress), 6944 March 2011. 6946 [RFC1122] Braden, R., "Requirements for Internet Hosts - 6947 Communication Layers", STD 3, RFC 1122, October 1989. 6949 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 6950 L. Repka, "S/MIME Version 2 Message Specification", 6951 RFC 2311, March 1998. 6953 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 6954 Requirements for Security", BCP 106, RFC 4086, June 2005. 6956 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 6957 the Session Description Protocol (SDP)", RFC 4145, 6958 September 2005. 6960 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 6961 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 6962 RFC 4787, January 2007. 6964 [RFC4828] Floyd, S. and E. Kohler, "TCP Friendly Rate Control 6965 (TFRC): The Small-Packet (SP) Variant", RFC 4828, 6966 April 2007. 6968 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 6969 "Using the Secure Remote Password (SRP) Protocol for TLS 6970 Authentication", RFC 5054, November 2007. 6972 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 6973 "Host Identity Protocol", RFC 5201, April 2008. 6975 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 6976 Housley, R., and W. Polk, "Internet X.509 Public Key 6977 Infrastructure Certificate and Certificate Revocation List 6978 (CRL) Profile", RFC 5280, May 2008. 6980 [RFC5694] Camarillo, G. and IAB, "Peer-to-Peer (P2P) Architecture: 6981 Definition, Taxonomies, Examples, and Applicability", 6982 RFC 5694, November 2009. 6984 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 6985 Issues and Solutions in Peer-to-Peer Systems for Realtime 6986 Communications", RFC 5765, February 2010. 6988 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 6989 Uniform Resource Identifiers (URIs)", RFC 5785, 6990 April 2010. 6992 [RFC6079] Camarillo, G., Nikander, P., Hautakorpi, J., Keranen, A., 6993 and A. Johnston, "HIP BONE: Host Identity Protocol (HIP) 6994 Based Overlay Networking Environment (BONE)", RFC 6079, 6995 January 2011. 6997 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 6999 [UnixTime] 7000 Wikipedia, "Unix Time", . 7003 [bryan-design-hotp2p08] 7004 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 7005 a Versatile, Secure P2PSIP Communications Architecture for 7006 the Public Internet", Hot-P2P'08. 7008 [handling-churn-usenix04] 7009 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 7010 "Handling Churn in a DHT", In Proc. of the USENIX Annual 7011 Technical Conference June 2004 USENIX 2004. 7013 [lookups-churn-p2p06] 7014 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 7015 Improving DHT Lookup Performance under Churn", IEEE 7016 P2P'06. 7018 [minimizing-churn-sigcomm06] 7019 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 7020 in Distributed Systems", SIGCOMM 2006. 7022 [non-transitive-dhts-worlds05] 7023 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 7024 Stoica, "Non-Transitive Connectivity and DHTs", 7025 WORLDS'05. 7027 [opendht-sigcomm05] 7028 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 7029 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 7030 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 7032 [vulnerabilities-acsac04] 7033 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 7034 Threats in Structured Peer-to-Peer Systems: A Quantitative 7035 Analysis", ACSAC 2004. 7037 Appendix A. Routing Alternatives 7039 Significant discussion has been focused on the selection of a routing 7040 algorithm for P2PSIP. This section discusses the motivations for 7041 selecting symmetric recursive routing for RELOAD and describes the 7042 extensions that would be required to support additional routing 7043 algorithms. 7045 A.1. Iterative vs Recursive 7047 Iterative routing has a number of advantages. It is easier to debug, 7048 consumes fewer resources on intermediate peers, and allows the 7049 querying peer to identify and route around misbehaving peers 7050 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 7051 iterative routing is intolerably expensive because a new connection 7052 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 7054 Iterative routing is supported through the RouteQuery mechanism and 7055 is primarily intended for debugging. It also allows the querying 7056 peer to evaluate the routing decisions made by the peers at each hop, 7057 consider alternatives, and perhaps detect at what point the 7058 forwarding path fails. 7060 A.2. Symmetric vs Forward response 7062 An alternative to the symmetric recursive routing method used by 7063 RELOAD is Forward-Only routing, where the response is routed to the 7064 requester as if it were a new message initiated by the responder (in 7065 the previous example, Z sends the response to A as if it were sending 7066 a request). Forward-only routing requires no state in either the 7067 message or intermediate peers. 7069 The drawback of forward-only routing is that it does not work when 7070 the overlay is unstable. For example, if A is in the process of 7071 joining the overlay and is sending a Join request to Z, it is not yet 7072 reachable via forward routing. Even if it is established in the 7073 overlay, if network failures produce temporary instability, A may not 7074 be reachable (and may be trying to stabilize its network connectivity 7075 via Attach messages). 7077 Furthermore, forward-only responses are less likely to reach the 7078 querying peer than symmetric recursive ones are, because the forward 7079 path is more likely to have a failed peer than is the request path 7080 (which was just tested to route the request) 7081 [non-transitive-dhts-worlds05]. 7083 An extension to RELOAD that supports forward-only routing but relies 7084 on symmetric responses as a fallback would be possible, but due to 7085 the complexities of determining when to use forward-only and when to 7086 fallback to symmetric, we have chosen not to include it as an option 7087 at this point. 7089 A.3. Direct Response 7091 Another routing option is Direct Response routing, in which the 7092 response is returned directly to the querying node. In the previous 7093 example, if A encodes its IP address in the request, then Z can 7094 simply deliver the response directly to A. In the absence of NATs or 7095 other connectivity issues, this is the optimal routing technique. 7097 The challenge of implementing direct response is the presence of 7098 NATs. There are a number of complexities that must be addressed. In 7099 this discussion, we will continue our assumption that A issued the 7100 request and Z is generating the response. 7102 o The IP address listed by A may be unreachable, either due to NAT 7103 or firewall rules. Therefore, a direct response technique must 7104 fallback to symmetric response [non-transitive-dhts-worlds05]. 7105 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 7106 received the message (and the TLS negotiation will provide earlier 7107 confirmation that A is reachable), but this fallback requires a 7108 timeout that will increase the response latency whenever A is not 7109 reachable from Z. 7110 o Whenever A is behind a NAT it will have multiple candidate IP 7111 addresses, each of which must be advertised to ensure 7112 connectivity; therefore Z will need to attempt multiple 7113 connections to deliver the response. 7114 o One (or all) of A's candidate addresses may route from Z to a 7115 different device on the Internet. In the worst case these nodes 7116 may actually be running RELOAD on the same port. Therefore, it is 7117 absolutely necessary to establish a secure connection to 7118 authenticate A before delivering the response. This step 7119 diminishes the efficiency of direct response because multiple 7120 roundtrips are required before the message can be delivered. 7121 o If A is behind a NAT and does not have a connection already 7122 established with Z, there are only two ways the direct response 7123 will work. The first is that A and Z both be behind the same NAT, 7124 in which case the NAT is not involved. In the more common case, 7125 when Z is outside A's NAT, the response will only be received if 7126 A's NAT implements endpoint-independent filtering. As the choice 7127 of filtering mode conflates application transparency with security 7128 [RFC4787], and no clear recommendation is available, the 7129 prevalence of this feature in future devices remains unclear. 7131 An extension to RELOAD that supports direct response routing but 7132 relies on symmetric responses as a fallback would be possible, but 7133 due to the complexities of determining when to use direct response 7134 and when to fallback to symmetric, and the reduced performance for 7135 responses to peers behind restrictive NATs, we have chosen not to 7136 include it as an option at this point. 7138 A.4. Relay Peers 7140 [I-D.jiang-p2psip-relay] has proposed implementing a form of direct 7141 response by having A identify a peer, Q, that will be directly 7142 reachable by any other peer. A uses Attach to establish a connection 7143 with Q and advertises Q's IP address in the request sent to Z. Z 7144 sends the response to Q, which relays it to A. This then reduces the 7145 latency to two hops, plus Z negotiating a secure connection to Q. 7147 This technique relies on the relative population of nodes such as A 7148 that require relay peers and peers such as Q that are capable of 7149 serving as a relay peer. It also requires nodes to be able to 7150 identify which category they are in. This identification problem has 7151 turned out to be hard to solve and is still an open area of 7152 exploration. 7154 An extension to RELOAD that supports relay peers is possible, but due 7155 to the complexities of implementing such an alternative, we have not 7156 added such a feature to RELOAD at this point. 7158 A concept similar to relay peers, essentially choosing a relay peer 7159 at random, has previously been suggested to solve problems of 7160 pairwise non-transitivity [non-transitive-dhts-worlds05], but 7161 deterministic filtering provided by NATs makes random relay peers no 7162 more likely to work than the responding peer. 7164 A.5. Symmetric Route Stability 7166 A common concern about symmetric recursive routing has been that one 7167 or more peers along the request path may fail before the response is 7168 received. The significance of this problem essentially depends on 7169 the response latency of the overlay. An overlay that produces slow 7170 responses will be vulnerable to churn, whereas responses that are 7171 delivered very quickly are vulnerable only to failures that occur 7172 over that small interval. 7174 The other aspect of this issue is whether the request itself can be 7175 successfully delivered. Assuming typical connection maintenance 7176 intervals, the time period between the last maintenance and the 7177 request being sent will be orders of magnitude greater than the delay 7178 between the request being forwarded and the response being received. 7179 Therefore, if the path was stable enough to be available to route the 7180 request, it is almost certainly going to remain available to route 7181 the response. 7183 An overlay that is unstable enough to suffer this type of failure 7184 frequently is unlikely to be able to support reliable functionality 7185 regardless of the routing mechanism. However, regardless of the 7186 stability of the return path, studies show that in the event of high 7187 churn, iterative routing is a better solution to ensure request 7188 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 7190 Finally, because RELOAD retries the end-to-end request, that retry 7191 will address the issues of churn that remain. 7193 Appendix B. Why Clients? 7195 There are a wide variety of reasons a node may act as a client rather 7196 than as a peer. This section outlines some of those scenarios and 7197 how the client's behavior changes based on its capabilities. 7199 B.1. Why Not Only Peers? 7201 For a number of reasons, a particular node may be forced to act as a 7202 client even though it is willing to act as a peer. These include: 7204 o The node does not have appropriate network connectivity, typically 7205 because it has a low-bandwidth network connection. 7206 o The node may not have sufficient resources, such as computing 7207 power, storage space, or battery power. 7208 o The overlay algorithm may dictate specific requirements for peer 7209 selection. These may include participating in the overlay to 7210 determine trustworthiness; controlling the number of peers in the 7211 overlay to reduce overly-long routing paths; or ensuring minimum 7212 application uptime before a node can join as a peer. 7214 The ultimate criteria for a node to become a peer are determined by 7215 the overlay algorithm and specific deployment. A node acting as a 7216 client that has a full implementation of RELOAD and the appropriate 7217 overlay algorithm is capable of locating its responsible peer in the 7218 overlay and using Attach to establish a direct connection to that 7219 peer. In that way, it may elect to be reachable under either of the 7220 routing approaches listed above. Particularly for overlay algorithms 7221 that elect nodes to serve as peers based on trustworthiness or 7222 population, the overlay algorithm may require such a client to locate 7223 itself at a particular place in the overlay. 7225 B.2. Clients as Application-Level Agents 7227 SIP defines an extensive protocol for registration and security 7228 between a client and its registrar/proxy server(s). Any SIP device 7229 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 7230 peer that implements the server-side functionality required by the 7231 SIP protocol. In this case, the peer would be acting as if it were 7232 the user's peer, and would need the appropriate credentials for that 7233 user. 7235 Application-level support for clients is defined by a usage. A usage 7236 offering support for application-level clients should specify how the 7237 security of the system is maintained when the data is moved between 7238 the application and RELOAD layers. 7240 Appendix C. Change Log 7242 C.1. Changes since draft-ietf-p2psip-reload-13 7244 Note to RFC Editor: Please remove this section. 7246 o Fixed finger formula. 7247 o Support for getting a certificate with multiple Node-IDs. 7248 o Added configuration signer. 7249 o Added way to specify mandatory extensions in configuration file. 7251 Authors' Addresses 7253 Cullen Jennings 7254 Cisco 7255 170 West Tasman Drive 7256 MS: SJC-21/2 7257 San Jose, CA 95134 7258 USA 7260 Phone: +1 408 421-9990 7261 Email: fluffy@cisco.com 7263 Bruce B. Lowekamp (editor) 7264 Skype 7265 Palo Alto, CA 7266 USA 7268 Email: bbl@lowekamp.net 7270 Eric Rescorla 7271 RTFM, Inc. 7272 2064 Edgewood Drive 7273 Palo Alto, CA 94303 7274 USA 7276 Phone: +1 650 678 2350 7277 Email: ekr@rtfm.com 7278 Salman A. Baset 7279 Columbia University 7280 1214 Amsterdam Avenue 7281 New York, NY 7282 USA 7284 Email: salman@cs.columbia.edu 7286 Henning Schulzrinne 7287 Columbia University 7288 1214 Amsterdam Avenue 7289 New York, NY 7290 USA 7292 Email: hgs@cs.columbia.edu